改了一亿个东西,修了一亿个 BUG
This commit is contained in:
41
ReplayFile/Player.cs
Normal file
41
ReplayFile/Player.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AnotherReplayReader.ReplayFile
|
||||
{
|
||||
internal sealed class Player
|
||||
{
|
||||
public static readonly IReadOnlyDictionary<string, string> ComputerNames = new Dictionary<string, string>
|
||||
{
|
||||
{ "E", "简单" },
|
||||
{ "M", "中等" },
|
||||
{ "H", "困难" },
|
||||
{ "B", "凶残" },
|
||||
};
|
||||
|
||||
public string PlayerName { get; }
|
||||
public uint PlayerIp { get; }
|
||||
public int FactionId { get; }
|
||||
public int Team { get; }
|
||||
|
||||
public Player(string[] playerEntry)
|
||||
{
|
||||
var isComputer = playerEntry[0][0] == 'C';
|
||||
|
||||
PlayerName = playerEntry[0].Substring(1);
|
||||
|
||||
if (isComputer)
|
||||
{
|
||||
PlayerName = ComputerNames[PlayerName];
|
||||
PlayerIp = 0;
|
||||
FactionId = int.Parse(playerEntry[2]);
|
||||
Team = int.Parse(playerEntry[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerIp = uint.Parse(playerEntry[1], System.Globalization.NumberStyles.HexNumber);
|
||||
FactionId = int.Parse(playerEntry[5]);
|
||||
Team = int.Parse(playerEntry[7]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user