Example #1
0
    /// <summary>
    /// 设置宠物技能
    /// </summary>
    void SetPetSkill()
    {
        LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>();

        gameObject.SetActive(data.bShowPetSkill);

        PetDataManager petData = DataManager.Manager <PetDataManager>();

        if (petData != null)
        {
            IPet pet = petData.GetPetByThisID(petData.CurFightingPet);
            if (pet != null)
            {
                List <PetSkillObj> list = pet.GetPetSkillList();
                if (list.Count == 0)
                {
                    skillIcon.mainTexture = null;
                    SetLongPressEvent(false);
                    ShowAdd(true);
                    return;
                }


                for (int i = 0; i < list.Count; i++)
                {
                    var           skill   = list[i];
                    uint          skillID = (uint)skill.id;
                    SkillDatabase db      = GameTableManager.Instance.GetTableItem <SkillDatabase>(skillID, skill.lv);
                    if (db != null)
                    {
                        if (db.petType == (int)PetSkillType.Initiative)
                        {
                            m_skillid = skillID;
                            UIManager.GetTextureAsyn(DataManager.Manager <UIManager>().GetResIDByFileName(false, db.iconPath, true), ref iuiIconAtlas, () =>
                            {
                                if (null != skillIcon)
                                {
                                    skillIcon.mainTexture = null;
                                }
                            }, skillIcon, false);
                            ShowAdd(false);
                            SetLongPressEvent(true);
                            break;
                        }
                        else
                        {
                            SetLongPressEvent(false);
                            ShowAdd(true);
                            skillIcon.mainTexture = null;
                        }
                    }
                }
            }
        }
        if (data.bShowPetSkill)
        {
            RunCD();
        }
    }
Example #2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="baseID">等于0时为第一次初始化</param>
    /// <returns></returns>
    int GetPetResID(int baseID = 0)
    {
        int resID = 0;
        List <SuitDataBase> petList = GetPetSuitData();
        SuitDataBase        petData = null;

        if (baseID == 0)
        {
            if (petList.Count == 0)
            {
                return(resID);
            }

            petData = petList[0];
            PetDataManager pm = DataManager.Manager <PetDataManager>();
            if (pm != null)
            {
                if (pm.CurFightingPet != 0)
                {
                    IPet pet = pm.GetPetByThisID(pm.CurFightingPet);
                    if (pet != null)
                    {
                        uint        petBaseID = pet.PetBaseID;
                        PetDataBase db        = GameTableManager.Instance.GetTableItem <PetDataBase>(petBaseID);
                        if (db != null)
                        {
                            resID = (int)db.modelID;
                        }
                    }
                }
                else
                {
                    resID = (int)petData.resid;
                }
            }
        }
        else
        {
            for (int i = 0; i < petList.Count; i++)
            {
                if (baseID == petList[i].base_id)
                {
                    petData = petList[i];
                    break;
                }
            }
            if (petData == null)
            {
                return(resID);
            }

            resID = (int)petData.resid;
        }
        return(resID);
    }