示例#1
0
    public static bool IsLogined()
    {
        if (GameDefines.OutputVerDefs == OutputVersionDefs.Windows)
        {
            return(!string.IsNullOrEmpty(GameDefines.Setting_LoginName));
        }
        else if (GameDefines.OutputVerDefs == OutputVersionDefs.Nd91iPhone)
        {
            return(U3dNdSender.IsLogined());
        }
        else if (GameDefines.OutputVerDefs == OutputVersionDefs.GfanAndroid)
        {
            return(U3dGfanSender.IsLogined());
        }
        else
        {
            return(!string.IsNullOrEmpty(UserUniqId));
        }

        return(false);
    }
    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        = "";
        }
    }