示例#1
0
        public int GetStackLevel(MahjongPieceDim dim)
        {
            int level = -1;

            foreach (MahjongTile tile in m_Tiles)
            {
                if (tile.StackLevel > level && dim.IsOverlapping(tile.Dimensions))
                {
                    level = tile.StackLevel;
                }
            }
            return(level);
        }
        public void Move(Point2D position)
        {
            MahjongPieceDim dim = GetDimensions(position);

            if (!dim.IsValid())
            {
                return;
            }

            m_Position = position;

            m_Game.Players.SendGeneralPacket(true, true);
        }
示例#3
0
        public void Move(Point2D position, MahjongPieceDirection direction, MahjongWind wind)
        {
            MahjongPieceDim dim = GetDimensions(position, direction);

            if (!dim.IsValid())
            {
                return;
            }

            this.m_Position  = position;
            this.m_Direction = direction;
            this.m_Wind      = wind;

            this.m_Game.Players.SendGeneralPacket(true, true);
        }
示例#4
0
        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);
        }
示例#5
0
		public bool IsOverlapping( MahjongPieceDim dim )
		{
			return m_Position.X < dim.m_Position.X + dim.m_Width && m_Position.Y < dim.m_Position.Y + dim.m_Height && m_Position.X + m_Width > dim.m_Position.X && m_Position.Y + m_Height > dim.m_Position.Y;
		}
 public bool IsOverlapping(MahjongPieceDim dim)
 {
     return(this.m_Position.X < dim.m_Position.X + dim.m_Width && this.m_Position.Y < dim.m_Position.Y + dim.m_Height && this.m_Position.X + this.m_Width > dim.m_Position.X && this.m_Position.Y + this.m_Height > dim.m_Position.Y);
 }
示例#7
0
		public int GetStackLevel( MahjongPieceDim dim )
		{
			int level = -1;
			foreach ( MahjongTile tile in m_Tiles )
			{
				if ( tile.StackLevel > level && dim.IsOverlapping( tile.Dimensions ) )
					level = tile.StackLevel;
			}
			return level;
		}