Latest
This commit is contained in:
+13
-6
@@ -15,6 +15,16 @@ namespace fxl.codes.kisekae.Models
|
||||
internal CelModel(ILogger<ConfigurationReaderService> logger, string line)
|
||||
{
|
||||
logger.LogTrace($"Parsing cel line {line}");
|
||||
|
||||
if (line.Contains("%t"))
|
||||
{
|
||||
var opacity = line[line.IndexOf("%t")..].Trim();
|
||||
opacity = opacity.Split(';', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
opacity = opacity.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
opacity = opacity.Replace("%t", "");
|
||||
Opacity = 1.0 - double.Parse(opacity) / 255;
|
||||
}
|
||||
|
||||
var matcher = new Regex(Regex);
|
||||
var match = matcher.Match(line);
|
||||
|
||||
@@ -26,13 +36,9 @@ namespace fxl.codes.kisekae.Models
|
||||
if (string.IsNullOrEmpty(group?.Value))
|
||||
{
|
||||
if (string.Equals(groupName, "Sets"))
|
||||
{
|
||||
for (var index = 0; index < Sets.Length; index++)
|
||||
{
|
||||
Sets[index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
logger.LogWarning($"Unable to find regex group {groupName} in {line}");
|
||||
continue;
|
||||
}
|
||||
@@ -42,7 +48,7 @@ namespace fxl.codes.kisekae.Models
|
||||
if (property.PropertyType == typeof(int)) property.SetValue(this, int.Parse(value));
|
||||
|
||||
if (property.PropertyType != Sets.GetType()) continue;
|
||||
|
||||
|
||||
foreach (var id in value.Split(' ', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
var success = int.TryParse(id, out var result);
|
||||
@@ -58,6 +64,7 @@ namespace fxl.codes.kisekae.Models
|
||||
public int PaletteId { get; init; }
|
||||
public bool[] Sets { get; } = new bool[10];
|
||||
public string Comment { get; init; }
|
||||
public double Opacity { get; } = 1.0;
|
||||
public Coordinate[] InitialPositions { get; } = new Coordinate[10];
|
||||
[JsonIgnore] public string DefaultImage => ImageByPalette.ContainsKey(PaletteId) ? ImageByPalette[PaletteId] : null;
|
||||
public Coordinate Offset { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user