public void OnStrengthen(IBattelBase battel, Action finish) { Strengthen.Invoke(carrentCount); carrentCount++; if (carrentCount == max) { ResetCards.Invoke(); DiscardAll(battel, finish); } else { finish.Invoke(); } }
public override void CreateData() { CSDefaultData ddata = null; bool isNew; if (GameConfig.IsMultiMode) { isNew = MultiColonyManager.Instance.AssignData(ID, CSConst.dtEnhance, ref ddata, _ColonyObj); } else { isNew = m_Creator.m_DataInst.AssignData(ID, CSConst.dtEnhance, ref ddata); } m_Data = ddata as CSEnhanceData; if (isNew) { Data.m_Name = CSUtils.GetEntityName(m_Type); Data.m_Durability = Info.m_Durability; } else { StartRepairCounter(Data.m_CurRepairTime, Data.m_RepairTime, Data.m_RepairValue); StartDeleteCounter(Data.m_CurDeleteTime, Data.m_DeleteTime); if (ItemMgr.Instance.Get(Data.m_ObjID) == null) { m_Item = null; } else { m_Item = ItemMgr.Instance.Get(Data.m_ObjID).GetCmpt <Strengthen>(); } StartCounter(Data.m_CurTime, Data.m_Time); } //for (int i = 0; i < m_WorkSpaces.Length; i++) //{ // m_WorkSpaces[i].Pos = Position; // m_WorkSpaces[i].m_Rot = Quaternion.identity; //} }
void OnGirdItemChanged(ItemObject item, ItemObject oldItem, int index) { if (oldItem != null) { if (item == null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mTakeAwayFromMachine.GetString(), oldItem.protoData.GetName(), CSUtils.GetEntityName(m_Type))); } else if (item == oldItem) { //log:lz-2016.04.14: 这里点击的是自己Item不做操作 //CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mNotEnoughGrid.GetString(), Color.red); } else { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutIntoMachine.GetString(), item.protoData.GetName(), CSUtils.GetEntityName(m_Type))); } } else if (item != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutIntoMachine.GetString(), item.protoData.GetName(), CSUtils.GetEntityName(m_Type))); } if (item != null) { m_enhanceItem = item.GetCmpt <Strengthen>(); m_repairItem = item.GetCmpt <Repair>(); m_recycleItem = item.GetCmpt <Recycle>(); } else { m_enhanceItem = null; m_repairItem = null; m_recycleItem = null; } OnItemChanged(item); }
// Enhanced time up void OnEnhancedTimeUp(Strengthen item) { m_SubEngneering.UpdatePopupHintInfo(m_Enhance); m_SubEngneering.ItemGrid.PlayGlow(true); }
/// <summary> /// check if this grid can put item in /// </summary> /// <param name="item">target_item</param> /// <param name="check_type">operation_type</param> /// <returns></returns> bool OnGridCheckItem(ItemObject item, CSUI_Grid.ECheckItemType check_type) { if (!CSUI_MainWndCtrl.IsWorking()) { return(false); } if (!m_Entity.IsRunning) { CSCommon com = m_Entity as CSCommon; if (com == null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), CSUtils.GetEntityName(m_Type)), Color.red); } else { if (com.Assembly == null) { CSUI_MainWndCtrl.ShowStatusBar("The machine is invalid.", Color.red); } else { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), CSUtils.GetEntityName(m_Type)), Color.red); } } return(false); } if (SelectItem_N.Instance.Place == ItemPlaceType.IPT_HotKeyBar) { return(false); } if (m_Type == CSConst.etEnhance) { if ((m_Entity as CSEnhance).IsEnhancing) { if (m_enhanceItem != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mHasBeenEnhancingTheItem.GetString(), m_enhanceItem.protoData.GetName()), Color.red); } return(false); } if (item != null) { //if ((item.prototypeData.m_OpType & ItemOperationType.EquipmentItem) == 0 // && item.prototypeId < CreationData.s_ObjectStartID) //{ // return false; //} Strengthen sItem = item.GetCmpt <Strengthen>(); if (null != sItem) { if (sItem.strengthenTime >= 100) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(ColonyMessage.CANNOT_ENHANCE_MORE), item.protoData.GetName()), Color.red); return(false); } } else { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(ColonyMessage.CANNOT_ENHANCE_ITEM), item.protoData.GetName()), Color.red); return(false); } } } else if (m_Type == CSConst.etRepair) { if ((m_Entity as CSRepair).IsRepairingM) { if (m_repairItem != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mHasBeenRepairingTheItem.GetString(), m_repairItem.protoData.GetName()), Color.red); } return(false); } if (item != null) { Repair sItem = item.GetCmpt <Repair>(); if (sItem == null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotRequireRepair.GetString(), item.protoData.GetName()), Color.red); return(false); } } } else if (m_Type == CSConst.etRecyle) { if ((m_Entity as CSRecycle).IsRecycling) { if (m_recycleItem != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mHasBeenRecyclingTheItem.GetString(), m_recycleItem.protoData.GetName()), Color.red); } return(false); } if (item != null) { Recycle sItem = item.GetCmpt <Recycle>(); //if (item.prototypeId > CreationData.s_ObjectStartID) //{ // // return true; //} //else //{ // Pathea.Replicator.Formula ms = Pathea.Replicator.Formula.Mgr.Instance.FindByProductId(item.prototypeId); // //MergeSkill ms = MergeSkill.s_tblMergeSkills.Find( // // delegate(MergeSkill hh) // // { // // return hh.m_productItemId == item.mItemID; // // }); if (sItem == null || sItem.GetRecycleItems() == null) { if (sItem != null) { Debug.LogError(item.nameText + " " + item.protoId + " should not have Recycle!"); } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantRecycle.GetString(), item.protoData.GetName()), Color.red); return(false); } //} } } return(true); }
public bool SetItem(ItemObject item) { if (m_Entity == null) { return(false); } if (m_ItemGrid == null) { InitItemGrid(); } if (item == null) { m_ItemGrid.m_Grid.SetItem(null); m_enhanceItem = null; m_repairItem = null; m_recycleItem = null; OnItemChanged(null); return(true); } if (m_Type == CSConst.etEnhance) { Strengthen enhanceItem = item.GetCmpt <Strengthen>(); if (enhanceItem == null) { return(false); } m_ItemGrid.m_Grid.SetItem(item); m_enhanceItem = enhanceItem; m_repairItem = null; m_recycleItem = null; OnItemChanged(item); } else if (m_Type == CSConst.etRepair) { Repair repairItem = item.GetCmpt <Repair>(); if (repairItem == null) { return(false); } m_ItemGrid.m_Grid.SetItem(item); m_enhanceItem = null; m_repairItem = repairItem; m_recycleItem = null; OnItemChanged(item); } else if (m_Type == CSConst.etRecyle) { Recycle recycleItem = item.GetCmpt <Recycle>(); if (recycleItem == null) { return(false); } m_ItemGrid.m_Grid.SetItem(item); m_enhanceItem = null; m_repairItem = null; m_recycleItem = recycleItem; OnItemChanged(item); } return(true); }