Esempio n. 1
0
    void OnSKillClick(GameObject go)
    {
        PetSkillItem item = go.GetComponent <PetSkillItem>();

        if (item != null)
        {
            CurSkillDataBase = item.SkillData;
            m_ctor_skill_scrollview.SetSelect(item);
        }
    }
Esempio n. 2
0
    void SetDataBase(int index, GameObject go)
    {
        PetSkillItem skillitem = go.GetComponent <PetSkillItem>();

        if (skillitem != null)
        {
            petDataManager.SelectSkillDataBase = skillitem.SkillData;

            SetItemHight(index);
        }
        else
        {
            SetItemHight(0);
            petDataManager.SelectSkillDataBase = null;
        }
    }
Esempio n. 3
0
 void OnUpdateUIGrid(UIGridBase grid, int index)
 {
     if (grid is PetSkillItem)
     {
         if (index < m_typeList.Count)
         {
             SkillDatabase db = m_typeList[index];
             if (db != null)
             {
                 PetSkillItem item = grid as PetSkillItem;
                 item.gameObject.SetActive(true);
                 item.SetIcon(db);
             }
         }
     }
 }
Esempio n. 4
0
    void ShowNoSkill(Transform item)
    {
        Transform addskill = item.Find("addskill");

        if (addskill != null)
        {
            addskill.gameObject.SetActive(true);
        }
        Transform sprTrans = item.Find("bg_choose");

        if (sprTrans != null)
        {
            sprTrans.gameObject.SetActive(false);
        }
        PetSkillItem ps = item.GetComponent <PetSkillItem>();

        if (ps != null)
        {
            ps.SetIcon(null);
        }

        Transform skillLv = item.Find("lv");

        if (skillLv != null)
        {
            skillLv.gameObject.SetActive(false);
        }
        Transform nameTrans = item.Find("Label");

        if (nameTrans == null)
        {
            nameTrans = item.Find("skillname");
        }
        if (nameTrans != null)
        {
            UILabel nameLabel = nameTrans.GetComponent <UILabel>();
            if (nameLabel != null)
            {
                nameLabel.text = CommonData.GetLocalString("技能");
            }
        }
    }
Esempio n. 5
0
    private void OnUIGridEventDlg(UIEventType eventType, object data, object param)
    {
        if (null == data)
        {
            return;
        }
        switch (eventType)
        {
        case UIEventType.Click:
        {
            PetSkillItem item = data as PetSkillItem;
            if (item != null)
            {
                OnSKillClick(item.gameObject);
            }
        }
        break;

        default:
            break;
        }
    }
Esempio n. 6
0
    void RefreshLockInfo(stLockSkillPetUserCmd_CS cmd)
    {
        int skillID = cmd.skill;

        for (int i = 0; i < 6; i++)
        {
            string    itemName = "petskill" + (i + 1).ToString();
            Transform go       = transform.Find(itemName);
            if (go != null)
            {
                PetSkillItem skill = go.GetComponent <PetSkillItem>();
                if (skill != null)
                {
                    if (skill.SkillData.wdID == skillID)
                    {
                        Transform trans = go.transform.Find("gouxuan");
                        if (trans != null)
                        {
                            SetLockDic(itemName, cmd.@lock);
                            trans.gameObject.SetActive(cmd.@lock);
                        }
                        uint n    = 0;
                        var  iter = lockSkillDic.GetEnumerator();
                        while (iter.MoveNext())
                        {
                            var dic = iter.Current;
                            if (dic.Value)
                            {
                                n += 1;
                            }
                        }
                        petDataManager.LockSkillNum = n;
                    }
                }
            }
        }
    }
Esempio n. 7
0
    public override bool OnMsg(UIMsgID msgid, object param)
    {
        if (msgid == UIMsgID.eShowUI)
        {
            if (param is ReturnBackUIMsg)
            {
                ReturnBackUIMsg showInfo = (ReturnBackUIMsg)param;
                if (showInfo.tabs.Length > 0)
                {
                    CurType = (PetSkillType)showInfo.tabs[0];
                }

                foreach (Transform item in m_ctor_skill_scrollview.CacheTransform)
                {
                    PetSkillItem petItem = item.GetComponent <PetSkillItem>();
                    if (petItem != null && petItem.SkillData != null && petItem.SkillData.wdID == (uint)showInfo.param)
                    {
                        petItem.gameObject.SendMessage("OnClick", SendMessageOptions.RequireReceiver);
                    }
                }
            }
        }
        return(base.OnMsg(msgid, param));
    }
