bool ChangeEntityWorkers() { if (m_EntityType != m_Entity.m_Type) { m_EntityType = m_Entity.m_Type; return(true); } else { CSCommon com = m_Entity as CSCommon; if (com == null) { return(false); } if (com.WorkerMaxCount != mPersonnelList.Count) { return(true); } for (int i = 0; i < com.WorkerMaxCount; i++) { if (com.Worker(i) != mPersonnelList[i]) { return(true); } } } return(false); }
void RefalshWorkersGrid() { CSCommon com = m_Entity as CSCommon; if (com == null) { return; } if (com.WorkerCount > mUIWokerList.Count) { AddCSUI_WorkeItem(com.WorkerCount - mUIWokerList.Count); } int j = 0; for (int i = 0; i < com.WorkerMaxCount; i++) { if (com.Worker(i) != null) { mUIWokerList[j].SetWorker(com.Worker(i)); mUIWokerList[j].gameObject.SetActive(true); j++; } } for (int i = j; i < mUIWokerList.Count; i++) { mUIWokerList[i].gameObject.SetActive(false); } mPersonnelList.Clear(); for (int i = 0; i < com.WorkerMaxCount; i++) { mPersonnelList.Add(com.Worker(i)); } mWorkerGrid.repositionNow = true; }
// Update is called once per frame void Update() { if (m_ItemGrid != null) { ItemObject item = m_ItemGrid.m_Grid.ItemObj; if (item == null) { m_ItemPart.m_Name.text = ""; if (m_Type == CSConst.etEnhance) { m_EnhanceProperty.m_Durability.text = "0 ([00BBFF] +0 [ffffff])"; m_EnhanceProperty.m_Atk.text = "0 ([00BBFF] +0 [ffffff])"; m_EnhanceProperty.m_Defense.text = "0 ([00BBFF] +0 [ffffff])"; m_EnhanceProperty.m_TimesEnhcance.text = "0"; } else if (m_Type == CSConst.etRepair) { m_RepairProperty.m_Durability.text = "0 ([00BBFF] +0 [ffffff])"; } else if (m_Type == CSConst.etRecyle) { m_RecycleProperty.m_Durability.text = "0 ([00BBFF] +0 [ffffff])"; } m_ItemPart.m_CostsTime.text = "00:00"; m_PopupHintsPart.m_EnhanceHintGo.SetActive(false); m_PopupHintsPart.m_RepairHintGo.SetActive(false); m_PopupHintsPart.m_RecyleHintGo.SetActive(false); } else { m_ItemPart.m_Name.text = item.protoData.name; // Item property float curValue = 0.0f; float nextValue = 0.0f; if (m_Type == CSConst.etEnhance) { if (m_enhanceItem != null) { curValue = m_enhanceItem.GetCurLevelProperty(Pathea.AttribType.Atk); nextValue = m_enhanceItem.GetNextLevelProperty(Pathea.AttribType.Atk); m_EnhanceProperty.m_Atk.text = Mathf.FloorToInt(curValue).ToString() + " ([00BBFF] + " + Mathf.FloorToInt((nextValue - curValue)).ToString() + "[ffffff])"; curValue = m_enhanceItem.GetCurLevelProperty(Pathea.AttribType.Def); nextValue = m_enhanceItem.GetNextLevelProperty(Pathea.AttribType.Def); m_EnhanceProperty.m_Defense.text = Mathf.FloorToInt(curValue).ToString() + " ([00BBFF] + " + Mathf.FloorToInt((nextValue - curValue)).ToString() + "[ffffff])"; curValue = m_enhanceItem.GetCurMaxDurability(); nextValue = m_enhanceItem.GetNextMaxDurability(); WhiteCat.CreationItemClass isoType = WhiteCat.CreationItemClass.None; if (null != m_enhanceItem.itemObj) { isoType = WhiteCat.CreationHelper.GetCreationItemClass(m_enhanceItem.itemObj); } if (isoType != WhiteCat.CreationItemClass.None) { //lz-2017.01.16 只有一部分ISO物品耐久需要乘一个系数才是显示耐久,其他的直接显示原数 switch (isoType) { case WhiteCat.CreationItemClass.Sword: case WhiteCat.CreationItemClass.Axe: case WhiteCat.CreationItemClass.Bow: case WhiteCat.CreationItemClass.Shield: case WhiteCat.CreationItemClass.HandGun: case WhiteCat.CreationItemClass.Rifle: curValue *= WhiteCat.PEVCConfig.equipDurabilityShowScale; nextValue *= WhiteCat.PEVCConfig.equipDurabilityShowScale; break; } } m_EnhanceProperty.m_Durability.text = Mathf.CeilToInt(curValue).ToString() + " ([00BBFF] + " + Mathf.CeilToInt((nextValue - curValue)).ToString() + "[ffffff])"; // Times Ehance m_EnhanceProperty.m_TimesEnhcance.text = m_enhanceItem.strengthenTime.ToString(); } CSEnhance cse = m_Entity as CSEnhance; m_ItemPart.m_CostsTime.text = CSUtils.GetRealTimeMS((int)cse.CostsTime); m_PopupHintsPart.m_EnhanceHintGo.SetActive(true); m_PopupHintsPart.m_RepairHintGo.SetActive(false); m_PopupHintsPart.m_RecyleHintGo.SetActive(false); } else if (m_Type == CSConst.etRepair) { if (null != m_repairItem) { curValue = m_repairItem.GetValue().current; float expendValue = m_repairItem.GetValue().ExpendValue; WhiteCat.CreationItemClass isoType = WhiteCat.CreationItemClass.None; if (null != m_repairItem.itemObj) { isoType = WhiteCat.CreationHelper.GetCreationItemClass(m_repairItem.itemObj); } if (isoType != WhiteCat.CreationItemClass.None) { //lz-2016.10.25 只有一部分ISO物品耐久需要乘一个系数才是显示耐久,其他的直接显示原数 switch (isoType) { case WhiteCat.CreationItemClass.Sword: case WhiteCat.CreationItemClass.Axe: case WhiteCat.CreationItemClass.Bow: case WhiteCat.CreationItemClass.Shield: case WhiteCat.CreationItemClass.HandGun: case WhiteCat.CreationItemClass.Rifle: curValue *= WhiteCat.PEVCConfig.equipDurabilityShowScale; expendValue *= WhiteCat.PEVCConfig.equipDurabilityShowScale; break; } } else { //lz-2016.10.24 其他物品显示的时候要小于100倍的显示,就和ToolTip上面的防御值一样了 curValue *= 0.01f; expendValue *= 0.01f; } m_RepairProperty.m_Durability.text = Mathf.CeilToInt(curValue).ToString() + " ([00BBFF] + " + Mathf.CeilToInt(expendValue).ToString() + "[ffffff])"; } CSRepair csr = m_Entity as CSRepair; m_ItemPart.m_CostsTime.text = CSUtils.GetRealTimeMS((int)csr.CostsTime); m_PopupHintsPart.m_EnhanceHintGo.SetActive(false); m_PopupHintsPart.m_RepairHintGo.SetActive(true); m_PopupHintsPart.m_RecyleHintGo.SetActive(false); } else if (m_Type == CSConst.etRecyle) { CSRecycle csr = m_Entity as CSRecycle; m_ItemPart.m_CostsTime.text = CSUtils.GetRealTimeMS((int)csr.CostsTime); if (null != m_recycleItem) { if (m_recycleItem.GetCurrent() == null) { curValue = 0; } else { curValue = m_recycleItem.GetCurrent().current;//todocolony } } WhiteCat.CreationItemClass isoType = WhiteCat.CreationItemClass.None; if (null != m_recycleItem.itemObj) { isoType = WhiteCat.CreationHelper.GetCreationItemClass(m_recycleItem.itemObj); } if (isoType != WhiteCat.CreationItemClass.None) { //lz-2017.01.16 只有一部分ISO物品耐久需要乘一个系数才是显示耐久,其他的直接显示原数 switch (isoType) { case WhiteCat.CreationItemClass.Sword: case WhiteCat.CreationItemClass.Axe: case WhiteCat.CreationItemClass.Bow: case WhiteCat.CreationItemClass.Shield: case WhiteCat.CreationItemClass.HandGun: case WhiteCat.CreationItemClass.Rifle: curValue *= WhiteCat.PEVCConfig.equipDurabilityShowScale; break; } } m_RecycleProperty.m_Durability.text = Mathf.CeilToInt(curValue).ToString(); m_PopupHintsPart.m_EnhanceHintGo.SetActive(false); m_PopupHintsPart.m_RepairHintGo.SetActive(false); m_PopupHintsPart.m_RecyleHintGo.SetActive(true); } } } // Worker CSCommon csc = m_Entity as CSCommon; if (csc != null) { int workCount = csc.WorkerCount; for (int i = 0; i < m_NpcGirds.Count; i++) { if (i < workCount) { m_NpcGirds[i].m_Npc = csc.Worker(i); } else { m_NpcGirds[i].m_Npc = null; } } m_NpcPart.m_AuttoSettleBtn.isEnabled = (workCount != csc.WorkerMaxCount); m_NpcPart.m_DisbandAllBtn.isEnabled = (workCount != 0); } }