Пример #1
0
    void OnLogin(JsonData json)
    {
        Debug.Log("NdSDKAgent: OnLogin");

        int code = (int)json[SDKConstants.KEY_ERROR_CODE];

        switch (code)
        {
        case NdErrorCode.ND_COM_PLATFORM_SUCCESS:

            JsonData data      = json[SDKConstants.KEY_JSON_DATA];
            string   userId    = (string)data[SDKConstants.KEY_USER_ID];
            string   sessionId = (string)data[SDKConstants.KEY_USER_SESSION_ID];
            string   nickName  = (string)data[SDKConstants.KEY_USER_NICKNAME];

            ThirdPartyPlatform.UserUniqId = userId;
            ThirdPartyPlatform.SessionId  = sessionId;
            ThirdPartyPlatform.NickName   = nickName;

            ThirdPartyPlatform.OnLogin(true);
            // Log.e("91","登陆成功 " + userId);
            break;

        case NdErrorCode.ND_COM_PLATFORM_ERROR_LOGIN_FAIL:
            // Log.e("91","登陆失败");
            break;

        case NdErrorCode.ND_COM_PLATFORM_ERROR_CANCEL:
            // Log.e("91","用户取消登陆");
            break;

        default:
            break;
        }
    }
    public void loginNotify(string args)
    {
        if (!ParseReceiveParams(args))
        {
            U3dGfanSender.ShowToast("loginNotify ParseReceiveParams error...");
        }

        U3dGfanSender.ShowToast("loginNotify finishi...IsSuccess " + IsSuccess());
        ThirdPartyPlatform.OnLogin(IsSuccess());
    }
Пример #3
0
    void OnLogin(JsonData json)
    {
        int code = (int)json[SDKConstants.KEY_ERROR_CODE];

        switch (code)
        {
        case MiErrorCode.MI_XIAOMI_GAMECENTER_SUCCESS:
            JsonData data = json[SDKConstants.KEY_JSON_DATA];
            if (null == data)
            {
                Debug.Log("Get error information form Android native OnLogin");
                break;
            }
            // Debug.Log("MiErrorCode.MI_XIAOMI_GAMECENTER_SUCCESS data.IsObject : " + data.IsObject);
            // Debug.Log("MiErrorCode.MI_XIAOMI_GAMECENTER_SUCCESS data.IsArray : " + data.IsArray);
            Debug.Log("MiErrorCode.MI_XIAOMI_GAMECENTER_SUCCESS data.Count : " + data.Count);

            string userId    = (string)data[SDKConstants.KEY_USER_ID];
            string sessionId = (string)data[SDKConstants.KEY_USER_SESSION_ID];
            string nickName  = (string)data[SDKConstants.KEY_USER_NICKNAME];

            ThirdPartyPlatform.UserUniqId = userId;
            ThirdPartyPlatform.SessionId  = sessionId;
            ThirdPartyPlatform.NickName   = nickName;

            ThirdPartyPlatform.OnLogin(true);
            break;

        case MiErrorCode.MI_XIAOMI_GAMECENTER_ERROR_LOGIN_FAIL:
            // 登陆失败
            ThirdPartyPlatform.OnLogin(false);
            break;

        case MiErrorCode.MI_XIAOMI_GAMECENTER_ERROR_CANCEL:
            // 取消登录
            ThirdPartyPlatform.OnLogin(false);
            break;

        case MiErrorCode.MI_XIAOMI_GAMECENTER_ERROR_ACTION_EXECUTED:
            //登录操作正在进行中
            ThirdPartyPlatform.OnLogin(false);
            break;

        default:
            // 登录失败
            break;
        }
    }
Пример #4
0
    void OnLogin(string args)
    {
        ParseReceiveParams(args);

        Debug.Log("U3dGfaniSDK OnLogin args: " + args);

        long userId = -1;

        long.TryParse(GetReceiveParam(KeyUserId), out userId);

        ThirdPartyPlatform.UserUniqId = userId.ToString();
        ThirdPartyPlatform.SessionId  = "";
        ThirdPartyPlatform.NickName   = GetReceiveParam(KeyUserName);

        // get the guest state
        string keyGuestValue = GetReceiveParam(KeyIsGuest);

        U3dGfaniOSSender.IsGuestAccount = keyGuestValue.Equals("1") || string.Compare(keyGuestValue, "true", true) == 0;

        ThirdPartyPlatform.OnLogin(IsSuccess(), GetReceiveParam(KeyResult));
    }
