mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
30 lines
674 B
C#
30 lines
674 B
C#
using System;
|
|
[Serializable]
|
|
public class DragonSlayer
|
|
{
|
|
public int Id;
|
|
public string Name;
|
|
public string Des;
|
|
public override string ToString()
|
|
{
|
|
return Id + "," + Name + "," + Des;
|
|
}
|
|
public static DragonSlayer Parser(string data)
|
|
{
|
|
if (string.IsNullOrEmpty(data))
|
|
{
|
|
return null;
|
|
}
|
|
DragonSlayer slayer = new DragonSlayer();
|
|
|
|
string[] split = data.Trim().Split(',');
|
|
if (split.Length < 3)
|
|
{
|
|
return null;
|
|
}
|
|
int.TryParse(split[0], out slayer.Id);
|
|
slayer.Name = split[1];
|
|
slayer.Des = split[2];
|
|
return slayer;
|
|
}
|
|
} |