Jas*_*n94 6 c# xna windows-phone-8
我正在为WP8创建一个游戏,但它在XNA中.如何让它具有开始屏幕的宽图标?默认情况下仅支持小和普通
由于XNA仅支持WP7应用,因此您必须检查您的应用是否在WP8上运行,如果是,请使用反射将磁贴更新为WP8图标.这个代码片段在这篇MSDN文章@Windows Phone OS 7.1应用程序中添加Windows Phone 8 Tile功能的例子就是一个很好的例子
您可能更容易使用Mangopollo库,该库具有与WP8类似的API内置的功能.这是包装WP8 API的源代码,可以从WP7 @ http://mangopollo.codeplex.com/SourceControl/changeset/view/100687#2023247调用
这里是在WP7应用程序中使用WP8宽磁贴的Mangopollo代码片段:
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 8");
return;
}
try
{
var mytile = new FlipTileData
{
Title = "wide flip tile",
BackTitle = "created by",
BackContent = "Rudy Huyn",
Count = 9,
SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative),
BackgroundImage = new Uri("/Assets/Background336x336_1.png", UriKind.Relative),
BackBackgroundImage = new Uri("/Assets/Background336x336_2.png", UriKind.Relative),
WideBackContent = "This is a very long long text to demonstrate the back content of a wide flip tile",
WideBackgroundImage = new Uri("/Assets/Background691x336_1.png", UriKind.Relative),
WideBackBackgroundImage = new Uri("/Assets/Background691x336_2.png", UriKind.Relative)
};
#if ALTERNATIVE_SOLUTION
var mytile = Mangopollo.Tiles.TilesCreator.CreateFlipTile("flip tile",
"created by", "Rudy Huyn",
"This is a very long long text to demonstrate the back content of a wide flip tile",
9, new Uri("/Assets/logo159x159.png", UriKind.Relative),
new Uri("/Assets/Background336x336_1.png", UriKind.Relative),
new Uri("/Assets/Background336x336_2.png", UriKind.Relative),
new Uri("/Assets/Background691x336_1.png", UriKind.Relative),
new Uri("/Assets/Background691x336_2.png", UriKind.Relative));
#endif
ShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20wipe%20flip%20tile",
UriKind.Relative), mytile, true);
}
catch
{
MessageBox.Show("remove tile before create it again");
}
Run Code Online (Sandbox Code Playgroud)
还有一件事需要记住,即使XNA应用程序是WP7应用程序,其他WP8 API也可以直接从XNA使用.这是一个关于如何在WP7应用程序(包括XNA)上使用WP8 in-app purhcase的示例.这里有一个关于如何在WP7应用程序中使用新的WP8启动器和选择器的示例(向下滚动).