public static bool IsWorking(bool bShowMsg = true)
    {
        if (m_Instance == null)
        {
            return(false);
        }

        if (m_Instance.m_WorkMode == EWorkType.Working)
        {
            return(true);
        }

        if (m_Instance.m_WorkMode == EWorkType.OutOfDistance)
        {
            if (bShowMsg)
            {
                //				ShowStatusBar("You need to use this item within the static field of a settlement!!", Color.red);
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mNeedStaticField.GetString(), Color.red);
            }
            return(false);
        }
        else if (m_Instance.m_WorkMode == EWorkType.NoAssembly)
        {
            if (bShowMsg)
            {
                //				ShowStatusBar("You need to place an assembly core to make it work!", Color.red);
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mNeedAssembly.GetString(), Color.red);
            }
            return(false);
        }
        else
        {
            return(false);
        }
    }
 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()));
     }
 }
    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 OnSelectionChange(string item)
 {
     if (item == CSUtils.GetWorkModeName(CSConst.pwtPatrol))
     {
         if (m_RefNpc != null)
         {
             m_RefNpc.m_WorkMode = CSConst.pwtPatrol;
             if (ShowStatusTips)
             {
                 CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mSoldierForPatrol.GetString(), 6f);
             }
         }
     }
     else if (item == CSUtils.GetWorkModeName(CSConst.pwtGuard))
     {
         if (m_RefNpc != null)
         {
             m_RefNpc.m_WorkMode = CSConst.pwtGuard;
             if (ShowStatusTips)
             {
                 CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mSoldierForGuard.GetString(), 6f);
             }
         }
     }
     m_PatrolInfoUI.gameObject.SetActive(true);
 }
    //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 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));
     }
 }
Exemple #7
0
    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));
        }
    }
 public void TryStartProcessing(object sender, int index)
 {
     if (!IsRunning)
     {
         return;
     }
     if (PeGameMgr.IsMulti)
     {
         _ColonyObj._Network.RPCServer(EPacketType.PT_CL_PRC_Start, index);
     }
     else
     {
         if (mTaskTable[index] == null)
         {
             return;
         }
         int errorCode;
         if (mTaskTable[index].CanStart(out errorCode))
         {
             StartProcessing(index);
         }
         else
         {
             if (errorCode > 0)
             {
                 CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(errorCode));
                 CSUI_MainWndCtrl.Instance.GoToPersonnelWorkWnd();
             }
         }
         UpdateSelectedTask();
     }
 }
 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));
 }
Exemple #10
0
    void OnSelectionChange(string item)
    {
        if (item == CSUtils.GetWorkModeName(CSConst.pwtNormalWork))
        {
            m_NormalModeUI.enabled   = true;
            m_WorkWhenNeedUI.enabled = false;
            m_WorkaholicUI.enabled   = false;

            if (m_RefNpc != null)
            {
                m_RefNpc.m_WorkMode = CSConst.pwtNormalWork;
            }

            if (ShowStatusTips)
            {
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mWorkerForNormal.GetString(), 6f);
            }
        }
        else if (item == CSUtils.GetWorkModeName(CSConst.pwtWorkWhenNeed))
        {
            m_NormalModeUI.enabled   = false;
            m_WorkWhenNeedUI.enabled = true;
            m_WorkaholicUI.enabled   = false;

            if (m_RefNpc != null)
            {
                m_RefNpc.m_WorkMode = CSConst.pwtWorkWhenNeed;
            }

            if (ShowStatusTips)
            {
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mWorkerForWorkWhenNeed.GetString(), 6f);
            }
        }
        else if (item == CSUtils.GetWorkModeName(CSConst.pwtWorkaholic))
        {
            m_NormalModeUI.enabled   = false;
            m_WorkWhenNeedUI.enabled = false;
            m_WorkaholicUI.enabled   = true;

            if (m_RefNpc != null)
            {
                m_RefNpc.m_WorkMode = CSConst.pwtWorkaholic;
            }

            if (ShowStatusTips)
            {
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mWorkerForWorkaholic.GetString(), 6f);
            }
        }

        if (onSelectChange != null)
        {
            onSelectChange(item);
        }
    }
