正在Unity3d中获取Windows Phone的AppID

正在Unity3d中获取Windows Phone的AppID,windows,unity3d,Windows,Unity3d,我正在unity3d中为windows phone开发游戏,我已经在游戏中插入了Rate me按钮,但在windows phone的运行时它不起作用,是否有任何方法可以访问unity3d中开发的windows phone中运行的当前应用程序的AppID。我需要unity3d CSharp中的代码来获取AppID 我在Unity中尝试了这段C#代码,但它不起作用,并且出现了错误,windows中找不到keywork string appId = Windows.ApplicationModel.

我正在unity3d中为windows phone开发游戏,我已经在游戏中插入了Rate me按钮,但在windows phone的运行时它不起作用,是否有任何方法可以访问unity3d中开发的windows phone中运行的当前应用程序的AppID。我需要unity3d CSharp中的代码来获取AppID

我在Unity中尝试了这段C#代码,但它不起作用,并且出现了错误,windows中找不到keywork

 string appId = Windows.ApplicationModel.Store.CurrentApp.AppId.ToString();
 LinkUri = new Uri("http://www.windowsphone.com/s?appid=" + appId, UriKind.Absolute)

这里我需要AppID来完成我的rate me链接。

您必须从Microsoft Create网页上的开发者门户获取AppID。然后,您可以将其硬编码到应用程序中,或将其另存为静态/全局可用变量,以便访问。这意味着您必须在编程分级游戏功能之前开始创建应用程序条目的过程。只需创建条目,不要提交!或者创建它,并将Rate应用程序添加为更新。我个人会选择前一种方法


对于苹果和谷歌评级/提交信息,您必须提前创建条目以获取SKU编号。此外,在iTunes/Apple/iOS/OSX中,您必须在开发者的门户/证书商店中创建应用程序并为其指定唯一名称等。

据我所知,Unity无法访问Windows命名空间,但您可以使用EventHandler从Unity调用“审阅任务”。您可以通过以下步骤完成此操作(请访问以获取详细说明)

在Unity游戏引擎中-

创建事件-

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));
 }