public void Logout(string playerId, OnResultDelegate callback)
        {
            WWWForm form = new WWWForm();

            form.AddField("token", token);
            CallWWW_result_async("Player/" + playerId + "/logout", form, callback, RequestType.Logout);
        }
 public static void resultCallback(OnResultDelegate userCallback, bool success)
 {
     if (userCallback != null)
     {
         userCallback(success);
     }
 }
        public void JoinAllQuests(string playerId, OnResultDelegate callback)
        {
            WWWForm form = new WWWForm();

            form.AddField("token", token);
            form.AddField("player_id", playerId);
            CallWWW_result_async("Quest/joinAll", form, callback, RequestType.JoinAllQuests);
        }
        public void Renew(string apiKey, string apiSecret, OnResultDelegate callback)
        {
            // form apikey-param to append to address later when execute async call
            apiKeyParam = "api_key=" + apiKey;

            WWWForm form = new WWWForm();

            form.AddField("api_key", apiKey);
            form.AddField("api_secret", apiSecret);
            CallWWW_result_async("Auth/renew", form, callback, RequestType.Renew);
        }
Exemple #5
0
 public void renew(string apikey, string apisecret, OnResultDelegate callback)
 {
                 #if UNITY_IOS || UNITY_STANDALONE_OSX && !DEBUG_DESKTOP
     OnRenewResult.userCallback = callback;
     _renew(apikey, apisecret, OnRenewResult.onResult);
                 #elif UNITY_ANDROID
     playbasis.Call("renew", apikey, apisecret, new OnRenewResult(callback));
                 #elif UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || DEBUG_DESKTOP
     this.DesktopNet.Renew(apikey, apisecret, callback);
                 #endif
 }
Exemple #6
0
 public void auth(string apikey, string apisecret, string bundleId, OnResultDelegate callback)
 {
                 #if UNITY_IOS || UNITY_STANDALONE_OSX && !DEBUG_DESKTOP
     OnAuthResult.userCallback = callback;
     _auth(apikey, apisecret, bundleId, OnAuthResult.onResult);
                 #elif UNITY_ANDROID
     playbasis.Call("auth", apikey, apisecret, new OnAuthTokenResult(callback));
                 #elif UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || DEBUG_DESKTOP
     this.DesktopNet.Auth(apikey, apisecret, callback);
                 #endif
 }
Exemple #7
0
 public void joinAllQuests(string playerId, OnResultDelegate callback)
 {
         #if UNITY_IOS || UNITY_STANDALONE_OSX && !DEBUG_DESKTOP
     OnJoinAllQuestsResult.userCallback = callback;
     _joinAllQuests(playerId, OnJoinAllQuestsResult.onResult);
                 #elif UNITY_ANDROID
     playbasis.Call("joinAllQuests", playerId, new OnJoinAllQuestsResult(callback));
                 #elif UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || DEBUG_DESKTOP
     this.DesktopNet.JoinAllQuests(playerId, callback);
                 #endif
 }
Exemple #8
0
 public void logout(string playerId, OnResultDelegate callback)
 {
                 #if UNITY_IOS || UNITY_STANDALONE_OSX && !DEBUG_DESKTOP
     OnLogoutResult.userCallback = callback;
     _logout(playerId, OnLogoutResult.onResult);
                 #elif UNITY_ANDROID
     playbasis.Call("logout", playerId, new OnLogoutResult(callback));
                 #elif UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || DEBUG_DESKTOP
     this.DesktopNet.Logout(playerId, callback);
                 #endif
 }
 public OnResult(OnResultDelegate callback) : base("com.playbasis.android.playbasissdk.api.OnResult")
 {
     userCallback = callback;
 }
Exemple #10
0
 private static extern void _joinAllQuests(string playerId, OnResultDelegate callback);
Exemple #11
0
 private static extern void _register(string playerId, string userName, string email, string imageUrl, OnResultDelegate callback);
