void SelectBackupOrDefault() { //lz-2016.10.16 如果没有选中的,就默认选中m_PersonnelMI if (null == mSelectedMenuItem || !m_ActiveMenuList.Contains(mSelectedMenuItem)) { mSelectedMenuItem = m_Menu.m_PersonnelMI; } ShowWndPart(mSelectedMenuItem, mSelectedMenuItem.m_Type); }
public void ShowWndPart(CSUI_LeftMenuItem menuItem, int mWndPartType, CSEntity selectEntity = null) { if (!isShow) { base.Show(); CheckFirstOpenColony(); } if (null == menuItem || !m_ActiveMenuList.Contains(menuItem)) { menuItem = m_Menu.m_PersonnelMI; } if (!menuItem.IsSelected) { menuItem.SelectSprite(true); } if (mSelectedMenuItem != null && mSelectedMenuItem != menuItem) { mSelectedMenuItem.IsSelected = false; } mSelectedMenuItem = menuItem; //log:lz-2016.05.26 只要打开都提示是否有电 if (menuItem.NotHaveAssembly || menuItem.NotHaveElectricity) { string entityNameStr = CSUtils.GetEntityName(menuItem.m_Type); //log:lz-2016.05.26 Hospital里面三个机械要分别提示 if (menuItem == m_Menu.m_HospitalMI && (m_Menu.m_HospitalMI.NotHaveAssembly || m_Menu.m_HospitalMI.NotHaveElectricity)) { List <string> names = new List <string>(); if (menuItem.AssemblyLevelInsufficient) { names = menuItem.GetNamesByAssemblyLevelInsufficient(); } else if (menuItem.NotHaveAssembly) { names = menuItem.GetNamesByNotHaveAssembly(); } else if (menuItem.NotHaveElectricity) { names = menuItem.GetNamesByNotHaveElectricity(); } if (null != names && names.Count > 0) { entityNameStr = ""; for (int i = 0; i < names.Count; i++) { entityNameStr += names[i]; entityNameStr += ","; } entityNameStr = entityNameStr.Substring(0, entityNameStr.Length - 1); } } if (!string.IsNullOrEmpty(entityNameStr)) { //lz-2016.06.08 检测顺序为:1.检测基地核心等级是否足够 2.检测是否有基地核心 3.检测是否有电 (注意:这个顺序不能修改,因为核心等级不足会满足没有核心的条件,具体参见menuItem.AssemblyLevelInsufficient的实现) if (menuItem.AssemblyLevelInsufficient) { ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkAssemblyLevelInsufficient.GetString(), entityNameStr), Color.red); } else if (menuItem.NotHaveAssembly) { ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutAssembly.GetString(), entityNameStr), Color.red); } else if (menuItem.NotHaveElectricity) { ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), entityNameStr), Color.red); } } } m_Windows.m_EngineeringUI.CloseLock(); mWndPartTag = mWndPartType; mSkillLock.gameObject.SetActive(!IsUnLock(mWndPartType)); #if UNITY_5 bool active = isActiveAndEnabled; #endif // Assembly if (mWndPartType == CSConst.dtAssembly) { m_Windows.m_AssemblyUI.gameObject.SetActive(true); m_Windows.m_AssemblyUI.SetEntity(m_Creator.Assembly); mSelectedEnntity = m_Creator.Assembly; } //etStorage else if (mWndPartType == CSConst.dtStorage) { m_Windows.m_StorageUI.gameObject.SetActive(true); m_Windows.m_StorageUI.Replace(menuItem.m_EntityList); } //etPowerPlant else if (menuItem.m_Type == CSConst.dtppCoal) { m_Windows.m_PPCoalUI.gameObject.SetActive(true); m_Windows.m_PPCoalUI.SetEntityList(menuItem.m_EntityList, selectEntity); } //dtDwelling else if (mWndPartType == CSConst.dtDwelling) { m_Windows.m_DwellingsUI.gameObject.SetActive(active); m_Windows.m_DwellingsUI.SetEntityList(menuItem.m_EntityList); } //dtEngineer else if (mWndPartType == CSConst.dtEngineer) { m_Windows.m_EngineeringUI.Replace(menuItem.m_EntityList, selectEntity); m_Windows.m_EngineeringUI.gameObject.SetActive(active); } //dtFarm else if (menuItem.m_Type == CSConst.dtFarm) { if (menuItem.m_EntityList.Count >= 1) { m_Windows.m_FarmUI.gameObject.SetActive(active); CSFarm f = menuItem.m_EntityList[0] as CSFarm; if (menuItem.m_EntityList.Count > 1) { foreach (CSEntity e in menuItem.m_EntityList) { CSFarm tempF = e as CSFarm; if (tempF.IsRunning) { f = tempF; break; } } } m_Windows.m_FarmUI.SetFarm(f); mSelectedEnntity = f; } } //dtFactory else if (menuItem.m_Type == CSConst.dtFactory) { //lz-2016.11.14 错误 #6335 Crush Bug if (menuItem.m_EntityList.Count >= 1) { NGUITools.SetActive(m_Windows.m_FactoryUI.gameObject, active); CSEntity f = menuItem.m_EntityList[0]; if (menuItem.m_EntityList.Count > 1) { foreach (CSEntity e in menuItem.m_EntityList) { if (e.IsRunning) { f = e; break; } } } m_Windows.m_FactoryUI.SetEntity(f); } } //etPersonnel else if (mWndPartType == CSConst.dtPersonnel) { m_Windows.m_PersonnelUI.gameObject.SetActive(true); } //Transaction else if (mWndPartType == CSConst.dtTrade) { m_Windows.m_TradingPostUI.gameObject.SetActive(true); m_Windows.m_TradingPostUI.SetMenu(menuItem); //lz-2016.10.31 刷新OptionWnd和WorkWnd的Entity if (null != menuItem && menuItem.m_EntityList.Count > 0) { mSelectedEnntity = menuItem.m_EntityList[0]; } } //Collect else if (mWndPartType == CSConst.dtProcessing) { m_Windows.m_CollectUI.gameObject.SetActive(true); m_Windows.m_CollectUI.UpdateCollect(); //lz-2016.11.28 错误 #7098 crash bug if (menuItem.m_EntityList.Count > 0) { CSEntity f = menuItem.m_EntityList[0]; if (menuItem.m_EntityList.Count > 1) { foreach (CSEntity e in menuItem.m_EntityList) { if (e.IsRunning) { f = e; break; } } } m_Windows.m_CollectUI.SetEnity(f); } } //Hospital else if (mWndPartType == CSConst.dtCheck || mWndPartType == CSConst.dtTreat || mWndPartType == CSConst.dtTent) { m_Windows.m_HospitalUI.gameObject.SetActive(true); //lw 2017.2.21:治疗的三个机器添加修理功能 m_Windows.m_HospitalUI.RefleshMechine(m_Windows.m_HospitalUI.m_CheckedPartType, menuItem.m_EntityList, selectEntity); } //Train else if (mWndPartType == CSConst.dtTrain) { m_Windows.m_TrainUI.gameObject.SetActive(true); //lz-2016.01.03 选中的entity切换为训练所 if (null != menuItem && menuItem.m_EntityList.Count > 0) { mSelectedEnntity = menuItem.m_EntityList[0]; } } //删除bed界面子窗口 DestroyChildWindowOfBed(); }
public void SetMenu(CSUI_LeftMenuItem curMenuItem) { m_CurMenuItem = curMenuItem; }