Пример #1
0
        private WWW SignIn(SignInDelegate callback, Session.SignInDelegate handler)
        {
            if (GMC2ServiceManager.Instance.GetConstantCount() == 0)
            {
                if (callback != null && callback is SignInDelegate)
                {
                    Result result = new Result(Result.NETMARBLES_DOMAIN, Result.SERVICE, "GMC2 is fail");
                    Log.Debug("[NMGPlayMode.SessionManager] SignIn Fail (" + result + ")");
                    callback(result, handler);
                }
                return(null);
            }

            deviceKey = NMGPlayerPrefs.GetDeviceKey();

            if (string.IsNullOrEmpty(deviceKey))
            {
                deviceKey = Guid.NewGuid().ToString().Replace("-", "").ToUpper();
                NMGPlayerPrefs.SetDeviceKey(deviceKey);
                Log.Debug("[NMGPlayMode.SessionManager] Save new deviceKey : " + deviceKey);
            }


            // UNDONE nmDeviceKey
            // string nmDeviceKey = null;
            // androidid, uuid

            WWWForm wwwForm = new WWWForm();

            wwwForm.AddField("gameCode", ConfigurationManager.Instance.GameCode);
            wwwForm.AddField("deviceKey", deviceKey);
            wwwForm.AddField("playerId", playerId);
            wwwForm.AddField("countryCode", countryCode);

            Dictionary <string, string> headerDic = new Dictionary <string, string>();

            headerDic["Content-Type"] = "application/x-www-form-urlencoded";
            headerDic["Accept"]       = "application/json";

            string authUrl = GMC2ServiceManager.Instance.GetConstantValue("authUrl");

            if (authUrl != null)
            {
                authUrl = authUrl.Replace("http://", "https://");
            }
            authUrl += NMGConstants.SIGN_IN;

            WWW www = new WWW(authUrl, wwwForm.data, headerDic);

            CallbackManager.NetmarbleGameObject.StartCoroutine(WaitForSignIn(www, callback, handler));
            return(www);
        }