68 lines
1.6 KiB
C#
68 lines
1.6 KiB
C#
using static XPlugin.Data.JsonLiteDB.JsonLiteDB;
|
|
|
|
public enum EnemyType
|
|
{
|
|
EnemyTa=1,//敌人哨塔
|
|
Marksman = 2,//卫兵
|
|
DropShip = 3,//运载机
|
|
Leviathan = 4,//利维坦
|
|
Sentry = 5,//飞行哨兵
|
|
MachineDragon = 6,//机械霸王龙
|
|
Pioneer = 7,//铁爪先锋
|
|
Boss = 8//最终Boss
|
|
}
|
|
|
|
public class EnemyData
|
|
{
|
|
public int Id;
|
|
public string Name;
|
|
public string NameCN;
|
|
public int Atk;
|
|
public int Speed;
|
|
public float Rate;
|
|
public float Hp;
|
|
|
|
//怪物简介
|
|
|
|
public string EnemyDesc;
|
|
|
|
public int[] DescInfos;
|
|
|
|
|
|
public EnemyData(TableReader table)
|
|
{
|
|
Id = table["EnemyId"].OptInt();
|
|
Name = table["Name"].OptString();
|
|
NameCN = table["Name_CN"].OptString();
|
|
Atk = table["Atk"].OptInt();
|
|
Speed = table["Speed"].OptInt();
|
|
Rate = table["Rate"].OptFloat();
|
|
Hp = table["Hp"].OptFloat();
|
|
|
|
EnemyDesc = table["EnemyDesc"].OptString();
|
|
string descInfos = table["DescInfo"].OptString();
|
|
DescInfos = ParseStringToIntArray(descInfos);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|