Esempio n. 8
0
    void ExecuLockGrop(GameObject go)
    {
        if (!petDataManager.bLockSkill)
        {
            return;
        }
        bool haLock = false;

        if (lockSkillDic.ContainsKey(go.name))
        {
            haLock = lockSkillDic[go.name];
        }
        if (!haLock)
        {
            int limitLock           = GameTableManager.Instance.GetGlobalConfig <int>("PetSkillLockLimit");
            List <PetSkillObj> list = CurPet.GetPetSkillList();
            int hasLock             = (int)petDataManager.LockSkillNum;
            int maxLock             = list.Count - limitLock;
            if (list.Count - limitLock <= hasLock)
            {
                TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Pet_Skill_zuiduosuodingXgejineng, maxLock);
                //  TipsManager.Instance.ShowTips( "最多锁定" + maxLock + "个技能" );
                return;
            }
        }
        if (m_type == PetSkillGroupType.Lock)
        {
            PetSkillItem skillitem = go.GetComponent <PetSkillItem>();
            if (skillitem != null && skillitem.SkillData != null)
            {
                haLock = !haLock;
                petDataManager.SelectSkillDataBase = skillitem.SkillData;
                SendSkillLock(skillitem.SkillData.wdID, haLock);
            }
        }
    }
Esempio n. 9
0
    void ShowHasSkill(Transform item, GameCmd.PetSkillObj skill)
    {
        Transform addskill = item.Find("addskill");

        if (addskill != null)
        {
            addskill.gameObject.SetActive(false);
        }
        SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>((uint)skill.id, 1);

        if (db != null)
        {
            Transform skillLv = item.Find("lv");
            if (skillLv != null)
            {
                UILabel lvLabel = skillLv.GetComponent <UILabel>();
                if (lvLabel != null)
                {
                    lvLabel.text = skill.lv.ToString();
                }
                skillLv.gameObject.SetActive(true);
            }
            PetSkillItem skillitem = item.gameObject.GetComponent <PetSkillItem>();
            if (skillitem == null)
            {
                skillitem = item.gameObject.AddComponent <PetSkillItem>();
            }
            skillitem.SkillData = db;
            skillitem.SetIcon(db);
            //Transform icon = item.Find("icon");
            //if (icon != null)
            //{
            //    icon.gameObject.SetActive(true);
            //    UITexture spr = icon.GetComponent<UITexture>();
            //    if (spr != null)
            //    {
            //        UIManager.GetTextureAsyn(db.iconPath, ref m_iconCASD, () =>
            //        {
            //            if (null != spr)
            //            {
            //                spr.mainTexture = null;
            //            }
            //        }, spr);

            //    }
            //    ShowTips(db, item, new Vector2(spr.width, spr.height));
            //}
            Transform nameTrans = item.Find("Label");
            if (nameTrans == null)
            {
                nameTrans = item.Find("skillname");
            }
            if (nameTrans != null)
            {
                UILabel nameLabel = nameTrans.GetComponent <UILabel>();
                if (nameLabel != null)
                {
                    nameLabel.text = db.strName;
                }
            }
            Transform sprTrans = item.Find("bg_choose");
            if (sprTrans != null)
            {
                if (petDataManager.SelectSkillDataBase != null)
                {
                    if (petDataManager.SelectSkillDataBase.wdID == skill.id)
                    {
                        sprTrans.gameObject.SetActive(true);
                    }
                    else
                    {
                        sprTrans.gameObject.SetActive(false);
                    }
                }
            }
        }
    }
