コード例 #1
0
 public override void stopAndRemoveCurrentRequests()
 {
     base.stopAndRemoveCurrentRequests();
     isLogged          = false;
     loginRequest      = null;
     mainUpdateRequest = null;
 }
コード例 #2
0
        private void OnUserDataObtained(string request_id)
        {
            if (mainUpdateRequest != null && mainUpdateRequest.id == request_id)
            {
                mainUpdateRequest = null;
            }

            if (OnDataReceived != null)
            {
                GSGetUserRequest request = (GSGetUserRequest)getRequestById(request_id);


                //Hacemos un usuario para el diff
                KuberaUser remoteUser = new KuberaUser(loginRequest.data.userId);
                remoteUser.remoteDataVersion    = request.data.version;
                remoteUser.levels               = request.data.levels;
                remoteUser.maxLevelReached      = request.data.maxLevelReached;
                remoteUser.gemsUse              = request.data.gemsUse;
                remoteUser.gemsPurchase         = request.data.gemsPurchase;
                remoteUser.gemsUseAfterPurchase = request.data.gemsUseAfterPurchase;
                remoteUser.lifesAsked           = request.data.lifesAsked;
                remoteUser.remoteLifesGranted   = request.data.remoteLifesGranted;

                OnDataReceived(JsonUtility.ToJson(remoteUser));
            }
        }
コード例 #3
0
        /**
         * Para obtener los datos del usuario
         **/
        public override void getUserData(string id, int aboveVersion, bool saveAsMainRequest = false)
        {
            getDataFailCount = 0;

            GSGetUserRequest request = queue.getComponentAttachedToGameObject <GSGetUserRequest>("GS_GetUserData");

            if (saveAsMainRequest)
            {
                mainUpdateRequest = request;
            }

            request.id                 = "get_" + id + "_" + UnityEngine.Random.Range(0, 99999).ToString("0000");
            request.playerId           = id;
            request.persistAfterFailed = true;
            request.showDebugInfo      = _mustShowDebugInfo;
            request.aboveVersion       = aboveVersion;
            request.initialize(getPath());
            request.OnComplete += OnUserDataObtained;
            request.OnFailed   += getDataFailed;
            request.OnTimeout  += getDataFailed;
            request.tryoutsBeforeDefinitelyFail = this.getDataMaxFailCountAllowed;

            addDependantRequest(request, saveAsMainRequest);
        }