Example #1
0
 public PetData(pet_base_info pet_info)
 {
     configId = (int)pet_info.id;
     //serverInstanceID = (int)pet_info.id;
     type             = (int)pet_info.type;
     status           = (int)pet_info.status;
     fight_score      = (int)pet_info.fight_score;
     aptitude         = (int)pet_info.aptitude;
     grow_up          = (int)pet_info.grow_up;
     lev              = (int)pet_info.lev;
     pet_name         = pet_info.pet_name;
     all_property     = pet_info.all_property;
     grow_up_property = pet_info.grow_up_property;
     jinghun_property = pet_info.jinghun_property;
     tian_soul        = (int)pet_info.tian_soul;
     di_soul          = (int)pet_info.di_soul;
     life_soul        = (int)pet_info.life_soul;
     pet_skill        = pet_info.pet_skill;
     for (int i = 0, max = pet_info.pet_skill.Count; i < max; i++)
     {
         NewPetSkillRef skill = ConfigMng.Instance.GetPetSkillRef((int)pet_info.pet_skill[i]);
         if (skill != null && skill.skillId > 0)
         {
             petSkill.Add(skill.skillId);
         }
     }
     grow_up_exp     = (int)pet_info.grow_up_exp;
     aptitude_exp    = (int)pet_info.aptitude_exp;
     hasChange       = true;
     ownerInstanceID = GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID;
     ownerName       = GameCenter.mainPlayerMng.MainPlayerInfo.Name;
 }
Example #2
0
 void CreateBook(int _index, NewPetSkillRef _skillRef)
 {
     if (_skillRef != null)
     {
         int id = _skillRef.id;
         if (!allSkill.ContainsKey(id))
         {
             SingleSkill item = SingleSkill.CeateNew(_index, id, parent);
             item.SkillRef = _skillRef;
             item.gameObject.SetActive(true);
             allSkill[id] = item;
             UIEventListener.Get(item.gameObject).onClick  -= OnClickDesBtn;
             UIEventListener.Get(item.gameObject).onClick  += OnClickDesBtn;
             UIEventListener.Get(item.gameObject).parameter = id;
         }
         else
         {
             SingleSkill skill = allSkill[id] as SingleSkill;
             skill.SkillRef = _skillRef;
             skill.gameObject.SetActive(true);
             UIEventListener.Get(skill.gameObject).onClick  -= OnClickDesBtn;
             UIEventListener.Get(skill.gameObject).onClick  += OnClickDesBtn;
             UIEventListener.Get(skill.gameObject).parameter = id;
         }
     }
 }
Example #3
0
    /// <summary>
    /// 点击技能弹出技能描述框
    /// </summary>
    void OnClickSkill(GameObject go)
    {
        NewPetSkillRef skillRef = (NewPetSkillRef)UIEventListener.Get(go).parameter;

        skillDesUi.SkillRef = skillRef;
        skillDesUi.fengYinBtn.gameObject.SetActive(true);
        skillDesUi.yiWangBtn.gameObject.SetActive(true);
        skillDesUi.gameObject.SetActive(true);
    }
Example #4
0
    /// <summary>
    /// 创造被动技能
    /// </summary>
    public static SingleLearnedSkill CeateBDSkill(int _index, int _id, GameObject gameParent)
    {
        NewPetSkillRef petSkillRef = ConfigMng.Instance.GetPetSkillRef(_id);

        if (petSkillRef != null)
        {
            if (petSkillRef.beidong == 2 || petSkillRef.beidong == 3 || petSkillRef.beidong == 4)
            {
                return(CeateNew(_index, _id, gameParent));
            }
        }
        return(null);
    }
Example #5
0
 bool IsStudySameSkill(int _kind)
 {
     if (curInfo == null)
     {
         return(false);
     }
     for (int i = 0, max = curInfo.SkillList.Count; i < max; i++)
     {
         NewPetSkillRef SkillRef = ConfigMng.Instance.GetPetSkillRef((int)curInfo.SkillList[i]);
         if (SkillRef.kind == _kind)//已经拥有这种类型的技能
         {
             return(true);
         }
     }
     return(false);
 }
