//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(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); if( version >= 2 ) { _BoardMap = reader.ReadMap(); } else { _BoardMap = Map; } if( version >= 1 ) { _AllowPlayerConfiguration = reader.ReadBool(); } else { _AllowPlayerConfiguration = true; } 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; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch( version ) { case 3: { _AllowBaddaBoomUpgrade = reader.ReadBool(); _AllowSpeedUpgrade = reader.ReadBool(); _AllowBlastStrengthUpgrade = reader.ReadBool(); _AllowDetonatorUpgrade = reader.ReadBool(); goto case 2; } case 2: { _BoardMap = reader.ReadMap(); goto case 1; } case 1: { _AllowPlayerConfiguration = reader.ReadBool(); goto case 0; } case 0: { 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; break; } } }