private void ConstructStateMachine() { mStoreStateMachine = new StoreStateMachine(); mClosedInventoryState = new ClosedInventoryState(mInventoryWindow); mStoreSelectionState = new StoreSelectionState(mInventoryWindow, OpenStore, Close); mStoreDisplayState = new StoreDisplayState(mInventoryWindow, mStoreOverlayWindow, Close); mPlayerInventoryState = new PlayerInventoryState(mInventoryWindow, mInventoryOverlayWindow, Close, OpenStoreSelector); mClosedInventoryState.AddTransition(mStoreSelectionState); mClosedInventoryState.AddTransition(mStoreDisplayState); mClosedInventoryState.AddTransition(mPlayerInventoryState); //mClosedInventoryState.AddTransition(mClosedInventoryState); mPlayerInventoryState.AddTransition(mClosedInventoryState); mPlayerInventoryState.AddTransition(mPlayerInventoryState); mPlayerInventoryState.AddTransition(mStoreSelectionState); mPlayerInventoryState.AddTransition(mStoreDisplayState); mPlayerInventoryState.AddTransition(mPlayerInventoryState); // mStoreSelectionState.AddTransition(mClosedInventoryState); // mStoreSelectionState.AddTransition(mStoreDisplayState); // mStoreSelectionState.AddTransition(mPlayerInventoryState); mStoreDisplayState.AddTransition(mStoreSelectionState); mStoreDisplayState.AddTransition(mPlayerInventoryState); mStoreDisplayState.AddTransition(mClosedInventoryState); mStoreDisplayState.AddTransition(mStoreDisplayState); mStoreStateMachine.EnterInitialState(mClosedInventoryState); }
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); }