Example #6
0
    /// <summary>
    /// 点击下方技能书学习技能
    /// </summary>
    void OnClickStudySkill(GameObject go)
    {
        if (GameCenter.mercenaryMng.curPetId == MercenaryMng.noPet || GameCenter.mercenaryMng.mercenaryInfoList.Count <= 0)
        {
            return;
        }
        int            skillId  = (int)UIEventListener.Get(go.GetComponent <UIButton>().gameObject).parameter;
        NewPetSkillRef skillref = ConfigMng.Instance.GetPetSkillRef(skillId);

        if (skillref != null)
        {
            MessageST mst = new MessageST();
            mst.messID = 164;
            mst.words  = new string[2] {
                skillref.name, skillref.res
            };
            mst.delYes = delegate
            {
                bool islenred             = IsStudySameSkill(skillref.kind, skillref.quality);
                bool isLearedHighterSkill = IsStudyHighSkill(skillref.kind, skillref.quality);
                //Debug.Log("islenred :  " + islenred + "  , isLearedHighterSkill : " + isLearedHighterSkill + "  , emptyNest : " + GameCenter.mercenaryMng.emptyNest);
                if (!IsStudySameSkill(skillref.kind) && GameCenter.mercenaryMng.emptyNest <= 0)//若宠物技能栏已满,则弹出上浮提示147
                {
                    GameCenter.messageMng.AddClientMsg(152);
                    return;
                }
                if (islenred)//若已经学了同类别的技能,则弹出另外的上浮提示148
                {
                    GameCenter.messageMng.AddClientMsg(153);
                }
                else if (!isLearedHighterSkill && skillref.quality > 2)
                {
                    GameCenter.messageMng.AddClientMsg(541);
                }
                else
                {
                    GameCenter.mercenaryMng.C2S_ReqPromote(PetChange.STUDYSKILL, GameCenter.mercenaryMng.curPetId, skillId);
                }
            };
            GameCenter.messageMng.AddClientMsg(mst);
        }
    }
Example #7
0
 /// <summary>
 /// 学习中级以上的技能时,必须要先学会低一级的技能
 /// </summary>
 bool IsStudyHighSkill(int _kind, int _quality)
 {
     //if (_quality <= 3) return true;
     if (curInfo == null)
     {
         return(false);
     }
     if (curInfo.SkillList.Count <= 0)
     {
         return(false);
     }
     for (int i = 0, max = curInfo.SkillList.Count; i < max; i++)
     {
         NewPetSkillRef SkillRef = ConfigMng.Instance.GetPetSkillRef((int)curInfo.SkillList[i]);
         if (SkillRef.kind == _kind && SkillRef.quality == _quality - 1)
         {
             return(true);
         }
     }
     return(false);
 }
Example #8
0
    /// <summary>
    /// 一键放入
    /// </summary>
    void OnClickPutInBagBtn(GameObject go)
    {
        ItemUI choodeitem = composeBookBtn.GetComponent <ItemUI>();

        if (choodeitem != null && choodeitem.EQInfo != null && choosedBookInMat.Count < needBookNum) //选择了要合成的技能书了才可点击
        {
            foreach (int bookId in bookInBag.Keys)
            {
                EquipmentRef   info         = ConfigMng.Instance.GetEquipmentRef(bookId);
                NewPetSkillRef petskill     = ConfigMng.Instance.GetPetSkillRefByBook(bookId);        //合成材料
                NewPetSkillRef composeskill = ConfigMng.Instance.GetPetSkillRefByBook(composeBookId); //要合成的书
                int            num          = 0;
                for (int j = 0; j < choosedBookInMat.Count; j++)
                {
                    if (bookId == choosedBookInMat[j])
                    {
                        ++num;
                    }
                }
                int val = GameCenter.inventoryMng.GetNumberByType(bookId) - num;
                if (info != null && petskill != null)
                {
                    if (petskill.kind != composeskill.kind && info.psetSkillLevel >= needLev) //不同类别、且材料等级要高
                    {
                        while (val > 0 && choosedBookInMat.Count < needBookNum)               //判断满足条件的书数量,满足添加到材料链表
                        {
                            choosedBookInMat.Add(bookId);
                            --val;
                        }
                        if (val <= 0) //如果书都添加到材料链表就从背包移出该书
                        {
                            choosedPetSkill.Remove(bookId);
                        }
                    }
                }
            }
            ShowBookInMat();
            ShowBookInBag();
        }
    }
