示例#1
0
    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);
    }