コード例 #1
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));
 }
コード例 #2
0
 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));
 }
コード例 #3
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()));
        }
    }
コード例 #4
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();
        }
    }
コード例 #5
0
    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();
        }
    }
コード例 #6
0
    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();
            }
        }
    }
コード例 #7
0
    public void UpdatePopupHintInfo(CSEntity entiy)
    {
        if (entiy == null)
        {
            return;
        }


        int type = entiy.m_Type;

        if (type == CSConst.etEnhance)
        {
            //            CSEnhance cse = entiy as CSEnhance;
            if (null == m_enhanceItem)
            {
                return;
            }

            float curValue  = 0.0f;
            float nextValue = 0.0f;

            if (!m_PopupHints.ContainsKey(type))
            {
                m_PopupHints.Add(type, new List <CSUI_PopupHint>());
            }

            foreach (CSUI_PopupHint ph in m_PopupHints[type])
            {
                if (ph != null && ph.gameObject != null)
                {
                    Destroy(ph.gameObject);
                }
            }

            m_PopupHints[type].Clear();

            Vector3 pos = m_EnhanceProperty.m_Durability.transform.position;
            //item.GetLevelUpValue(ItemProperty.DurabilityMax, out curValue, out nextValue);
            curValue  = m_enhanceItem.GetCurMaxDurability();
            nextValue = m_enhanceItem.GetNextMaxDurability();
            string         str   = " + " + Mathf.FloorToInt(nextValue - curValue).ToString();
            CSUI_PopupHint phTmp = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_EnhanceHintGo.transform, new Vector3(10, -2, -6), str, true);
            m_PopupHints[type].Add(phTmp);

            pos = m_EnhanceProperty.m_Atk.transform.position;
            //item.GetLevelUpValue(ItemProperty.Atk, out curValue, out nextValue);
            curValue  = m_enhanceItem.GetCurLevelProperty(Pathea.AttribType.Atk);
            nextValue = m_enhanceItem.GetNextLevelProperty(Pathea.AttribType.Atk);
            str       = " + " + Mathf.FloorToInt(nextValue - curValue).ToString();
            phTmp     = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_EnhanceHintGo.transform, new Vector3(10, -2, -6), str, true);
            m_PopupHints[type].Add(phTmp);

            pos = m_EnhanceProperty.m_Defense.transform.position;
            //item.GetLevelUpValue(ItemProperty.Def, out curValue, out nextValue);
            curValue  = m_enhanceItem.GetCurLevelProperty(Pathea.AttribType.Def);
            nextValue = m_enhanceItem.GetNextLevelProperty(Pathea.AttribType.Def);
            str       = " + " + Mathf.FloorToInt(nextValue - curValue).ToString();
            phTmp     = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_EnhanceHintGo.transform, new Vector3(10, -2, -6), str, true);
            m_PopupHints[type].Add(phTmp);
        }
        else if (type == CSConst.etRepair)
        {
            CSRepair repair = entiy as CSRepair;

            if (!m_PopupHints.ContainsKey(type))
            {
                m_PopupHints.Add(type, new List <CSUI_PopupHint>());
            }

            foreach (CSUI_PopupHint ph in m_PopupHints[type])
            {
                if (ph != null && ph.gameObject != null)
                {
                    Destroy(ph.gameObject);
                }
            }

            m_PopupHints[type].Clear();

            Vector3        pos   = m_EnhanceProperty.m_Durability.transform.position;
            float          val   = repair.GetIncreasingDura();
            string         str   = " + " + Mathf.FloorToInt(val).ToString();
            CSUI_PopupHint phTmp = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_RepairHintGo.transform, new Vector3(10, -2, 0), str, true);
            m_PopupHints[type].Add(phTmp);
        }
        else if (type == CSConst.etRecyle)
        {
        }
    }