Exemple #11
0
    void OnSelectionChange(string item)
    {
        if (item == CSUtils.GetWorkModeName(CSConst.pwtFarmForMag))
        {
            m_ManageUI.enabled  = true;
            m_HarvestUI.enabled = false;
            m_PlantUI.enabled   = false;

            if (m_RefNpc != null)
            {
                m_RefNpc.TrySetWorkMode(CSConst.pwtFarmForMag);
            }

            if (ShowStatusTips)
            {
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mFarmerForManage.GetString(), 6f);
            }
        }
        else if (item == CSUtils.GetWorkModeName(CSConst.pwtFarmForHarvest))
        {
            m_ManageUI.enabled  = false;
            m_HarvestUI.enabled = true;
            m_PlantUI.enabled   = false;

            if (m_RefNpc != null)
            {
                m_RefNpc.TrySetWorkMode(CSConst.pwtFarmForHarvest);
            }

            if (ShowStatusTips)
            {
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mFarmerForHarvest.GetString(), 6f);
            }
        }
        else if (item == CSUtils.GetWorkModeName(CSConst.pwtFarmForPlant))
        {
            m_ManageUI.enabled  = false;
            m_HarvestUI.enabled = true;
            m_PlantUI.enabled   = false;

            if (m_RefNpc != null)
            {
                m_RefNpc.TrySetWorkMode(CSConst.pwtFarmForPlant);
            }

            if (ShowStatusTips)
            {
                CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mFarmerForPlant.GetString(), 6f);
            }
        }

        if (onSelectChange != null)
        {
            onSelectChange(item);
        }
    }
Exemple #12
0
 public void SetSequentialActiveResult(bool active, CSEntity entity)
 {
     if (m_Entity == entity)
     {
         m_SequentialPlantingCB.isChecked = m_Farm.Data.m_SequentialPlanting;
         if (active)
         {
             CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mPlantSequence.GetString());
         }
     }
 }
    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()));
        }
    }
 void OnJionin(object sender, int index)
 {
     if (m_RefNpc != null)
     {
         m_RefNpc.TrySetProcessingIndex(index);
         //lz-2016.06.27 单击如果:npc工作正常并且这个进程没有材料,就提示需要加材料
         if (m_RefNpc.CanProcess && !CheckProcessHasMaterial(index))
         {
             CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(82209012));
         }
     }
 }
    void OnEquipRightMouseClicked(Grid_N grid)
    {
        if (m_RefNpc == null)
        {
            return;
        }

        if (null == grid.ItemObj)
        {
            return;
        }

        if (GameConfig.IsMultiMode)
        {
            if (NpcEquipment.TryTakeOffEquipment(grid.ItemObj))
            {
                PlayerNetwork.mainPlayer.RequestNpcTakeOffEquip(m_RefNpc.Id, grid.ItemObj.instanceId, -1);
                //lz-2016.08.31 脱下装备成功播放音效
                GameUI.Instance.PlayTakeOffEquipAudio();
            }
        }
        else
        {
            PlayerPackageCmpt playerPackageCmpt = PeCreature.Instance.mainPlayer == null ? null : Pathea.PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>();
            //lz-2016.07.19 这里应该用添加和移除同步检测和操作的接口
            if (NpcEquipment.TakeOffEquipment(grid.ItemObj, true, playerPackageCmpt))
            {
                GameUI.Instance.mItemPackageCtrl.Show();
                if (GameUI.Instance.mItemPackageCtrl != null)
                {
                    GameUI.Instance.mItemPackageCtrl.ResetItem();
                }
                //lz-2016.08.31 脱下装备成功播放音效
                GameUI.Instance.PlayTakeOffEquipAudio();
            }
            else
            {
                //lz-2016.07.19 玩家包裹可以添加,说明在取下装备的时候失败了
                if (null == playerPackageCmpt || playerPackageCmpt.package.CanAdd(grid.ItemObj))
                {
                    //lz-2016.07.19 提示NPC正在使用此装备
                    CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000594));
                }
                else
                {
                    //lz-2016.07.19  提示玩家背包已经满了
                    CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000050).Replace("\\n", " "));
                }
            }
        }
    }
Exemple #16
0
    // 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);
    }
Exemple #17
0
    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);
    }
Exemple #18
0
 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));
 }
