protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } mInfos.Clear(); RefundBtnInfo info = null; while (reader.Read()) { info = new RefundBtnInfo(); info.panel_name = GetReaderString(reader, "panel_name"); info.open_type = DBTextResource.ParseUI(GetReaderString(reader, "open_type")); info.panel_param1 = GetReaderString(reader, "panel_param1"); info.panel_node = GetReaderString(reader, "panel_node"); info.btn_panel_pos = DBTextResource.ParseVector3(GetReaderString(reader, "btn_panel_pos")); info.tips_panel_pos = DBTextResource.ParseVector3(GetReaderString(reader, "tips_panel_pos")); info.btn_text = GetReaderString(reader, "btn_text"); info.tips_panel_text = GetReaderString(reader, "tips_panel_text"); info.message_box_text = GetReaderString(reader, "message_box_text"); info.url = GetReaderString(reader, "url"); mInfos.Add(info); } }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } mInfos.Clear(); CurrencyPanelInfo info = null; while (reader.Read()) { info = new CurrencyPanelInfo(); info.panel_name = GetReaderString(reader, "panel_name"); if (Const.Region == RegionType.KOREA) { info.money_type_list = GetReaderString(reader, "money_type_list_kr"); } else { info.money_type_list = GetReaderString(reader, "money_type_list"); } info.panel_node = GetReaderString(reader, "panel_node"); info.panel_pos = DBTextResource.ParseVector3(GetReaderString(reader, "panel_pos")); info.panel_param1 = GetReaderString(reader, "panel_param1"); mInfos.Add(info); } }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } mInfos.Clear(); mSortInfos.Clear(); while (reader.Read()) { var tmp_info = new TrialBossItem(); tmp_info.DgnId = DBTextResource.ParseUI(GetReaderString(reader, "dgn_id")); //副本ID tmp_info.TrialType = DBTextResource.ParseUI(GetReaderString(reader, "type")); tmp_info.Rank = DBTextResource.ParseUI(GetReaderString(reader, "rank")); tmp_info.ActorId = DBTextResource.ParseUI(GetReaderString(reader, "actor_id")); tmp_info.ShowAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_award")); tmp_info.ShowAssistAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_assist_award")); tmp_info.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); tmp_info.DefaultAngles = DBTextResource.ParseVector3(GetReaderString(reader, "default_angles")); tmp_info.CameraViewField = DBTextResource.ParseF(GetReaderString(reader, "camera_view_field")); tmp_info.CameraRotate = DBTextResource.ParseVector3(GetReaderString(reader, "camera_rotate")); tmp_info.DefaultActionName = GetReaderString(reader, "default_action_name"); tmp_info.Icon = GetReaderString(reader, "icon"); if (mInfos.ContainsKey(tmp_info.DgnId) == false) { mInfos.Add(tmp_info.DgnId, tmp_info); if (mSortInfos.ContainsKey(tmp_info.TrialType) == false) { mSortInfos.Add(tmp_info.TrialType, new List <TrialBossItem>()); } mSortInfos[tmp_info.TrialType].Add(tmp_info); } else { GameDebug.LogError("DBTrialBoss contain the same info; Dgn_id = " + tmp_info.DgnId); } } foreach (var item in mSortInfos) { mSortInfos[item.Key].Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } return(0); }); } }
/// <summary> /// 根据id得到模型信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public ModelInfo GetModel(uint id) { ModelInfo info; if (mModels.TryGetValue(id, out info)) { return(info); } string query_str = string.Format("SELECT * FROM {0} WHERE {1}=\"{2}\"", mTableName, "id", id); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query_str); if (reader == null) { mModels[id] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mModels[id] = null; reader.Close(); reader.Dispose(); return(null); } string model = GetReaderString(reader, "model"); string ui_model = GetReaderString(reader, "ui_model"); string icon = GetReaderString(reader, "icon"); float scale = DBTextResource.ParseF_s(GetReaderString(reader, "scale"), 0f); Vector3 posOffsetInScene = DBTextResource.ParseVector3(GetReaderString(reader, "pos_offset_in_scene")); Vector3 camOffsetInDialogWnd = DBTextResource.ParseVector3(GetReaderString(reader, "cam_offset_in_dialog_wnd")); Vector3 camRotateInDialogWnd = DBTextResource.ParseVector3(GetReaderString(reader, "cam_rotate_in_dialog_wnd")); Vector3 modelOffsetInChipWin = DBTextResource.ParseVector3(GetReaderString(reader, "model_offset_in_chip_win")); Vector3 modelAngleInChipWin = DBTextResource.ParseVector3(GetReaderString(reader, "model_angle_in_chip_win")); string modelShowAction = GetReaderString(reader, "model_show_action"); info = new ModelInfo(id, model, ui_model, icon, scale, posOffsetInScene, camOffsetInDialogWnd, camRotateInDialogWnd, modelOffsetInChipWin, modelAngleInChipWin, modelShowAction); mModels.Add(info.Id, info); reader.Close(); reader.Dispose(); return(info); }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } //List<string> mount_action_name_array = new List<string>(){ "rideidle", "rideidle01", "rideidle02", "rideidle03", "rideidle04", "rideidle06" }; m_VocationMountInfos = new Dictionary <uint, VocationMountInfo>(); while (reader.Read()) { var vocation = DBTextResource.ParseUI(GetReaderString(reader, "vocation")); VocationMountInfo data = new VocationMountInfo(); //data.mount_offset_dict = new Dictionary<string, Vector3>(); data.rider_self_height_dict = new Dictionary <string, VocationMountInfo.OnRideActionInfo>(); for (int index = 0; index < mount_action_name_array.Count; ++index) { List <string> list_str = DBTextResource.ParseArrayString(GetReaderString(reader, mount_action_name_array[index]), ";"); if (list_str == null || list_str.Count == 0) { continue; } data.rider_self_height_dict[mount_action_name_array[index]] = new VocationMountInfo.OnRideActionInfo(); VocationMountInfo.OnRideActionInfo tmp_info = data.rider_self_height_dict[mount_action_name_array[index]]; if (list_str.Count >= 1) { tmp_info.mount_offset_dict = DBTextResource.ParseVector3(list_str[0]); } if (list_str.Count >= 2) { Vector2 v2 = DBTextResource.ParseVector2(list_str[1]); tmp_info.self_center_height = v2.x; tmp_info.self_height = v2.y; } } m_VocationMountInfos[vocation] = data; } }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } mInfos.Clear(); ProbabilityBtnInfo info = null; while (reader.Read()) { info = new ProbabilityBtnInfo(); info.panel_name = GetReaderString(reader, "panel_name"); string sys_id_str = GetReaderString(reader, "sys_id"); info.sys_id = uint.Parse(sys_id_str); info.panel_node = GetReaderString(reader, "panel_node"); info.panel_pos = DBTextResource.ParseVector3(GetReaderString(reader, "panel_pos")); info.url = GetReaderString(reader, "url"); info.panel_param1 = GetReaderString(reader, "panel_param1"); mInfos.Add(info); } }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mSortInfos.Clear(); mNormalDegreeSortInfos.Clear(); DBGrowSkinItem info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBGrowSkinItem(); info.GrowType = DBTextResource.ParseUI_s(GetReaderString(reader, "type"), 0); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Name = GetReaderString(reader, "name"); info.Desc = GetReaderString(reader, "desc"); //描述 info.UnlockType = (SkinUnLockType)DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_type"), 0); //解锁方式 if (info.UnlockType == SkinUnLockType.WhenOpenFunc) { //info.UnlockPlayerLevel = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0); //解锁条件 } else if (info.UnlockType == SkinUnLockType.CostGoods) { info.UnLockGoodsConditionArray = new List <DBPet.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) { DBPet.UnLockGoodsCondition tmp_item = new DBPet.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_grow_skin", info.Id)); } } } else if (info.UnlockType == SkinUnLockType.GrowLevel) { info.UnlockGrowLevel = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0); //解锁条件 } else { } info.UnlockDesc = GetReaderString(reader, "unlock_desc"); //解锁说明 info.SortId = DBTextResource.ParseUI_s(GetReaderString(reader, "sort_id"), 0); //排序ID info.Quality = DBTextResource.ParseUI_s(GetReaderString(reader, "quality"), 0); //品质 info.ActorId = DBTextResource.ParseUI_s(GetReaderString(reader, "actor_id"), 0); //角色ID info.ModelLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos")); info.ModelLocalScale = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale")); info.ModelLocalScaleGoods = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale_goods")); info.ModelLocalAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_angles")); info.ModelParentDefaultAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_default_angles")); info.ModelParentLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_local_pos")); info.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); info.ModelDefaultAngle = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle")); info.ModelSceneOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_scene_offset")); info.SurfaceOffset = DBTextResource.ParseVector3(GetReaderString(reader, "surfaceOffset")); info.GetOffset = DBTextResource.ParseVector3(GetReaderString(reader, "getOffset")); info.AttrArray = DBTextResource.ParseDBAttrItems(GetReaderString(reader, "attr")); //属性加成 info.IdleActionWhenRiding = GetReaderString(reader, "idleActionWhenRiding"); info.RunActionWhenRiding = GetReaderString(reader, "runActionWhenRiding"); info.SceneModelOffset = DBTextResource.ParseVector3(GetReaderString(reader, "sceneModelOffset")); if (mInfos.ContainsKey(info.GrowType) == false) { mInfos.Add(info.GrowType, new Dictionary <uint, DBGrowSkinItem>()); } mInfos[info.GrowType][info.Id] = info; if (mSortInfos.ContainsKey(info.GrowType) == false) { mSortInfos.Add(info.GrowType, new List <DBGrowSkinItem>()); } mSortInfos[info.GrowType].Add(info); if (info.UnlockType == SkinUnLockType.WhenOpenFunc || info.UnlockType == SkinUnLockType.GrowLevel) { if (mNormalDegreeSortInfos.ContainsKey(info.GrowType) == false) { mNormalDegreeSortInfos.Add(info.GrowType, new List <DBGrowSkinItem>()); } mNormalDegreeSortInfos[info.GrowType].Add(info); } } foreach (var item in mSortInfos) { item.Value.Sort((a, b) => { if (a.SortId < b.SortId) { return(-1); } else if (a.SortId > b.SortId) { return(1); } if (a.Id < b.Id) { return(-1); } else if (a.Id > b.Id) { return(1); } return(0); }); } foreach (var item in mNormalDegreeSortInfos) { item.Value.Sort((a, b) => { if (a.UnlockType == SkinUnLockType.WhenOpenFunc) { if (b.UnlockType != SkinUnLockType.WhenOpenFunc) { return(-1); } } else { if (b.UnlockType == SkinUnLockType.WhenOpenFunc) { return(1); } else { if (a.UnlockGrowLevel < b.UnlockGrowLevel) { return(-1); } else if (a.UnlockGrowLevel > b.UnlockGrowLevel) { return(1); } return(0); } } if (a.Id < b.Id) { return(-1); } else if (a.Id > b.Id) { return(1); } return(0); }); } } } }
/// <summary> /// 获取timeline配置表内容 /// </summary> /// <param name="id"></param> /// <param name="timelineConfig"></param> /// <returns></returns> bool GetTimelineConfig(uint id, out TimelineConfig timelineConfig) { timelineConfig = new TimelineConfig(); timelineConfig.Id = id; List <Dictionary <string, string> > dbs = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "data_timeline", "id", id.ToString()); if (dbs.Count > 0) { Dictionary <string, string> db = dbs[0]; // prefab路径 string prefabPath = string.Empty; string prefabKey = "prefab_" + LocalPlayerManager.Instance.LocalActorAttribute.Vocation; db.TryGetValue(prefabKey, out prefabPath); if (string.IsNullOrEmpty(prefabPath) == true) { db.TryGetValue("prefab_1", out prefabPath); } if (string.IsNullOrEmpty(prefabPath) == true) { GameDebug.LogError("Get timeline config error, can not find timeline prefab config, id: " + id); return(false); } timelineConfig.PrefabPath = prefabPath; // prefab位置 string rawStr = string.Empty; db.TryGetValue("pos", out rawStr); timelineConfig.Pos = DBTextResource.ParseVector3(rawStr); // prefab旋转 rawStr = string.Empty; db.TryGetValue("rotation", out rawStr); timelineConfig.Rotation = DBTextResource.ParseVector3(rawStr); // 播放完毕后是否需要镜头融合 db.TryGetValue("need_camera_follow_interpolation_when_finished", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.NeedCameraFollowInterpolationWhenFinished = false; } else { timelineConfig.NeedCameraFollowInterpolationWhenFinished = true; } // 播放时是否显示主角 db.TryGetValue("show_local_player", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.ShowLocalPlayer = false; } else { timelineConfig.ShowLocalPlayer = true; } // 播放时是否不停止主角行为 db.TryGetValue("no_stop_local_player", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.NoStopLocalPlayer = false; } else { timelineConfig.NoStopLocalPlayer = true; } // 播放时是否显示ui db.TryGetValue("show_ui", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.ShowUI = false; } else { timelineConfig.ShowUI = true; } // 播放的最低内存要求 db.TryGetValue("min_memory", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.MinMemory = 0; } else { uint.TryParse(rawStr, out timelineConfig.MinMemory); } // 播放时是否显示ui db.TryGetValue("pause_music", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.PauseMusic = false; } else { timelineConfig.PauseMusic = true; } // 关联prefab的路径 db.TryGetValue("related_prefab", out rawStr); timelineConfig.RelatedPrefabPath = rawStr; // 关联prefab的位置 db.TryGetValue("related_prefab_pos", out rawStr); timelineConfig.RelatedPrefabPos = DBTextResource.ParseVector3(rawStr); // 绑定的lua脚本 db.TryGetValue("behavior_script", out timelineConfig.BehaviorScript); // 播放完毕后是否要触发gc db.TryGetValue("need_gc", out rawStr); if (string.IsNullOrEmpty(rawStr) == true || rawStr.Equals("0")) { timelineConfig.NeedGC = false; } else { timelineConfig.NeedGC = true; } return(true); } else { GameDebug.LogError("Get timeline config error, can not find timeline id: " + id); return(false); } }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mSortInfos.Clear(); DBDataAllSkill db_all_skill = DBManager.Instance.GetDB <DBDataAllSkill>(); DBStigmaInfo info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBStigmaInfo(); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Name = GetReaderString(reader, "name"); info.Quality = DBTextResource.ParseUI_s(GetReaderString(reader, "quality"), 0); // 品质 info.CostGoodsId = DBTextResource.ParseUI_s(GetReaderString(reader, "cost"), 0); //消耗的物品ID info.Exp = DBTextResource.ParseUI_s(GetReaderString(reader, "exp"), 0); //每次获得经验 info.Rank = DBTextResource.ParseUI_s(GetReaderString(reader, "rank"), 0); //排序规则 info.Actor_id = DBTextResource.ParseUI_s(GetReaderString(reader, "actor_id"), 0); //角色ID 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.ModelParentDefaultAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_default_angles")); info.ModelParentLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_local_pos")); info.Icon = GetReaderString(reader, "icon"); //图标 List <List <uint> > skills_str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "skills")); //玩家技能列表(主键是玩家职业) info.PlayerSkills = new Dictionary <uint, List <DBStigmaSkillItemSkillItem> >(); 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) { uint skill_id = skills_str_array[index][0]; DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(skill_id); if (skill_info != null) { uint vocation = skill_info.Require_race; DBStigmaSkillItemSkillItem tmp_DBStigmaSkillItemSkillItem = new DBStigmaSkillItemSkillItem(); tmp_DBStigmaSkillItemSkillItem.skill_id = skill_id; tmp_DBStigmaSkillItemSkillItem.open_level = skills_str_array[index][1]; if (info.PlayerSkills.ContainsKey(vocation) == false) { info.PlayerSkills.Add(vocation, new List <DBStigmaSkillItemSkillItem>()); } info.PlayerSkills[vocation].Add(tmp_DBStigmaSkillItemSkillItem); } else { GameDebug.LogError(string.Format("Can't find the DBAllSkill = {0}", skill_id)); } } else { GameDebug.LogError(string.Format("There is error player_skills (id = {0}) in DBStigma", 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]); } } mInfos.Add(info.Id, info); mSortInfos.Add(info); } } } mSortInfos.Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } return(0); }); }
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); }); }
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); }); }