mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-03-21 17:34:28 -05:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
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;
|
|
}
|