feat: add view models for all entities

This commit is contained in:
k0t9i
2023-01-29 20:44:24 +04:00
parent 16630de6a4
commit 8b27c84a9e
4413 changed files with 1150 additions and 122 deletions

View File

@@ -1,16 +1,28 @@
namespace Client.Domain.ValueObjects
using Client.Domain.Common;
namespace Client.Domain.ValueObjects
{
public class ExperienceInfo
public class ExperienceInfo : NotifyPropertyChanged
{
public uint Level { get; set; }
public uint Exp { get; set; }
public uint Sp { get; set; }
private uint level;
private uint exp;
private uint sp;
public uint Level { get => level; set { if (value != level) { level = value; OnPropertyChanged("Level"); OnPropertyChanged("ExpToLevel"); } } }
public uint Exp { get => exp; set { if (value != exp) { exp = value; OnPropertyChanged("Exp"); } } }
public uint Sp { get => sp; set { if (value != sp) { sp = value; OnPropertyChanged("Sp"); } } }
public uint ExpToLevel {
get
{
return level * 200;
}
}
public ExperienceInfo(uint level, uint exp, uint sp)
{
Level = level;
Exp = exp;
Sp = sp;
this.level = level;
this.exp = exp;
this.sp = sp;
}
}
}

View File

@@ -1,14 +1,19 @@
namespace Client.Domain.ValueObjects
using Client.Domain.Common;
namespace Client.Domain.ValueObjects
{
public class FullName
public class FullName : NotifyPropertyChanged
{
public string Nickname { get; set; }
public string Title { get; set; }
private string nickname;
private string title;
public string Nickname { get => nickname; set { if (value != nickname) { nickname = value; OnPropertyChanged("Nickname"); } } }
public string Title { get => title; set { if (value != title) { title = value; OnPropertyChanged("Title"); } } }
public FullName(string nickname, string title)
{
Nickname = nickname;
Title = title;
this.nickname = nickname;
this.title = title;
}
}
}

View File

@@ -1,20 +1,26 @@
using Client.Domain.Enums;
using Client.Domain.Common;
using Client.Domain.Enums;
namespace Client.Domain.ValueObjects
{
public class Phenotype
public class Phenotype : NotifyPropertyChanged
{
public RaceEnum Race { get; set; }
public bool IsMale { get; set; }
public ClassEnum Class { get; set; }
public ClassEnum ActiveClass { get; set; }
private RaceEnum race;
private bool isMale;
private ClassEnum @class;
private ClassEnum activeClass;
public RaceEnum Race { get => race; set { if (value != race) { race = value; OnPropertyChanged("Race"); } } }
public bool IsMale { get => isMale; set { if (value != isMale) { isMale = value; OnPropertyChanged("IsMale"); } } }
public ClassEnum Class { get => @class; set { if (value != @class) { @class = value; OnPropertyChanged("Class"); } } }
public ClassEnum ActiveClass { get => activeClass; set { if (value != activeClass) { activeClass = value; OnPropertyChanged("ActiveClass"); } } }
public Phenotype(RaceEnum race, bool isMale, ClassEnum @class, ClassEnum activeClass)
{
Race = race;
IsMale = isMale;
Class = @class;
ActiveClass = activeClass;
this.race = race;
this.isMale = isMale;
this.@class = @class;
this.activeClass = activeClass;
}
}
}

View File

@@ -1,18 +1,25 @@
namespace Client.Domain.ValueObjects
using Client.Domain.Common;
namespace Client.Domain.ValueObjects
{
public class Transform
public class Transform : NotifyPropertyChanged
{
public Vector3 Position { get; set; }
public Vector3 Rotation { get; set; }
public Vector3 Velocity { get; set; }
public Vector3 Acceleration { get; set; }
private Vector3 position;
private Vector3 rotation;
private Vector3 velocity;
private Vector3 acceleration;
public Vector3 Position { get => position; set { if (value != position) { position = value; OnPropertyChanged("Position"); } } }
public Vector3 Rotation { get => rotation; set { if (value != rotation) { rotation = value; OnPropertyChanged("Rotation"); } } }
public Vector3 Velocity { get => velocity; set { if (value != velocity) { velocity = value; OnPropertyChanged("Velocity"); } } }
public Vector3 Acceleration { get => acceleration; set { if (value != acceleration) { acceleration = value; OnPropertyChanged("Acceleration"); } } }
public Transform(Vector3 position, Vector3 rotation, Vector3 velocity, Vector3 acceleration)
{
Position = position;
Rotation = rotation;
Velocity = velocity;
Acceleration = acceleration;
this.position = position;
this.rotation = rotation;
this.velocity = velocity;
this.acceleration = acceleration;
}
}
}

View File

@@ -1,16 +1,33 @@
namespace Client.Domain.ValueObjects
using Client.Domain.Common;
using System;
namespace Client.Domain.ValueObjects
{
public class Vector3
public class Vector3 : NotifyPropertyChanged
{
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
private float x;
private float y;
private float z;
public float X { get => x; set { if (value != x) { x = value; OnPropertyChanged("X"); } } }
public float Y { get => y; set { if (value != y) { y = value; OnPropertyChanged("Y"); } } }
public float Z { get => z; set { if (value != z) { z = value; OnPropertyChanged("X"); } } }
public Vector3(float x, float y, float z)
{
X = x;
Y = y;
Z = z;
this.x = x;
this.y = y;
this.z = z;
}
public float HorizontalSqrDistance(Vector3 other)
{
return MathF.Pow(x - other.x, 2) + MathF.Pow(y - other.y, 2);
}
public float HorizontalDistance(Vector3 other)
{
return MathF.Sqrt(HorizontalSqrDistance(other));
}
}
}

View File

@@ -1,22 +1,31 @@
namespace Client.Domain.ValueObjects
using Client.Domain.Common;
namespace Client.Domain.ValueObjects
{
public class VitalStats
public class VitalStats : NotifyPropertyChanged
{
public uint Hp { get; set; }
public uint MaxHp { get; set; }
public uint Mp { get; set; }
public uint MaxMp { get; set; }
public uint Cp { get; set; }
public uint MaxCp { get; set; }
private uint hp;
private uint maxHp;
private uint mp;
private uint maxMp;
private uint cp;
private uint maxCp;
public uint Hp { get => hp; set { if (value != hp) { hp = value; OnPropertyChanged("Hp"); } } }
public uint MaxHp { get => maxHp; set { if (value != maxHp) { maxHp = value; OnPropertyChanged("MaxHp"); } } }
public uint Mp { get => mp; set { if (value != mp) { mp = value; OnPropertyChanged("Mp"); } } }
public uint MaxMp { get => maxMp; set { if (value != maxMp) { maxMp = value; OnPropertyChanged("MaxMp"); } } }
public uint Cp { get => cp; set { if (value != cp) { cp = value; OnPropertyChanged("Cp"); } } }
public uint MaxCp { get => maxCp; set { if (value != maxCp) { maxCp = value; OnPropertyChanged("MaxCp"); } } }
public VitalStats(uint hp, uint maxHp, uint mp, uint maxMp, uint cp, uint maxCp)
{
Hp = hp;
MaxHp = maxHp;
Mp = mp;
MaxMp = maxMp;
Cp = cp;
MaxCp = maxCp;
this.hp = hp;
this.maxHp = maxHp;
this.mp = mp;
this.maxMp = maxMp;
this.cp = cp;
this.maxCp = maxCp;
}
}
}