Exemple #12
0
 private static extern void _logout(string playerId, OnResultDelegate callback);
        public void Register(string playerId, string userName, string email, string imageUrl, OnResultDelegate callback)
        {
            WWWForm form = new WWWForm();

            form.AddField("token", token);
            form.AddField("username", playerId);
            form.AddField("email", email);
            form.AddField("image", imageUrl);

            CallWWW_result_async("Player/" + playerId + "/register", form, callback, RequestType.Register);
        }
Exemple #14
0
 /// make async request for boolean type result
 private void CallWWW_result_async(string address, WWWForm data, OnResultDelegate callback, RequestType type)
 {
     MonoUtil.GetMainObj().StartCoroutine(CallWWW_result_asyncCR(address, data, callback, type));
 }
 public OnJoinAllQuestsResult(OnResultDelegate callback) : base(callback)
 {
 }
 public OnRegisterResult(OnResultDelegate callback) : base(callback)
 {
 }
 public OnLogoutResult(OnResultDelegate callback) : base(callback)
 {
 }
 public OnRenewResult(OnResultDelegate callback) : base(callback)
 {
 }
Exemple #19
0
 public void register(string playerId, string userName, string email, string imageUrl, OnResultDelegate callback)
 {
                 #if UNITY_IOS || UNITY_STANDALONE_OSX && !DEBUG_DESKTOP
     OnRegisterResult.userCallback = callback;
     _register(playerId, userName, email, imageUrl, OnRegisterResult.onResult);
                 #elif UNITY_ANDROID
     playbasis.Call("register", playerId, userName, email, imageUrl, new OnRegisterResult(callback));
                 #elif UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || DEBUG_DESKTOP
     this.DesktopNet.Register(playerId, userName, email, imageUrl, callback);
                 #endif
 }
 public OnAuthTokenResult(OnResultDelegate callback) : base(callback)
 {
 }
Exemple #21
0
 private void Form1_Load(object sender, EventArgs e)
 {
     ResultView = new OnResultDelegate(ResultSum);
 }
Exemple #22
0
 private static extern void _auth(string apikey, string apisecret, string bundleId, OnResultDelegate callback);
Exemple #23
0
        IEnumerator CallWWW_result_asyncCR(string address, WWWForm data, OnResultDelegate callback, RequestType type)
        {
            string fullAddress = BASE_URL + address + (address.Contains("?") ? "&" + apiKeyParam : "?" + apiKeyParam);

            Debug.Log("Making async request to " + fullAddress);

            WWW client = null;

            if (data != null)
            {
                client = new WWW(fullAddress, data.data, data.headers);
                yield return(client);
            }
            else
            {
                client = new WWW(fullAddress);
                yield return(client);
            }

            // if there was error then return immediately
            if (IsError(client))
            {
                if (callback != null)
                {
                    callback(false);
                }
            }
            else
            {
                // otherwise, check for actual success flag
                bool success = false;

                if (type == RequestType.Auth ||
                    type == RequestType.Renew)
                {
                    // parse basic result to check its success flag first
                    _basicResult result = JsonConvert.DeserializeObject <_basicResult>(client.text, new JsonSerializerSettings {
                        NullValueHandling = NullValueHandling.Ignore
                    });
                    success = result.success;

                    // save token if success
                    if (success)
                    {
                        JObject jsonObj = JObject.Parse(client.text);
                        _authWr auth    = JsonConvert.DeserializeObject <_authWr>(jsonObj["response"].ToString(), new JsonSerializerSettings {
                            NullValueHandling = NullValueHandling.Ignore
                        });
                        token = auth.token;
                    }
                }
                else
                {
                    // parse basic result to check its success flag first
                    _basicResult result = JsonConvert.DeserializeObject <_basicResult>(client.text, new JsonSerializerSettings {
                        NullValueHandling = NullValueHandling.Ignore
                    });
                    success = result.success;
                }

                // execute callback
                if (callback != null)
                {
                    callback(success);
                }
            }
        }
Exemple #24
0
 private static extern void _renew(string apikey, string apisecret, OnResultDelegate callback);