Beispiel #1
0
    void Authenticate()
    {
        if (IsAuthenticated())
        {
            return;
        }

        Debug.Log("Social.localUser.Authenticate");

        EnableLoadingOverlay(true);
        m_State = GameCenterState.AUTHENTICATING;

        // authenticate user:
        Social.localUser.Authenticate(( bool success ) =>
        {
            // handle success or failure
            Debug.Log("Social.localUser.Authenticate success - " + success);
            if (success)
            {
                m_State = GameCenterState.CHECK_AUTH;
            }
            else
            {
                m_State = GameCenterState.FAIL_AUTH;
                ++s_Retry;
                EnableLoadingOverlay(false);
            }
        });
    }
Beispiel #2
0
 void Initialise()
 {
     if (!s_Initialised)
     {
         s_Initialised = true;
         m_State       = GameCenterState.START_AUTH;
         m_QueueState  = GameCenterState.NONE;
     }
 }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        switch (m_State)
        {
        case GameCenterState.START_AUTH:
            Authenticate();
            break;

        case GameCenterState.AUTHENTICATING:
            // Nothing
            break;

        case GameCenterState.CHECK_AUTH:
            if (IsAuthenticated())
            {
                EnableLoadingOverlay(false);
                ResumeState();
            }
            else
            {
                // Wait
            }
            break;

        case GameCenterState.FAIL_AUTH:
            if (m_QueueState != GameCenterState.NONE)
            {
                // Show popup
                Popup popup = Popup.GetPopup();
                if (popup)
                {
                    popup.ShowPopup("Fail to connect to Game Center.");
                }

                m_QueueState = GameCenterState.NONE;
            }

            m_State = GameCenterState.NONE;
            break;

        case GameCenterState.SHOWING_LEADERBOARD:
            ShowLeaderboardUI();
            break;

        default:
            // Idle
            break;
        }
    }
Beispiel #4
0
    void ShowLeaderboardUI()
    {
        if (!IsAuthenticated())
        {
            PauseState(GameCenterState.START_AUTH);
            Authenticate();
        }
        else
        {
            Debug.Log("Social.ShowLeaderboardUI()");
            //MainMenuManager.DisableButtons();
            Social.ShowLeaderboardUI();

            m_State = GameCenterState.NONE;
        }
    }
Beispiel #5
0
 public void StartShowLeaderboardUI()
 {
     m_State = GameCenterState.SHOWING_LEADERBOARD;
 }
Beispiel #6
0
 void PauseState(GameCenterState goState)
 {
     m_QueueState = m_State;
     m_State      = goState;
 }
Beispiel #7
0
 void ResumeState()
 {
     m_State      = m_QueueState;
     m_QueueState = GameCenterState.NONE;
 }
        internal void SetWindows()
        {
            _loginWindowState = new LoginWindowState();
            var loginWindow = new ConditionalInterface(() => _canShowUITable[SSCUIState.LoginWindow]);

            loginWindow.SetState(_loginWindowState);
            _cdInterface.Add(loginWindow);

            _playerOnlineWindow = new PlayerOnlineWindow();
            var playerOnlineWindow = new ConditionalInterface(() => _canShowUITable[SSCUIState.PlayerOnlineWindow]);

            playerOnlineWindow.SetState(_playerOnlineWindow);
            _cdInterface.Add(playerOnlineWindow);

            _homePageState = new HomePageState();
            var hompage = new ConditionalInterface(() => _canShowUITable[SSCUIState.HomePage]);

            hompage.SetState(_homePageState);
            _cdInterface.Add(hompage);

            _communicationState = new CommunicationState();
            var commPage = new ConditionalInterface(() => _canShowUITable[SSCUIState.CommunicationPage]);

            commPage.SetState(_communicationState);
            _cdInterface.Add(commPage);


            _mainPageState = new MailPageState();
            var mailPage = new ConditionalInterface(() => _canShowUITable[SSCUIState.MailPage]);

            mailPage.SetState(_mainPageState);
            _cdInterface.Add(mailPage);


            _unionPageState2 = new UnionPageState2();
            var unionpage2 = new ConditionalInterface(() => _canShowUITable[SSCUIState.UnionPage2]);

            unionpage2.SetState(_unionPageState2);
            _cdInterface.Add(unionpage2);

            _unionPageState = new UnionPageState();
            var unionpage = new ConditionalInterface(() => _canShowUITable[SSCUIState.UnionPage]);

            unionpage.SetState(_unionPageState);
            _cdInterface.Add(unionpage);

            _unionCandidateState = new UnionCandidatePage();
            var cddpage = new ConditionalInterface(() => _canShowUITable[SSCUIState.UnionCandidatePage]);

            cddpage.SetState(_unionCandidateState);
            _cdInterface.Add(cddpage);

            _unionCreateState = new UnionCreatePage();
            var unioncreatepage = new ConditionalInterface(() => _canShowUITable[SSCUIState.UnionPage3]);

            unioncreatepage.SetState(_unionCreateState);
            _cdInterface.Add(unioncreatepage);


            _rankBoardState = new RankBoardState();
            var rankpage = new ConditionalInterface(() => _canShowUITable[SSCUIState.RankBoard]);

            rankpage.SetState(_rankBoardState);
            _cdInterface.Add(rankpage);

            _getitemState = new ItemUIState();
            var itempage = new ConditionalInterface(() => _canShowUITable[SSCUIState.ItemPage]);

            itempage.SetState(_getitemState);
            _cdInterface.Add(itempage);

            _getnpcState = new NPCUIState();
            var uinpcinterface = new ConditionalInterface(() => _canShowUITable[SSCUIState.NPCPage]);

            uinpcinterface.SetState(_getnpcState);
            _cdInterface.Add(uinpcinterface);


            _gameCenterState = new GameCenterState();
            var uiGameCenter = new ConditionalInterface(() => _canShowUITable[SSCUIState.GameCenterPage]);

            uiGameCenter.SetState(_gameCenterState);
            _cdInterface.Add(uiGameCenter);

            _playerInventoryState  = new PlayerInventoryState();
            _playerInventoryState2 = new PlayerInventoryState2();
            AddState(_playerInventoryState, SSCUIState.InventoryPage);
            AddState(_playerInventoryState2, SSCUIState.InventoryPage2);

            normalShopState = new NormalShopState();
            AddState(normalShopState, SSCUIState.NormalShopPage);

            AddState(new NormalShopBuyState(), SSCUIState.NormalShopBuyPage);
            AddState(new LotteryState(), SSCUIState.LotteryPage);


            var unionDonateState     = new UnionDonationPage();
            var uniondonateInterface = new ConditionalInterface(() => _canShowUITable[SSCUIState.UnionDonationPage]);

            uniondonateInterface.SetState(unionDonateState);
            _cdInterface.Add(uniondonateInterface);

            // 置顶
            _playerProfileState = new PlayerProfileState();
            var profileinterface = new ConditionalInterface(() => _canShowUITable[SSCUIState.ProfilePage]);

            profileinterface.SetState(_playerProfileState);
            _cdInterface.Add(profileinterface);
        }