Don't use canvas I guess

This commit is contained in:
Lani Aung
2021-10-11 21:08:17 -06:00
parent 590c84b81f
commit d1d891881f
11 changed files with 84 additions and 111 deletions
+5 -7
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using fxl.codes.kisekae.Services;
using Microsoft.Extensions.Logging;
@@ -58,13 +59,10 @@ namespace fxl.codes.kisekae.Models
public bool[] Sets { get; } = new bool[10];
public string Comment { get; init; }
public Coordinate[] InitialPositions { get; } = new Coordinate[10];
public string DefaultImage => ImageByPalette.ContainsKey(PaletteId) ? ImageByPalette[PaletteId] : null;
[JsonIgnore] public string DefaultImage => ImageByPalette.ContainsKey(PaletteId) ? ImageByPalette[PaletteId] : null;
public Coordinate Offset { get; set; }
public Coordinate PositionForSet(int set)
{
var current = InitialPositions[set];
return current == null ? new Coordinate(0, 0) : new Coordinate(current.X + Offset.X, current.Y + Offset.Y);
}
[JsonIgnore] public int Height { get; internal set; }
[JsonIgnore] public int Width { get; internal set; }
[JsonIgnore] public int ZIndex { get; internal set; }
}
}
+6 -8
View File
@@ -1,17 +1,17 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using SixLabors.ImageSharp;
namespace fxl.codes.kisekae.Models
{
public class PlaysetModel
{
public int[] CurrentPalettes = new int[10];
public string Name { get; set; }
public int Height { get; set; }
public int Width { get; set; }
public Color BorderColor { get; set; } = Color.Black;
public List<PaletteModel> Palettes { get; } = new();
[JsonIgnore] public Color BorderColor { get; set; } = Color.Black;
[JsonIgnore] public List<PaletteModel> Palettes { get; } = new();
public List<CelModel> Cels { get; } = new();
public bool[] EnabledSets
@@ -19,10 +19,8 @@ namespace fxl.codes.kisekae.Models
get
{
var enabled = new bool[10];
foreach (var cel in Cels)
for (var index = 0; index < cel.Sets.Length; index++)
if (cel.Sets[index])
enabled[index] = true;
for (var index = 0; index < enabled.Length; index++) enabled[index] = Cels.Any(x => x.Sets[index]);
return enabled;
}