48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using static XPlugin.Data.JsonLiteDB.JsonLiteDB;
|
|
|
|
public class CombatUnitInfo
|
|
{
|
|
public int ID;
|
|
/// <summary>
|
|
/// 所属波次
|
|
/// </summary>
|
|
public int Belong;
|
|
public int[] EnemyTypeList;
|
|
|
|
public int Special;
|
|
public float BornTime;
|
|
|
|
public CombatUnitInfo(TableReader table)
|
|
{
|
|
ID = table["ID"].OptInt();
|
|
Belong = table["Belong"].OptInt();
|
|
EnemyTypeList = ParseStringToIntArray(table["EnemyType"].OptString());
|
|
BornTime = table["BornTime"].OptFloat();
|
|
}
|
|
|
|
public CombatUnitInfo(int curId,int curBelong, int[] curEnemyList,float curBornTime)
|
|
{
|
|
ID = curId;
|
|
Belong = curBelong;
|
|
EnemyTypeList = curEnemyList;
|
|
BornTime = curBornTime;
|
|
}
|
|
|
|
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;
|
|
}
|
|
} |