我正在为 WP8 创建游戏,但它是在 XNA 中。我怎样才能让它的开始屏幕有一个宽图标?默认只支持small和normal
最佳答案
由于 XNA 仅支持 WP7 应用程序,因此您必须检查您的应用程序是否在 WP8 上运行,如果是,则使用反射将磁贴更新为 WP8 图标。在这篇 MSDN 文章 @ Adding Windows Phone 8 Tile functionality to Windows Phone OS 7.1 apps 中有一个很好的示例说明该代码片段的外观。
使用 Mangopollo 对您来说可能更容易具有与 WP8 类似的 API 的内置功能的库。这是包装要从 WP7 @ http://mangopollo.codeplex.com/SourceControl/changeset/view/100687#2023247 调用的 WP8 API 的源代码
这是 Mangopollo在 WP7 应用程序中使用 WP8 宽磁贴的代码片段:
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");
}
还有一点要记住,即使 XNA 应用程序是 WP7 应用程序,也可以直接从 XNA 使用其他 WP8 API。这是一个关于如何 use WP8 in-app purhcase on WP7 apps 的例子(包括 XNA)。这是关于 how to use new WP8 Launchers & Choosers in WP7 apps 的示例(向下滚动)。
关于c# - 我的游戏如何在开始屏幕上有一个宽图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13961048/