【问题标题】:How can my game have a wide icon for the start screen?我的游戏如何在开始屏幕上有一个宽图标?
【发布时间】:2012-12-19 20:56:47
【问题描述】:

我正在为 WP8 创建游戏,但它在 XNA 中。我怎样才能让它在开始屏幕上有一个宽图标?默认只支持small和normal

【问题讨论】:

    标签: c# xna windows-phone-8


    【解决方案1】:

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

    中有一个很好的例子来说明代码 sn-p 的样子

    使用Mangopollo 库可能会更容易,它内置了与 WP8 类似的 API 的功能。这是包装要从 WP7 调用的 WP8 API 的源代码 @http://mangopollo.codeplex.com/SourceControl/changeset/view/100687#2023247

    这里是Mangopollo 代码 sn-p 在 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 上的一个示例(向下滚动)。

    【讨论】:

    • Mangopollo 示例应用中上述代码 sn-p 的最后一条语句使用 MainPage.xaml 的 Uri 来启动应用。 XNA 游戏应该使用什么 Uri?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多