Exemple #19
0
    bool OnGridCheckItem_ToolWeed(ItemObject item, CSUI_Grid.ECheckItemType check_type)
    {
        if (item == null)
        {
            return(true);
        }

        if (item.protoId == ProtoTypeId.INSECTICIDE)
        {
            return(true);
        }

        CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mOnlyCanPutInsecticider.GetString(), Color.red);
        return(false);
    }
Exemple #20
0
    public void OnRightMouseCliked_Equip(Grid_N grid)
    {
        if (null == equipmentCmpt)
        {
            return;
        }

        if (grid.ItemObj == null)
        {
            return;
        }

        if (PeGameMgr.IsMulti)
        {
            //lz-2016.10.31 错误 #5316 先尝试脱装备,可以脱的时候再脱,避免复制装备
            if (equipmentCmpt.TryTakeOffEquipment(grid.ItemObj))
            {
                PlayerNetwork.mainPlayer.RequestNpcTakeOffEquip(servant.Id, grid.ItemObj.instanceId, -1);
                //lz-2016.08.31 脱下装备成功播放音效
                GameUI.Instance.PlayTakeOffEquipAudio();
            }
        }
        else
        {
            PlayerPackageCmpt playerPackageCmpt = PeCreature.Instance.mainPlayer == null ? null : Pathea.PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>();
            if (equipmentCmpt.TakeOffEquipment(grid.ItemObj, true, playerPackageCmpt))
            {
                GameUI.Instance.mItemPackageCtrl.ResetItem();
                //lz-2016.08.30 脱下装备成功播放音效
                GameUI.Instance.PlayTakeOffEquipAudio();
            }
            else
            {
                //lz-2016.07.19 玩家包裹可以添加,说明在取下装备的时候失败了
                if (null == playerPackageCmpt || playerPackageCmpt.package.CanAdd(grid.ItemObj))
                {
                    //lz-2016.07.19 提示NPC正在使用此装备
                    MessageBox_N.ShowOkBox(PELocalization.GetString(8000594));
                }
                else
                {
                    //lz-2016.07.19  提示玩家背包已经满了
                    CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000050));
                }
            }
        }
    }
 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));
 }
Exemple #22
0
 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);
             }
         }
     }
 }
Exemple #23
0
    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()));
        }
    }
Exemple #24
0
    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();
        }
    }
Exemple #25
0
 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 bool IsChargeable(ItemObject itemObj)
    {
        if (null == itemObj)
        {
            return(false);
        }

        ItemAsset.Energy energy = itemObj.GetCmpt <ItemAsset.Energy>();

        if (null == energy || itemObj.protoData.unchargeable)
        {
            if (m_bUseMsgBox)
            {
                //lz-2016.10.24 把对话框的提示改成左上角提示
                PeTipMsg.Register(PELocalization.GetString(8000094), PeTipMsg.EMsgLevel.Error);
            }
            else
            {
                CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000094), Color.red);
            }
            return(false);
        }

        if ((!(energy is ItemAsset.EnergySmall)) && !m_bCanChargeLargedItem)
        {
            if (m_bUseMsgBox)
            {
                //lz-2016.10.24 把对话框的提示改成左上角提示
                PeTipMsg.Register(PELocalization.GetString(8000095), PeTipMsg.EMsgLevel.Warning);
            }
            else
            {
                CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000095), Color.red);
            }
            return(false);
        }

        return(true);
    }
Exemple #27
0
 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));
         }
     }
 }
Exemple #28
0
    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);
    }
Exemple #29
0
    void OnRightMouseClicked(Grid_N grid)
    {
        if (grid.Item == null)
        {
            return;
        }

        if (onCheckItem != null && !onCheckItem(null, ECheckItemType.RightMounseClick))
        {
            return;
        }

        if (GameConfig.IsMultiMode)
        {
            OnRightMouseClickedMulti(grid, m_Index);
            return;
        }

        ItemObject oldItem = grid.ItemObj;

        Pathea.PlayerPackageCmpt package = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>();

        if (package.package.CanAdd(grid.ItemObj))
        {
            package.Add(grid.ItemObj);
            GameUI.Instance.mItemPackageCtrl.ResetItem();
            grid.SetItem(null);

            if (OnItemChanged != null)
            {
                OnItemChanged(null, oldItem, m_Index);
            }
        }
        else
        {
            CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mNotEnoughGrid.GetString(), Color.red);
        }
    }
    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);
    }