void Start() { foreach (string serverTypeName in Enum.GetNames(typeof(ServerTypes))) { ServerDropdown.options[(int)Enum.Parse(typeof(ServerTypes), serverTypeName)] = new Dropdown.OptionData(LanguageManager.Instance.GetText("Server_" + serverTypeName)); } ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( LanguageManager.Instance.GetText("LoginMenu_NeedNetwork"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), delegate { ReturnToOnlineMode(true); cp.CloseUIForm(); }, delegate { cp.CloseUIForm(); ReturnToSingleMode(); }); cp.UIType.IsESCClose = false; cp.UIType.IsClickElsewhereClose = false; }
public void OnSave() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize("If you export these species as presets, existing presets would be cleared. Continue?", "Continue", "Cancel", delegate { NatureController.Instance.OnSaveAllCreatures(); cp.CloseUIForm(); }, delegate { cp.CloseUIForm(); }); }
public void OnLoad() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize("If the presets are loaded, all species here would be cleared. Continue?", "Continue", "Cancel", delegate { NatureController.Instance.LoadAllSpeciesFromXML(); cp.CloseUIForm(); }, delegate { cp.CloseUIForm(); }); }
public void OnReturnButtonClick() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize("Confirm to leave? Your changes will be discarded.", "Confirm", "Cancel", delegate { cp.CloseUIForm(); OnClose(); }, delegate { cp.CloseUIForm(); }); }
private void OnChapterMapRoundCountChange(string value_str, UnityAction onSaveChapter, UnityAction onRefreshStory) { if (int.TryParse(value_str, out int value)) { if (isReturning) { Cur_Chapter.ChapterMapRoundCount = value; return; } if (value < Chapter.SystemMinMapRoundCount) { SetChapterMapRoundCount(Chapter.SystemMinMapRoundCount.ToString(), false); } else if (value > Chapter.SystemMaxMapRoundCount) { SetChapterMapRoundCount(Chapter.SystemMaxMapRoundCount.ToString(), false); } else { RoundCountBefore = Cur_Chapter.ChapterMapRoundCount; Cur_Chapter.ChapterMapRoundCount = value; if (isSelected) { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(LanguageManager.Instance.GetText("StoryEditorPanel_Notice_ChangeChapterRoundCount"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), delegate { cp.CloseUIForm(); Cur_Chapter.Levels.Clear(); onSaveChapter(); onRefreshStory(); }, delegate { cp.CloseUIForm(); isReturning = true; SetChapterMapRoundCount(RoundCountBefore.ToString(), false); isReturning = false; }); cp.UIType.IsESCClose = false; cp.UIType.IsClickElsewhereClose = false; } } } else { SetChapterMapRoundCount(Chapter.SystemMaxMapRoundCount.ToString(), false); } }
private void GoToCardEditorPanel() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( LanguageManager.Instance.GetText("Notice_ReturnWarningSave"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), leftButtonClick: delegate { SceneManager.LoadScene("CardEditorScene"); cp.CloseUIForm(); }, rightButtonClick: delegate { cp.CloseUIForm(); }); }
private void GenerateNewShopItem(ShopItem si) { LevelPropertyForm_ShopItem row_si = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.LevelPropertyForm_ShopItem].AllocateGameObject <LevelPropertyForm_ShopItem>(ShopItemContainer); row_si.Initialize(si, onEditButtonClick: delegate { CurEdit_ShopItem = row_si; switch (si) { case ShopItem_Card sic: { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( descText: LanguageManager.Instance.GetText("LevelEditorPanel_SetCardPrice"), leftButtonClick: delegate { if (int.TryParse(cp.InputText1, out int cardRareLevel)) { if (int.TryParse(cp.InputText2, out int probability)) { cp.CloseUIForm(); sic.CardRareLevel = cardRareLevel; sic.Probability = probability; Refresh(); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)ShopItemContainer)); } else { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_LevelEditorPanel_PleaseInputInteger"), 0f, 1f); } } else { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_LevelEditorPanel_PleaseInputInteger"), 0f, 1f); } }, rightButtonClick: delegate { cp.CloseUIForm(); }, leftButtonText: LanguageManager.Instance.GetText("Common_Confirm"), rightButtonText: LanguageManager.Instance.GetText("Common_Cancel"), inputFieldPlaceHolderText1: LanguageManager.Instance.GetText("LevelEditorPanel_CardRareLevelPlaceHolder"), inputFieldPlaceHolderText2: LanguageManager.Instance.GetText("LevelEditorPanel_ProbabilityPlaceHolder") ); break; }
private void GenerateNewBonus(Bonus bonus) { LevelPropertyForm_Bonus row_bonus = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.LevelPropertyForm_Bonus].AllocateGameObject <LevelPropertyForm_Bonus>(BonusContainer); row_bonus.Initialize(bonus, onEditButtonClick: delegate { OnEditAction?.Invoke(); CurEdit_Bonus = row_bonus; switch (bonus) { case Bonus_UnlockCardByID b_cid: { OnStartSelectCard(true, b_cid.CardID, 1, LevelEditorPanel.SelectCardContents.SelectBonusCards); break; } case Bonus_UnlockCardByLevelNum b_level: { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( descText: LanguageManager.Instance.GetText("LevelEditorPanel_SetUnlockCardLevelNum"), leftButtonClick: delegate { if (int.TryParse(cp.InputText1, out int levelNum)) { cp.CloseUIForm(); b_level.LevelNum = levelNum; Refresh(); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)BonusContainer)); } else { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Notice_LevelEditorPanel_PleaseInputInteger"), 0f, 1f); } }, rightButtonClick: delegate { cp.CloseUIForm(); }, leftButtonText: LanguageManager.Instance.GetText("Common_Confirm"), rightButtonText: LanguageManager.Instance.GetText("Common_Cancel"), inputFieldPlaceHolderText1: LanguageManager.Instance.GetText("LevelEditorPanel_CardLevelNum") ); break; }
private void ReturnToStoryEditor() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( LanguageManager.Instance.GetText("Notice_ReturnWarningSave"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), leftButtonClick: delegate { CloseUIForm(); StoryEditorPanel sep = UIManager.Instance.ShowUIForms <StoryEditorPanel>(); sep.InitializeLevelList(); sep.RefreshStory(); cp.CloseUIForm(); }, rightButtonClick: delegate { cp.CloseUIForm(); }); }
void Awake() { UIType.InitUIType( isClearStack: false, isESCClose: false, isClickElsewhereClose: false, uiForms_Type: UIFormTypes.Normal, uiForms_ShowMode: UIFormShowModes.Normal, uiForm_LucencyType: UIFormLucencyTypes.Penetrable); LeaveShopButton.onClick.AddListener(delegate { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(LanguageManager.Instance.GetText("ShopPanel_LeaveWarning"), LanguageManager.Instance.GetText("Common_Leave"), LanguageManager.Instance.GetText("Common_Cancel"), leftButtonClick: delegate { StoryManager.Instance.GetStory().Crystal = CrystalWhenEnter; foreach (ShopItem shopItem in Cur_BoughtShopItem) { BuyShopItemRequest si_request = new BuyShopItemRequest(Client.Instance.Proxy.ClientID, shopItem); Client.Instance.Proxy.SendMessage(si_request); } LeaveShopRequest request = new LeaveShopRequest(Client.Instance.Proxy.ClientID, StoryManager.Instance.GetStory().CurrentFightingChapterID, Cur_Shop.LevelID); Client.Instance.Proxy.SendMessage(request); CloseUIForm(); UIManager.Instance.ShowUIForms <StoryPanel>(); cp.CloseUIForm(); }, rightButtonClick: delegate { cp.CloseUIForm(); } ); }); LanguageManager.Instance.RegisterTextKeys(new List <(Text, string)> { (LeftClickTipText, "ShopPanel_LeftClickTipText"), (RightClickTipText, "ShopPanel_RightClickTipText"), (MyDeckText, "ShopPanel_MyDeckText"), }); }
public void OnSave() { if (GeoElements.Count == 0) { ConfirmPanel cp1 = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp1.Initialize("Please draw something", "Confirm", null, delegate { cp1.CloseUIForm(); }, delegate { cp1.CloseUIForm(); }); return; } if (Cur_GGI.Name == null) { ConfirmPanel cp1 = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp1.Initialize("Please input the name", "Confirm", null, delegate { cp1.CloseUIForm(); }, delegate { cp1.CloseUIForm(); }); return; } ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize("Confirm to save? Species name: " + Cur_GGI.Name, "Confirm", "Cancel", delegate { Cur_GGI.ResetCenterAndSortingOrder(); if (NatureController.Instance.AllGeoGroupInfo.ContainsKey(Cur_GGI.Name)) { NatureController.Instance.AllGeoGroupInfo[Cur_GGI.Name] = Cur_GGI; } else { NatureController.Instance.AllGeoGroupInfo.Add(Cur_GGI.Name, Cur_GGI); } GameToDF2Manager.Instance.OnAddSpeciesToEntity(new List <string> { Cur_GGI.Name }); UIManager.Instance.GetBaseUIForm <CreatureEditorPanel>().OnClose(); cp.CloseUIForm(); }, delegate { cp.CloseUIForm(); }); }
public void OnSurrenderButtonClick() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( LanguageManager.Instance.GetText("ExitMenu_SureToSurrender"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_Cancel"), delegate { cp.CloseUIForm(); CloseUIForm(); SurrenderCore(); }, cp.CloseUIForm ); }
private void SelectNode(ChapterMapNode node) { StartButton.gameObject.SetActive(true); StartButton.onClick.RemoveAllListeners(); StartButton.onClick.AddListener(delegate { if (node.Cur_Level != null) { if (node.IsBeated) { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("StoryPanel_CannotStartBeatedLevel"), 0, 1f); } else { switch (node.Cur_Level) { case Enemy enemy: { UnityAction action = delegate { UIManager.Instance.GetBaseUIForm <StartMenuPanel>().StartGameCore(RoundManager.PlayMode.Single, Cur_ChapterMap.Cur_Chapter.ChapterID, node.Cur_Level.LevelID); }; action.Invoke(); CurrentStartGameAction = action; break; } case Shop shop: { StandaloneStartLevelRequest request = new StandaloneStartLevelRequest(Client.Instance.Proxy.ClientID, -1, Cur_ChapterMap.Cur_Chapter.ChapterID, node.Cur_Level.LevelID); Client.Instance.Proxy.SendMessage(request); break; } } } } else { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(LanguageManager.Instance.GetText("Notice_SelectEmptyLevel"), LanguageManager.Instance.GetText("Common_Confirm"), null, delegate { cp.CloseUIForm(); }, null); } });
public void OnQuitGameButtonClick() { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( LanguageManager.Instance.GetText("Notice_StartMenu_QuitGameConfirm"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_Cancel"), delegate { LogoutRequest request = new LogoutRequest(Client.Instance.Proxy.ClientID, Client.Instance.Proxy.Username); Client.Instance.Proxy.SendMessage(request); cp.CloseUIForm(); }, cp.CloseUIForm ); if (Client.Instance.Proxy.ClientState == ProxyBase.ClientStates.Matching) { Client.Instance.Proxy.CancelMatch(); } }
private void SaveLevel() { bool isExistedInLibrary = AllLevels.LevelDict[Cur_Level.LevelType].ContainsKey(Cur_Level.LevelNames["en"]); bool isNameChanged = !LastLevelEnglishName.Equals(Cur_Level.LevelNames["en"]); bool isInvalidName = Cur_Level.LevelNames["en"].Equals("New" + Cur_Level.LevelType); if (isInvalidName) { NoticeManager.Instance.ShowInfoPanelCenter(string.Format(LanguageManager.Instance.GetText("Notice_LevelEditorPanel_SaveLevelInvalidName"), Cur_Level.LevelNames["en"]), 0f, 1f); return; } if (isExistedInLibrary) { if (isNameChanged) { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(String.Format(LanguageManager.Instance.GetText("LevelEditorPanel_OverrideExistedLevel"), Cur_Level.LevelNames["en"]), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), delegate { cp.CloseUIForm(); NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f); AllLevels.RenameLevel(Cur_Level.LevelType, LastLevelEnglishName, Cur_Level); LastLevelEnglishName = Cur_Level.LevelNames["en"]; AllLevels.ReloadLevelXML(); }, delegate { cp.CloseUIForm(); }); } else { NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f); AllLevels.RefreshLevelXML(Cur_Level); LastLevelEnglishName = Cur_Level.LevelNames["en"]; AllLevels.ReloadLevelXML(); } } else { if (isNameChanged) { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(String.Format(LanguageManager.Instance.GetText("LevelEditorPanel_DeleteOriginalLevel"), LastLevelEnglishName), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), delegate { cp.CloseUIForm(); NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f); AllLevels.RenameLevel(Cur_Level.LevelType, LastLevelEnglishName, Cur_Level); LastLevelEnglishName = Cur_Level.LevelNames["en"]; AllLevels.ReloadLevelXML(); }, delegate { cp.CloseUIForm(); NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f); AllLevels.RefreshLevelXML(Cur_Level); LastLevelEnglishName = Cur_Level.LevelNames["en"]; AllLevels.ReloadLevelXML(); }); } else { NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f); AllLevels.RefreshLevelXML(Cur_Level); AllLevels.ReloadLevelXML(); } } }
public bool SetLevel(Level level) { if (level == null) { SetLevelType(LevelTypes.Shop.ToString(), false); SetLevelType(LevelTypes.Enemy.ToString(), false); } else { resetLevelBackup = level.Clone(); Cur_Level = level; LastLevelEnglishName = Cur_Level.LevelNames["en"]; OnChangeLevelTypeByEdit = false; SetLevelType(Cur_Level.LevelType.ToString(), false); OnChangeLevelTypeByEdit = true; SetLevelName_en(Cur_Level.LevelNames["en"], false); SetLevelName_zh(Cur_Level.LevelNames["zh"], false); SetLevelPicID(Cur_Level.LevelPicID.ToString(), false); SetLevelDifficultyLevel(Cur_Level.DifficultyLevel.ToString(), false); switch (Cur_Level) { case Enemy enemy: { SetEnemyType(enemy.EnemyType.ToString(), false); SetEnemyBeginMetal(enemy.BuildInfo.BeginMetal.ToString(), false); SetEnemyDrawCardNum(enemy.BuildInfo.DrawCardNum.ToString(), false); SetEnemyEnergy(enemy.BuildInfo.Energy.ToString(), false); SetEnemyLife(enemy.BuildInfo.Life.ToString(), false); Row_BonusGroups.Initialize( enemy.BonusGroups, ClientUtils.UpdateLayout(UIManager.Instance.GetBaseUIForm <LevelEditorPanel>().RightPanel), addAction: delegate { enemy.BonusGroups.Add(new BonusGroup(false, new List <Bonus>(), 1, false)); Row_BonusGroups.Refresh(); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer)); }, clearAction: delegate { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( descText: LanguageManager.Instance.GetText("LevelEditorPanel_ClearConfirm"), leftButtonText: LanguageManager.Instance.GetText("Common_Yes"), rightButtonText: LanguageManager.Instance.GetText("Common_No"), leftButtonClick: delegate { cp.CloseUIForm(); enemy.BonusGroups.Clear(); Row_BonusGroups.Refresh(); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer)); }, rightButtonClick: delegate { cp.CloseUIForm(); }); }, onStartSelectCard: OnStartSelectCard); CardSelectPanel.SetBuildCards(enemy.BuildInfo.M_BuildCards, gotoAction: delegate { M_SelectCardContents = SelectCardContents.SelectDeckCards; CardSelectPanel.SetCardLibraryPanelEnable(true); }); M_SelectCardContents = SelectCardContents.SelectDeckCards; CardSelectPanel.SetCardLibraryPanelEnable(true); CardSelectPanel.SwitchSingleSelect(false); CardSelectPanel.SelectCardsByBuildCards(CardStatTypes.Total); LevelEditorPanel_CardPriority.Initialize(enemy.CardPriority); LevelEditorPanel_CardComboList.Initialize(enemy.CardComboList, Initialize_Right); break; } case Shop shop: { CardSelectPanel.UnselectAllCards(); CardSelectPanel.SetCardLibraryPanelEnable(false); Row_ShopItems.Initialize(shop.ShopItems, ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer)); SetShopItemCardCount(shop.ShopItemCardCount.ToString(), false); SetShopItemOthersCount(shop.ShopItemOthersCount.ToString(), false); Row_ShopItems.SetButtonActions( gotoAction: delegate { }, clearAction: delegate { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( descText: LanguageManager.Instance.GetText("LevelEditorPanel_ClearConfirm"), leftButtonText: LanguageManager.Instance.GetText("Common_Yes"), rightButtonText: LanguageManager.Instance.GetText("Common_No"), leftButtonClick: delegate { cp.CloseUIForm(); shop.ShopItems.Clear(); Row_ShopItems.Refresh(); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer)); }, rightButtonClick: delegate { cp.CloseUIForm(); }); }); break; } } } return(false); }
public void RefreshLeftPanelInfo(GeoGroupInfo ci) { LifeBar.value = ci.Life; LifeText.text = Mathf.RoundToInt(ci.Life).ToString(); SpeedBar.value = ci.Speed; SpeedText.text = Mathf.RoundToInt(ci.Speed).ToString(); DamageBar.value = ci.Damage; DamageText.text = Mathf.RoundToInt(ci.Damage).ToString(); VisionBar.value = ci.Vision; VisionText.text = Mathf.RoundToInt(ci.Vision).ToString(); GeneralSize.text = Mathf.Round(ci.GeneralSize / 10) + "cm"; Mass.text = Mathf.Round(ci.Mass) + "kg"; DietButton.onClick.RemoveAllListeners(); DietButton.onClick.AddListener(delegate { if (string.IsNullOrEmpty(NameInputField.text)) { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize("Please set the name first", "Confirm", null, delegate { cp.CloseUIForm(); }, delegate { }); return; } else { DietPanel.gameObject.SetActive(true); DietPanel.Refresh(ci); } }); }
public void Response(RequestBase r) { ClientLog.Instance.PrintReceive("Server: " + r.DeserializeLog()); if (!(r is ResponseBundleBase)) { switch (r.GetProtocol()) { case NetProtocols.CLIENT_ID_REQUEST: { ClientIdRequest request = (ClientIdRequest)r; ClientID = request.givenClientId; NetworkManager.ServerVersion = request.serverVersion; if (NetworkManager.Instance.ClientInvalid) { UIManager.Instance.GetBaseUIForm <LoginPanel>().ShowUpdateConfirmPanel(); } else { ClientState = ClientStates.GetId; ClientVersionValidRequest validRequest = new ClientVersionValidRequest(ClientID); SendMessage(validRequest); if (Client.Instance.IsStandalone) { RegisterRequest request0 = new RegisterRequest(Client.Instance.Proxy.ClientID, "Player", ""); SendMessage(request0); LoginRequest request1 = new LoginRequest(Client.Instance.Proxy.ClientID, "Player", ""); SendMessage(request1); } } break; } case NetProtocols.REGISTER_RESULT_REQUEST: { RegisterResultRequest request = (RegisterResultRequest)r; if (request.isSuccess) { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Proxy_RegisterSuccess"), 0, 0.5f); } else { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Proxy_UserNameUsed"), 0, 0.5f); } break; } case NetProtocols.LOGIN_RESULT_REQUEST: { LoginResultRequest request = (LoginResultRequest)r; switch (request.stateCode) { case LoginResultRequest.StateCodes.Success: { Username = request.username; ClientState = ClientStates.Login; NoticeManager.Instance.ShowInfoPanelTop(LanguageManager.Instance.GetText("Proxy_LoginSuccess"), 0, 0.5f); if (Client.Instance.IsStandalone) { UIManager.Instance.ShowUIForms <StartMenuPanel>().SetState(StartMenuPanel.States.Show_Main_Standalone); } else { UIManager.Instance.ShowUIForms <StartMenuPanel>().SetState(StartMenuPanel.States.Show_Main_Online); } break; } case LoginResultRequest.StateCodes.WrongPassword: { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Proxy_WrongPassword"), 0, 0.5f); break; } case LoginResultRequest.StateCodes.UnexistedUser: { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Proxy_UserNameNotExisted"), 0, 0.5f); break; } case LoginResultRequest.StateCodes.AlreadyOnline: { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Proxy_AlreadyLogin"), 0, 0.5f); break; } } break; } case NetProtocols.LOGOUT_RESULT_REQUEST: { LogoutResultRequest request = (LogoutResultRequest)r; if (request.isSuccess) { Username = ""; ClientState = ClientStates.GetId; NoticeManager.Instance.ShowInfoPanelTop(LanguageManager.Instance.GetText("Proxy_LogOutSuccess"), 0, 0.5f); Client.Instance.Proxy.ClientState = ClientStates.GetId; UIManager.Instance.CloseUIForm <StartMenuPanel>(); UIManager.Instance.CloseUIForm <SelectBuildPanel>(); UIManager.Instance.ShowUIForms <LoginPanel>(); } else { NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("Proxy_LogOutFailed"), 0, 0.5f); } break; } case NetProtocols.START_NEW_STORY_REQUEST_RESPONSE: { StartNewStoryRequestResponse request = (StartNewStoryRequestResponse)r; StoryManager.Instance.InitializeStory(request.Story); SelectBuildManager.Instance.SwitchGameMode(SelectBuildManager.GameMode.Single, true); UIManager.Instance.GetBaseUIForm <StartMenuPanel>().SetState(StartMenuPanel.States.Show_Single_HasStory); UIManager.Instance.ShowUIForms <StoryPlayerInformationPanel>().SetCrystal(StoryManager.Instance.GetStory().Crystal); UIManager.Instance.CloseUIForm <StartMenuPanel>(); UIManager.Instance.ShowUIForms <StoryPanel>().InitiateStoryCanvas(); UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().ShowNewCardNotice(); AudioManager.Instance.SoundPlay("sfx/OnStoryStart"); break; } case NetProtocols.CREATE_BUILD_REQUEST_RESPONSE: { CreateBuildRequestResponse request = (CreateBuildRequestResponse)r; SelectBuildManager.Instance.OnCreateNewBuildResponse(request.buildInfo); break; } case NetProtocols.BUILD_UPDATE_RESPONSE: { BuildUpdateRequest request = (BuildUpdateRequest)r; SelectBuildManager.Instance.RefreshSomeBuild(request.BuildInfo); break; } case NetProtocols.DELETE_BUILD_REQUEST_RESPONSE: { DeleteBuildRequestResponse request = (DeleteBuildRequestResponse)r; SelectBuildManager.Instance.OnDeleteBuildResponse(request.buildID); break; } case NetProtocols.CLIENT_BUILDINFOS_REQUEST: { ClientBuildInfosRequest request = (ClientBuildInfosRequest)r; OnlineManager.Instance.OnlineBuildInfos = request.OnlineBuildInfos; OnlineManager.Instance.OnlineGamePlaySettings = request.OnlineGamePlaySettings; StoryManager.Instance.InitializeStory(request.Story); break; } case NetProtocols.START_FIGHTING_ENEMY_REQUEST: { StoryManager.Instance.StartFightEnemy(((StartFightingEnemyRequest)r).LevelID); break; } case NetProtocols.GAME_STOP_BY_LEAVE_REQUEST: { GameStopByLeaveRequest request = (GameStopByLeaveRequest)r; RoundManager.Instance.OnGameStopByLeave(request); break; } case NetProtocols.GAME_STOP_BY_SERVER_ERROR_REQUEST: { RoundManager.Instance.OnGameStopByServerError((GameStopByServerErrorRequest)r); break; } case NetProtocols.BEAT_LEVEL_REQUEST: { BeatLevelRequest request = (BeatLevelRequest)r; StoryManager.Instance.SetLevelBeated(request.LevelID); UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().StartGameAction = null; UIManager.Instance.GetBaseUIForm <SelectBuildPanel>().ShowNewCardNotice(); UIManager.Instance.GetBaseUIForm <StartMenuPanel>().SingleDeckButton.SetTipImageTextShow(StoryManager.Instance.JustGetSomeCard); if (StoryManager.Instance.JustGetSomeCard) { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize( LanguageManager.Instance.GetText("RoundManager_JustGotANewCard"), LanguageManager.Instance.GetText("RoundManager_GoToDeck"), LanguageManager.Instance.GetText("RoundManager_GotIt"), delegate { cp.CloseUIForm(); UIManager.Instance.ShowUIForms <SelectBuildPanel>(); }, cp.CloseUIForm); } break; } case NetProtocols.REFRESH_STORY_REQUEST: { RefreshStoryRequest request = (RefreshStoryRequest)r; StoryManager.Instance.InitializeStory(request.Story); UIManager.Instance.GetBaseUIForm <StoryPanel>().InitiateStoryCanvas(); UIManager.Instance.GetBaseUIForm <StoryPlayerInformationPanel>().SetCrystal(StoryManager.Instance.GetStory().Crystal); SelectBuildManager.Instance.SwitchGameMode(SelectBuildManager.GameMode.Single, true); break; } case NetProtocols.VISIT_SHOP_REQUEST_RESPONSE: { VisitShopRequestResponse request = (VisitShopRequestResponse)r; UIManager.Instance.CloseUIForm <StoryPanel>(); UIManager.Instance.ShowUIForms <ShopPanel>().Initialize(request.Shop); UIManager.Instance.GetBaseUIForm <StoryPlayerInformationPanel>().SetCrystal(StoryManager.Instance.GetStory().Crystal); break; } case NetProtocols.BUY_SHOP_ITEM_REQUEST_RESPONSE: { BuyShopItemRequestResponse request = (BuyShopItemRequestResponse)r; StoryManager.Instance.GetStory().Crystal -= request.ShopItem.Price; UIManager.Instance.GetBaseUIForm <StoryPlayerInformationPanel>().SetCrystal(StoryManager.Instance.GetStory().Crystal); UIManager.Instance.GetBaseUIForm <ShopPanel>().RefreshAllShopItemAffordable(); UIManager.Instance.GetBaseUIForm <ShopPanel>().SetAllButtonLock(false); if (request.ShopItem is ShopItem_Card si_card) { StoryManager.Instance.JustGetNewCards.Add(si_card.GenerateCardID); } break; } case NetProtocols.RANDOM_NUMBER_SEED_REQUEST: { RoundManager.Instance.OnRandomNumberSeed((RandomNumberSeedRequest)r); break; } } } else // 战斗内行为全部交由RoundManager处理 { ResponseBundleBase request = (ResponseBundleBase)r; if (request is GameStart_ResponseBundle) { RoundManager.Instance.Initialize(); } if (request is EndRoundRequest_ResponseBundle) { if (ClientID == ((EndRoundRequest_ResponseBundle)request).ClientID) { RoundManager.Instance.EndRound(); } } foreach (ServerRequestBase attachedRequest in request.AttachedRequests) //请求预处理,提取关键信息,如机甲死亡、弃牌等会影响客户端交互的信息 { RoundManager.Instance.ResponseToSideEffects_PrePass(attachedRequest); } foreach (ServerRequestBase attachedRequest in request.AttachedRequests) { RoundManager.Instance.ResponseToSideEffects(attachedRequest); } } }
public void InitializeLevelList() { SelectTab(LevelTypes.Enemy); foreach (KeyValuePair <LevelTypes, List <StoryEditorPanel_LevelButton> > kv in MyLevelButtons) { foreach (StoryEditorPanel_LevelButton btn in kv.Value) { btn.PoolRecycle(); } kv.Value.Clear(); } foreach (KeyValuePair <LevelTypes, SortedDictionary <string, Level> > kv in AllLevels.LevelDict) { SortedDictionary <int, List <Level> > sortedListByLevelDifficulty = new SortedDictionary <int, List <Level> >(); if (kv.Key == LevelTypes.Enemy) { foreach (KeyValuePair <string, Level> _kv in kv.Value) { if (!sortedListByLevelDifficulty.ContainsKey(_kv.Value.DifficultyLevel)) { sortedListByLevelDifficulty.Add(_kv.Value.DifficultyLevel, new List <Level>()); } sortedListByLevelDifficulty[_kv.Value.DifficultyLevel].Add(_kv.Value); } foreach (KeyValuePair <int, List <Level> > KV in sortedListByLevelDifficulty) { foreach (Level lv in KV.Value) { if (lv.LevelNames["en"].Equals("New" + kv.Key)) { continue; } StoryEditorPanel_LevelButton btn = StoryEditorPanel_LevelButton.BaseInitialize( level : lv.Clone(), parent : LevelContainerDict[kv.Key], onSetButtonClick : delegate(Level level) { ChapterMap.SetCurrentNodeLevel(level); }, onEditButtonClick: delegate { UIManager.Instance.CloseUIForm <StoryEditorPanel>(); UIManager.Instance.ShowUIForms <LevelEditorPanel>().SetLevel(lv.Clone()); }, onDeleteButtonClick: delegate { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(LanguageManager.Instance.GetText("StoryEditorPanel_DeleteLevelFormLibrary0"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), delegate { cp.CloseUIForm(); AllLevels.DeleteLevel(kv.Key, lv.LevelNames["en"]); InitializeLevelList(); SelectTab(kv.Key); SetStory(AllStories.GetStory("DefaultStory", CloneVariantUtils.OperationType.Clone)); }, delegate { cp.CloseUIForm(); }); } ); MyLevelButtons[kv.Key].Add(btn); } } } else { foreach (KeyValuePair <string, Level> _kv in kv.Value) { if (_kv.Key.Equals("New" + kv.Key)) { continue; } StoryEditorPanel_LevelButton btn = StoryEditorPanel_LevelButton.BaseInitialize( level : _kv.Value.Clone(), parent : LevelContainerDict[kv.Key], onSetButtonClick : delegate(Level level) { ChapterMap.SetCurrentNodeLevel(level); }, onEditButtonClick: delegate { UIManager.Instance.CloseUIForm <StoryEditorPanel>(); UIManager.Instance.ShowUIForms <LevelEditorPanel>().SetLevel(_kv.Value.Clone()); }, onDeleteButtonClick: delegate { ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>(); cp.Initialize(LanguageManager.Instance.GetText("StoryEditorPanel_DeleteLevelFormLibrary0"), LanguageManager.Instance.GetText("Common_Yes"), LanguageManager.Instance.GetText("Common_No"), delegate { cp.CloseUIForm(); AllLevels.DeleteLevel(kv.Key, _kv.Value.LevelNames["en"]); InitializeLevelList(); SelectTab(kv.Key); SetStory(AllStories.GetStory("DefaultStory", CloneVariantUtils.OperationType.Clone)); }, delegate { cp.CloseUIForm(); }); } ); MyLevelButtons[kv.Key].Add(btn); } } } }