Add project data
This commit is contained in:
64
Tabletop.Core/Models/Layout.cs
Normal file
64
Tabletop.Core/Models/Layout.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Layout : LocalizationModelBase<LayoutDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("layout_id")]
|
||||
public int LayoutId { get; set; }
|
||||
[CompareField("gamemode_id")]
|
||||
public int GamemodeId { get; set; }
|
||||
[CompareField("teams")]
|
||||
public int Teams { get; set; }
|
||||
[CompareField("width")]
|
||||
public string Width { get; set; } = string.Empty;
|
||||
[CompareField("height")]
|
||||
public string Height { get; set; } = string.Empty;
|
||||
|
||||
public List<SetupZone> SetupZones { get; set; } = [];
|
||||
public List<CaptureZone> CaptureZones { get; set; } = [];
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return LayoutId > 0 ? LayoutId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "LAYOUT_ID", LayoutId },
|
||||
{ "NAME", description.Name }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "LAYOUT_ID", LayoutId },
|
||||
{ "GAMEMODE_ID", GamemodeId },
|
||||
{ "TEAMS", Teams },
|
||||
{ "WIDTH", Width },
|
||||
{ "HEIGHT", Height }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class LayoutDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("layout_id")]
|
||||
public int LayoutId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user