protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } while (reader.Read()) { DBWorldBossItem ad = new DBWorldBossItem(); ad.Id = DBTextResource.ParseUI(GetReaderString(reader, "id")); ad.ShowAward = new List <DBWorldBoss.DBWorldBossRewardItem>(); List <List <string> > award_str_array = DBTextResource.ParseArrayStringString(GetReaderString(reader, "show_award_new")); for (int gid_index = 0; gid_index < award_str_array.Count; ++gid_index) { List <string> one_goods_array = award_str_array[gid_index]; if (one_goods_array.Count < 2) { continue; } uint goods_id = 0; if (uint.TryParse(one_goods_array[0], out goods_id) == false) { continue; } uint goods_num = 0; if (uint.TryParse(one_goods_array[1], out goods_num) == false) { continue; } string reward_type = ""; if (one_goods_array.Count > 2 && one_goods_array[2] != "" && one_goods_array[2] != "0") { reward_type = one_goods_array[2]; } DBWorldBossRewardItem reward_item = new DBWorldBossRewardItem(); reward_item.goods_id = goods_id; reward_item.goods_num = goods_num; reward_item.reward_type = reward_type; ad.ShowAward.Add(reward_item); } ad.MustDropAwardArray = new List <DBWorldBossRewardItem>(); award_str_array = DBTextResource.ParseArrayStringString(GetReaderString(reader, "must_drop_award")); for (int gid_index = 0; gid_index < award_str_array.Count; ++gid_index) { List <string> one_goods_array = award_str_array[gid_index]; if (one_goods_array.Count < 2) { continue; } uint goods_id = 0; if (uint.TryParse(one_goods_array[0], out goods_id) == false) { continue; } uint goods_num = 0; if (uint.TryParse(one_goods_array[1], out goods_num) == false) { continue; } string reward_type = ""; if (one_goods_array.Count > 2 && one_goods_array[2] != "" && one_goods_array[2] != "0") { reward_type = one_goods_array[2]; } DBWorldBossRewardItem reward_item = new DBWorldBossRewardItem(); reward_item.goods_id = goods_id; reward_item.goods_num = goods_num; reward_item.reward_type = reward_type; ad.MustDropAwardArray.Add(reward_item); } //ad.ShowAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_award")); ad.Tag = DBTextResource.ParseUI_s(GetReaderString(reader, "tag"), 0); ad.Rank = DBTextResource.ParseUI(GetReaderString(reader, "rank")); ad.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); ad.ModelCameraRotate = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_rotate")); ad.ModelDefaultAngle = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle")); ad.DeathModelCenter = DBTextResource.ParseVector3(GetReaderString(reader, "death_model_center")); ad.DeathModelRadius = DBTextResource.ParseF(GetReaderString(reader, "death_model_radius")); ad.ColorType = DBTextResource.ParseUI_s(GetReaderString(reader, "color_type"), 0); ad.Order = DBTextResource.ParseUI_s(GetReaderString(reader, "order"), 0); data.Add(ad.Id, ad); m_sortData.Add(ad); } m_sortData.Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } return(0); }); }
/// <summary> /// 获取奖励item列表 /// </summary> /// <returns>The reward item list.</returns> /// <param name="rewardId">Reward identifier.</param> public List <RewardInfo> GetRewardItemList(uint rewardId) { List <RewardInfo> rewardList = new List <RewardInfo>(); rewardList.Clear(); if (mRewardInfosList == null) { mRewardInfosList = new Dictionary <uint, List <RewardInfo> >(); mRewardInfosList.Clear(); } if (mRewardInfosList.ContainsKey(rewardId) == true) { foreach (RewardInfo rewardInfo in mRewardInfosList[rewardId]) { rewardList.Add(rewardInfo); } } else { List <RewardInfo> rewardInfos = new List <RewardInfo>(); rewardInfos.Clear(); //string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1} LIKE \"{2}__\"", "reward", "item_id", rewardId); //List<Dictionary<string, string>> rows = DBManager.Instance.QuerySqliteRow<string>(GlobalConfig.DBFile, queryStr, true); List <Dictionary <string, string> > rows = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "reward", "cid", rewardId.ToString()); if (rows.Count > 0) { foreach (Dictionary <string, string> row in rows) { RewardInfo rewardInfo = new RewardInfo(); string raw = string.Empty; row.TryGetValue("item_id", out raw); uint itemId = DBTextResource.ParseUI_s(raw, 0); rewardInfo.mItemID = itemId; row.TryGetValue("gid", out raw); uint gid = DBTextResource.ParseUI_s(raw, 0); rewardInfo.mGID = gid; row.TryGetValue("num", out raw); long num = 0; if (long.TryParse(raw, out num) == false) { List <long> nums = DBTextResource.ParseArrayLong(raw, ","); if (nums.Count > 0) { rewardInfo.mFixedNum = nums[0]; rewardInfo.mNum = nums[0]; } else { rewardInfo.mFixedNum = num; rewardInfo.mNum = num; } } else { rewardInfo.mFixedNum = num; rewardInfo.mNum = num; } row.TryGetValue("race", out raw); byte race = DBTextResource.ParseBT_s(raw, 0); rewardInfo.mVocation = race; row.TryGetValue("is_lv_eff", out raw); byte isLvEff = DBTextResource.ParseBT_s(raw, 0); rewardInfo.mEffectByLevel = isLvEff; row.TryGetValue("lv_limit", out raw); rewardInfo.mLvLimit = DBTextResource.ParseArrayUint(raw, ","); row.TryGetValue("is_bind", out raw); rewardInfo.mIsBind = DBTextResource.ParseUI_s(raw, 0); row.TryGetValue("sys_open", out raw); rewardInfo.mOpenSysId = DBTextResource.ParseUI_s(raw, 0); row.TryGetValue("show_color_effect2", out raw); if (string.IsNullOrEmpty(raw) == true || raw.Equals("0") == true) { rewardInfo.mShowColorEffect2 = false; } else { rewardInfo.mShowColorEffect2 = true; } rewardInfos.Add(rewardInfo); } } foreach (RewardInfo rewardInfo in rewardInfos) { rewardList.Add(rewardInfo); } mRewardInfosList.Add(rewardId, rewardInfos); } // 删除不是本职业的奖励 for (int i = rewardList.Count - 1; i >= 0; i--) { if (rewardList[i].mVocation != 0 && (uint)rewardList[i].mVocation != LocalPlayerManager.Instance.LocalActorAttribute.Vocation) { rewardList.Remove(rewardList[i]); } } if (rewardList == null) { rewardList = new List <RewardInfo>(); rewardList.Clear(); } return(rewardList); }
InstanceTypeInfo GetItemInfo(uint warType, uint warSubType) { uint key = MakeKey(warType, warSubType); var war_type = ""; if (warType == GameConst.WAR_TYPE_DUNGEON) { war_type = "WAR_TYPE_DUNGEON"; } else if (warType == GameConst.WAR_TYPE_WILD) { war_type = "WAR_TYPE_WILD"; } var war_sub_type = DBInstanceType.Instance.GetInstanceType(warSubType); string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\" AND {0}.{3}=\"{4}\"", mTableName, "war_type", war_type, "war_subtype", war_sub_type); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { mInstanceTypeControls[key] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mInstanceTypeControls[key] = null; reader.Close(); reader.Dispose(); return(null); } var info = new InstanceTypeInfo(); info.m_WarType = warType; info.m_WarSubType = warSubType; info.m_PrecedentPlayer = DBTextResource.ParseUI_s(GetReaderString(reader, "precedent_player"), 0) == 1; info.m_CannotHidePlayer = DBTextResource.ParseUI_s(GetReaderString(reader, "cannot_hide_player"), 0) == 1; info.m_PKLevelLimit = DBTextResource.ParseUI_s(GetReaderString(reader, "pk_lv_limit"), 0) == 1; info.m_UsePKMode = DBTextResource.ParseUI_s(GetReaderString(reader, "use_pk_mode"), 0) == 1; info.m_NoShowAtkCampTips = DBTextResource.ParseUI_s(GetReaderString(reader, "no_show_atk_camp_tips"), 0) == 1; info.m_IgnoreClickPlayer = DBTextResource.ParseUI_s(GetReaderString(reader, "ignore_click_player"), 0) == 1; info.m_ForceShowHpBar = DBTextResource.ParseUI_s(GetReaderString(reader, "force_show_hp_bar"), 0) == 1; info.m_ForbidUseGoodsTypes = DBTextResource.ParseArrayKeyValuePairUintUint(GetReaderString(reader, "forbid_use_goods_types")); info.m_ForbidChangePk = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_change_pk"), 0) == 1; info.m_ShowDanmakuChatChannels = DBTextResource.ParseArrayUint(GetReaderString(reader, "show_danmaku_switch"), ","); info.m_ForbidOpenWorldMap = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_open_world_map"), 0) == 1; info.m_HideHpBar = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_hp_bar"), 0) == 1; info.m_HideCamp = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_camp"), 0) == 1; info.m_ForbidPet = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_pet"), 0) == 1; info.m_HideTeam = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_team"), 0) == 1; info.m_ForbidTeam = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_team"), 0) == 1; info.m_HidePvpHpBar = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_pvp_hp_bar"), 0) == 1; info.m_AutoPickDrop = DBTextResource.ParseUI_s(GetReaderString(reader, "auto_pick_drop"), 0) == 1; info.m_IsShowAutoFightingGotExp = DBTextResource.ParseUI_s(GetReaderString(reader, "is_show_auto_fighting_got_exp"), 0) == 1; info.m_ActId = DBTextResource.ParseUI_s(GetReaderString(reader, "act_id"), 0); info.m_ExitTips = GetReaderString(reader, "exit_tips"); info.m_is_can_exit = DBTextResource.ParseUI_s(GetReaderString(reader, "is_can_exit"), 0) == 1; info.m_ForbidJumpOutAnimationOut = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_jump_out_animation_out"), 0) == 1; info.m_ForbidJumpOutAnimationIn = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_jump_out_animation_in"), 0) == 1; info.m_PlayJumpOutAnimationTeamIn = DBTextResource.ParseUI_s(GetReaderString(reader, "play_jump_out_animation_team_in"), 0) == 1; info.m_HideCount = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_count"), 0) == 1; info.m_ForbidElfin = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_elfin"), 0) == 1; info.m_ForbidMagicPet = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_magic_pet"), 0) == 1; info.m_hide_guild = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_guild"), 0) == 1; info.m_hide_mate = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_mate"), 0) == 1; info.m_replace_name = GetReaderString(reader, "replace_name"); info.m_BanShortCutWin = DBTextResource.ParseUI_s(GetReaderString(reader, "ban_shortCut_win"), 0) == 1; info.m_BanBossNoticeWin = DBTextResource.ParseUI_s(GetReaderString(reader, "ban_boss_notice_win"), 0) == 1; info.m_BanMarriageNoticeWin = DBTextResource.ParseUI_s(GetReaderString(reader, "ban_marriage_notice_win"), 0) == 1; info.m_NoFlyShoe = DBTextResource.ParseUI_s(GetReaderString(reader, "no_fly_shoe"), 0) == 1; info.m_AutoCollect = DBTextResource.ParseUI_s(GetReaderString(reader, "auto_collect"), 0) == 1; info.m_DoNotPatrol = DBTextResource.ParseUI_s(GetReaderString(reader, "do_not_patrol"), 0) == 1; info.m_ShowServerName = DBTextResource.ParseUI_s(GetReaderString(reader, "show_server_name"), 0) == 1; info.m_ClearCd = DBTextResource.ParseUI_s(GetReaderString(reader, "clear_cd"), 0) == 1; info.m_MinPlayerCount = DBTextResource.ParseUI_s(GetReaderString(reader, "min_player_count"), 0); mInstanceTypeControls[key] = info; reader.Close(); reader.Dispose(); return(info); }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mSortStatisticArray.Clear(); DBGuildBossItem info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBGuildBossItem(); info.BossType = DBTextResource.ParseUI_s(GetReaderString(reader, "type"), 0); //类型ID info.Star = DBTextResource.ParseUI_s(GetReaderString(reader, "star"), 0); //星级 info.TypeName = GetReaderString(reader, "type_name"); //类型名字 info.Name = GetReaderString(reader, "name"); //名字 info.DungeonId = DBTextResource.ParseUI_s(GetReaderString(reader, "dgn_id"), 0); //副本ID info.OpenCond = DBTextResource.ParseUI_s(GetReaderString(reader, "open_cond"), 0); //开启条件(世界等级) info.OpenCost = DBTextResource.ParseUI_s(GetReaderString(reader, "open_cost"), 0); //开启需要的帮派资金 info.BossRewardId = DBTextResource.ParseUI_s(GetReaderString(reader, "reward_id"), 0); //帮派boss奖励显示data_guild_boss_gift 表的id //info.RewardItemArray = new List<DBGuildBossRewardItem>(); //for(int index = 1; index <= 5; ++index) //{ // string tmp_reward_col_name = string.Format("reward_{0}", index); // string tmp_reward_str = GetReaderString(reader, tmp_reward_col_name); // if(tmp_reward_str != null && tmp_reward_str.Length > 0) // { // List<string> parse_array = DBTextResource.ParseArrayString(tmp_reward_str, ",", false); // if(parse_array != null && parse_array.Count >= 4) // { // uint goods_id = 0; // if(uint.TryParse(parse_array[0], out goods_id)) // { // DBGuildBossRewardItem tmp_item = new DBGuildBossRewardItem(); // tmp_item.GoodsId = goods_id; // tmp_item.RewardType = parse_array[1]; // tmp_item.RewardDesc1 = parse_array[2]; // tmp_item.RewardDesc2 = parse_array[3]; // info.RewardItemArray.Add(tmp_item); // } // } // } //} if (mInfos.ContainsKey(info.BossType) == false) { mInfos.Add(info.BossType, new Dictionary <uint, DBGuildBossItem>()); } if (mInfos[info.BossType].ContainsKey(info.Star) == false) { mInfos[info.BossType].Add(info.Star, info); } else { GameDebug.LogError(string.Format("has repeat id {0}-{1}", info.BossType, info.Star)); } DBGuildBossStatisticItem find_item = mSortStatisticArray.Find((a) => { return(a.BossType == info.BossType); }); if (find_item == null) { find_item = new DBGuildBossStatisticItem(); find_item.BossType = info.BossType; find_item.MaxStar = info.Star; find_item.TypeName = info.TypeName; find_item.BossItemSortArray = new List <DBGuildBossItem>(); find_item.BossItemSortArray.Add(info); mSortStatisticArray.Add(find_item); } else { if (find_item.MaxStar < info.Star) { find_item.MaxStar = info.Star; } find_item.BossItemSortArray.Add(info); } } } } mSortStatisticArray.Sort((a, b) => { if (a.BossType < b.BossType) { return(-1); } else if (a.BossType > b.BossType) { return(1); } return(0); }); for (int index = 0; index < mSortStatisticArray.Count; ++index) { mSortStatisticArray[index].BossItemSortArray.Sort((a, b) => { if (a.Star < b.Star) { return(-1); } else if (a.Star > b.Star) { return(1); } return(0); }); } }
/// <summary> /// 读取指定窗口的配置 /// </summary> /// <param name="name"></param> /// <returns></returns> private UIInfo GetUIInfo(string name) { string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "name", name); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, queryStr); if (reader == null) { return(null); } if (!reader.HasRows || !reader.Read()) { reader.Close(); reader.Dispose(); return(null); } UIInfo info = new UIInfo(); info.name = name; info.support_back = DBTextResource.ParseBT_s(GetReaderString(reader, "support_back"), 0) == 1; info.is_modal = DBTextResource.ParseBT_s(GetReaderString(reader, "is_modal"), 0) == 1; info.ui_type = DBTextResource.ParseBT_s(GetReaderString(reader, "ui_type"), 0); info.is_global = DBTextResource.ParseBT_s(GetReaderString(reader, "is_global"), 0) == 1; info.sub_panels = GetReaderString(reader, "sub_panels"); info.init_open_panels = GetReaderString(reader, "init_open_panels"); info.sub_canvas_lenght = DBTextResource.ParseBT_s(GetReaderString(reader, "sub_canvas_lenght"), 0); info.lua_path = GetReaderString(reader, "lua_path"); var delay_time_text = GetReaderString(reader, "destroy_delay_time"); ushort delay_time = 0; if (string.IsNullOrEmpty(delay_time_text)) { if (SystemInfo.systemMemorySize <= 1024) { delay_time = 10; } else { delay_time = 20; } } else { delay_time = DBTextResource.ParseUS_s(delay_time_text, 10); } info.destroy_delay_time = delay_time; info.static_layer_index = DBTextResource.ParseS_s(GetReaderString(reader, "static_layer_index"), -1); info.reconnect_handle = DBTextResource.ParseBT_s(GetReaderString(reader, "reconnect_handle"), 0); info.return_handle = DBTextResource.ParseBT_s(GetReaderString(reader, "return_handle"), 0); info.stay_when_switch_plane_instance = DBTextResource.ParseBT_s(GetReaderString(reader, "stay_when_switch_plane_instance"), 0) == 1; info.close_wins_type_when_show = DBTextResource.ParseBT_s(GetReaderString(reader, "close_wins_type_when_show"), 0); info.ban_back_last_panel = DBTextResource.ParseBT_s(GetReaderString(reader, "ban_back_last_panel"), 0) == 1; info.ban_sub_window_when_back = DBTextResource.ParseBT_s(GetReaderString(reader, "ban_sub_window_when_back"), 0) == 1; info.reopen = DBTextResource.ParseBT_s(GetReaderString(reader, "reopen"), 0) == 1; info.patch_id = DBTextResource.ParseBT_s(GetReaderString(reader, "patch_id"), 0); mData[info.name] = info; reader.Close(); reader.Dispose(); return(info); }
/// <summary> /// 根据技能id和技能等级获取一个公会技能的信息 /// </summary> /// <param name="skill_id"></param> /// <param name="skill_level"></param> /// <returns></returns> public DBGuildSkillItem GetOneItem(uint skill_id, uint skill_level) { uint uid = skill_id * 1000 + skill_level; DBGuildSkillItem info; if (mInfos.TryGetValue(uid, out info)) { return(info); } string query_str = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\" AND {0}.{3}=\"{4}\"", mTableName, "id", skill_id, "lv", skill_level); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query_str); if (reader == null) { mInfos[uid] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mInfos[uid] = null; reader.Close(); reader.Dispose(); return(null); } info = new DBGuildSkillItem(); info.SkillId = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); // 技能ID info.Name = GetReaderString(reader, "name"); //技能名字 info.Level = DBTextResource.ParseUI_s(GetReaderString(reader, "lv"), 0); //等级 info.OpenLv = DBTextResource.ParseUI_s(GetReaderString(reader, "open_lv"), 0); //开放等级(玩家等级) info.OpenCost = DBTextResource.ParseUI_s(GetReaderString(reader, "open_cost"), 0); //开启消耗帮贡 info.LvUpCost = DBTextResource.ParseUI_s(GetReaderString(reader, "lv_up_cost"), 0); //升级消耗帮贡 info.AttrArray = new List <DBCommonAttrItem>(); List <List <uint> > uint_uint_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "attr")); for (int index = 0; index < uint_uint_array.Count; ++index) { if (uint_uint_array[index].Count >= 2) { DBCommonAttrItem item = new DBCommonAttrItem(); item.attr_id = uint_uint_array[index][0]; item.attr_num = uint_uint_array[index][1]; info.AttrArray.Add(item); } } info.Icon = GetReaderString(reader, "icon"); //图标 info.CurShowAttrArray = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "cur_attr_id")); //玩家当前属性 info.CurAttrId = 0; //当前属性ID if (info.CurShowAttrArray != null && info.CurShowAttrArray.Count > 0 && info.CurShowAttrArray[0] != null && info.CurShowAttrArray[0].Count > 0) { info.CurAttrId = info.CurShowAttrArray[0][0]; } mInfos[uid] = info; reader.Close(); reader.Dispose(); return(info); }
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); }); }