Ejemplo n.º 1
0
        public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int, object> callback)
        {
            if (!mInitialized)
            {
                Debug.LogError("ASDKManager.Pay: not initialized");
                callback(AStatusCode.FAIL, 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;

            //object extraInfo = EB.JSON.Parse(transaction.payload);
            //string tid = EB.Dot.String("tid", extraInfo, string.Empty);
            string transid = transaction.transactionId;

            //customorderid;订单
            //url回调地址
            //sum数额
            //desc描述
            //callBackData其他
            EB.Debug.Log(string.Format("!!!ASDKManager Pay = customorderid {0},url ={1}, cost ={2},desc={3}, callBackData={4}!!!", transid, mNotifyUrl, item.cost, item.category, null));
            ASdk.pay(transid, mNotifyUrl, item.cost.ToString(), item.category, "");
        }
Ejemplo n.º 2
0
        /*public static void InitializeSDK(System.Action<string, bool> callback)
         * {
         *  if (mInitialized)
         *  {
         *      EB.Debug.LogWarning("ASDKManager.InitializeSDK: Initialized");
         *      callback(null, true);
         *      return;
         *  }
         *
         *  if (Application.platform != RuntimePlatform.Android)
         *  {
         *      callback("Not support", false);
         *      return;
         *  }
         *
         *  mInitCallback += callback;
         *
         *  if (!mInitializing)
         *  {
         *      mInitializing = true;
         *
         *      SparxASDKManager.InitCallback += delegate (bool sucess, string msg)
         *      {
         *          EB.Debug.Log("InitCallback: sucess={0}, msg={1}", sucess, msg);
         *
         *          mInitializing = false;
         *
         *          if (sucess)
         *          {
         *              mInitialized = true;
         *          }
         *
         *          if (mInitCallback != null)
         *          {
         *              mInitCallback(mInitialized ? null : msg, mInitialized);
         *              mInitCallback = null;
         *          }
         *      };
         *
         *      new GameObject("asdk_plugin_listener", typeof(SparxASDKManager));
         *
         *      ASdk.initSDK(Info);
         *  }
         * }*/

        public void InitializeSDK(object options, System.Action <string, bool> callback)
        {
            if (mInitialized)
            {
                EB.Debug.LogWarning("ASDKManager.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("asdk_plugin_listener", typeof(SparxASDKManager));

                ASdk.initSDK();
            }
        }
Ejemplo n.º 3
0
 public void Logout()
 {
     if (mLoggedIn)
     {
         mLoggedIn = false;
         ASdk.loginOut();
     }
 }
Ejemplo n.º 4
0
 public void ExitSDK(System.Action <bool> callback)
 {
     if (mInitialized)
     {
         UnityEngine.Debug.Log("ASDKManager ExitSDK!!");
         mExitCallback += callback;
         ASdk.exitSDK();
     }
 }
Ejemplo n.º 5
0
        public void Login(System.Action <string, object> callback)
        {
            if (mLoggedIn)
            {
                Hashtable data = new Hashtable()
                {
                    { "sessionid", mSid },
                    { "accountid", mAid }
                };
                callback(null, data);
                return;
            }

            mAuthCallback += callback;

            Hub.RunInBackground = true;
            ASdk.login();
        }