コード例 #1
0
    private static bool _LoadDataBase(string tablePath, ref Dictionary <int, WeaponInfo> Info)
    {
        Info.Clear();
        TextAsset datas = Resources.Load <TextAsset>(tablePath);

        if (datas != null)
        {
            string[] lines = datas.text.Split('\n');
            for (int i = 1; i < lines.Length - 1; i++)
            {
                string[]   weaponInfo = lines[i].Split(',');
                WeaponInfo data       = new WeaponInfo();
                data.SetID(int.Parse(weaponInfo[0]));
                data.SetType(int.Parse(weaponInfo[1]));
                data.SetTitle(weaponInfo[2]);
                data.SetDamage(float.Parse(weaponInfo[3]));
                data.SetExplosion(float.Parse(weaponInfo[4]));
                data.SetFireRate(float.Parse(weaponInfo[5]));
                data.SetCapacity(int.Parse(weaponInfo[6]));
                data.SetStart_Mags(int.Parse(weaponInfo[7]));
                data.SetMax_Mags(int.Parse(weaponInfo[8]));
                data.SetEmpty_Reload_Speed(float.Parse(weaponInfo[9]));
                data.SetTactical_Reload_Speed(float.Parse(weaponInfo[10]));
                data.SetMin_Spread(float.Parse(weaponInfo[11]));
                data.SetMax_Spread(float.Parse(weaponInfo[12]));
                data.SetSpread_Increase_per_shot(float.Parse(weaponInfo[13]));
                data.SetRange(float.Parse(weaponInfo[14]));
                data.SetFireMode(float.Parse(weaponInfo[15]));
                data.SetName(weaponInfo[16]);
                data.SetImage(weaponInfo[17]);
                data.SetCost(int.Parse(weaponInfo[18]));
                Info.Add(data.ID, data);
            }
            return(true);
        }
        return(false);
    }
コード例 #2
0
 public void CopyTo(WeaponInfo other)
 {
     other.SetID(this.ID);
     other.SetType(this.Type);
     other.SetTitle(this.Title);
     other.SetDamage(this.Damage);
     other.SetExplosion(this.Explosion_Damage);
     other.SetFireRate(this.FirePerMinute);
     other.SetCapacity(this.Capacity);
     other.SetStart_Mags(this.Start_Mags);
     other.SetMax_Mags(this.Max_Mags);
     other.SetEmpty_Reload_Speed(this.ReloadSpeed);
     other.SetTactical_Reload_Speed(this.Tactical_Reload_Speed);
     other.SetMin_Spread(this.Min_Spread);
     other.SetMax_Spread(this.Max_Spread);
     other.SetSpread_Increase_per_shot(this.Spread_Increase_per_shot);
     other.SetRange(this.Range);
     other.SetFireMode(this.FireMode);
     other.SetName(this.Name);
     other.SetImage(this.Image);
     other.SetCost(this.Cost);
     other.Ammo = this.Ammo;
     other.Mags = this.Mags;
 }