protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } DamageEffectInfo effectInfo; while (reader.Read()) { effectInfo = new DamageEffectInfo(); effectInfo.ID = DBTextResource.ParseUI(GetReaderString(reader, "type_idx")); effectInfo.Target = (EffectTarget)DBTextResource.ParseUI(GetReaderString(reader, "target")); effectInfo.IsCombineValue = DBTextResource.ParseUI_s(GetReaderString(reader, "combine_value"), 0) == 1; mDamageEffectInfos.Add(effectInfo.ID, effectInfo); } }
public DBBuffInfo GetBuffInfo(uint uiID) { DBBuffInfo info = null; if (mBuffInfos.TryGetValue(uiID, out info)) { return(info); } string query_str = string.Format("SELECT * FROM {0} WHERE {1}=\"{2}\"", mTableName, "id", uiID); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query_str); if (reader == null) { mBuffInfos[uiID] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mBuffInfos[uiID] = null; reader.Close(); reader.Dispose(); return(null); } var buff_info = new Buff.BuffInfo(); buff_info.buff_id = DBTextResource.ParseUI(GetReaderString(reader, "id")); buff_info.is_show_tip = DBTextResource.ParseUI(GetReaderString(reader, "is_show_tip")) == 1; buff_info.max_add_num = DBTextResource.ParseUS(GetReaderString(reader, "max_layer")); buff_info.add_eff = DBTextResource.ParseArrayUint(GetReaderString(reader, "add_eff"), ","); buff_info.delay_time = DBTextResource.ParseUI_s(GetReaderString(reader, "delay_time"), 0) * 0.001f; buff_info.shape_shift = DBTextResource.ParseUI_s(GetReaderString(reader, "transform"), 0); buff_info.shift_state = DBTextResource.ParseBT_s(GetReaderString(reader, "shift_state"), 0); buff_info.life_time = 3.0f;//buff的时间由服务端发送下来 buff_info.name = GetReaderString(reader, "name"); buff_info.icon = GetReaderString(reader, "icon"); buff_info.effect_file = GetReaderString(reader, "effect_file"); buff_info.priority = DBTextResource.ParseUS_s(GetReaderString(reader, "priority"), 0); buff_info.force_show = DBTextResource.ParseUS_s(GetReaderString(reader, "force_show"), 0) == 1; buff_info.other_hide = DBTextResource.ParseUS_s(GetReaderString(reader, "other_hide"), 0) == 1; buff_info.bind_pos = (BindPos)DBTextResource.ParseUI(GetReaderString(reader, "bind_pos")); buff_info.follow_target = DBTextResource.ParseUI_s(GetReaderString(reader, "follow_target"), 1) == 1; buff_info.scale = DBTextResource.ParseF_s(GetReaderString(reader, "scale"), 1.0f); buff_info.auto_scale = DBTextResource.ParseUS_s(GetReaderString(reader, "auto_scale"), 0) == 1; buff_info.des = GetReaderString(reader, "des"); buff_info.hide_countDown = DBTextResource.ParseUS_s(GetReaderString(reader, "hide_countDown"), 0) == 1; var max_count = GetReaderString(reader, "max_count"); if (string.IsNullOrEmpty(max_count)) { buff_info.max_count = 5; } else { buff_info.max_count = DBTextResource.ParseI_s(max_count, 5); } string status = GetReaderString(reader, "status");// buff的特殊状态 BattleStatusType status_type = Buff.GetBattleState(status); if (status_type != BattleStatusType.BATTLE_STATUS_TYPE_INVALID) { buff_info.battle_effect_type = status_type; Bind(buff_info, BuffEffect.BattleStateChangeBegin, BuffEffect.BattleStateChangeEnd, null); } if (buff_info.shape_shift != 0) { Bind(buff_info, BuffEffect.ShapeShiftBegin, BuffEffect.ShapeShiftEnd, null); } // 设置周期更新时间 buff_info.period_time = Mathf.Infinity; buff_info.buff_flags |= (ushort)Buff.BuffFlags.AF_RECOVERY_AFTER_DIE; mBuffInfos.Add(buff_info.buff_id, buff_info); reader.Close(); reader.Dispose(); return(buff_info); }