示例#1
0
        public void InitializeSDK(object options, System.Action <string, bool> callback)
        {
            if (mInitialized)
            {
                EB.Debug.LogWarning("XiaoMiSDKManager.InitializeSDK: Initialized");
                callback(null, true);
                return;
            }

            if (Application.platform != RuntimePlatform.Android)
            {
                callback(null, false);
                return;
            }

            mInitCallback += callback;

            //mNotifyUrl = EB.Dot.String("notifyUrl", options, mNotifyUrl);

            //bool debugMode = EB.Dot.Bool("debugMode", options, false);
            //int gameId = EB.Dot.Integer("gameId", options, 0);

            if (!mInitializing)
            {
                mInitializing = true;

                Hub.RunInBackground = true;

                new GameObject("xiaomi_plugin_listener", typeof(SparxXiaoMiSDKManager));
                XiaoMiGameSdk.initSDK();
            }
        }
示例#2
0
 public void DestroySDK()
 {
     if (mInitialized)
     {
         mInitialized  = false;
         mLoggedIn     = false;
         mAuthCallback = null;
         mInitCallback = null;
         mPayCallback  = null;
         XiaoMiGameSdk.exitSDK();
     }
 }
示例#3
0
        //public override void OnLoggedIn()
        //{
        //	var user = Hub.LoginManager.LocalUser;
        //	Hashtable loginGameRole = new Hashtable();
        //	loginGameRole["roleId"] = user.Id.Value.ToString();
        //	loginGameRole["roleName"] = user.Name;
        //	loginGameRole["zoneId"] = user.WorldId.ToString();
        //	loginGameRole["zoneName"] = string.Empty;
        //	loginGameRole["roleCTime"] = 0L;
        //	loginGameRole["roleLevel"] = user.Level.ToString();
        //	//loginGameRole["roleLevelMTime"] = null;

        //	SubmitLoginData(EB.JSON.Stringify(loginGameRole));
        //}

        public void Login(System.Action <string, object> callback)
        {
            if (mLoggedIn)
            {
                callback(null, null);
                return;
            }

            mAuthCallback += callback;

            Hub.RunInBackground = true;
            XiaoMiGameSdk.login();
        }
示例#4
0
        public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int, object> callback)
        {
            if (!mInitialized)
            {
                EB.Debug.LogError("XiaoMiSDKManager.Pay: not initialized");
                callback(XiaoMiStatusCode.NO_INIT, null);
                return;
            }

            mPayCallback += callback;

            var    user     = Hub.Instance.LoginManager.LocalUser;
            long   uid      = user.Id.Value;
            int    worldId  = user.WorldId;
            string name     = user.Name;
            int    level    = user.Level;
            int    vipLevel = user.Vip;

            XiaoMiGameSdk.pay((int)item.cost, worldId.ToString(), uid.ToString(), name, level.ToString(), vipLevel.ToString(), string.Empty, transaction.transactionId);
        }