46 lines
1014 B
C#
46 lines
1014 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using static XPlugin.Data.JsonLiteDB.JsonLiteDB;
|
|
|
|
public class BulletData
|
|
{
|
|
public int ID;
|
|
|
|
public string Name;
|
|
|
|
public string Name_CN;
|
|
|
|
public int[] Damage;
|
|
|
|
public int Number;
|
|
|
|
public BulletData(TableReader table)
|
|
{
|
|
ID = table["ID"].OptInt();
|
|
Name = table["Name"].OptString();
|
|
Name_CN = table["Name_CN"].OptString();
|
|
string damage = table["Damage"].OptString();
|
|
Number = table["Number"].OptInt();
|
|
Damage = ParseStringToIntArray(damage);
|
|
}
|
|
|
|
int[] ParseStringToIntArray(string input)
|
|
{
|
|
if (input == "")
|
|
{
|
|
return null;
|
|
}
|
|
string[] elements = input.Replace("(", "").Replace(")", "").Split(',');
|
|
int[] intArray = new int[elements.Length];
|
|
|
|
for (int i = 0; i < elements.Length; i++)
|
|
{
|
|
intArray[i] = int.Parse(elements[i]);
|
|
}
|
|
|
|
return intArray;
|
|
}
|
|
|
|
}
|