private Change ( int index, Ship ship ) : Ship | ||
index | int | 編成を変更する艦のインデックス。通常は 0 ~ 5、旗艦以外をすべて外す場合は -1。 |
ship | Ship | 艦隊の |
return | Ship |
internal Ship Change(int index, Ship ship)
{
var current = this.originalShips[index];
List<Ship> list;
if (index == -1)
{
list = this.originalShips.Take(1).ToList();
}
else
{
list = this.originalShips.ToList();
list[index] = ship;
list.RemoveAll(x => x == null);
}
var ships = new Ship[this.originalShips.Length];
Array.Copy(list.ToArray(), ships, list.Count);
this.UpdateShips(ships);
return current;
}