List <HangInfo.TagInfo> ParseTagList(string str) { List <HangInfo.TagInfo> tagList = new List <HangInfo.TagInfo>(); tagList.Clear(); List <string> tagStrs = DBTextResource.ParseArrayString(str); uint index = 1; foreach (string tagStr in tagStrs) { HangInfo.TagInfo tagInfo = new HangInfo.TagInfo(); tagInfo.Index = index; var matches = Regex.Matches(tagStr, @"([_a-zA-Z]+)_(\d+)"); foreach (Match match in matches) { tagInfo.Type = match.Groups[1].Value; tagInfo.Id = DBTextResource.ParseUI(match.Groups[2].Value); } tagList.Add(tagInfo); index++; } return(tagList); }
public static List <string> GetStringList(string key) { string raw = GetString(key); // string[] splits = raw.Split('[', ']', ','); // List<string> lst = new List<string>(); // foreach (string s in splits) // { // lst.Add(s); // } // return lst; return(DBTextResource.ParseArrayString(raw)); }
public DBGuildTotemItem GetOneItem(uint lv) { DBGuildTotemItem info; if (mInfos.TryGetValue(lv, out info)) { return(info); } string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "lv", lv); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { mInfos[lv] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mInfos[lv] = null; reader.Close(); reader.Dispose(); return(null); } info = new DBGuildTotemItem(); info.Lv = DBTextResource.ParseUI_s(GetReaderString(reader, "lv"), 0); info.Exp = DBTextResource.ParseUL_s(GetReaderString(reader, "exp"), 0); info.Buffs = DBTextResource.ParseArrayUint(GetReaderString(reader, "buffs"), ","); info.Descs = DBTextResource.ParseArrayString(GetReaderString(reader, "descs")); info.NextOffsetDescs = DBTextResource.ParseArrayString(GetReaderString(reader, "next_offset_descs")); mInfos.Add(info.Lv, 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; } SysConfig config = null; while (reader.Read()) { var id = DBTextResource.ParseUI(GetReaderString(reader, "sys_id")); config = new SysConfig(id); var sys_title = GetReaderString(reader, "sys_title"); var level = DBTextResource.ParseUS_s(GetReaderString(reader, "lv_open"), 0); string taskTypeStr = GetReaderString(reader, "task_limit"); if (string.IsNullOrEmpty(taskTypeStr)) { taskTypeStr = "0"; } var task_type = (ESysTaskType)Enum.Parse(typeof(ESysTaskType), taskTypeStr); var task_id = DBTextResource.ParseUI_s(GetReaderString(reader, "task_args"), 0); string positionStr = GetReaderString(reader, "position"); if (string.IsNullOrEmpty(positionStr)) { positionStr = "0"; } var pos = (ESysBtnPos)Enum.Parse(typeof(ESysBtnPos), positionStr); uint sub_pos = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_pos"), 0); string fixedPosStr = GetReaderString(reader, "fixed_pos"); if (string.IsNullOrEmpty(fixedPosStr)) { fixedPosStr = "0"; } var is_fixed = (ESysBtnFixType)DBTextResource.ParseUI_s(fixedPosStr, 1); bool show_bg = DBTextResource.ParseUI_s(GetReaderString(reader, "show_bg"), 0) == 1; uint is_activity = DBTextResource.ParseUI_s(GetReaderString(reader, "is_activity"), 0); var desc = GetReaderString(reader, "desc"); var btn_sprite = GetReaderString(reader, "btn_spr"); var btn_text = GetReaderString(reader, "btn_text"); var sort_order = DBTextResource.ParseBT_s(GetReaderString(reader, "sort_order"), 0); var transfer_limit = DBTextResource.ParseUI_s(GetReaderString(reader, "transfer_limit"), 0); var not_open_tips = GetReaderString(reader, "not_open_tips"); var main_ui_btn_id = DBTextResource.ParseUI_s(GetReaderString(reader, "main_ui_btn_id"), 0); config.Init(level, task_type, task_id, pos, sub_pos, is_fixed, show_bg, is_activity == 1, desc, btn_sprite, btn_text, sort_order, transfer_limit, not_open_tips, sys_title, main_ui_btn_id); config.NeedAnim = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_anim"), 0) == 0 ? false : true; if (pos == ESysBtnPos.NONE) // 当在主ui上没有按钮图标的时候,也一定不需要播放开启的动画 { if (config.NeedAnim) { config.NeedAnim = false; GameDebug.LogError(string.Format("sys:{0} 在主ui上没有图标, 却配置了开启动画", id)); } } config.InitNeedShow = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_show"), 0) == 0 ? false : true; config.PatchId = DBTextResource.ParseI_s(GetReaderString(reader, "patch_id"), 0); config.HideBtnWhenActNotOpen = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_btn_when_act_not_open"), 0) == 0 ? false : true; config.SysIdClosePresent = DBTextResource.ParseUI_s(GetReaderString(reader, "sys_id_close_present"), 0); // 如果有系统开放关联配置,需要将数据存在另外的字典中 if (config.SysIdClosePresent != 0) { List <uint> notifySysIdList = null; if (!mConfigRelation.TryGetValue(config.SysIdClosePresent, out notifySysIdList)) { notifySysIdList = new List <uint>(); mConfigRelation[config.SysIdClosePresent] = notifySysIdList; } if (!notifySysIdList.Contains(config.Id)) { notifySysIdList.Add(config.Id); } } config.TabOrder = DBTextResource.ParseUI_s(GetReaderString(reader, "tab_order"), 0); config.DropDown = DBTextResource.ParseArrayUint(GetReaderString(reader, "drop_down"), ","); config.DropDownType = DBTextResource.ParseUI(GetReaderString(reader, "drop_down_type")); config.UIBehavior = DBTextResource.ParseArrayString(GetReaderString(reader, "ui_behavior")); config.TimeLimitStr = GetReaderString(reader, "time_limit"); config.CustomCondition = DBTextResource.ParseUI_s(GetReaderString(reader, "custom_condition"), 0) == 0 ? false : true; mConfigList.Add(config); mConfigMap[config.Id] = config; } mConfigList.Sort(); }
/// <summary> /// 获取某个副本的信息 /// </summary> /// <returns>The instance info.</returns> /// <param name="id">Identifier.</param> public InstanceInfo GetInstanceInfo(uint id) { InstanceInfo info = null; if (mInstanceInfos.TryGetValue(id, out info)) { return(info); } string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id.ToString()); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, queryStr); if (table_reader == null) { mInstanceInfos.Add(id, null); return(null); } if (!table_reader.HasRows) { mInstanceInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } if (!table_reader.Read()) { mInstanceInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } info = new InstanceInfo(); Type gameConstType = typeof(GameConst); info.mId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "id"), 0); info.mMaxTime = DBTextResource.ParseI(GetReaderString(table_reader, "max_time")); info.mNeedGoods = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "need_goods")); info.mDyNeedGoods = DBTextResource.ParseArrayUintUint(GetReaderString(table_reader, "dy_need_goods")); info.mNeedLv = DBTextResource.ParseUS_s(GetReaderString(table_reader, "need_lv"), 0); info.mLvUpLimit = DBTextResource.ParseUS_s(GetReaderString(table_reader, "lv_up_limit"), 0); info.mRecommendAttrs = ParseRecommendAttrs(GetReaderString(table_reader, "recommend_attrs")); info.mSingleEnter = DBTextResource.ParseI(GetReaderString(table_reader, "single_enter")) == 1 ? true : false; string mbCountStr = GetReaderString(table_reader, "mb_count"); ushort mbCount = 0; /* 进入人数四种要求: * 0:可单人,也可以任意组队(不用配) * 1:必须单人(可以没有队伍,也可以在只有他一个人的队伍中) * N(N>=2):必须N人以上组队 * {M,N}:大于等于M且小于等于N */ if (string.IsNullOrEmpty(mbCountStr) == true) { info.mMinMemberCount = 0; info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } else if (ushort.TryParse(mbCountStr, out mbCount) == true) { info.mMinMemberCount = mbCount; if (info.mMinMemberCount == 0) { info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } else if (info.mMinMemberCount == 1) { info.mMinMemberCount = 0; info.mMaxMemberCount = 1; } else { info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } } else { List <uint> mbCountList = DBTextResource.ParseArrayUint(mbCountStr, ","); if (mbCountList.Count >= 2) { info.mMinMemberCount = (ushort)mbCountList[0]; info.mMaxMemberCount = (ushort)mbCountList[1]; } } info.mSweepCosts = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "sweep_costs")); info.mSweepLimit = DBTextResource.ParseVector2(GetReaderString(table_reader, "sweep_limit")); info.mName = GetReaderString(table_reader, "name"); //System.Reflection.FieldInfo fieldInfo = null; //string warTypeStr = GetReaderString(table_reader, "war_type"); //if (mGameConstUintValueCache.ContainsKey(warTypeStr) == true) //{ // info.mWarType = mGameConstUintValueCache[warTypeStr]; //} //else //{ // fieldInfo = gameConstType.GetField(warTypeStr); // if (fieldInfo != null) // { // info.mWarType = Convert.ToUInt32(fieldInfo.GetValue(null)); // mGameConstUintValueCache[warTypeStr] = info.mWarType; // } // else // { // GameDebug.LogError("Can not find war type " + warTypeStr + " in db instance!!!"); // } //} //string warsubTypeStr = GetReaderString(table_reader, "war_subtype"); //if (string.IsNullOrEmpty(warsubTypeStr) == false) //{ // if (mGameConstUintValueCache.ContainsKey(warsubTypeStr) == true) // { // info.mWarSubType = mGameConstUintValueCache[warsubTypeStr]; // } // else // { // fieldInfo = gameConstType.GetField(warsubTypeStr); // if (fieldInfo != null) // { // info.mWarSubType = Convert.ToUInt32(fieldInfo.GetValue(null)); // mGameConstUintValueCache[warsubTypeStr] = info.mWarSubType; // } // else // { // GameDebug.LogError("Can not find sub war type " + warsubTypeStr + " in db instance!!!"); // } // } //} uint warType = 0; uint warSubType = 0; string warTypeStr = GetReaderString(table_reader, "war_type"); string warSubTypeStr = GetReaderString(table_reader, "war_subtype"); ConvertWarType(warTypeStr, warSubTypeStr, out warType, out warSubType); info.mWarType = warType; info.mWarSubType = warSubType; info.mDesc = GetReaderString(table_reader, "desc"); info.mStages.Clear(); string stagesStr = GetReaderString(table_reader, "stages"); List <string> stages = DBTextResource.ParseArrayString(stagesStr); for (int j = 0; j < stages.Count; j++) { if (!String.IsNullOrEmpty(stages[j])) { info.mStages.Add(DBTextResource.ParseUI(stages[j])); } } info.mPKType = DBTextResource.ParseI(GetReaderString(table_reader, "pk_type")); info.mReviveTimes = DBTextResource.ParseUS(GetReaderString(table_reader, "revive_times")); info.mReadyCountDown = DBTextResource.ParseUS(GetReaderString(table_reader, "ready_count_down")); info.mResultCountDown = DBTextResource.ParseUI(GetReaderString(table_reader, "result_count_down")); info.mIsReloadSceneWhenTheSame = DBTextResource.ParseI(GetReaderString(table_reader, "is_reload_scene_when_the_same")) == 0 ? false : true; info.mMinPos = DBTextResource.ParseVector2(GetReaderString(table_reader, "mini_map_pos_x")); info.mMaxPos = DBTextResource.ParseVector2(GetReaderString(table_reader, "mini_map_pos_y")); info.mMiniMapWidth = info.mMaxPos.x - info.mMinPos.x; info.mMiniMapHeight = info.mMaxPos.y - info.mMinPos.y; info.mMiniMapName = GetReaderString(table_reader, "mini_map"); info.mIsCanOpenMiniMap = DBTextResource.ParseI(GetReaderString(table_reader, "is_open_mini_map")) == 0 ? false : true; string isShowMarkStr = GetReaderString(table_reader, "is_show_mark"); if (isShowMarkStr == string.Empty || isShowMarkStr == "0") { info.mIsShowMark = false; } else { info.mIsShowMark = true; } string isAutoFightStr = GetReaderString(table_reader, "is_auto_fight"); if (isAutoFightStr == string.Empty || isAutoFightStr == "0") { info.mIsAutoFight = false; } else { info.mIsAutoFight = true; } string canNotRideStr = GetReaderString(table_reader, "can_not_ride"); if (canNotRideStr == string.Empty || canNotRideStr == "0") { info.mCanNotRide = false; } else { info.mCanNotRide = true; } info.mRewardIds = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "reward_1"), ","); info.mShowRewardIds = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "show_rewards"), ","); info.mNeedTaskId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "need_task_id"), 0); info.mPlanesInstanceId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "planes_dg_id"), 0); info.mStartTimeline = DBTextResource.ParseUI_s(GetReaderString(table_reader, "start_timeline"), 0); info.mGuardedNpcId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "npc_id"), 0); string showBossAssStr = GetReaderString(table_reader, "show_boss_assistant"); if (showBossAssStr == string.Empty || showBossAssStr == "0") { info.mShowBossAssistant = false; } else { info.mShowBossAssistant = true; } info.mForbidJumpOutAnimationOut = DBTextResource.ParseUI_s(GetReaderString(table_reader, "forbid_jump_out_animation_out"), 0) == 1; info.mForbidWaterWaveEffect = DBTextResource.ParseUI_s(GetReaderString(table_reader, "forbid_water_wave_effect"), 0) == 1; info.mIsCanSendPosition = DBTextResource.ParseUI_s(GetReaderString(table_reader, "is_can_send_position"), 0) == 1; info.mMergeLevel = DBTextResource.ParseUI_s(GetReaderString(table_reader, "merge_level"), 0); info.mMergeConsume = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "merge_consume")); #if UNITY_EDITOR if (mInstanceInfos.ContainsKey(info.mId)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, info.mId)); table_reader.Close(); table_reader.Dispose(); return(info); } #endif mInstanceInfos.Add(info.mId, info); table_reader.Close(); table_reader.Dispose(); return(info); }
public static void ResponseClickEmojiTextHref(string origText) { if (origText.Contains("goodsOid")) { string idStr = origText.Replace("goodsOid=", ""); var matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; //GameDebug.LogError("=============== OnClickHref test"); Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } //兼容3个参数和2个参数 matchs = Regex.Matches(idStr, @"\{(\d+),(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); ulong goodsGid = DBTextResource.ParseUL_s(_match.Groups[3].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; pack.gid = (uint)goodsGid; Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } } else if (origText.Contains("teamId")) { var idStr = origText.Replace("teamId=", ""); var teamId = uint.Parse(idStr); TeamManager.Instance.Apply(teamId); } else if (origText.Contains("playerId")) {//查看玩家 var idStr = origText.Replace("playerId=", ""); List <string> param_list = DBTextResource.ParseArrayString(idStr, ";"); if (param_list.Count >= 5) { // 不能查看玩家自己的信息 if (param_list[0].Equals(LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx.ToString()) == false) { Dictionary <string, string> playerInfo = new Dictionary <string, string>(); playerInfo.Clear(); playerInfo.Add("uuid", param_list[0]); xc.ui.ugui.UIManager.Instance.ShowWindow("UIWatchPlayerWindow", playerInfo); } } else { GameDebug.LogError("playerId param is error! idStr = " + idStr); } } else if (origText.Contains("jumpSysId=")) {//跳转系统ID var idStr = origText.Replace("jumpSysId=", ""); List <string> param_list = DBTextResource.ParseArrayString(idStr, ";"); if (param_list.Count >= 1) { uint sys_id = 0; if (uint.TryParse(param_list[0], out sys_id)) { if (LuaScriptMgr.Instance != null) { XLua.LuaFunction func = LuaScriptMgr.Instance.GetLuaFunction(LuaScriptMgr.Instance.Lua.Global, "GotoSysRouter_chatItem"); if (func != null) { func.Action(param_list); } } } } else { GameDebug.LogError("jumpSysId param is error! idStr = " + idStr); } } else if (origText.Contains("clientGoodsTips")) {//客户端拼凑的物品TIPS string idStr = origText; //var idStr = origText.Replace("clientGoodsTips=", ""); var matchs = Regex.Matches(origText, @"clientGoodsTips=\{(.+)\}"); foreach (Match _match in matchs) { if (_match.Success) { idStr = _match.Groups[1].Value; } } Goods item_info = xc.GoodsHelper.ParseClientGoodsStr(idStr); if (item_info != null) { GoodsHelper.ShowGoodsTips(item_info, null, null, "GuildWarehouseNormal"); } else { GameDebug.LogError("playerId param is error! idStr = " + idStr); } } else if (origText.Contains("enter_guild_manor")) {//进入帮派领地 if (SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_GUILD, true)) { if (LocalPlayerManager.Instance.GuildID > 0) { InstanceHelper.EnterGuildManor(); } else { xc.UINotice.Instance.ShowMessage(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_77")); xc.ui.ugui.UIManager.GetInstance().ShowSysWindow("UIGuildWindow"); } } } else if (origText.Contains("goodsTips")) {//查看物品 string idStr = origText.Replace("goodsTips=", ""); var matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; //GameDebug.LogError("=============== OnClickHref test"); Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } } else if (origText.Contains("goodsGid")) { var matchs = Regex.Matches(origText, @"goodsGid=\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { //uint playerId = (DBTextResource.ParseUI(_match.Groups[1].Value)); uint goodsGid = DBTextResource.ParseUI(_match.Groups[2].Value); var goods = GoodsHelper.CreateGoodsByTypeId(goodsGid); if (goods != null) { GoodsHelper.ShowGoodsTips(goods); } } } } else if (origText.Contains("position=")) { var matchs = Regex.Matches(origText, @"position=\{(\d+),(\d+),(\d+\.?\d*),(\d+\.?\d*)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint instanceId = DBTextResource.ParseUI(_match.Groups[1].Value); uint line = DBTextResource.ParseUI(_match.Groups[2].Value); float x = DBTextResource.ParseF(_match.Groups[3].Value); float z = DBTextResource.ParseF(_match.Groups[4].Value); ClientEventMgr.GetInstance().FireEvent( (int)ClientEvent.CE_CHAT_JUMP_TO_CONST_POSITION, new CEventEventParamArgs(instanceId, line, x, z)); } } } else if (origText.Contains("marketGoodsTips")) { var matchs = Regex.Matches(origText, @"marketGoodsTips=\{(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint goodsOid = DBTextResource.ParseUI(_match.Groups[1].Value); Net.C2SMarketDetail pack = new Net.C2SMarketDetail(); pack.oid = goodsOid; Net.NetClient.GetBaseClient().SendData <Net.C2SMarketDetail>(xc.protocol.NetMsg.MSG_MARKET_DETAIL, pack); } } } else { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHAT_RESPONSE_CLICK_TEXT_HREF, new CEventEventParamArgs(origText)); } }
/// <summary> /// 获取表格中的技能数据 /// </summary> public SkillInfoSev GetSkillInfo(uint skill_id) { SkillInfoSev skill_info = null; if (!mSkillInfoMap.TryGetValue(skill_id, out skill_info)) { string query_str = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", "data_skill", "id", skill_id); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, "data_skill", query_str); if (table_reader == null) { mSkillInfoMap[skill_id] = null; return(null); } if (!table_reader.HasRows || !table_reader.Read()) { mSkillInfoMap[skill_id] = null; table_reader.Close(); table_reader.Dispose(); return(null); } skill_info = new SkillInfoSev(); skill_info.Id = DBTextResource.ParseUI(GetReaderString(table_reader, "id")); skill_info.IsPg = DBTextResource.ParseUS_s(GetReaderString(table_reader, "is_pg"), 0) == 1; skill_info.FindTargetType = DBTextResource.ParseUS_s(GetReaderString(table_reader, "find_target"), 1); skill_info.FindTarget = skill_info.FindTargetType != 0; skill_info.TargetLimit = GetReaderString(table_reader, "target_limit"); skill_info.IsTrigger = GetReaderString(table_reader, "action_type") != "active"; skill_info.CDTime = DBTextResource.ParseUI_s(GetReaderString(table_reader, "cd"), 0); skill_info.Range = DBTextResource.ParseUI_s(GetReaderString(table_reader, "range"), 0) * 0.01f - 0.5f; // 因为服务端减少了容错,攻击范围变得更小了,所以这里减0.5 skill_info.Range = Mathf.Max(0f, skill_info.Range); skill_info.MpCost = DBTextResource.ParseI_s(GetReaderString(table_reader, "cost"), 0); skill_info.Target = GetReaderString(table_reader, "target"); skill_info.ForwardSpeed = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "forward_move_speed"), 0) * 0.01f; skill_info.ForwardTime = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "forward_move_time"), 0) * GlobalConst.MilliToSecond; skill_info.MaxSingTime = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "max_sing_time"), 0) * GlobalConst.MilliToSecond; skill_info.CastingSpeed = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "casting_move_speed"), 0) * 0.01f; skill_info.CastingTime = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "casting_move_time"), 0) * GlobalConst.MilliToSecond; skill_info.BulletId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "bullet_id"), 0); skill_info.ParentSkillId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "parent_skill"), 0); skill_info.ChildSkillId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "child_skill"), 0); skill_info.AnimationName = GetReaderString(table_reader, "skill_ani"); skill_info.Sound = GetReaderString(table_reader, "skill_sound"); skill_info.CastingReadyName = GetReaderString(table_reader, "skill_sing_ani"); skill_info.CastingAnimationName = GetReaderString(table_reader, "skill_casting_ani"); skill_info.CastingEndAnimationName = GetReaderString(table_reader, "skill_casting_end_ani"); skill_info.RigidityTime = DBTextResource.ParseUS_s(GetReaderString(table_reader, "rigidity_time"), 0) * GlobalConst.MilliToSecond; skill_info.CacheTime = DBTextResource.ParseUS_s(GetReaderString(table_reader, "cache_time"), 0) * GlobalConst.MilliToSecond; skill_info.SkillAnnounce = GetReaderString(table_reader, "skill_announce"); skill_info.CostFury = DBTextResource.ParseUI_s(GetReaderString(table_reader, "cost_fury"), 0); skill_info.GenFury = DBTextResource.ParseUI_s(GetReaderString(table_reader, "gen_fury"), 0); skill_info.IsFalseHitBack = DBTextResource.ParseUS_s(GetReaderString(table_reader, "isFalseHitBack"), 0) == 1; skill_info.UiEffectIconList = DBTextResource.ParseArrayString(GetReaderString(table_reader, "ui_effect_icon_list"), ",", true); skill_info.UiEffectSoundName = GetReaderString(table_reader, "ui_effect_sound"); string[] ratios = TextHelper.GetTupleFromString(GetReaderString(table_reader, "multi_hit_ratio")); if (ratios != null) { skill_info.MultiHitRatios = new List <float>(); for (int j = 0; j < ratios.Length; ++j) { float ratio = DBTextResource.ParseF(ratios[j]); skill_info.MultiHitRatios.Add(ratio); } } string[] delays = TextHelper.GetTupleFromString(GetReaderString(table_reader, "multi_hit_delay")); if (delays != null) { skill_info.MultiHitDelayTimes = new List <float>(); for (int j = 0; j < delays.Length; ++j) { float delay = DBTextResource.ParseF(delays[j]); skill_info.MultiHitDelayTimes.Add(delay); } } if (skill_info.MultiHitDelayTimes != null && skill_info.MultiHitDelayTimes.Count != skill_info.MultiHitRatios.Count) { string log = string.Format("SkillId: {0} 多段伤害系数与延迟时间不匹配", skill_info.Id); Debug.LogError(log); } string[] effects = TextHelper.GetTupleFromString(GetReaderString(table_reader, "effects")); // 先把table_reader关闭,因为在GetBattleFxInfo和GetSkillEffectInfo中需要获取新的Reader table_reader.Close(); table_reader.Dispose(); // 获取技能特效参数 DBBattleFx.BattleFxInfo battleInfo = DBBattleFx.Instance.GetBattleFxInfo(skill_info.Id); if (battleInfo != null) { skill_info.BattleFxInfo = battleInfo; } else { if (skill_info.IsTrigger == false)// 非触发类型的技能才需要战斗效果信息 { GameDebug.LogError(string.Format("Skill: {0}没有对应的战斗效果信息", skill_info.Id)); } } // 追踪目标类型的子弹(依赖于battleInfo,所以要放在battleInfo数据读取之后) if (skill_info.BulletId != 0 && skill_info.IsTrigger == false) { DBBulletTrace.BulletInfo bulletInfo = DBBulletTrace.GetInstance().GetBulletInfo(skill_info.BulletId); if (bulletInfo != null) { skill_info.BulletTrace = new BulletTrackInstance(bulletInfo, skill_info); } } // 获取技能效果参数 if (effects != null) { for (int j = 0; j < effects.Length; ++j) { uint effectId = DBTextResource.ParseUI(effects[j]); var effect_info = DBSkillEffect.GetInstance().GetSkillEffectInfo(effectId); if (effect_info == null) { string log = string.Format("SkillId: {0} 对应的技能效果Id: {1} 错误", skill_info.Id, effectId); Debug.LogError(log); } else { if (effect_info.type == "charge" || effect_info.type == "teleport")// 冲锋、瞬移技能的移动速度参数放在效果表中配置 { skill_info.CastingSpeed = effect_info.p1 * GlobalConst.UnitScale; if (effect_info.type == "teleport") { skill_info.Invisible = true; } } } } } mSkillInfoMap[skill_info.Id] = skill_info; } return(skill_info); }