void UpdateWorkingTime() { // float restTime = Mathf.Max(m_PPCoal.Data.m_WorkedTime - m_PPCoal.Data.m_CurWorkedTime, 0); // float percent = restTime / m_PPCoal.Data.m_WorkedTime; float restTime = m_PPCoal.RestTime; float percent = m_PPCoal.RestPercent; m_Work.m_TimePer.text = ((int)(percent * 100)).ToString() + " %"; m_Work.m_TimeLeft.text = CSUtils.GetRealTimeMS((int)restTime); bool canAdd = true; foreach (CSUI_MaterialGrid mg in m_MatGrids) { if (mg.ItemID != 0) { mg.NeedCnt = Mathf.Max(1, Mathf.RoundToInt(mg.MaxCnt * (1 - percent))); mg.ItemNum = playerPackageCmpt.package.GetCount(mg.ItemID); if (mg.NeedCnt > mg.ItemNum) { canAdd = false; } } else { mg.ItemNum = -1; } } m_Work.m_Button.isEnabled = canAdd; }
void Update() { if (null != GameUI.Instance.mMainPlayer && mMachinePos != Vector3.zero) { if (Vector3.Distance(GameUI.Instance.mMainPlayer.position, mMachinePos) > 8f) { OnClose(); } } if (mRepairItem == null || mRepairItem.ItemObj == null) { return; } if (this.mRepairMachine.m_Repair != null && this.mRepairMachine.m_Repair.IsRepairingM) { this.m_CostTimeLabel.text = CSUtils.GetRealTimeMS((int)mRepairMachine.m_Repair.CostsTime); } else { this.m_CostTimeLabel.text = "00:00"; } //if(null != PlayerFactory.mMainPlayer && null != mRepairMachine) //{ // if(Vector3.Distance(PlayerFactory.mMainPlayer.transform.position,mRepairMachine.transform.position) > 10f) // OnClose(); //} }
void UpdateUpgradeTime() { if (m_Assembly.isUpgrading) { float restTime = m_Assembly.Data.m_UpgradeTime - m_Assembly.Data.m_CurUpgradeTime; float percent = m_Assembly.Data.m_CurUpgradeTime / m_Assembly.Data.m_UpgradeTime; m_Upgrade.m_Slider.sliderValue = percent; m_Upgrade.m_TimeLb.text = CSUtils.GetRealTimeMS((int)restTime); } else { m_Upgrade.m_Slider.sliderValue = 0F; m_Upgrade.m_TimeLb.text = CSUtils.GetRealTimeMS(0); } }
void UpdateDelete() { if (m_Entity.isDeleting) { float restTime = m_Entity.BaseData.m_DeleteTime - m_Entity.BaseData.m_CurDeleteTime; float percent = m_Entity.BaseData.m_CurDeleteTime / m_Entity.BaseData.m_DeleteTime; m_Delete.m_Slider.sliderValue = percent; m_Delete.m_TimeLb.text = CSUtils.GetRealTimeMS((int)restTime); } else { m_Delete.m_Slider.sliderValue = 0F; m_Delete.m_TimeLb.text = CSUtils.GetRealTimeMS(0); } }
void UpdateRepair() { if (m_Entity.isRepairing) { float restTime = m_Entity.BaseData.m_RepairTime - m_Entity.BaseData.m_CurRepairTime; float percent = m_Entity.BaseData.m_CurRepairTime / m_Entity.BaseData.m_RepairTime; m_Repair.m_Slider.sliderValue = percent; m_Repair.m_TimeLb.text = CSUtils.GetRealTimeMS((int)restTime); } else { m_Repair.m_Slider.sliderValue = 0F; m_Repair.m_TimeLb.text = CSUtils.GetRealTimeMS(0); } }
// 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); } }