c# - 我的游戏如何在开始屏幕上有一个宽图标?

标签 c# xna windows-phone-8

我正在为 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/

相关文章:

c# - EF SaveChangesAsync 极慢

c# - 我应该抛出 Global.asax 的 Application_Error 处理程序中发生的异常吗?

c# - LINQ to Entities 不支持 Entity Framework 'ArrayIndex'

c# - 阵列克隆访问?

c# - 在 Unity 中使用 Shells 技术实现 Fur

xaml - 将复选框绑定(bind)到 LongListSelector

windows-phone-8 - windows phone 8 模拟器无效指针错误

c# - Deployment.Current.Dispatcher.BeginInvoke 如何在 Windows 应用商店应用程序中工作?

c# - 检查 StreamReader 是否可以读取另一行

.net - 是否可以为Zune构建电子邮件阅读器?