Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            int length = reader.ReadInt();

            m_Tiles = new MahjongTile[length];

            for (int i = 0; i < length; i++)
            {
                m_Tiles[i] = new MahjongTile(this, reader);
            }

            m_DealerIndicator = new MahjongDealerIndicator(this, reader);

            m_WallBreakIndicator = new MahjongWallBreakIndicator(this, reader);

            m_Dices = new MahjongDices(this, reader);

            m_Players = new MahjongPlayers(this, reader);

            m_ShowScores      = reader.ReadBool();
            m_SpectatorVision = reader.ReadBool();

            m_LastReset = DateTime.Now;
        }
Ejemplo n.º 2
0
 public void SendTilePacket(MahjongTile tile, bool players, bool spectators)
 {
     foreach (Mobile mobile in GetInGameMobiles(players, spectators))
     {
         mobile.Send(new MahjongTileInfo(tile, mobile));
     }
 }
Ejemplo n.º 3
0
 public void SendTilePacket(MahjongTile tile, bool players, bool spectators)
 {
     foreach (var mobile in GetInGameMobiles(players, spectators))
     {
         mobile.NetState.SendMahjongTileInfo(tile, mobile);
     }
 }
Ejemplo n.º 4
0
        private void BuildVerticalWall(ref int index, int x, int y, int stackLevel, MahjongPieceDirection direction, MahjongTileTypeGenerator typeGenerator)
        {
            for (int i = 0; i < 17; i++)
            {
                Point2D position = new Point2D(x, y + i * 20);
                m_Tiles[index + i] = new MahjongTile(this, index + i, typeGenerator.Next(), position, stackLevel, direction, false);
            }

            index += 17;
        }
Ejemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Level = (SecureLevel)reader.ReadInt();

                goto case 0;
            }

            case 0:
            {
                if (version < 1)
                {
                    m_Level = SecureLevel.CoOwners;
                }

                int length = reader.ReadInt();
                m_Tiles = new MahjongTile[length];

                for (int i = 0; i < length; i++)
                {
                    m_Tiles[i] = new MahjongTile(this, reader);
                }

                m_DealerIndicator = new MahjongDealerIndicator(this, reader);

                m_WallBreakIndicator = new MahjongWallBreakIndicator(this, reader);

                m_Dices = new MahjongDices(this, reader);

                m_Players = new MahjongPlayers(this, reader);

                m_ShowScores      = reader.ReadBool();
                m_SpectatorVision = reader.ReadBool();

                m_LastReset = DateTime.Now;

                break;
            }
            }
        }
Ejemplo n.º 6
0
        public MahjongTileInfo(MahjongTile tile, Mobile to)
            : base(0xDA)
        {
            MahjongGame    game    = tile.Game;
            MahjongPlayers players = game.Players;

            EnsureCapacity(18);

            m_Stream.Write(tile.Game.Serial);
            m_Stream.Write((byte)0);
            m_Stream.Write((byte)0x3);

            m_Stream.Write((byte)tile.Number);

            if (tile.Flipped)
            {
                int hand = tile.Dimensions.GetHandArea();

                if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to || (game.SpectatorVision && players.IsSpectator(to)))
                {
                    m_Stream.Write((byte)tile.Value);
                }
                else
                {
                    m_Stream.Write((byte)0);
                }
            }
            else
            {
                m_Stream.Write((byte)0);
            }

            m_Stream.Write((short)tile.Position.Y);
            m_Stream.Write((short)tile.Position.X);
            m_Stream.Write((byte)tile.StackLevel);
            m_Stream.Write((byte)tile.Direction);

            m_Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
        }
Ejemplo n.º 7
0
 public void SendTilePacket(MahjongTile tile, bool players, bool spectators)
 {
     foreach (Mobile mobile in GetInGameMobiles(players, spectators))
     {
         mobile.Send(new MahjongTileInfo(tile, mobile));
     }
 }
Ejemplo n.º 8
0
		private void BuildHorizontalWall( ref int index, int x, int y, int stackLevel, MahjongPieceDirection direction, MahjongTileTypeGenerator typeGenerator )
		{
			for ( int i = 0; i < 17; i++ )
			{
				Point2D position = new Point2D( x + i*20, y );
				m_Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false );
			}

			index += 17;
		}
Ejemplo n.º 9
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				{
					m_Level = (SecureLevel)reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version < 1 )
						m_Level = SecureLevel.CoOwners;

					int length = reader.ReadInt();
					m_Tiles = new MahjongTile[length];

					for ( int i = 0; i < length; i++ )
						m_Tiles[i] = new MahjongTile( this, reader );

					m_DealerIndicator = new MahjongDealerIndicator( this, reader );

					m_WallBreakIndicator = new MahjongWallBreakIndicator( this, reader );

					m_Dices = new MahjongDices( this, reader );

					m_Players = new MahjongPlayers( this, reader );

					m_ShowScores = reader.ReadBool();
					m_SpectatorVision = reader.ReadBool();

					m_LastReset = DateTime.UtcNow;

					break;
				}
			}
		}
Ejemplo n.º 10
0
		public MahjongTileInfo( MahjongTile tile, Mobile to ) : base( 0xDA )
		{
			MahjongGame game = tile.Game;
			MahjongPlayers players = game.Players;

			EnsureCapacity( 18 );

			m_Stream.Write( (int) tile.Game.Serial );
			m_Stream.Write( (byte) 0 );
			m_Stream.Write( (byte) 0x3 );

			m_Stream.Write( (byte) tile.Number );

			if ( tile.Flipped )
			{
				int hand = tile.Dimensions.GetHandArea();

				if ( hand < 0 || players.IsPublic( hand ) || players.GetPlayer( hand ) == to || (game.SpectatorVision && players.IsSpectator( to )) )
					m_Stream.Write( (byte)tile.Value );
				else
					m_Stream.Write( (byte) 0 );
			}
			else
			{
				m_Stream.Write( (byte) 0 );
			}

			m_Stream.Write( (short) tile.Position.Y );
			m_Stream.Write( (short) tile.Position.X );
			m_Stream.Write( (byte) tile.StackLevel );
			m_Stream.Write( (byte) tile.Direction );

			m_Stream.Write( tile.Flipped ? (byte) 0x10 : (byte) 0x0 );
		}
Ejemplo n.º 11
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            int length = reader.ReadInt();
            m_Tiles = new MahjongTile[length];

            for ( int i = 0; i < length; i++ )
            {
                m_Tiles[i] = new MahjongTile( this, reader );
            }

            m_DealerIndicator = new MahjongDealerIndicator( this, reader );

            m_WallBreakIndicator = new MahjongWallBreakIndicator( this, reader );

            m_Dices = new MahjongDices( this, reader );

            m_Players = new MahjongPlayers( this, reader );

            m_ShowScores = reader.ReadBool();
            m_SpectatorVision = reader.ReadBool();

            m_LastReset = DateTime.Now;
        }