示例#1
0
            public void Update(bool extraSurrounding)
            {
                ulong steamId;

                if (SteamId == null || !ulong.TryParse(SteamId, out steamId))
                {
                    throw new InvalidDataException(
                              $"The Steam ID ({SteamId ?? "NULL"}) for the zone '{Name}' is invalid.");
                }
                var identity = GameManager.Instance.GetIdentity(steamId);

                if (identity == null)
                {
                    throw new InvalidDataException($"Couldn't find the Identity for {SteamId} in the zone '{Name}'.");
                }
                if (MainCell <= 0)
                {
                    throw new InvalidDataException(
                              $"The Cell ({SteamId ?? "NULL"}) for the zone '{Name}' is invalid.");
                }
                var cluster = BuildConnectedOwnedCellCluster(identity, MainCell);

                Stakes.Clear();
                foreach (var cell in cluster)
                {
                    var stake = GetStakeOnCell(cell);
                    if (stake != null)
                    {
                        Stakes.Add(stake);
                    }
                }
                if (extraSurrounding)
                {
                    var surroundingCells = GetUniqueSurroundingUnownedCells(cluster);
                    foreach (var surroundingCell in surroundingCells)
                    {
                        cluster.Add(surroundingCell);
                    }
                }
                Bounds.Clear();
                AllCells.Clear();
                foreach (var cell in cluster)
                {
                    Bounds.Add(GetCellBounds(cell));
                    AllCells.Add(cell);
                }
            }
示例#2
0
 /// <summary>
 /// Empties the Worksheet
 /// </summary>
 internal void ClearCells()
 {
     AllCells.Clear();
     Columns.ColumnsList.Clear();
     Rows.Clear();
 }