Пример #5
0
    private void OnLoginResult(int code, string msg)
    {
        log(string.Format("UCCallbackMessage - OnLoginResult: code={0}, msg={1}", code, msg));

        //输出登录结果到页面(接入后删除)
        SendMessage("setMessage", string.Format("UCCallbackMessage - OnLoginResult: code={0}, msg={1}", code, msg));

        if (code == UCStatusCode.SUCCESS)
        {
            UCConfig.logined = true;

            //显示悬浮按钮
            //UCGameSdk.showFloatButton (100, 20, true);

            //进入分区通知,//TODO: 应在进入分区时进行该调用
            //UCGameSdk.notifyZone ("66区-风起云涌", "R29924", "Role-大漠孤烟");

            Debug.Log("uc sid is " + UCGameSdk.getSid());

            // 缺少获取用户基本信息的接口
            ThirdPartyPlatform.UserUniqId = "";
            ThirdPartyPlatform.SessionId  = UCGameSdk.getSid();
            ThirdPartyPlatform.NickName   = "";

            ThirdPartyPlatform.OnLogin(true);
        }
        else if (code == UCStatusCode.LOGIN_EXIT)
        {
            //登录界面退出,返回到游戏画面
            log("login UI exit, back to game UI");
        }
        else
        {
            log(string.Format("Failed login, code={0}, msg={1}", code, msg));

            //登录失败
            //
        }
    }
    public void loginNotify(string args)
    {
        ParseReceiveParams(args);

        // result it 1 = success or 0 = fail
        string result = GetReceiveParam(KeyResult);
        string error  = GetReceiveParam(KeyError);

        Debug.Log("[U3d2NdReceiver]: loginNotify------------------- the result is " + result);
        Debug.Log("[U3d2NdReceiver]: loginNotify------------------- the error is " + error);

        if (U3dNdSender.IsLogined())
        {
            if (string.IsNullOrEmpty(ThirdPartyPlatform.CacheUserUniqId))
            {
                // First login
                ThirdPartyPlatform.OnLogin(IsSuccess());
                Debug.Log("first login id is " + ThirdPartyPlatform.CacheUserUniqId);
            }
            else if (!U3dNdSender.GetUserUniqId().Equals(ThirdPartyPlatform.CacheUserUniqId))
            {
                // User switch account
                TalkingDataGA.Logout();
                Globals.Instance.Restart();

                Debug.Log("switch account login id is " + ThirdPartyPlatform.CacheUserUniqId);
            }
            else
            {
                ThirdPartyPlatform.OnLogin(IsSuccess());
            }
            ThirdPartyPlatform.CacheUserUniqId = U3dNdSender.GetUserUniqId();
        }
        else
        {
            if (!string.IsNullOrEmpty(ThirdPartyPlatform.CacheUserUniqId))
            {
                // Logout event
                TalkingDataGA.Logout();
                Globals.Instance.Restart();

                Debug.Log("Log out id is " + ThirdPartyPlatform.CacheUserUniqId);
            }
            else
            {
                // Not login
                // if (Globals.Instance.MGUIManager)
                // {
                //  string wordText = Globals.Instance.MDataTableManager.GetWordText(23200001); // "Confirm quit game";
                //  Globals.Instance.MGUIManager.CreateGUIDialog(delegate(GUIDialog gui)
                //  {
                //      gui.SetTextAnchor(ETextAnchor.MiddleCenter,false);
                //      gui.SetDialogType(EDialogType.QUIT_GAME, wordText);
                //  }
                //  , EDialogStyle.DialogOkCancel
                //  );
                // }

                // Logout event
                TalkingDataGA.Logout();
                Globals.Instance.Restart();
            }

            ThirdPartyPlatform.CacheUserUniqId = "";
            ThirdPartyPlatform.UserUniqId      = "";
            ThirdPartyPlatform.SessionId       = "";
            ThirdPartyPlatform.NickName        = "";
        }
    }
Пример #7
0
 public void OnLogin(string args)
 {
     ThirdPartyPlatform.UserUniqId = args;
     ThirdPartyPlatform.OnLogin(true);
 }