v0.0.1-Alpha (#42)
This commit is contained in:
parent
d30f93c454
commit
a36796c2c1
3552 changed files with 2476 additions and 15223 deletions
46
Projects/Scripts/Items/Games/Mahjong/MahjongPieceDim.cs
Normal file
46
Projects/Scripts/Items/Games/Mahjong/MahjongPieceDim.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
namespace Server.Engines.Mahjong
|
||||
{
|
||||
public struct MahjongPieceDim
|
||||
{
|
||||
public Point2D Position{ get; }
|
||||
|
||||
public int Width{ get; }
|
||||
|
||||
public int Height{ get; }
|
||||
|
||||
public MahjongPieceDim(Point2D position, int width, int height)
|
||||
{
|
||||
Position = position;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return Position.X >= 0 && Position.Y >= 0 && Position.X + Width <= 670 && Position.Y + Height <= 670;
|
||||
}
|
||||
|
||||
public bool IsOverlapping(MahjongPieceDim dim)
|
||||
{
|
||||
return Position.X < dim.Position.X + dim.Width && Position.Y < dim.Position.Y + dim.Height &&
|
||||
Position.X + Width > dim.Position.X && Position.Y + Height > dim.Position.Y;
|
||||
}
|
||||
|
||||
public int GetHandArea()
|
||||
{
|
||||
if (Position.X + Width > 150 && Position.X < 520 && Position.Y < 35)
|
||||
return 0;
|
||||
|
||||
if (Position.X + Width > 635 && Position.Y + Height > 150 && Position.Y < 520)
|
||||
return 1;
|
||||
|
||||
if (Position.X + Width > 150 && Position.X < 520 && Position.Y + Height > 635)
|
||||
return 2;
|
||||
|
||||
if (Position.X < 35 && Position.Y + Height > 150 && Position.Y < 520)
|
||||
return 3;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue