void OnStorageMainOpStateEvent(CSUI_StorageMain.EEventType type, object obj1, object obj2) { if (type == CSUI_StorageMain.EEventType.CantWork) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), (string)obj1), Color.red); } else if (type == CSUI_StorageMain.EEventType.PutItemInto) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutIntoMachine.GetString(), (string)obj1, (string)obj2)); } else if (type == CSUI_StorageMain.EEventType.DeleteItem) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mDeleteItem.GetString(), (string)obj1, (string)obj2)); } else if (type == CSUI_StorageMain.EEventType.TakeAwayItem) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mTakeAwayFromMachine.GetString(), (string)obj1, (string)obj2)); } else if (type == CSUI_StorageMain.EEventType.ResortItem) { CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mResortTheItems.GetString()); } else if (type == CSUI_StorageMain.EEventType.SplitItem) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mSplitItems.GetString(), (string)obj1, (string)obj2)); } }
public void OnCompoundBtnClickSuccess(int item_id, CSFactory entity) { if (m_Factory == entity) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mJoinCompoudingQueue.GetString(), ItemProto.GetItemData(item_id).GetName())); } }
// public delegate void TriggerEvent(GameObject go); // public TriggerEvent onEnterTrigger; void OnTriggerEnter(Collider target) { if ((Pathea.PeGameMgr.IsSingleAdventure && Pathea.PeGameMgr.yirdName == Pathea.AdventureScene.MainAdventure.ToString()) || Pathea.PeGameMgr.IsMultiAdventure) { Debug.Log("enter dungen"); if (null == target.GetComponentInParent <Pathea.MainPlayerCmpt>()) { return; } if (isShow == true) { return; } // isShow = true; if (level >= DungeonConstants.TASK_LEVEL_START) { ob = MessageBox_N.ShowYNBox(PELocalization.GetString(DungenMessage.TASK_ENTER_DUNGEN), SceneTranslate, SetFalse); } else { ob = MessageBox_N.ShowYNBox(CSUtils.GetNoFormatString(PELocalization.GetString(DungenMessage.ENTER_DUNGEN), level.ToString()), SceneTranslate, SetFalse); } } }
//lz-2016.08.15 增加基地NPC召回按钮 void OnCallBtn(GameObject go) { if (null != m_RefNpc && null != m_RefNpc.NPC) { //m_RefNpc.NPC ECsNpcState state; if (!NpcMgr.CallBackColonyNpcToPlayer(m_RefNpc.NPC, out state)) { switch (state) { case ECsNpcState.None: break; case ECsNpcState.Working: CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(82201077), m_RefNpc.FullName)); break; case ECsNpcState.InMission: CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(82201078), m_RefNpc.FullName)); break; case ECsNpcState.OutOfRadiu: CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(82201079)); break; } } else { CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(82201080)); } } }
void OnItemGridChanged(ItemObject item, ItemObject oldItem, int index) { //--to do: wait npcpackage //if (oldItem != null) // RefNpc.m_Npc.RemoveFromBag(oldItem); //if (item != null) // RefNpc.m_Npc.AddToBag(item); if (oldItem != null) { if (item == null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mTakeAwayItemFromNpc.GetString(), oldItem.protoData.GetName(), m_RefNpc.FullName)); } else if (item == oldItem) { CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mNotEnoughGrid.GetString(), Color.red); } else { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutItemToNpc.GetString(), item.protoData.GetName(), m_RefNpc.FullName)); } } else if (item != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutItemToNpc.GetString(), item.protoData.GetName(), m_RefNpc.FullName)); } }
void RPC_S2C_BeginRecycle(uLink.BitStream stream, uLink.NetworkMessageInfo info) { _ColonyObj._RecordData.m_DeleteTime = stream.Read <float>(); m_Entity.StartDeleteCounter(0, _ColonyObj._RecordData.m_DeleteTime); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToDelete.GetString(), m_Entity.Name)); }
void RPC_S2C_RepairStart(uLink.BitStream stream, uLink.NetworkMessageInfo info) { _ColonyObj._RecordData.m_CurRepairTime = stream.Read <float>(); _ColonyObj._RecordData.m_RepairTime = stream.Read <float>(); _ColonyObj._RecordData.m_RepairValue = stream.Read <float>(); m_Entity.StartRepairCounter(_ColonyObj._RecordData.m_CurRepairTime, _ColonyObj._RecordData.m_RepairTime, _ColonyObj._RecordData.m_RepairValue); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRepair.GetString(), m_Entity.Name)); }
void RPC_S2C_FCT_Fetch(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int itemId = stream.Read <int>(); bool succ = stream.Read <bool>(); if (succ) { //1.success UI CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mTakeAwayCompoundItem.GetString(), ItemProto.GetItemData(itemId).GetName())); } }
// CSUI_Grid bool OnGridCheckItem(ItemObject item, CSUI_Grid.ECheckItemType check_type) { if (item == null) { return(true); } if (PlantInfo.GetPlantInfoByItemId(item.protoId) != null)//--to do: judge if a seed; { return(true); } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotPlantSeed.GetString(), item.protoData.GetName()), Color.red); return(false); }
void OnOKBtn() { if (m_Entity == null) { return; } if (!GameConfig.IsMultiMode) { if (funcType == FuncType.Repair) { foreach (CSUI_MaterialGrid item in m_MatItemList) { m_PlayerPackageCmpt.package.Destroy(item.ItemID, item.NeedCnt); } m_Entity.StartRepairCounter(); // CSUI_MainWndCtrl.ShowStatusBar("Start to repair the " + m_Entity.Name + "."); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRepair.GetString(), m_Entity.Name)); } else { m_Entity.ClearDeleteGetsItem(); foreach (CSUI_MaterialGrid item in m_MatItemList) { m_Entity.AddDeleteGetsItem(item.ItemID, item.NeedCnt); } m_Entity.StartDeleteCounter(); // CSUI_MainWndCtrl.ShowStatusBar("Start to delete the " + m_Entity.Name + "."); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToDelete.GetString(), m_Entity.Name)); } } else { //multimode if (funcType == FuncType.Repair) { m_Entity._ColonyObj.Repair(); } else { m_Entity._ColonyObj.RecycleItems(); } } Destroy(gameObject); }
public void AddFuelSuccess(CSPPCoal m_PPCoal) { if (this.m_PPCoal != m_PPCoal) { return; } foreach (CSUI_MaterialGrid mg in m_MatGrids) { if (mg.ItemID != 0) { CSUI_MainWndCtrl.CreatePopupHint(mg.transform.position, this.transform, new Vector3(10, -2, -5), " - " + mg.NeedCnt.ToString(), false); } } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mFullFuelTips.GetString(), m_Entity.Name)); }
public void UpgradeStartSuccuss(CSAssembly entity, string rolename) { if (m_Assembly == null && m_Assembly != entity) { return; } //popup material decreased if (PeCreature.Instance.mainPlayer.GetCmpt <EntityInfoCmpt>().characterName.givenName == rolename) { foreach (CSUI_MaterialGrid mg in m_MatGrids) { if (mg.ItemID > 0) { CSUI_MainWndCtrl.CreatePopupHint(mg.transform.position, this.transform, new Vector3(10, -2, -5), " - " + mg.NeedCnt.ToString(), false); } } } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToUpgrade.GetString(), m_Entity.Name)); }
void CheckCantWorkTip() { //lz-2016.10.24 如果基地可以工作,说明没有超过距离,并且有核心 if (CSUI_MainWndCtrl.IsWorking()) { if (null != m_CurMenuItem) { //lz-2016.10.24 贸易站核心等级不足提示 if (m_CurMenuItem.AssemblyLevelInsufficient) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkAssemblyLevelInsufficient.GetString(), CSUtils.GetEntityName(m_CurMenuItem.m_Type)), Color.red); } //lz-2016.10.24 贸易站没电提示 else if (m_CurMenuItem.NotHaveElectricity) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), CSUtils.GetEntityName(m_CurMenuItem.m_Type)), Color.red); } } } }
public void StartWorkerResult(int type, CSEntity m_entity, string rolename) { if (type == m_CurType) { if (m_CurType == CSConst.etEnhance) { if ((CSEntity)m_Enhance != m_entity) { return; } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToEnhance.GetString(), m_Enhance.m_Item.protoData.GetName())); if (PeCreature.Instance.mainPlayer.GetCmpt <EntityInfoCmpt>().characterName.givenName == rolename) { // Popoup hints foreach (CSUI_MaterialGrid mg in m_MatList) { Vector3 pos = mg.transform.position; CSUI_MainWndCtrl.CreatePopupHint(pos, transform, new Vector3(10, -2, -8), " - " + mg.NeedCnt, false); } } } else if (m_CurType == CSConst.etRepair) { if ((CSEntity)m_Repair != m_entity) { return; } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRepair.GetString(), m_Repair.m_Item.protoData.GetName())); } else if (m_CurType == CSConst.etRecyle) { if ((CSEntity)m_Recycle != m_entity) { return; } CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRecycle.GetString(), m_Recycle.m_Item.protoData.GetName())); } // CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRepair.GetString(), m_Repair.m_Item.protoData.GetName())); } }
void OnAddFuelBtn() { //lz-2016.11.02 错误 #5426 空对象 if (null == PeCreature.Instance || PeCreature.Instance.mainPlayer == null || null == m_PPCoal || null == m_Entity) { return; } if (!GameConfig.IsMultiMode) { PlayerPackageCmpt packageCmpt = PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>(); if (null == packageCmpt) { return; } ItemPackage accessor = packageCmpt.package._playerPak; if (null == accessor) { return; } foreach (CSUI_MaterialGrid mg in m_MatGrids) { if (null != mg && mg.ItemID != 0) { accessor.Destroy(mg.ItemID, mg.NeedCnt); CSUI_MainWndCtrl.CreatePopupHint(mg.transform.position, transform, new Vector3(10, -2, -5), " - " + mg.NeedCnt.ToString(), false); } } m_PPCoal.StartWorkingCounter(); // CSUI_Main.ShowStatusBar("The " + m_Entity.Name +" is full with fuel now"); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mFullFuelTips.GetString(), m_Entity.Name)); } else { m_PPCoal._ColonyObj._Network.PPC_AddFuel(); } }
public void OnTrainAttributeTrainingResult(int instructorId, int traineeId) { trainingType = ETrainingType.Attribute; InstructorNpcId = instructorId; TraineeNpcId = traineeId; SetInstructorNpcUI(instructorId); SetTraineeNpcUI(traineeId); SetNpcIsTraining(true); SetStopBtn(true); StartAttributeCounter(); LockUI(true); if (IsMine) { if (m_MgCreator.GetNpc(InstructorNpcId) != null && m_MgCreator.GetNpc(TraineeNpcId) != null) { CSUI_MainWndCtrl.ShowStatusBar( CSUtils.GetNoFormatString(PELocalization.GetString(CSTrainMsgID.START_TRAINING) , m_MgCreator.GetNpc(InstructorNpcId).FullName , m_MgCreator.GetNpc(TraineeNpcId).FullName)); } } }
void OnLivingRoomClick() { if (m_RefNpc == null || !(m_RefNpc.m_Occupation == CSConst.potWorker || m_RefNpc.m_Occupation == CSConst.potDoctor)) { return; } if (m_RefCommon.WorkerCount >= m_RefCommon.WorkerMaxCount) { return; } if (m_RefNpc.WorkRoom != m_RefCommon) { m_RefNpc.TrySetWorkRoom(m_RefCommon); //--to do: wait //if(GameConfig.IsMultiMode) //{ // if(m_RefNpc.m_Npc.Netlayer is AiAdNpcNetwork) // ((AiAdNpcNetwork)m_RefNpc.m_Npc.Netlayer).SetClnWorkRoomID(m_RefNpc.WorkRoom.ID); //} CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mSetWorkRoom.GetString(), m_RefNpc.FullName, CSUtils.GetEntityName(m_RefCommon.m_Type))); } }
public void ShowTips(ETipType type, int replaceStrId = -1) { string str = "?"; string replaceStr = PELocalization.GetString(replaceStrId); switch (type) { case ETipType.process_for_resource: str = CSUtils.GetNoFormatString(PELocalization.GetString(AutoCycleTips.PROCESS_FOR_RESOURCE), replaceStr); break; case ETipType.process_for_storage: str = CSUtils.GetNoFormatString(PELocalization.GetString(AutoCycleTips.PROCESS_FOR_STORAGE), replaceStr); break; case ETipType.replicate_for: str = CSUtils.GetNoFormatString(PELocalization.GetString(AutoCycleTips.REPLICATE_FOR), replaceStr); break; case ETipType.storage_full: str = CSUtils.GetNoFormatString(PELocalization.GetString(AutoCycleTips.STORAGE_FULL), replaceStr); break; case ETipType.factory_to_storage: str = CSUtils.GetNoFormatString(PELocalization.GetString(AutoCycleTips.FACTORY_TO_STORAGE), replaceStr); break; case ETipType.medicine_supply: str = CSUtils.GetNoFormatString(PELocalization.GetString(AutoCycleTips.MEDICINE_SUPPLY), replaceStr); break; } new PeTipMsg(str, PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Colony); string[] infoInColony = Regex.Split(str, "\\[-\\] ", RegexOptions.IgnoreCase); if (infoInColony.Length < 2) { return; } CSUI_MainWndCtrl.ShowStatusBar(infoInColony[1], 10); }
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); }
public void AddChargeItemResult(bool success, int index, int objId, CSPPCoal entity) { if (entity == m_PPCoal) { CSUI_ChargingGrid cg = m_ChargingGrids[index]; ItemObject itemObj = ItemMgr.Instance.Get(objId); if (success) { cg.SetItemUI(itemObj); if (!cg.m_bUseMsgBox) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToCharge.GetString(), itemObj.protoData.GetName())); } } else { if (!cg.m_bUseMsgBox) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotToBeCharged.GetString(), itemObj.protoData.GetName()), Color.red); } } } }
public void AddHistory(CSStorageHistoryAttr historyAttr) { HistoryStruct hs = new HistoryStruct(); hs.m_Day = historyAttr.m_Day; switch (historyAttr.m_Type) { case CSStorageHistoryAttr.EType.NpcAddSth: { string str = historyAttr.m_TimeStrColor + historyAttr.m_TimeStr + UIMsgBoxInfo.mStorageHistory_1.GetString(); hs.m_Value = CSUtils.GetNoFormatString(str, historyAttr.m_NameColorStr + historyAttr.m_NpcName + "[FFFFFF]", historyAttr.m_ItemStr); } break; case CSStorageHistoryAttr.EType.NpcUseSth: { string str = historyAttr.m_TimeStrColor + historyAttr.m_TimeStr + UIMsgBoxInfo.mStorageHistory_2.GetString(); hs.m_Value = CSUtils.GetNoFormatString(str, historyAttr.m_NameColorStr + historyAttr.m_NpcName + "[FFFFFF]", historyAttr.m_ItemStr); } break; default: break; } Data.m_History.Enqueue(hs); ExcuteEvent(CSConst.eetStorage_HistoryEnqueue, hs); if (Data.m_History.Count > c_HistorMaxCount) { HistoryStruct str = Data.m_History.Dequeue(); ExcuteEvent(CSConst.eetStorage_HistoryDequeue, str); Debug.Log("Storage history [" + str + "] remove."); } }
void OnToolsGridItemChanged(ItemObject item, ItemObject oldItem, int index) { m_Farm.SetPlantTool(index, item); if (oldItem != null) { if (item == null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mTakeAwayFromMachine.GetString(), oldItem.protoData.GetName(), CSUtils.GetEntityName(CSConst.etFarm))); } else if (item == oldItem) { CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mNotEnoughGrid.GetString(), Color.red); } else { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutIntoMachine.GetString(), item.protoData.GetName(), CSUtils.GetEntityName(CSConst.etFarm))); } } else if (item != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mPutIntoMachine.GetString(), item.protoData.GetName(), CSUtils.GetEntityName(CSConst.etFarm))); } }
void OnCompoundBtnClick(GameObject go) { if (!GameConfig.IsMultiMode) { UIGraphControl graph_ctrl = FactoryReplicator.m_MiddleContent.graphCtrl; if (!graph_ctrl.isCanCreate()) { return; } int item_id = graph_ctrl.rootNode.GetItemID(); int item_num = graph_ctrl.rootNode.getCount; //lz-2016.09.26 时间使用份数计算的,所有要除掉productItemCount float time = graph_ctrl.rootNode.ms.timeNeed * item_num / graph_ctrl.rootNode.ms.m_productItemCount; if (RandomMapConfig.useSkillTree) { if (GameUI.Instance.mSkillWndCtrl._SkillMgr != null) { time = GameUI.Instance.mSkillWndCtrl._SkillMgr.CheckReduceTime((float)time); } } if (m_Factory.SetCompoudItem(item_id, item_num, time)) { for (int i = 0; i < graph_ctrl.mGraphItemList.Count; i++) { if (graph_ctrl.mGraphItemList[i].mPartent == graph_ctrl.rootNode) { PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>().package.Destroy(graph_ctrl.mGraphItemList[i].GetItemID(), graph_ctrl.mGraphItemList[i].needCount); } } // Status bar CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mJoinCompoudingQueue.GetString(), ItemProto.GetItemData(item_id).GetName())); //.... if (GameUI.Instance.mItemPackageCtrl != null) { GameUI.Instance.mItemPackageCtrl.ResetItem(); } } } else { UIGraphControl graph_ctrl = FactoryReplicator.m_MiddleContent.graphCtrl; if (!graph_ctrl.isCanCreate()) { return; } int skill_id = graph_ctrl.rootNode.ms.id; //lz-2016.09.26 多人的接口需要的是productCount int productCount = graph_ctrl.rootNode.getCount / graph_ctrl.rootNode.ms.m_productItemCount; //to do--skillid,num if (m_Factory.Data.m_CompoudItems.Count >= CSFactory.c_CompoudItemCount) { return; } //lz-2016.09.26 多人的接口需要的是productCount m_Factory._ColonyObj._Network.FCT_Compoud(skill_id, productCount); } }
void OnSelectionChange(string item) { if (null == m_RefNpc || null == m_RefNpc.NPC) { return; } //lz-2016.09.14 npc死亡之后不可以切换职业 if (m_RefNpc.NPC.aliveEntity.isDead) { CSUI_StatusBar.ShowText(UIMsgBoxInfo.mNpdDeadNotChangeProfession.GetString(), Color.red, 5.5f); m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); return; } HideAllProfessionalSpr(); if (item == CSUtils.GetOccupaName(CSConst.potDweller)) { if (m_RefNpc.TrySetOccupation(CSConst.potDweller)) { m_DwellerIconUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForDweller.GetString(), m_RefNpc.FullName), 5.5f); } } else { //lz-2016.10.26 不能去直接设置m_OccupationUI.textLabel.text的值,那样m_OccupationUI.selection没有被改变,影响UIPoupList的正常功能 m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } else if (item == CSUtils.GetOccupaName(CSConst.potWorker)) { if (m_RefNpc.TrySetOccupation(CSConst.potWorker)) { m_WorkerIconUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForWorker.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } else if (item == CSUtils.GetOccupaName(CSConst.potFarmer)) { if (CSMain.s_MgCreator.Farmers.Count >= CSFarm.MAX_WORKER_COUNT) { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(ColonyMessage.OCCUPATION_NPC_TOO_MANY), m_RefNpc.FullName), 5.5f); } return; } if (m_RefNpc != null) { if (m_RefNpc.TrySetOccupation(CSConst.potFarmer)) { m_FarmerIconUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForFarmer.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } } else if (item == CSUtils.GetOccupaName(CSConst.potSoldier)) { if (m_RefNpc != null) { if (m_RefNpc.TrySetOccupation(CSConst.potSoldier)) { m_SoldierIconUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForSolider.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } } else if (item == CSUtils.GetOccupaName(CSConst.potFollower)) { if (m_RefNpc != null) { if (m_RefNpc.TrySetOccupation(CSConst.potFollower)) { m_FollowerIcomUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForFollower.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } } else if (item == CSUtils.GetOccupaName(CSConst.potProcessor)) { if (CSMain.s_MgCreator.Processors.Count >= ProcessingConst.WORKER_AMOUNT_MAX) { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(ColonyMessage.OCCUPATION_NPC_TOO_MANY), m_RefNpc.FullName), 5.5f); } return; } if (m_RefNpc != null) { if (m_RefNpc.TrySetOccupation(CSConst.potProcessor)) { m_ProcessorIcomUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForProcessor.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } } else if (item == CSUtils.GetOccupaName(CSConst.potDoctor)) { if (m_RefNpc != null) { if (m_RefNpc.TrySetOccupation(CSConst.potDoctor)) { m_DoctorIconUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForDoctor.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } } else if (item == CSUtils.GetOccupaName(CSConst.potTrainer)) { if (m_RefNpc != null) { if (m_RefNpc.TrySetOccupation(CSConst.potTrainer)) { m_InstructorIconUI.enabled = true; if (onSelectChange != null) { onSelectChange(item); } if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionForInstructor.GetString(), m_RefNpc.FullName), 5.5f); } } else { m_OccupationUI.selection = CSUtils.GetOccupaName(m_RefNpc.m_Occupation); if (ShowStatusTips) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mProfessionFailed.GetString(), m_RefNpc.FullName), 5.5f); } } } } if (GameConfig.IsMultiMode) { //--to do: wait //if(m_RefNpc.m_Npc.Netlayer is AiAdNpcNetwork) // ((AiAdNpcNetwork)m_RefNpc.m_Npc.Netlayer).SetClnOccupation(m_RefNpc.m_Occupation); } }
/// <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); }
void OnUpgradeBtn() { if (PeCreature.Instance.mainPlayer == null) { return; } ItemPackage accessor = PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>().package._playerPak; //check start bool canUpgrade = true; bool bEnough = true; foreach (CSUI_MaterialGrid mg in m_MatGrids) { if (mg.ItemID != 0) { mg.ItemNum = playerPackageCmpt.package.GetCount(mg.ItemID); if (mg.ItemNum < mg.NeedCnt) { bEnough = false; new PeTipMsg(PELocalization.GetString(821000001), PeTipMsg.EMsgLevel.Warning); break; } } } if (bEnough && !m_Assembly.isUpgrading && !m_Assembly.isDeleting) { canUpgrade = true; } else { canUpgrade = false; } if (m_Assembly.Level == m_Assembly.GetMaxLevel()) { canUpgrade = false; } if (!canUpgrade) { return; } //check end if (!GameConfig.IsMultiMode) { foreach (CSUI_MaterialGrid mg in m_MatGrids) { if (mg.ItemID > 0) { accessor.Destroy(mg.ItemID, mg.NeedCnt); //package.DeleteItemWithItemID(mg.ItemID, mg.NeedCnt); CSUI_MainWndCtrl.CreatePopupHint(mg.transform.position, this.transform, new Vector3(10, -2, -5), " - " + mg.NeedCnt.ToString(), false); } } m_Assembly.StartUpgradeCounter(); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToUpgrade.GetString(), m_Entity.Name)); } else { m_Assembly._ColonyObj._Network.ASB_LevelUp(); } }
void StartToWork() { if (!GameConfig.IsMultiMode) { //lw:2017.4.6 crash PeCreature.Instance.mainPlayer可能为null if (PeCreature.Instance != null && PeCreature.Instance.mainPlayer != null) { PlayerPackageCmpt pkg = PeCreature.Instance.mainPlayer.packageCmpt as PlayerPackageCmpt; if (pkg != null) { ItemPackage accessor = pkg.package._playerPak; if (m_CurType == CSConst.etEnhance) { //lw:2017.4.6 crash if (m_Enhance != null && m_Enhance.m_Item != null && m_Enhance.m_Item.protoData != null) { // take out material from player foreach (CSUI_MaterialGrid matGrid in m_MatList) { accessor.Destroy(matGrid.ItemID, matGrid.NeedCnt); } m_Enhance.StartCounter(); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToEnhance.GetString(), m_Enhance.m_Item.protoData.GetName())); // Popoup hints foreach (CSUI_MaterialGrid mg in m_MatList) { Vector3 pos = mg.transform.position; CSUI_MainWndCtrl.CreatePopupHint(pos, transform, new Vector3(10, -2, -8), " - " + mg.NeedCnt, false); } } } else if (m_CurType == CSConst.etRepair) { if (null != m_Repair && m_Repair.m_Item != null && m_Repair.m_Item.protoData != null) { // take out material from player foreach (CSUI_MaterialGrid matGrid in m_MatList) { accessor.Destroy(matGrid.ItemID, matGrid.NeedCnt); } m_Repair.StartCounter(); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRepair.GetString(), m_Repair.m_Item.protoData.GetName())); } } else if (m_CurType == CSConst.etRecyle) { if (m_Recycle != null && m_Recycle.m_Item != null && m_Recycle.m_Item.protoData != null) { m_Recycle.StartCounter(); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToRecycle.GetString(), m_Recycle.m_Item.protoData.GetName())); } } } } } else { //multimode if (m_CurType == CSConst.etEnhance) { m_Enhance._ColonyObj._Network.EHN_Start(); } else if (m_CurType == CSConst.etRepair) { m_Repair._ColonyObj._Network.RPA_Start(); } else if (m_CurType == CSConst.etRecyle) { m_Recycle._ColonyObj._Network.RCY_Start(); } } }
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(); }
void OnDropItem(Grid_N grid) { //lz-2016.10.25 因为多人暂时只支持从背包中拖到充电中,所以统一多人和单人,避免出现显示问题 if (SelectItem_N.Instance.Place != ItemPlaceType.IPT_Bag) { return; } if (onItemCheck != null && !onItemCheck(grid.ItemObj)) { return; } if (grid.Item == null) { switch (SelectItem_N.Instance.Place) { case ItemPlaceType.IPT_HotKeyBar: SelectItem_N.Instance.SetItem(null); break; default: if (SetItem(SelectItem_N.Instance.ItemObj)) { if (GameConfig.IsMultiMode) { if (OnDropItemMulti != null) { OnDropItemMulti(m_Index, grid); } } SelectItem_N.Instance.RemoveOriginItem(); SelectItem_N.Instance.SetItem(null); if (!m_bUseMsgBox) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToCharge.GetString(), grid.Item.protoData.GetName())); } // CSUI_Main.ShowStatusBar("Start to charge the " + grid.Item.mItemData.m_Englishname + "."); } else { if (!m_bUseMsgBox) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotToBeCharged.GetString(), SelectItem_N.Instance.ItemObj.protoData.GetName()), Color.red); } // CSUI_Main.ShowStatusBar("The " + SelectItem_N.Instance.ItemObj.mItemData.m_Englishname + " is not need to be charged.", Color.red); } break; } } else { ItemObject io = grid.ItemObj; Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); if (pkg.package.CanAdd(io) && SetItem(SelectItem_N.Instance.ItemObj)) { pkg.package.AddItem(io); SelectItem_N.Instance.RemoveOriginItem(); SelectItem_N.Instance.SetItem(null); if (!m_bUseMsgBox) { if (grid.Item != null) { CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mStartToCharge.GetString(), grid.Item.protoData.GetName())); } } // CSUI_Main.ShowStatusBar("Start to charge the " + grid.Item.mItemData.m_Englishname + "."); } else { if (!m_bUseMsgBox) { // CSUI_Main.ShowStatusBar("The " + SelectItem_N.Instance.ItemObj.mItemData.m_Englishname + " is not need to be charged.", Color.red); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotToBeCharged.GetString(), SelectItem_N.Instance.ItemObj.protoData.GetName()), Color.red); } } } }
// --------------------------------- // Callback // --------------------------------- void OnCompoudClick(CSUI_CompoundItem ci) { if (!GameConfig.IsMultiMode) { int index = m_CompoudItems.FindIndex(item0 => item0 == ci); if (index != -1) { if (!CSUI_MainWndCtrl.IsWorking()) { return; } if (m_Factory.CompoudItemsCount <= index) { return; } Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); if (pkg == null) { Debug.LogError("CSUI_Factory.OnCompoundClick: pkg is null!"); return; } CompoudItem ci_data = null; ItemProto item_data; if (!m_Factory.GetTakeAwayCompoundItem(index, out ci_data)) { if (ci_data != null) { item_data = ItemProto.GetItemData(ci_data.itemID); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mIsCompounding.GetString(), item_data.GetName()), Color.red); } return; } item_data = ItemProto.GetItemData(ci_data.itemID); int pacakgeEmptyCount = pkg.package.GetSlotList(ci_data.itemID).vacancyCount; if (!pkg.package.CanAdd(m_Factory.Data.m_CompoudItems[index].itemID, ci.Count)) { // Status bar //lz-2016.07.16 背包空间不足这条提示是基地复制器和玩家复制器通用的,在基地用的时候,基地的提示只能显示一行,不能换行 string tip = PELocalization.GetString(8000050).Replace("\\n", " "); CSUI_MainWndCtrl.ShowStatusBar(tip, Color.red); if (item_data.maxStackNum > 1 || pacakgeEmptyCount == 0) { return; } } int originalCount = ci_data.itemCnt; int addCount = originalCount; if (item_data.maxStackNum > 1) { pkg.Add(ci_data.itemID, ci_data.itemCnt); } else { if (originalCount > pacakgeEmptyCount) { addCount = pacakgeEmptyCount; } pkg.Add(ci_data.itemID, addCount); } ci_data.itemCnt = originalCount - addCount; if (ci_data.itemCnt == 0) { m_Factory.TakeAwayCompoudItem(index); CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mTakeAwayCompoundItem.GetString(), item_data.GetName())); } } } else { int index = m_CompoudItems.FindIndex(item0 => item0 == ci); if (index != -1) { if (m_Factory.CompoudItemsCount <= index || m_Factory.Data.m_CompoudItems[index] == null || m_Factory.Data.m_CompoudItems[index].curTime < m_Factory.Data.m_CompoudItems[index].time) { return; } m_Factory._ColonyObj._Network.FCT_Fetch(index); } } }