示例#1
0
    /////////////////////////////////////////////////////////////////////////
    // gamecenter or google
    void OnConnectedGameCenter(UM_ConnectionState um_connection_state)
    {
        if (um_connection_state != UM_ConnectionState.DISCONNECTED)
        {
#if SH_TEST || SH_DEV
            Tooltip.Instance.ShowMessageKey("NotImplement");
#endif
            return;
        }
        if (um_connection_state != UM_ConnectionState.CONNECTED)
        {
            return;
        }
        UM_GameServiceManager.OnConnectionStateChnaged -= OnConnectedGameCenter;
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            SHSavedData.LoginPlatform = LoginPlatform.GameCenter;
            break;

        case RuntimePlatform.Android:
            SHSavedData.LoginPlatform = LoginPlatform.GooglePlay;
            break;
        }

        Debug.LogFormat("user id : {0}", UM_GameServiceManager.Instance.Player.PlayerId);

        LoginCallback();
    }
    //--------------------------------------
    // Connection
    //--------------------------------------

    public void Connect()
    {
        if (!_IsInitedCalled)
        {
            Init();
        }

        if (_ConnectionSate == UM_ConnectionState.CONNECTED || _ConnectionSate == UM_ConnectionState.CONNECTING)
        {
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GameCenterManager.Init();
            break;

        case RuntimePlatform.Android:
            GooglePlayConnection.Instance.Connect();
            break;
        }

        _ConnectionSate = UM_ConnectionState.CONNECTING;
    }
    //--------------------------------------
    // Private Methods
    //--------------------------------------


    private void SetConnectionState(UM_ConnectionState NewState)
    {
        if (_ConnectionSate != NewState)
        {
            _ConnectionSate = NewState;
            OnConnectionStateChnaged(_ConnectionSate);
        }
    }
示例#4
0
    private void OnAllLoaded()
    {
        _ConnectionSate = UM_ConnectionState.CONNECTED;
        _player         = new GameServicePlayerTemplate(GameCenterManager.Player, GooglePlayManager.instance.player);


        dispatch(PLAYER_CONNECTED);
        OnPlayerConnected();
    }
    private void OnAllLoaded()
    {
        _IsDataLoaded   = true;
        _ConnectionSate = UM_ConnectionState.CONNECTED;
        _Player         = new UM_PlayerTemplate(GameCenterManager.Player, GooglePlayManager.Instance.player);


        OnPlayerConnected();
    }
示例#6
0
    //--------------------------------------
    // Handlers
    //--------------------------------------


    void HandleOnConnectionStateChnaged(UM_ConnectionState state)
    {
        if (UM_GameServiceManager.Instance.IsConnected)
        {
            UM_Player player = UM_GameServiceManager.Instance.Player;
            if (player.BigPhoto == null)
            {
                player.LoadBigPhoto();
            }
        }
        UpdateUserPanel();
    }
    //--------------------------------------
    // IOS Events
    //--------------------------------------



    private void OnAuthFinished(ISN_Result res)
    {
        if (res.IsSucceeded)
        {
            OnServiceConnected();
        }
        else
        {
            _ConnectionSate = UM_ConnectionState.DISCONNECTED;
            OnPlayerDisconnected();
        }
    }
示例#8
0
    void OnConnectedGameCenter(UM_ConnectionState um_connection_state)
    {
        if (um_connection_state != UM_ConnectionState.CONNECTED)
        {
            Debug.LogWarningFormat("UM_ConnectionState : {0}", um_connection_state);
            return;
        }
        UM_GameServiceManager.OnConnectionStateChnaged -= OnConnectedGameCenter;

        Debug.LogFormat("user id : {0}", UM_GameServiceManager.Instance.Player.PlayerId);

        ConnectToGameserver();
    }
示例#9
0
 private void OnAndroidPlayerDisconnected()
 {
     _ConnectionSate = UM_ConnectionState.DISCONNECTED;
     dispatch(PLAYER_DISCONNECTED);
     OnPlayerDisconnected();
 }
 private void OnAndroidPlayerDisconnected()
 {
     _ConnectionSate = UM_ConnectionState.DISCONNECTED;
     OnPlayerDisconnected();
 }