// 自动吃药
        public bool AutoPercent(int nType)
        {
            bool bSucceed = false;

            if (nType != (int)MedicSubClass.HP && nType != (int)MedicSubClass.MP)
            {
                return(false);
            }
            GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
            GameItem          eItem    = null;
            int nType2 = nType;

            if (nType == (int)MedicSubClass.HP)
            {
                eItem  = BackPack.GetItemByGuid(HpDrugGUID);
                nType2 = (int)MedicSubClass.HP_DY;
            }
            else if (nType == (int)MedicSubClass.MP)
            {
                eItem  = BackPack.GetItemByGuid(MpDrugGUID);
                nType2 = (int)MedicSubClass.MP_DY;
            }

            if (eItem != null && eItem.IsValid())
            {
                Tab_CommonItem line = TableManager.GetCommonItemByID(eItem.DataID, 0);
                if (null != line)
                {
                    if (line.ClassID == (int)ItemClass.MEDIC &&
                        (line.SubClassID == nType || line.SubClassID == nType2) &&
                        (AutoHpID == line.Id || AutoMpID == line.Id))
                    {
                        bSucceed = true;
                        AutoUseDrug(eItem);
                    }
                }
            }
            if (bSucceed == false)
            {
                for (int index = 0; index < BackPack.ContainerSize; ++index)
                {
                    GameItem eItemEx = BackPack.GetItem(index);
                    if (eItemEx != null && eItemEx.IsValid())
                    {
                        Tab_CommonItem line = TableManager.GetCommonItemByID(eItemEx.DataID, 0);
                        if (null != line)
                        {
                            if (line.ClassID == (int)ItemClass.MEDIC &&
                                (line.SubClassID == nType || line.SubClassID == nType2) &&
                                (AutoHpID == line.Id || AutoMpID == line.Id))
                            {
                                bSucceed = true;
                                if (AutoUseDrug(eItemEx))
                                {
                                    //BackPackItemLogic.Instance().UseItem(eItemEx);
                                    if (nType == (int)MedicSubClass.HP)
                                    {
                                        HpDrugGUID = eItemEx.Guid;
                                    }
                                    else
                                    {
                                        MpDrugGUID = eItemEx.Guid;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(bSucceed);
        }
        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;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }