public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); _BoardMap = version >= 2 ? reader.ReadMap() : Map; _AllowPlayerConfiguration = version < 1 || reader.ReadBool(); State = (BoardGameState) reader.ReadInt(); _CostToPlay = reader.ReadInt(); CurrentMaxPlayers = reader.ReadInt(); _BoardWidth = reader.ReadInt(); _BoardHeight = reader.ReadInt(); GameZone = new Rectangle3D(new Point3D(reader.ReadInt(), reader.ReadInt(), reader.ReadInt()), new Point3D(reader.ReadInt(), reader.ReadInt(), reader.ReadInt())); _BoardOffset = new Point3D(reader.ReadInt(), reader.ReadInt(), reader.ReadInt()); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { Players.Add(reader.ReadMobile()); } count = reader.ReadInt(); for (int i = 0; i < count; i++) { BackgroundItems.Add((GamePiece) reader.ReadItem()); } if (_State == BoardGameState.Pending || _State == BoardGameState.Recruiting) { _State = BoardGameState.Inactive; _Players = null; } _BoardGameRegion = new BoardGameRegion(this); _BoardGameRegion.Register(); _SettingsReady = !_AllowPlayerConfiguration; }
//updates all game pieces position public virtual void UpdatePosition() { if (_BoardMap == null || _BoardMap == Map.Internal) { _BoardMap = Map; } foreach (GamePiece piece in BackgroundItems) { piece.UpdatePosition(); } if (_BoardGameRegion != null) { _BoardGameRegion.Unregister(); } _BoardGameRegion = new BoardGameRegion(this); _BoardGameRegion.Register(); }