我的游戏如何在开始屏幕上显示宽图标?

时间:2012-12-19 20:56:47

标签: c# xna windows-phone-8

我正在为WP8创建游戏,但它在XNA中。如何让它具有开始屏幕的宽图标?默认情况下仅支持小和正常

1 个答案:

答案 0 :(得分:7)

由于XNA仅支持WP7应用,因此您必须检查您的应用是否在WP8上运行,如果是,请使用反射将磁贴更新为WP8图标。这个代码片段在这篇MSDN文章@ Adding Windows Phone 8 Tile functionality to Windows Phone OS 7.1 apps

上的表现就是一个很好的例子。

使用具有与WP8类似API内置功能的Mangopollo库可能更容易。这是包含从WP7 @ http://mangopollo.codeplex.com/SourceControl/changeset/view/100687#2023247

调用的WP8 API的源代码

以下是在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");
}

还有一件事要记住,即使XNA应用是WP7应用,其他WP8 API也可以直接从XNA使用。这是关于如何use WP8 in-app purhcase on WP7 apps(包括XNA)的示例。这是how to use new WP8 Launchers & Choosers in WP7 apps上的一个例子(向下滚动)。