Beispiel #1
0
        public static void login(NCommon.LoginType loginType)
        {
#if UNITY_ANDROID
            {
                if (mGamePotClass != null)
                {
                    mGamePotClass.CallStatic("login", loginType.ToString());
                }
            }
#elif UNITY_EDITOR
            {
                GamePotEventListener listener = GamePotEventListener.s_instance;
                if (loginType == NCommon.LoginType.GUEST)
                {
                    Debug.Log("GamePot - UNITY EDITOR DUMMY CALLBACK login with GUEST. It does not communicate with server.");
                    // Temporary user info for UnityEditor Development mode
                    if (listener != null)
                    {
                        NUserInfo userInfo = new NUserInfo
                        {
                            memberid = "UE-" + SystemInfo.deviceUniqueIdentifier,
                            userid   = "UE-" + SystemInfo.deviceUniqueIdentifier,
                            name     = "UnityEditor",
                            token    = "UnityEditorTempToken"
                        };

                        GamePotSettings.MemberInfo = userInfo;
                        listener.onLoginSuccess(userInfo.ToJson());
                    }
                    else
                    {
                        Debug.LogError("GamePot UnityEditor listener is NULL");
                    }
                }
                else
                {
                    Debug.Log("GamePot - UNITY EDITOR DUMMY CALLBACK login cancelled");
                    listener.onLoginCancel();
                }
            }
#endif
        }
    public string ToJson()
    {
        JsonData data = new JsonData();

        data["type"]    = type;
        data["message"] = message;

        if (type.Equals("maintenance"))
        {
            if (url != null && !url.Equals("null"))
            {
                data["url"] = url;
            }
        }
        else if (type.Equals("needupdate"))
        {
            if (currentAppVersion != null && !currentAppVersion.Equals("null"))
            {
                data["currentAppVersion"] = currentAppVersion;
            }
            if (updateAppVersion != null && !updateAppVersion.Equals("null"))
            {
                data["updateAppVersion"] = updateAppVersion;
            }

            data["currentAppVersionCode"] = currentAppVersionCode;
            data["updateAppVersionCode"]  = updateAppVersionCode;
            data["isForce"] = isForce;

            NUserInfo nestedUserinfo = JsonMapper.ToObject <NUserInfo>(resultPayload);
            data["resultPayload"] = nestedUserinfo.ToJson();
        }

        Debug.Log("NAppStatus::ToJson() - " + data.ToJson());

        return(data.ToJson());
    }