Ejemplo n.º 1
0
    public void OnOpItemClickEx(AutoitemLogicEx item)
    {
        GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;

        if (Singleton <ObjManager> .Instance.MainPlayer)
        {
            if (m_nType == 1)
            {
                Singleton <ObjManager> .Instance.MainPlayer.AutoHpID         = item.m_nId;
                Singleton <ObjManager> .Instance.MainPlayer.HpDrugGUID       = BackPack.GetItemGuidByDataID(item.m_nId);
                Singleton <ObjManager> .Instance.MainPlayer.AutoIsSelectDrug = true;
            }
            else if (m_nType == 2)
            {
                Singleton <ObjManager> .Instance.MainPlayer.AutoMpID         = item.m_nId;
                Singleton <ObjManager> .Instance.MainPlayer.MpDrugGUID       = BackPack.GetItemGuidByDataID(item.m_nId);
                Singleton <ObjManager> .Instance.MainPlayer.AutoIsSelectDrug = true;
            }
            else if (m_nType == 3)
            {
                Singleton <ObjManager> .Instance.MainPlayer.AutoEquipGuid = item.m_ItemGuid;
            }
        }

        if (null != m_parent)
        {
            m_parent.UpdateDrug();
        }

        UIManager.CloseUI(UIInfo.AutoDrug);
    }
Ejemplo n.º 2
0
    public void OnClickMedicneItem()
    {
        GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;

        if (Singleton <ObjManager> .Instance.MainPlayer)
        {
            if (AutoFightLogic.Instance())
            {
                AutoFightLogic.Instance().OnClickSelectItem(this);
            }

            if (m_Type == 1)
            {
                Singleton <ObjManager> .Instance.MainPlayer.AutoHpID         = m_nId;
                Singleton <ObjManager> .Instance.MainPlayer.HpDrugGUID       = BackPack.GetItemGuidByDataID(m_nId);
                Singleton <ObjManager> .Instance.MainPlayer.AutoIsSelectDrug = true;
            }
            else if (m_Type == 2)
            {
                Singleton <ObjManager> .Instance.MainPlayer.AutoMpID         = m_nId;
                Singleton <ObjManager> .Instance.MainPlayer.MpDrugGUID       = BackPack.GetItemGuidByDataID(m_nId);
                Singleton <ObjManager> .Instance.MainPlayer.AutoIsSelectDrug = true;
            }
            else if (m_Type == 3)
            {
                Singleton <ObjManager> .Instance.MainPlayer.AutoEquipGuid = m_ItemGuid;
                if (AutoFightLogic.Instance() != null)
                {
                    AutoFightLogic.Instance().UpdateDrug();
                }
            }
            _showChoose();
        }
    }
Ejemplo n.º 3
0
        public void UpdateSelectDrug()
        {
            GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
            GameItem          eItem    = BackPack.GetItemByGuid(HpDrugGUID);
            //if (AutoIsSelectDrug == false) 永远可以自动选择药
            {
                //做自动选药处理
                bool isFind = false;
                if (eItem == null || (eItem != null && eItem.IsValid() == false) || AutoIsSelectDrug == false)
                {
                    //优先选择选择过的药品类型
                    if (AutoIsSelectDrug == true)
                    {
                        if (AutoIsSelectDrug == true)
                        {
                            if (BackPack.GetItemCountByDataId(AutoHpID) > 0)
                            {
                                HpDrugGUID = BackPack.GetItemGuidByDataID(AutoHpID);
                                isFind     = true;
                            }
                        }
                    }
                    if (!isFind)
                    {
                        for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYHP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYHP; --i)
                        {
                            Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0);
                            if (commonItem != null)
                            {
                                if (BaseAttr.Level >= commonItem.MinLevelRequire)
                                {
                                    for (int index = 0; index < BackPack.ContainerSize; ++index)
                                    {
                                        GameItem eItemEx = BackPack.GetItem(index);
                                        if (eItemEx != null && eItemEx.DataID == i) //身上有这个药
                                        {
                                            AutoHpID   = i;
                                            HpDrugGUID = BackPack.GetItemGuidByDataID(AutoHpID);
                                            isFind     = true;
                                            break;
                                        }
                                    }
                                    if (isFind)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (!isFind)
                    {
                        for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_HP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_HP; --i)
                        {
                            Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0);
                            if (commonItem != null)
                            {
                                if (BaseAttr.Level >= commonItem.MinLevelRequire)
                                {
                                    for (int index = 0; index < BackPack.ContainerSize; ++index)
                                    {
                                        GameItem eItemEx = BackPack.GetItem(index);
                                        if (eItemEx != null && eItemEx.DataID == i) //身上有这个药
                                        {
                                            AutoHpID   = i;
                                            HpDrugGUID = BackPack.GetItemGuidByDataID(AutoHpID);
                                            isFind     = true;
                                            break;
                                        }
                                    }
                                    if (isFind)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                eItem = BackPack.GetItemByGuid(MpDrugGUID);
                if (eItem == null || (eItem != null && eItem.IsValid() == false) || AutoIsSelectDrug == false)
                {
                    isFind = false;
                    //优先选择选择过的药品类型
                    if (AutoIsSelectDrug == true)
                    {
                        if (BackPack.GetItemCountByDataId(AutoMpID) > 0)
                        {
                            MpDrugGUID = BackPack.GetItemGuidByDataID(AutoMpID);
                            isFind     = true;
                        }
                    }

                    if (!isFind)
                    {
                        for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYMP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYMP; --i)
                        {
                            Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0);
                            if (commonItem != null)
                            {
                                if (BaseAttr.Level >= commonItem.MinLevelRequire)
                                {
                                    for (int index = 0; index < BackPack.ContainerSize; ++index)
                                    {
                                        GameItem eItemEx = BackPack.GetItem(index);
                                        if (eItemEx != null && eItemEx.DataID == i) //身上有这个药
                                        {
                                            AutoMpID   = i;
                                            MpDrugGUID = BackPack.GetItemGuidByDataID(AutoMpID);
                                            isFind     = true;
                                            break;
                                        }
                                    }
                                    if (isFind)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (!isFind)
                    {
                        for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_MP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_MP; --i)
                        {
                            Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0);
                            if (commonItem != null)
                            {
                                if (BaseAttr.Level >= commonItem.MinLevelRequire)
                                {
                                    for (int index = 0; index < BackPack.ContainerSize; ++index)
                                    {
                                        GameItem eItemEx = BackPack.GetItem(index);
                                        if (eItemEx != null && eItemEx.DataID == i) //身上有这个药
                                        {
                                            AutoMpID   = i;
                                            MpDrugGUID = BackPack.GetItemGuidByDataID(AutoMpID);
                                            isFind     = true;
                                            break;
                                        }
                                    }
                                    if (isFind)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }