public void SendTilePacket(MahjongTile tile, bool players, bool spectators)
 {
     foreach (Mobile mobile in GetInGameMobiles(players, spectators))
     {
         mobile.Send(new MahjongTileInfo(tile, mobile));
     }
 }
示例#2
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;
        }
示例#3
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;
            }
            }
        }
示例#4
0
        public MahjongTileInfo(MahjongTile tile, Mobile to) : base(0xDA)
        {
            MahjongGame    game    = tile.Game;
            MahjongPlayers players = game.Players;

            EnsureCapacity(18);

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

            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)))
                {
                    Stream.Write((byte)tile.Value);
                }
                else
                {
                    Stream.Write((byte)0);
                }
            }
            else
            {
                Stream.Write((byte)0);
            }

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

            Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
        }