fix: Codegens mahjong (#1070)
This commit is contained in:
parent
800f864335
commit
6edccfe2aa
15 changed files with 1272 additions and 1122 deletions
|
|
@ -1,50 +1,49 @@
|
|||
namespace Server.Engines.Mahjong
|
||||
namespace Server.Engines.Mahjong;
|
||||
|
||||
public struct MahjongPieceDim
|
||||
{
|
||||
public struct MahjongPieceDim
|
||||
public Point2D Position { get; }
|
||||
|
||||
public int Width { get; }
|
||||
|
||||
public int Height { get; }
|
||||
|
||||
public MahjongPieceDim(Point2D position, int width, int height)
|
||||
{
|
||||
public Point2D Position { get; }
|
||||
Position = position;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
public int Width { get; }
|
||||
public bool IsValid() =>
|
||||
Position.X >= 0 && Position.Y >= 0 && Position.X + Width <= 670 && Position.Y + Height <= 670;
|
||||
|
||||
public int Height { get; }
|
||||
public bool IsOverlapping(MahjongPieceDim dim) =>
|
||||
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 MahjongPieceDim(Point2D position, int width, int height)
|
||||
public int GetHandArea()
|
||||
{
|
||||
if (Position.X + Width > 150 && Position.X < 520 && Position.Y < 35)
|
||||
{
|
||||
Position = position;
|
||||
Width = width;
|
||||
Height = height;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool IsValid() =>
|
||||
Position.X >= 0 && Position.Y >= 0 && Position.X + Width <= 670 && Position.Y + Height <= 670;
|
||||
|
||||
public bool IsOverlapping(MahjongPieceDim dim) =>
|
||||
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 > 635 && Position.Y + Height > 150 && Position.Y < 520)
|
||||
{
|
||||
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;
|
||||
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