mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-10-01 14:48:33 -05:00
Initial commit
This commit is contained in:
37
TableturfBattleServer/Move.cs
Normal file
37
TableturfBattleServer/Move.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TableturfBattleServer;
|
||||
public class Move {
|
||||
[JsonProperty("card")]
|
||||
public Card Card { get; }
|
||||
[JsonProperty("isPass")]
|
||||
public bool IsPass { get; }
|
||||
[JsonProperty("x")]
|
||||
public int X { get; }
|
||||
[JsonProperty("y")]
|
||||
public int Y { get; }
|
||||
[JsonProperty("rotation")]
|
||||
public int Rotation { get; }
|
||||
[JsonProperty("isSpecialAttack")]
|
||||
public bool IsSpecialAttack { get; }
|
||||
|
||||
public Move(Card card, bool isPass, int x, int y, int rotation, bool isSpecialAttack) {
|
||||
this.Card = card ?? throw new ArgumentNullException(nameof(card));
|
||||
this.IsPass = isPass;
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
this.Rotation = rotation;
|
||||
this.IsSpecialAttack = isSpecialAttack;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeX() => !this.IsPass;
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeY() => !this.IsPass;
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeRotation() => !this.IsPass;
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeIsSpecialAttack() => !this.IsPass;
|
||||
}
|
||||
Reference in New Issue
Block a user