Esempio n. 10
0
        protected override void ParseData(SqliteDataReader reader)
        {
            mInfos.Clear();
            mSortInfos.Clear();
            mEvolutionIds.Clear();
            DBDataAllSkill db_all_skill = DBManager.Instance.GetDB <DBDataAllSkill>();
            PetInfo        info;

            if (reader != null)
            {
                if (reader.HasRows == true)
                {
                    while (reader.Read())
                    {
                        info = new PetInfo();

                        info.Id         = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0);
                        info.Desc       = GetReaderString(reader, "desc");                                                    //说明
                        info.UnlockType = (PetUnLockType)DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_type"), 0); //解锁方式
                        if (info.UnlockType == PetUnLockType.PlayerLevel)
                        {
                            info.UnlockPlayerLevel = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0);          //解锁条件
                        }
                        else if (info.UnlockType == PetUnLockType.CostGoods)
                        {
                            info.UnLockGoodsConditionArray = new List <UnLockGoodsCondition>();
                            List <List <uint> > str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "unlock_condition"));
                            for (int index = 0; index < str_array.Count; ++index)
                            {
                                if (str_array[index].Count >= 2)
                                {
                                    UnLockGoodsCondition tmp_item = new UnLockGoodsCondition();
                                    tmp_item.goods_id  = str_array[index][0];
                                    tmp_item.goods_num = str_array[index][1];
                                    info.UnLockGoodsConditionArray.Add(tmp_item);
                                }
                                else
                                {
                                    GameDebug.LogError(string.Format("There is error unlock_condition (id = {0}) in data_pet", info.Id));
                                }
                            }
                        }
                        else if (info.UnlockType == PetUnLockType.PrePetDegree)
                        {
                            List <uint> str_array = DBTextResource.ParseArrayUint(GetReaderString(reader, "unlock_condition"), ",");
                            if (str_array != null && str_array.Count >= 2)
                            {
                                info.UnLockPrePetConditionData            = new UnLockPrePetCondition();
                                info.UnLockPrePetConditionData.pet_id     = str_array[0];
                                info.UnLockPrePetConditionData.step_level = str_array[1];
                            }
                            else
                            {
                                GameDebug.LogError(string.Format("There is error unlock_condition (id = {0}) in data_pet", info.Id));
                            }
                        }
                        else if (info.UnlockType == PetUnLockType.EvolutionReplace)
                        {
                            info.PreIdInEvolution      = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0);
                            info.HasCheckEvolution     = false;
                            info.FirstPetIdInEvolution = 0;
                        }
                        else
                        {
                        }

                        info.Unlock_desc = GetReaderString(reader, "unlock_desc");                           //解锁说明
                        info.Rank        = DBTextResource.ParseUI_s(GetReaderString(reader, "rank"), 0);     //排序规则
                        info.Actor_id    = DBTextResource.ParseUI_s(GetReaderString(reader, "actor_id"), 0); //角色ID
                        info.Quality     = DBTextResource.ParseUI_s(GetReaderString(reader, "quality"), 1);  //品质
                        info.MaxQual     = DBTextResource.ParseUI_s(GetReaderString(reader, "max_qual"), 1); //最高升品
                        info.MaxStep     = DBTextResource.ParseUI_s(GetReaderString(reader, "max_step"), 1); //最高升阶
                        info.Head_icon   = GetReaderString(reader, "head_icon");                             // 头像

                        info.ModelCameraOffset     = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset"));
                        info.ModelCameraOffsetInfo = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset_info"));
                        info.ModelCameraRotate     = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_rotate"));
                        info.ModelDefaultAngle     = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle"));
                        info.ModelCameraOffset2    = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset_2"));
                        info.ModelCameraOffset3    = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset_3"));
                        info.ModelLocalPos         = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos"));
                        info.ModelLocalScale       = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale"));
                        info.ModelLocalAngles      = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_angles"));
                        info.ModelLocalPos2        = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos2"));
                        info.ModelLocalScale2      = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale2"));

                        info.ModelShowModelOffset    = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_model_offset"));
                        info.ModelShowCameraRotation = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_camera_rotation"));
                        info.ModelShowCameraOffset   = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_camera_offset"));


                        info.ModelShowScale = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_scale"));

                        //技能列表
                        info.AllSkills       = new List <PetSkillItem>();
                        info.Skills          = new List <PetSkillItem>();
                        info.PassivitySkills = new List <PetSkillItem>();
                        List <List <uint> > skills_str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "skills"));
                        for (int index = 0; index < skills_str_array.Count; ++index)
                        {
                            if (skills_str_array[index].Count >= 2)
                            {
                                PetSkillItem tmp_PetSkillItem = new PetSkillItem();
                                tmp_PetSkillItem.skill_id    = skills_str_array[index][0];
                                tmp_PetSkillItem.open_degree = skills_str_array[index][1];
                                info.AllSkills.Add(tmp_PetSkillItem);
                                DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(tmp_PetSkillItem.skill_id);
                                if (skill_info != null)
                                {
                                    if (skill_info.SkillType == DBDataAllSkill.SKILL_TYPE.Active)
                                    {
                                        info.Skills.Add(tmp_PetSkillItem);
                                    }
                                    else if (skill_info.SkillType == DBDataAllSkill.SKILL_TYPE.Passive)
                                    {
                                        info.PassivitySkills.Add(tmp_PetSkillItem);
                                    }
                                }
                                else
                                {
                                    GameDebug.LogError(string.Format("[DBPet] can't find the skill! pet_id = {0} skill_id = {1}",
                                                                     info.Id, tmp_PetSkillItem.skill_id));
                                }
                            }
                            else
                            {
                                GameDebug.LogError(string.Format("There is error skills (id = {0}) in data_pet", info.Id));
                            }
                        }

                        //玩家技能
                        info.PlayerSkills = new Dictionary <uint, List <PetSkillItem> >();
                        skills_str_array  = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "player_skills"));
                        for (int index = 0; index < skills_str_array.Count; ++index)
                        {
                            if (skills_str_array[index].Count >= 2)
                            {
                                PetSkillItem tmp_PetSkillItem = new PetSkillItem();
                                tmp_PetSkillItem.skill_id    = skills_str_array[index][0];
                                tmp_PetSkillItem.open_degree = skills_str_array[index][1];

                                DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(tmp_PetSkillItem.skill_id);
                                uint vocation = 0;
                                if (skill_info != null)
                                {
                                    vocation = skill_info.Require_race;
                                }
                                if (info.PlayerSkills.ContainsKey(vocation) == false)
                                {
                                    info.PlayerSkills.Add(vocation, new List <PetSkillItem>());
                                }
                                info.PlayerSkills[vocation].Add(tmp_PetSkillItem);
                            }
                            else
                            {
                                GameDebug.LogError(string.Format("There is error player_skills (id = {0}) in data_pet", info.Id));
                            }
                        }
                        if (info.PlayerSkills.ContainsKey(DBDataAllSkill.CommonVocationType))
                        {
                            foreach (var item in info.PlayerSkills)
                            {
                                if (item.Key == DBDataAllSkill.CommonVocationType)
                                {
                                    continue;
                                }
                                item.Value.AddRange(info.PlayerSkills[DBDataAllSkill.CommonVocationType]);
                            }
                        }
                        //info.Icon = GetReaderString(reader, "icon");

                        mInfos.Add(info.Id, info);
                        mSortInfos.Add(info);
                    }
                }
            }

            int no_deal_evolution_count = 0;

            while (true)
            {
                no_deal_evolution_count = 0;
                foreach (var item in mInfos)
                {
                    if (item.Value.UnlockType != PetUnLockType.EvolutionReplace)
                    {
                        continue;
                    }
                    if (item.Value.HasCheckEvolution)
                    {
                        continue;//已经处理过
                    }
                    if (item.Value.PreIdInEvolution == 0)
                    {//第一个进化的ID
                        uint first_pet_id = item.Value.Id;
                        mEvolutionIds[first_pet_id] = new List <uint>();
                        mEvolutionIds[first_pet_id].Add(item.Value.Id);
                        item.Value.HasCheckEvolution     = true;
                        item.Value.FirstPetIdInEvolution = first_pet_id;
                    }
                    else if (mInfos.ContainsKey(item.Value.PreIdInEvolution) &&
                             mInfos[item.Value.PreIdInEvolution].HasCheckEvolution)
                    {//非第一个进化的ID且前置进化ID已经计算过
                        uint first_pet_id = mInfos[item.Value.PreIdInEvolution].FirstPetIdInEvolution;
                        mEvolutionIds[first_pet_id].Add(item.Value.Id);
                        item.Value.HasCheckEvolution     = true;
                        item.Value.FirstPetIdInEvolution = first_pet_id;
                    }
                    else//后续循环处理
                    {
                        no_deal_evolution_count++;
                    }
                }

                if (no_deal_evolution_count <= 0)
                {
                    break;
                }
            }


            mSortInfos.Sort((a, b) => {
                if (a.Rank < b.Rank)
                {
                    return(-1);
                }
                else if (a.Rank > b.Rank)
                {
                    return(1);
                }
                if (a.Id < b.Id)
                {
                    return(-1);
                }
                else if (a.Id > b.Id)
                {
                    return(1);
                }
                return(0);
            });
        }