public static MahjongPieceDim GetDimensions( Point2D position, MahjongPieceDirection direction ) { if ( direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down ) return new MahjongPieceDim( position, 40, 20 ); else return new MahjongPieceDim( position, 20, 40 ); }
public MahjongDealerIndicator(MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind) { _game = game; _position = position; _direction = direction; _wind = wind; }
public static void MoveTile(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGamePlayer(state.Mobile)) { return; } int number = pvSrc.ReadByte(); if (number < 0 || number >= game.Tiles.Length) { return; } pvSrc.ReadByte(); // Current direction MahjongPieceDirection direction = GetDirection(pvSrc.ReadByte()); pvSrc.ReadByte(); bool flip = pvSrc.ReadBoolean(); pvSrc.ReadInt16(); // Current Y pvSrc.ReadInt16(); // Current X pvSrc.ReadByte(); int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); pvSrc.ReadByte(); game.Tiles[number].Move(new Point2D(x, y), direction, flip, game.Players.GetPlayerIndex(state.Mobile)); }
public MahjongDealerIndicator( MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind ) { m_Game = game; m_Position = position; m_Direction = direction; m_Wind = wind; }
public MahjongDealerIndicator(MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind) { m_Game = game; m_Position = position; m_Direction = direction; m_Wind = wind; }
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) { if (direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down) { return(new MahjongPieceDim(position, 20, 30)); } return(new MahjongPieceDim(position, 30, 20)); }
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) { if (direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down) { return(new MahjongPieceDim(position, 40, 20)); } return(new MahjongPieceDim(position, 20, 40)); }
public MahjongTile(MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped) { m_Game = game; m_Number = number; m_Value = value; m_Position = position; m_StackLevel = stackLevel; m_Direction = direction; m_Flipped = flipped; }
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; }
public MahjongDealerIndicator( MahjongGame game, GenericReader reader ) { m_Game = game; int version = reader.ReadInt(); m_Position = reader.ReadPoint2D(); m_Direction = (MahjongPieceDirection) reader.ReadInt(); m_Wind = (MahjongWind) reader.ReadInt(); }
public MahjongTile( MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped ) { m_Game = game; m_Number = number; m_Value = value; m_Position = position; m_StackLevel = stackLevel; m_Direction = direction; m_Flipped = flipped; }
public MahjongDealerIndicator(MahjongGame game, GenericReader reader) { m_Game = game; int version = reader.ReadInt(); m_Position = reader.ReadPoint2D(); m_Direction = (MahjongPieceDirection)reader.ReadInt(); m_Wind = (MahjongWind)reader.ReadInt(); }
public void Move( Point2D position, MahjongPieceDirection direction, MahjongWind wind ) { MahjongPieceDim dim = GetDimensions( position, direction ); if ( !dim.IsValid() ) return; m_Position = position; m_Direction = direction; m_Wind = wind; m_Game.Players.SendGeneralPacket( true, true ); }
public MahjongTile(MahjongGame game, GenericReader reader) { this.m_Game = game; int version = reader.ReadInt(); this.m_Number = reader.ReadInt(); this.m_Value = (MahjongTileType)reader.ReadInt(); this.m_Position = reader.ReadPoint2D(); this.m_StackLevel = reader.ReadInt(); this.m_Direction = (MahjongPieceDirection)reader.ReadInt(); this.m_Flipped = reader.ReadBool(); }
public MahjongTile(MahjongGame game, GenericReader reader) { m_Game = game; int version = reader.ReadInt(); m_Number = reader.ReadInt(); m_Value = (MahjongTileType)reader.ReadInt(); m_Position = reader.ReadPoint2D(); m_StackLevel = reader.ReadInt(); m_Direction = (MahjongPieceDirection)reader.ReadInt(); m_Flipped = reader.ReadBool(); }
public void Move(Point2D position, MahjongPieceDirection direction, MahjongWind wind) { MahjongPieceDim dim = GetDimensions(position, direction); if (!dim.IsValid()) { return; } m_Position = position; m_Direction = direction; m_Wind = wind; m_Game.Players.SendGeneralPacket(true, true); }
public static void MoveDealerIndicator(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) { return; } MahjongPieceDirection direction = GetDirection(pvSrc.ReadByte()); MahjongWind wind = GetWind(pvSrc.ReadByte()); int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); game.DealerIndicator.Move(new Point2D(x, y), direction, wind); }
public void Move( Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea ) { MahjongPieceDim dim = GetDimensions( position, direction ); int curHandArea = Dimensions.GetHandArea(); int newHandArea = dim.GetHandArea(); if ( !IsMovable || !dim.IsValid() || ( validHandArea >= 0 && ((curHandArea >= 0 && curHandArea != validHandArea) || (newHandArea >= 0 && newHandArea != validHandArea)) ) ) return; m_Position = position; m_Direction = direction; m_StackLevel = -1; // Avoid self interference m_StackLevel = m_Game.GetStackLevel( dim ) + 1; m_Flipped = flip; m_Game.Players.SendTilePacket( this, true, true ); }
public void Move(Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea) { MahjongPieceDim dim = GetDimensions(position, direction); int curHandArea = Dimensions.GetHandArea(); int newHandArea = dim.GetHandArea(); if (!IsMovable || !dim.IsValid() || (validHandArea >= 0 && ((curHandArea >= 0 && curHandArea != validHandArea) || (newHandArea >= 0 && newHandArea != validHandArea)))) { return; } m_Position = position; m_Direction = direction; m_StackLevel = -1; // Avoid self interference m_StackLevel = m_Game.GetStackLevel(dim) + 1; m_Flipped = flip; m_Game.Players.SendTilePacket(this, true, true); }
private void Deserialize(IGenericReader reader, int version) { _position = reader.ReadPoint2D(); _direction = (MahjongPieceDirection)reader.ReadInt(); _wind = (MahjongWind)reader.ReadInt(); }
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; }
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) => direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down