public void initBuildingLinkCard(string id) { BuildingId = id; BasicSubMenuPanel P = null; for (int i = 0; i < MCP.homeScene.AllSubMenus.Length; i++) { if (MCP.homeScene.AllSubMenus[i] == null) { continue; } P = MCP.homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>(); if (P.buildingId == BuildingId) { IndexInHS = i; thisTag = (HomeScene.HomeSceneSubMenu)i; //buildingImg //NPCImg NameText.text = thisTag.ToString() + "·" + SDGameManager.T("Lv.") + P.Level; break; } } if (P == null) { return; } bool flag = P.CheckIfCanLvUp(); lvUpBtn.interactable = flag; }
public void lvUpBtnTapped() { BasicSubMenuPanel P = AllSubMenus[(int)CurrentSubMenuType].GetComponent <BasicSubMenuPanel>(); if (P.CheckIfCanLvUp()) { P.BtnToLvUp(); } }
public void resetOneSubMenu(HomeSceneSubMenu type) { BasicSubMenuPanel panel = AllSubMenus[(int)type].GetComponent <BasicSubMenuPanel>(); if (panel.thisMenuOpened) { panel.commonBackAction(); } }
public void ExtraBtnTapped() { BasicSubMenuPanel P = MCP.homeScene.AllSubMenus[(int)thisTag] .GetComponent <BasicSubMenuPanel>(); bool flag = P.CheckIfCanLvUp(); if (flag) { P.BtnToLvUp(); } }
public void checkLvUpBtn() { BasicSubMenuPanel P = AllSubMenus[(int)CurrentSubMenuType].GetComponent <BasicSubMenuPanel>(); if (P.CheckIfCanLvUp()) { int lv = P.Level; SubMenuLvUpBtn.GetComponentInChildren <Text>().text = "升级 </n> 当前等级" + lv; SubMenuLvUpBtn.gameObject.SetActive(true); } else { SubMenuLvUpBtn.gameObject.SetActive(false); } }
private void Awake() { //建筑Id设置 for (int i = 0; i < AllSubMenus.Length; i++) { if (AllSubMenus[i] == null) { continue; } BasicSubMenuPanel panel = AllSubMenus[i].GetComponent <BasicSubMenuPanel>(); if (panel) { panel.buildingId = "BUILD#" + (i + 1); } } }
public void WhenChangingSubMenu (HomeSceneSubMenu oldOne, HomeSceneSubMenu newOne) { if (oldOne != HomeSceneSubMenu.End && newOne == HomeSceneSubMenu.End) { //返回城镇大街页面 changeToHomeScene(); } else if (newOne != HomeSceneSubMenu.End) { //进入功能建筑页面 BasicSubMenuPanel P = AllSubMenus[(int)newOne].GetComponent <BasicSubMenuPanel>(); changeToSubMenuScene(P.AboveOuterMenuIsShowing); } if (oldOne != HomeSceneSubMenu.End) { AllSubMenus[(int)oldOne].GetComponent <BasicSubMenuPanel>()._canvas.sortingOrder = -1; } if (newOne != HomeSceneSubMenu.End) { AllSubMenus[(int)newOne].GetComponent <BasicSubMenuPanel>()._canvas.sortingOrder = 0; } if (oldOne == HomeSceneSubMenu.BattleTeam && newOne != oldOne) { _BattleTeamPanel.GetComponent <BattleTeamPanel>() .changeSpriterenderersStatus(true); } else if (newOne == HomeSceneSubMenu.BattleTeam && newOne != oldOne) { _BattleTeamPanel.GetComponent <BattleTeamPanel>() .changeSpriterenderersStatus(false); } // RefreshDataInOuterMenu(); }
public void refreshAllBuildingsInfor() { AllBuildings.Clear(); for (int i = 0; i < homeScene.AllSubMenus.Length; i++) { if (homeScene.AllSubMenus[i] == null) { continue; } if (homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>() && homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>().LvUpEnable) { AllBuildings.Add(homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>()); } } LvUpEnableBuildingCount = AllBuildings.Count; //建筑升级存档数量修正 if (SDDataManager.Instance.PlayerData.buildingsOwned.Count < AllBuildings.Count) { for (int i = 0; i < AllBuildings.Count; i++) { BasicSubMenuPanel Menu = AllBuildings[i]; bool flag = true; foreach (GDEtownBuildingData B in SDDataManager.Instance.PlayerData.buildingsOwned) { if (B.id == Menu.buildingId) { flag = false; break; } } if (flag) { SDDataManager.Instance.PlayerData.buildingsOwned.Add (new GDEtownBuildingData(GDEItemKeys.townBuilding_newTownBuilding) { id = Menu.buildingId, level = 0, NPC = null, }); SDDataManager.Instance.PlayerData.Set_buildingsOwned(); } } } for (int i = 0; i < AllBuildings.Count; i++) { foreach (GDEtownBuildingData b in SDDataManager.Instance.PlayerData.buildingsOwned) { if (b.id == AllBuildings[i].buildingId) { AllBuildings[i].Level = b.level; if (AllBuildings[i].ShowNPC && AllBuildings[i].RepresentNPC != null) { if (b.NPC == null) { b.NPC = new GDENPCData(GDEItemKeys.NPC_noone) { id = AllBuildings[i].RepresentNPC.TalkerID, }; SDDataManager.Instance.PlayerData.Set_buildingsOwned(); } else if (b.NPC.id != AllBuildings[i].RepresentNPC.TalkerID) { b.NPC.id = AllBuildings[i].RepresentNPC.TalkerID; SDDataManager.Instance.PlayerData.Set_buildingsOwned(); } } else { if (b.NPC != null) { b.NPC = null; SDDataManager.Instance.PlayerData.Set_buildingsOwned(); } } break; } } } }