Example #9
0
 private List <uint> CompareByQuality(List <uint> _pet_skill)
 {
     if (_pet_skill.Count > 0)
     {
         for (int j = 0, max = _pet_skill.Count; j < max; j++)
         {
             for (int i = 0; i < max - j - 1; i++)
             {
                 NewPetSkillRef skill1 = ConfigMng.Instance.GetPetSkillRef((int)_pet_skill[i]);
                 NewPetSkillRef skill2 = ConfigMng.Instance.GetPetSkillRef((int)_pet_skill[i + 1]);
                 if (skill1 != null && skill2 != null)
                 {
                     if (skill1.quality < skill2.quality)
                     {
                         exchange          = _pet_skill[i];
                         _pet_skill[i]     = _pet_skill[i + 1];
                         _pet_skill[i + 1] = exchange;
                     }
                 }
             }
         }
     }
     return(_pet_skill);
 }
Example #10
0
    /// <summary>
    /// 显示所有被动技能
    /// </summary>
    void ShowSkill()
    {
        skillProperty = 0;
        List <NewPetSkillRef> list = new List <NewPetSkillRef>();

        for (int i = 0, max = curInfo.SkillList.Count; i < max; i++)
        {
            NewPetSkillRef petSkillRef = ConfigMng.Instance.GetPetSkillRef((int)curInfo.SkillList[i]);
            if (petSkillRef != null)
            {
                if (petSkillRef.beidong == 2 || petSkillRef.beidong == 3 || petSkillRef.beidong == 4)
                {
                    if (petSkillRef.beidong == 4)
                    {
                        for (int j = 0; j < petSkillRef.add_attr.Count; j++)
                        {
                            skillProperty += petSkillRef.add_attr[j].value;
                        }
                    }
                    list.Add(petSkillRef);
                }
            }
        }
        if (parent != null)
        {
            if (grid != null)
            {
                grid.maxPerLine = list.Count;

                for (int i = 0, max = petBDSkillList.Count; i < max; i++)
                {
                    petBDSkillList[i].SkillRef = null;
                    petBDSkillList[i].gameObject.SetActive(false);
                }

                for (int i = 0, max = list.Count; i < max; i++)
                {
                    NewPetSkillRef petSkillRef = list[i];
                    if (petSkillRef != null)
                    {
                        if (petBDSkillList.Count <= i)
                        {
                            SingleLearnedSkill item = SingleLearnedSkill.CeateBDSkill(i, petSkillRef.id, parent);
                            if (item != null)
                            {
                                item.gameObject.SetActive(true);
                                petBDSkillList.Add(item);
                                UIEventListener.Get(item.gameObject).onClick  -= OnClickSkill;
                                UIEventListener.Get(item.gameObject).onClick  += OnClickSkill;
                                UIEventListener.Get(item.gameObject).parameter = petSkillRef.id;
                            }
                        }
                        else
                        {
                            petBDSkillList[i].SkillRef = petSkillRef;
                            petBDSkillList[i].gameObject.SetActive(true);
                            UIEventListener.Get(petBDSkillList[i].gameObject).onClick  -= OnClickSkill;
                            UIEventListener.Get(petBDSkillList[i].gameObject).onClick  += OnClickSkill;
                            UIEventListener.Get(petBDSkillList[i].gameObject).parameter = petSkillRef.id;
                        }
                    }
                }
                grid.repositionNow = true;
            }
        }
    }