c# - Guide.IsTrialMode 是否适用于 Windows 8 商店应用程序的 MonoGame?

标签 c# windows-8 windows-store-apps monogame

我一直在使用 XNA 为 xbox 和 Windows Phone 7 制作游戏。现在我想使用 MonoGame 创建一个 metro Windows 8 Store 应用程序。

我已经成功地克服了所有困难并让它开始工作,但是我遇到了 Guide.IsTrialMode 的问题。

根据游戏是否处于试用模式,我有单独的逻辑可以在其他平台上运行,但是当我在本地计算机或模拟器中测试我的应用程序时,它总是认为我没有购买游戏。我担心的是,当它出现在应用商店并且人们真正购买它时,逻辑不会改变。

TL;DR:Guide.IsTrialMode 在 Windows 8 商店应用的 MonoGame 中是否有效?我该如何测试它?

最佳答案

编辑:在 DEBUG 中,您似乎可以设置 Guide.SimulateTrialMode 以测试一种或另一种方式。


下面是有关 Windows 8 商店应用程序试用模式的信息:

Create a trial version of your app

LicenseInformation class

基本上,它使用 bool 标志 licenseInformation.IsTrial。如果你再深入研究 MonoGame source code on GitHub ,我们可以看到他们是如何实现检查的:

#if WINDOWS_STOREAPP
    var licenseInformation = CurrentApp.LicenseInformation;
    ...
    isTrialMode = !licenseInformation.IsActive || licenseInformation.IsTrial;
#endif

因此,您的 licenseInformation 似乎未设置为事件,或者设置为试用(如果您在测试时遇到问题)。第一个链接包含有关如何测试它的信息,但我不确定如何将其扩展到 MonoGame:

Now, test your app using simulated calls to the license server. In JavaScript, C#, Visual Basic, or Visual C++, replace references to CurrentApp with CurrentAppSimulator in the app's initialization code. CurrentAppSimulator gets test-specific licensing info from an XML file called "WindowsStoreProxy.xml", located in \Microsoft\Windows Store\ApiData. If this path and file don't exist, you must create them, either during installation or at run-time. If you try to access the CurrentAppSimulator.LicenseInformation property without WindowsStoreProxy.xml present in that specific location, you will get an error.

我想在最坏的情况下,您可以自己构建 MonoGame,将 CurrentApp 更改为 CurrentAppSimulator

关于c# - Guide.IsTrialMode 是否适用于 Windows 8 商店应用程序的 MonoGame?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16627814/

相关文章:

c# - 使用 VirtualAlloc 从字节数组运行程序?

c# - 在 C/C#/C++ 中进行反向循环的最佳方法是什么?

c# - 如何使用 Json.NET.Schema 要求属性?

javascript - 在 Windows 8 Metro 应用程序中进行后台轮询的最佳方式是什么?

xaml - 禁用嵌套 ContentControl 的动画

windows - Powershell Windows 应用程序获取发布者显示名称

c# - 在不同时区之间转换时间

c# - Windows Phone 8 View 模型绑定(bind)

c# - 在 Windows 8 中针对 metro 和非 metro 目标平台进行多目标定位

windows-store-apps - HubSection 中的 DataTemplate 没有得到全高