コード例 #1
0
ファイル: DBBuffSev.cs プロジェクト: wuhuolong/MaxBooks
    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);
    }
コード例 #2
0
ファイル: DBBattleFx.cs プロジェクト: wuhuolong/MaxBooks
    public BattleFxInfo GetBattleFxInfo(uint uiKey)
    {
        BattleFxInfo info;

        if (mBattleFxInfos.TryGetValue(uiKey, out info))
        {
            return(info);
        }

        string query_str = string.Format("SELECT * FROM {0} WHERE {1}=\"{2}\"", mTableName, "id", uiKey);
        var    reader    = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query_str);

        if (reader == null)
        {
            mBattleFxInfos[uiKey] = null;
            return(null);
        }

        if (!reader.HasRows || !reader.Read())
        {
            mBattleFxInfos[uiKey] = null;
            reader.Close();
            reader.Dispose();
            return(null);
        }

        info = new BattleFxInfo();

        uint id = DBTextResource.ParseUI(GetReaderString(reader, "id"));

        info.HitDelayTime = DBTextResource.ParseUS(GetReaderString(reader, "hit_time")) * GlobalConst.MilliToSecond;
        info.IsFlying     = DBTextResource.ParseUS(GetReaderString(reader, "is_flying")) == 1;
        info.FlyingAngle  = DBTextResource.ParseF(GetReaderString(reader, "flying_angle"));
        info.FlyingXSpeed = DBTextResource.ParseF(GetReaderString(reader, "flying_xspeed"));
        info.FlyingXFric  = DBTextResource.ParseF(GetReaderString(reader, "flying_xfric"));

        string under_attack_effect = GetReaderString(reader, "under_attack_effect");
        string under_attack_sound  = GetReaderString(reader, "under_attack_sound");

        if (under_attack_sound != string.Empty)
        {
            under_attack_sound = string.Format("{{0}.mp3", under_attack_sound);
        }

        if (!string.IsNullOrEmpty(under_attack_effect) || !string.IsNullOrEmpty(under_attack_sound))
        {
            info.BeattackEffectData              = new AnimationEffect.ResInitData();
            info.BeattackEffectData.BindNode     = GetReaderString(reader, "bind_node"); //"Bip001Pelvis";
            info.BeattackEffectData.Effect       = under_attack_effect;
            info.BeattackEffectData.Audio        = under_attack_sound;
            info.BeattackEffectData.EndTime      = (float)DBTextResource.ParseF_s(GetReaderString(reader, "under_attack_effect_lifetime"), 0) * 0.001f;
            info.BeattackEffectData.FollowTarget = DBTextResource.ParseUS_s(GetReaderString(reader, "follow_target"), 1) == 1;
            info.BeattackEffectData.AutoScale    = DBTextResource.ParseUS_s(GetReaderString(reader, "auto_scale"), 0) == 1;
        }

        mBattleFxInfos.Add(id, info);

        reader.Close();
        reader.Dispose();

        return(info);
    }