コード例 #1
0
 public void ExitSDK(System.Action <int> callback)
 {
     if (mInitialized)
     {
         Hub.RunInBackground = true;
         mExitSDKCallback   += callback;
         YiJieSDK.pxExitSDK();
     }
 }
コード例 #2
0
 public void Init(object initData, Action <string, bool> callback)
 {
     EB.Debug.Log("YiJieSDKManager.Init");
     if (mInitialized)
     {
         EB.Debug.LogWarning("YiJieSDKManager.Init: Initialized");
         callback(null, true);
         return;
     }
     mCallbackUrl = EB.Dot.String("notifyUrl", initData, mCallbackUrl);
     EB.Debug.Log("YiJieSDKManager.Init", mCallbackUrl);
     mInitCallback      += callback;
     Hub.RunInBackground = true;
     new GameObject(plugin_listener, typeof(SparxYiJieSDKManager));
     YiJieSDK.pxInit();
 }
コード例 #3
0
        public void SetRoleData()
        {
            if (!mInitialized)
            {
                EB.Debug.LogError("YiJiSDK.SetRoleData: not initialized");
                return;
            }

            User curUser = Hub.LoginManager.LocalUser;

            if (curUser == null)
            {
                return;
            }
            var    worlds    = Hub.LoginManager.GameWorlds;
            var    world     = System.Array.Find(worlds, w => w.Id == curUser.WorldId);
            string worldName = world != null ? world.Name : (worlds.Length > 0 ? worlds[0].Name : "Default");

            YiJieSDK.pxSetRoleData(curUser.Id.Value.ToString(), curUser.Name, curUser.Level.ToString(), curUser.WorldId.ToString(), worldName);
        }
コード例 #4
0
        public void SetData(string dataType)
        {
            User curUser = Hub.LoginManager.LocalUser;

            EB.Debug.Log("YiJiSDK.SetData curUser = {0} datatype = {1}", curUser, dataType);
            if (curUser == null)
            {
                Hashtable nullGameInfo = new Hashtable();
                nullGameInfo.Add("roleId", 1);
                nullGameInfo.Add("roleName", "Default");
                nullGameInfo.Add("roleLevel", 1);
                nullGameInfo.Add("zoneId", 1);
                nullGameInfo.Add("zoneName", "Default");
                nullGameInfo.Add("balance", "0");
                nullGameInfo.Add("vip", "1");
                nullGameInfo.Add("partyName", EB.Localizer.GetString("ID_LABEL_NAME_NONE") + EB.Localizer.GetString("ID_ALLIANCE"));
                nullGameInfo.Add("roleCTime", "-1");
                nullGameInfo.Add("roleLevelMTime", "-1");
                YiJieSDK.pxSetData(dataType, JSON.Stringify(nullGameInfo));
                return;
            }
            var    worlds    = Hub.LoginManager.GameWorlds;
            var    world     = System.Array.Find(worlds, w => w.Id == curUser.WorldId);
            string worldName = world != null ? world.Name : (worlds.Length > 0 ? worlds[0].Name : "Default");

            Hashtable gameInfo = new Hashtable();

            gameInfo.Add("roleId", curUser.Id.Value > 0 ? curUser.Id.Value : 1);
            gameInfo.Add("roleName", string.IsNullOrEmpty(curUser.Name) ? "Default" : curUser.Name);
            gameInfo.Add("roleLevel", curUser.Level > 0 ? curUser.Level : 1);
            gameInfo.Add("zoneId", world.Id > 0 ? world.Id : 1);
            gameInfo.Add("zoneName", worldName);
            gameInfo.Add("balance", "0");
            gameInfo.Add("vip", "1");
            gameInfo.Add("partyName", EB.Localizer.GetString("ID_LABEL_NAME_NONE") + EB.Localizer.GetString("ID_ALLIANCE"));
            gameInfo.Add("roleCTime", "-1");
            gameInfo.Add("roleLevelMTime", "-1");
            YiJieSDK.pxSetData(dataType, JSON.Stringify(gameInfo));
        }
コード例 #5
0
        public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, Action <int> callback)
        {
            if (!mInitialized)
            {
                callback(YiJieSDKConfig.PAY_FAILURE);
                EB.Debug.LogError("YiJiSDK.Pay: not initialized");
                return;
            }
            mPayCallback += callback;
            int    unitPrice = 10;
            string unitName  = EB.Localizer.GetString("ID_LADDER_STAGE_ZUANSHI");
            int    count     = item.cents / 10;

            if (item.productId == "com.manhuang.fusesandbox.aliancecard" || item.productId == "com.manhuang.fusesandbox.monthcard")
            {
                unitPrice = item.cents;
                unitName  = item.longName;
                count     = 1;
            }
            string callbackInfo = transaction.transactionId;

            YiJieSDK.pxPay(unitPrice, unitName, count, callbackInfo, mCallbackUrl);
            EB.Debug.Log("YiJieSDKManager.Pay unitPrice = {0} unitName = {1} count = {2} callBackInfo = {3} callBackUrl = {4}", unitPrice, unitName, count, callbackInfo, mCallbackUrl);
        }
コード例 #6
0
        public void Login(Action <string, object> callback)
        {
            EB.Debug.Log("YiJieSDKManager.Login");
            if (!mInitialized)
            {
                callback("YiJieSDK has not been inited", null);
                EB.Debug.LogError("YiJiSDK.Login: not initialized");
                return;
            }

            if (mLoggedIn)
            {
                callback(null, authData);
                return;
            }

            mLoginCallback     += callback;
            Hub.RunInBackground = true;

            YiJieSDK.pxLogin();

            /*if (!mSDKLogout)
             *          {
             *                  YiJieSDK.pxLogin();
             *          }
             *          else
             *          {
             *                  mSDKLogout = false;
             *                  mLoggedIn = true;
             *                  if (mLoginCallback != null)
             *                  {
             *                          mLoginCallback(null, authData);
             *                          mLoginCallback = null;
             *                  }
             *          }*/
        }
コード例 #7
0
 public void Logout()
 {
     YiJieSDK.pxLogout();
 }