我正在开发unity3d的windows phone游戏,我在游戏中插入了Rate mebutton,但是在windows phone运行时没有工作,有什么方法可以访问在Unity3d开发的windows phone中运行的当前应用程序的AppID。 我需要unity3d CSharp获取AppID的代码。
我在Unity中尝试这个C#代码,但它没有工作,并没有错误find窗口的keywork。
string appId = Windows.ApplicationModel.Store.CurrentApp.AppId.ToString(); LinkUri = new Uri("http://www.windowsphone.com/s?appid=" + appId, UriKind.Absolute)
在这里,我需要AppID来完成我的链接。
据我所知,Unity无法访问Windows命名空间,但可以使用EventHandler从Unity调用“Review Task”。 您可以通过以下步骤来完成此操作(请访问Unity Expert以获取详细说明)。
在Unity Game Engine中,
创建活动 –
using UnityEngine; using System; public static class events { //Create a new event public static event EventHandler RateUs; public static void FireRateUs() { Debug.Log ("Opening Rate Task......"); //If event is subscribed than fire it if(RateUs!=null) RateUs(null,null); } }
火事件 –
using UnityEngine; public class RateUs : MonoBehaviour { void OnMouseDown() { events.FireRateUs(); } }
在Visual Studio IDE中
订阅事件 –
public MainPage() { . . . . events.RateUs += events_RateUs; }
调用函数 –
void events_RateUs(object sender, EventArgs e) { String AppId = Windows.ApplicationModel.Store.CurrentApp.AppId.ToString(); Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + AppId)); }
您必须从Microsoft Create网页上的开发者门户获取您的AppID。 然后,您可以将其硬编码到您的应用程序中,或者将其保存为静态/全局可用变量以用于访问目的。 这意味着在评级游戏功能编程之前,您将不得不开始创建应用程序条目的过程。 只需创建条目,不要提交它! 或者创建它,然后添加Rate应用程序作为更新。 我会选择以前的方法,亲自!
对于Apple和Google评分/提交信息,您必须提前创建条目以获取SKU编号。 同样在iTunes / Apple / iOS / OSX中,您必须创建该应用程序,并在开发人员的门户/证书存储中为其指定一个唯一的名称等。