예제 #1
0
        void SaveNewSkillList()
        {
            string newSkillSaveNameStr = string.Format("{0}NewSkillList", Game.GetInstance().LocalPlayerID.obj_idx);

            System.Text.StringBuilder newSkillListBuilder = new System.Text.StringBuilder();
            for (int index = 0; index < m_new_skills_array.Count; ++index)
            {
                if (index != m_new_skills_array.Count - 1)
                {
                    newSkillListBuilder.AppendFormat("{0},", m_new_skills_array[index]);
                }
                else
                {
                    newSkillListBuilder.AppendFormat("{0}", m_new_skills_array[index]);
                }
            }
            UserPlayerPrefs.GetInstance().SetString(newSkillSaveNameStr, newSkillListBuilder.ToString());
            UserPlayerPrefs.GetInstance().Save();
        }
예제 #2
0
        void InitHasOpenSysMount()
        {
            if (m_hasInitOpenSysMount)
            {
                return;
            }
            if (Game.GetInstance().LocalPlayerID == null)
            {
                m_hasInitOpenSysMount = false;
                return;
            }
            string newSkillSaveNameStr = string.Format("{0}IsOpenSysMount", Game.GetInstance().LocalPlayerID.obj_idx);

            m_hasOpenSysMount = UserPlayerPrefs.GetInstance().GetInt(newSkillSaveNameStr, 0) == 1; //默认是不开启
            //默认是不开启
            if (CustomDataMgr.Instance.IsExistCustomData(CustomDataType.IsOpenSysMount, 1))
            {
                m_hasOpenSysMount = true;
            }
            m_hasInitOpenSysMount = true;
        }
예제 #3
0
        /// <summary>
        /// 根据服务端的数据来设置所有已开放的主动和被动技能
        /// </summary>
        /// <param name="add_skills"></param>
        public void AddSkillList(List <Net.PkgSkillsOne> add_skills)
        {
            DBDataAllSkill db_all_skill = DBManager.Instance.GetDB <DBDataAllSkill>();

            // 获取新的技能的id,需要在返回野外的时候表现获取的动画,同时获得多个时,只表现最后一个技能的动画
            uint new_active_skill_id = 0;

            if (m_skills_info_array == null)
            {
                m_skills_info_array = new List <Net.PkgSkillsOne>();
                if (m_new_skills_array == null)
                {
                    m_new_skills_array = new List <uint>();
                    // m_new_skills_array的数据 用于在技能系统面板中显示'新'的标识
                    string   newSkillSaveNameStr = string.Format("{0}NewSkillList", Game.GetInstance().LocalPlayerID.obj_idx);
                    string   newSkillListStr     = UserPlayerPrefs.GetInstance().GetString(newSkillSaveNameStr, "");
                    string[] substr   = newSkillListStr.Split(',');
                    uint     skill_id = 0;
                    for (int index = 0; index < substr.Length; ++index)
                    {
                        string cur = substr[index];

                        if (uint.TryParse(cur, out skill_id))
                        {
                            if (skill_id != 0)
                            {
                                m_new_skills_array.Add(skill_id);
                            }
                        }
                    }
                }
            }
            else // m_skills_info_array不为空时
            {
                bool add_newLearnSkill = false;
                foreach (var item in add_skills)
                {
                    if (m_new_skills_array.Contains(item.id) == false)
                    {
                        m_new_skills_array.Add(item.id);
                        add_newLearnSkill = true;
                    }

                    // 判断是否有新获取的主动技能
                    var skil_info = db_all_skill.GetOneAllSkillInfo(item.id);
                    if (skil_info != null && skil_info.SkillType == DBDataAllSkill.SKILL_TYPE.Active)
                    {
                        if (m_ActiveSkillIdList != null && !m_ActiveSkillIdList.Contains(item.id))
                        {
                            new_active_skill_id = item.id;
                        }
                    }
                }

                if (add_newLearnSkill)
                {
                    SaveNewSkillList();
                }
            }

            m_skills_info_array.AddRange(add_skills);
            if (m_ActiveSkillIdList == null)
            {
                m_ActiveSkillIdList = new List <uint>();
            }

            // 获取已经开放的技能列表,来设置固定装配位置的技能
            foreach (var info in m_skills_info_array)
            {
                // 不处理被动技能
                var skil_info = db_all_skill.GetOneAllSkillInfo(info.id);
                if (skil_info == null || skil_info.SkillType != DBDataAllSkill.SKILL_TYPE.Active)
                {
                    continue;
                }

                if (m_ActiveSkillIdList.Contains(info.id) == false)
                {
                    //GameDebug.LogError("m_ActiveSkillIdList " + info.id);
                    m_ActiveSkillIdList.Add(info.id);// 将技能id添加到列表中
                }
                // 固定技能槽的位置
                if (skil_info.Can_set_key == false)
                {
                    SkillManager.Instance.SetOpeningSkill((DBCommandList.OPFlag)skil_info.FixedKeyPos, skil_info.Sub_id);
                }
                else
                {
                    uint skill_pos = SkillHoleManager.Instance.GetOpenSkillHole(skil_info.Id);
                    if (skill_pos != 0)
                    {
                        // 对应位置没有装配的时候自动设置
                        uint has_exist_skill_id_in_slot = SkillManager.Instance.GetNormalFitSkillId(skill_pos);
                        bool needSetOpeningSkill        = false;
                        if (has_exist_skill_id_in_slot == 0)
                        {
                            needSetOpeningSkill = true;
                        }
                        else if (skil_info.ReplaceIds != null)
                        {
                            DBDataAllSkill.AllSkillInfo all_info = db_all_skill.GetOneAllSkillInfo_byActiveSkillId(has_exist_skill_id_in_slot);
                            if (all_info != null && skil_info.ReplaceIds.Contains(all_info.Id))
                            {//技能升级,直接替换
                                needSetOpeningSkill = true;
                            }
                        }
                        if (needSetOpeningSkill)
                        {
                            SkillManager.Instance.SetOpeningSkill((DBCommandList.OPFlag)skill_pos, skil_info.Sub_id);
                        }
                    }
                }

                if (info.id == new_active_skill_id)// 是新获取的技能,需要进行动画表现
                {
                    //GameDebug.LogError("[OpenNewSkill] info.id = " + info.id);
                    SkillHoleManager.Instance.OpenNewSkill(info.id);
                }
                else // 直接开启对应的技能孔
                {
                    //GameDebug.LogError("[OpenSkill] info.id = " + info.id);
                    SkillHoleManager.Instance.OpenSkill(info.id);
                }
            }
            RefreshSkillLevel();
        }