Math is hard
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace fxl.codes.kisekae.Entities
|
namespace fxl.codes.kisekae.Entities
|
||||||
{
|
{
|
||||||
public class CelConfig
|
public class CelConfig
|
||||||
@@ -10,10 +12,9 @@ namespace fxl.codes.kisekae.Entities
|
|||||||
public Palette Palette { get; set; }
|
public Palette Palette { get; set; }
|
||||||
public int PaletteGroup { get; set; }
|
public int PaletteGroup { get; set; }
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; }
|
||||||
public int X { get; set; }
|
|
||||||
public int Y { get; set; }
|
|
||||||
public int Transparency { get; set; }
|
public int Transparency { get; set; }
|
||||||
public Set Sets { get; set; }
|
public Set Sets { get; set; }
|
||||||
public Render Render { get; set; }
|
public Render Render { get; set; }
|
||||||
|
public List<CelPosition> Positions { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace fxl.codes.kisekae.Entities
|
||||||
|
{
|
||||||
|
public class CelPosition
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Set { get; set; }
|
||||||
|
public int X { get; set; }
|
||||||
|
public int Y { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,6 @@ namespace fxl.codes.kisekae.Entities
|
|||||||
public string Data { get; set; }
|
public string Data { get; set; }
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int BorderIndex { get; set; }
|
public string BackgroundColorHex { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@ namespace fxl.codes.kisekae.Entities
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Kisekae Kisekae { get; set; }
|
public Kisekae Kisekae { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
public string Comment { get; set; }
|
|
||||||
public List<PaletteColor> Colors { get; set; } = new();
|
public List<PaletteColor> Colors { get; set; } = new();
|
||||||
public byte[] Data { get; set; }
|
public byte[] Data { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -5,16 +5,16 @@ namespace fxl.codes.kisekae.Entities
|
|||||||
[Flags]
|
[Flags]
|
||||||
public enum Set
|
public enum Set
|
||||||
{
|
{
|
||||||
Unset = -1,
|
None = 0,
|
||||||
Zero = 2 ^ 0,
|
Zero = 1 << 0,
|
||||||
One = 2 ^ 1,
|
One = 1 << 1,
|
||||||
Two = 2 ^ 2,
|
Two = 1 << 2,
|
||||||
Three = 2 ^ 3,
|
Three = 1 << 3,
|
||||||
Four = 2 ^ 4,
|
Four = 1 << 4,
|
||||||
Five = 2 ^ 5,
|
Five = 1 << 5,
|
||||||
Six = 2 ^ 6,
|
Six = 1 << 6,
|
||||||
Seven = 2 ^ 7,
|
Seven = 1 << 7,
|
||||||
Eight = 2 ^ 8,
|
Eight = 1 << 8,
|
||||||
Nine = 2 ^ 9
|
Nine = 1 << 9
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+353
@@ -0,0 +1,353 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using fxl.codes.kisekae;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace fxl.codes.kisekae.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(KisekaeContext))]
|
||||||
|
[Migration("20211120201836_UseBackgroundHex")]
|
||||||
|
partial class UseBackgroundHex
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.0")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("ConfigurationId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ConfigurationId");
|
||||||
|
|
||||||
|
b.ToTable("Action");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<byte[]>("Data")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.Property<string>("FileName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Height")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("KisekaeId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OffsetX")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OffsetY")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Width")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("KisekaeId");
|
||||||
|
|
||||||
|
b.ToTable("Cels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("CelId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ConfigurationId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Fix")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Mark")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PaletteGroup")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("PaletteId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("RenderId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Sets")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Transparency")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("X")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Y")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CelId");
|
||||||
|
|
||||||
|
b.HasIndex("ConfigurationId");
|
||||||
|
|
||||||
|
b.HasIndex("PaletteId");
|
||||||
|
|
||||||
|
b.HasIndex("RenderId");
|
||||||
|
|
||||||
|
b.ToTable("CelConfigs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("BackgroundColorHex")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Data")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Height")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("KisekaeId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Width")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("KisekaeId");
|
||||||
|
|
||||||
|
b.ToTable("Configurations");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("CheckSum")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("FileName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("KisekaeSets");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Data")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.Property<string>("FileName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("KisekaeId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("KisekaeId");
|
||||||
|
|
||||||
|
b.ToTable("Palettes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Group")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Hex")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("PaletteId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PaletteId");
|
||||||
|
|
||||||
|
b.ToTable("PaletteColors");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Render", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<byte[]>("Image")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Renders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Configuration", null)
|
||||||
|
.WithMany("Actions")
|
||||||
|
.HasForeignKey("ConfigurationId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
|
.WithMany("Cels")
|
||||||
|
.HasForeignKey("KisekaeId");
|
||||||
|
|
||||||
|
b.Navigation("Kisekae");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Cel", "Cel")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CelId");
|
||||||
|
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Configuration", "Configuration")
|
||||||
|
.WithMany("Cels")
|
||||||
|
.HasForeignKey("ConfigurationId");
|
||||||
|
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PaletteId");
|
||||||
|
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Render", "Render")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RenderId");
|
||||||
|
|
||||||
|
b.Navigation("Cel");
|
||||||
|
|
||||||
|
b.Navigation("Configuration");
|
||||||
|
|
||||||
|
b.Navigation("Palette");
|
||||||
|
|
||||||
|
b.Navigation("Render");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
|
.WithMany("Configurations")
|
||||||
|
.HasForeignKey("KisekaeId");
|
||||||
|
|
||||||
|
b.Navigation("Kisekae");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
|
.WithMany("Palettes")
|
||||||
|
.HasForeignKey("KisekaeId");
|
||||||
|
|
||||||
|
b.Navigation("Kisekae");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
|
||||||
|
.WithMany("Colors")
|
||||||
|
.HasForeignKey("PaletteId");
|
||||||
|
|
||||||
|
b.Navigation("Palette");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Actions");
|
||||||
|
|
||||||
|
b.Navigation("Cels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Cels");
|
||||||
|
|
||||||
|
b.Navigation("Configurations");
|
||||||
|
|
||||||
|
b.Navigation("Palettes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Colors");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace fxl.codes.kisekae.Migrations
|
||||||
|
{
|
||||||
|
public partial class UseBackgroundHex : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "BorderIndex",
|
||||||
|
table: "Configurations");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "BackgroundColorHex",
|
||||||
|
table: "Configurations",
|
||||||
|
type: "text",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "BackgroundColorHex",
|
||||||
|
table: "Configurations");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "BorderIndex",
|
||||||
|
table: "Configurations",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+386
@@ -0,0 +1,386 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using fxl.codes.kisekae;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace fxl.codes.kisekae.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(KisekaeContext))]
|
||||||
|
[Migration("20211121011039_Positions")]
|
||||||
|
partial class Positions
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.0")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("ConfigurationId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ConfigurationId");
|
||||||
|
|
||||||
|
b.ToTable("Action");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<byte[]>("Data")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.Property<string>("FileName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Height")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("KisekaeId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OffsetX")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OffsetY")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Width")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("KisekaeId");
|
||||||
|
|
||||||
|
b.ToTable("Cels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("CelId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ConfigurationId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Fix")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Mark")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PaletteGroup")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("PaletteId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("RenderId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Sets")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Transparency")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CelId");
|
||||||
|
|
||||||
|
b.HasIndex("ConfigurationId");
|
||||||
|
|
||||||
|
b.HasIndex("PaletteId");
|
||||||
|
|
||||||
|
b.HasIndex("RenderId");
|
||||||
|
|
||||||
|
b.ToTable("CelConfigs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("CelConfigId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Set")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("X")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Y")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CelConfigId");
|
||||||
|
|
||||||
|
b.ToTable("CelPosition");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("BackgroundColorHex")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Data")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Height")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("KisekaeId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Width")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("KisekaeId");
|
||||||
|
|
||||||
|
b.ToTable("Configurations");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("CheckSum")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("FileName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("KisekaeSets");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Data")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.Property<string>("FileName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("KisekaeId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("KisekaeId");
|
||||||
|
|
||||||
|
b.ToTable("Palettes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Group")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Hex")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("PaletteId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PaletteId");
|
||||||
|
|
||||||
|
b.ToTable("PaletteColors");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Render", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<byte[]>("Image")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Renders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Configuration", null)
|
||||||
|
.WithMany("Actions")
|
||||||
|
.HasForeignKey("ConfigurationId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
|
.WithMany("Cels")
|
||||||
|
.HasForeignKey("KisekaeId");
|
||||||
|
|
||||||
|
b.Navigation("Kisekae");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Cel", "Cel")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CelId");
|
||||||
|
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Configuration", "Configuration")
|
||||||
|
.WithMany("Cels")
|
||||||
|
.HasForeignKey("ConfigurationId");
|
||||||
|
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PaletteId");
|
||||||
|
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Render", "Render")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RenderId");
|
||||||
|
|
||||||
|
b.Navigation("Cel");
|
||||||
|
|
||||||
|
b.Navigation("Configuration");
|
||||||
|
|
||||||
|
b.Navigation("Palette");
|
||||||
|
|
||||||
|
b.Navigation("Render");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.CelConfig", null)
|
||||||
|
.WithMany("Positions")
|
||||||
|
.HasForeignKey("CelConfigId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
|
.WithMany("Configurations")
|
||||||
|
.HasForeignKey("KisekaeId");
|
||||||
|
|
||||||
|
b.Navigation("Kisekae");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
|
.WithMany("Palettes")
|
||||||
|
.HasForeignKey("KisekaeId");
|
||||||
|
|
||||||
|
b.Navigation("Kisekae");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
|
||||||
|
.WithMany("Colors")
|
||||||
|
.HasForeignKey("PaletteId");
|
||||||
|
|
||||||
|
b.Navigation("Palette");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Positions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Actions");
|
||||||
|
|
||||||
|
b.Navigation("Cels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Cels");
|
||||||
|
|
||||||
|
b.Navigation("Configurations");
|
||||||
|
|
||||||
|
b.Navigation("Palettes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Colors");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace fxl.codes.kisekae.Migrations
|
||||||
|
{
|
||||||
|
public partial class Positions : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "X",
|
||||||
|
table: "CelConfigs");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Y",
|
||||||
|
table: "CelConfigs");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CelPosition",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Set = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
X = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Y = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
CelConfigId = table.Column<int>(type: "integer", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CelPosition", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CelPosition_CelConfigs_CelConfigId",
|
||||||
|
column: x => x.CelConfigId,
|
||||||
|
principalTable: "CelConfigs",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CelPosition_CelConfigId",
|
||||||
|
table: "CelPosition",
|
||||||
|
column: "CelConfigId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CelPosition");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "X",
|
||||||
|
table: "CelConfigs",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Y",
|
||||||
|
table: "CelConfigs",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -117,12 +117,6 @@ namespace fxl.codes.kisekae.Migrations
|
|||||||
b.Property<int>("Transparency")
|
b.Property<int>("Transparency")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("X")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Y")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CelId");
|
b.HasIndex("CelId");
|
||||||
@@ -136,6 +130,33 @@ namespace fxl.codes.kisekae.Migrations
|
|||||||
b.ToTable("CelConfigs");
|
b.ToTable("CelConfigs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("CelConfigId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Set")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("X")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Y")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CelConfigId");
|
||||||
|
|
||||||
|
b.ToTable("CelPosition");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -144,8 +165,8 @@ namespace fxl.codes.kisekae.Migrations
|
|||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("BorderIndex")
|
b.Property<string>("BackgroundColorHex")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Data")
|
b.Property<string>("Data")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
@@ -298,6 +319,13 @@ namespace fxl.codes.kisekae.Migrations
|
|||||||
b.Navigation("Render");
|
b.Navigation("Render");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("fxl.codes.kisekae.Entities.CelConfig", null)
|
||||||
|
.WithMany("Positions")
|
||||||
|
.HasForeignKey("CelConfigId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
|
||||||
@@ -325,6 +353,11 @@ namespace fxl.codes.kisekae.Migrations
|
|||||||
b.Navigation("Palette");
|
b.Navigation("Palette");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Positions");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Actions");
|
b.Navigation("Actions");
|
||||||
|
|||||||
+19
-7
@@ -5,17 +5,29 @@ namespace fxl.codes.kisekae.Models
|
|||||||
{
|
{
|
||||||
public class CelModel
|
public class CelModel
|
||||||
{
|
{
|
||||||
public readonly int Fix;
|
internal CelModel(CelConfig celConfig, int zIndex)
|
||||||
public readonly string Image;
|
|
||||||
public readonly int Mark;
|
|
||||||
public readonly int ZIndex;
|
|
||||||
|
|
||||||
internal CelModel(CelConfig celConfig, Render render, int zIndex)
|
|
||||||
{
|
{
|
||||||
Mark = celConfig.Mark;
|
Mark = celConfig.Mark;
|
||||||
Fix = celConfig.Fix;
|
Fix = celConfig.Fix;
|
||||||
ZIndex = zIndex;
|
ZIndex = zIndex;
|
||||||
Image = Convert.ToBase64String(render.Image);
|
Image = Convert.ToBase64String(celConfig.Render.Image);
|
||||||
|
Height = celConfig.Cel.Height;
|
||||||
|
Width = celConfig.Cel.Width;
|
||||||
|
Opacity = (double)(255 - celConfig.Transparency) / 255;
|
||||||
|
|
||||||
|
foreach (var position in celConfig.Positions) InitialPositions[position.Set] = new CoordinateModel(position.X, position.Y);
|
||||||
|
|
||||||
|
Offset = new CoordinateModel(celConfig.Cel.OffsetX, celConfig.Cel.OffsetY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Fix { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
public string Image { get; set; }
|
||||||
|
public int Mark { get; set; }
|
||||||
|
public double Opacity { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int ZIndex { get; set; }
|
||||||
|
public CoordinateModel[] InitialPositions { get; set; } = new CoordinateModel[10];
|
||||||
|
public CoordinateModel Offset { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace fxl.codes.kisekae.Models
|
||||||
|
{
|
||||||
|
public class CoordinateModel
|
||||||
|
{
|
||||||
|
internal CoordinateModel(int x, int y)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int X { get; set; }
|
||||||
|
public int Y { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
-10
@@ -1,25 +1,40 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using SixLabors.ImageSharp;
|
using fxl.codes.kisekae.Entities;
|
||||||
using Configuration = fxl.codes.kisekae.Entities.Configuration;
|
|
||||||
|
|
||||||
namespace fxl.codes.kisekae.Models
|
namespace fxl.codes.kisekae.Models
|
||||||
{
|
{
|
||||||
public class PlaysetModel
|
public class PlaysetModel
|
||||||
{
|
{
|
||||||
public readonly int Height;
|
[JsonIgnore] public readonly string BorderColor;
|
||||||
public readonly string Name;
|
|
||||||
public readonly int Width;
|
|
||||||
public readonly CelModel[] Cels;
|
|
||||||
|
|
||||||
[JsonIgnore] public Color BorderColor = Color.Black;
|
|
||||||
|
|
||||||
internal PlaysetModel(Configuration configuration)
|
internal PlaysetModel(Configuration configuration)
|
||||||
{
|
{
|
||||||
|
BorderColor = configuration.BackgroundColorHex;
|
||||||
|
|
||||||
Name = configuration.Name;
|
Name = configuration.Name;
|
||||||
Height = configuration.Height;
|
Height = configuration.Height;
|
||||||
Width = configuration.Width;
|
Width = configuration.Width;
|
||||||
Cels = new CelModel[0];
|
var totalCels = configuration.Cels.Count;
|
||||||
|
Cels = configuration.Cels.Select((x, index) => new CelModel(x, (totalCels - index) * 10)).ToArray();
|
||||||
|
|
||||||
|
var summation = configuration.Cels.Aggregate(Set.None, (current, cel) => current | cel.Sets);
|
||||||
|
if (summation == Set.None)
|
||||||
|
{
|
||||||
|
Array.Fill(Sets, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var value in Enum.GetValues<Set>().Where(x => (x & summation) == x && x != Set.None))
|
||||||
|
if (value == Set.Zero) Sets[0] = true;
|
||||||
|
else Sets[(int)Math.Log2((double)value)] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CelModel[] Cels { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool[] Sets { get; set; } = new bool[10];
|
||||||
|
public int Width { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-2
@@ -3,7 +3,7 @@ export interface Playset {
|
|||||||
readonly height: number
|
readonly height: number
|
||||||
readonly width: number
|
readonly width: number
|
||||||
readonly cels: Cel[]
|
readonly cels: Cel[]
|
||||||
readonly enabledSets: boolean[]
|
readonly sets: boolean[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Cel {
|
export interface Cel {
|
||||||
@@ -11,7 +11,6 @@ export interface Cel {
|
|||||||
readonly fix: number
|
readonly fix: number
|
||||||
readonly initialPositions: Coordinate[]
|
readonly initialPositions: Coordinate[]
|
||||||
readonly offset: Coordinate
|
readonly offset: Coordinate
|
||||||
readonly sets: boolean[]
|
|
||||||
|
|
||||||
currentPositions: Coordinate[]
|
currentPositions: Coordinate[]
|
||||||
currentFix: number
|
currentFix: number
|
||||||
|
|||||||
+2
-2
@@ -52,7 +52,7 @@ export default class Tracker {
|
|||||||
let element = elements[index] as HTMLDivElement
|
let element = elements[index] as HTMLDivElement
|
||||||
element.style.visibility = "hidden"
|
element.style.visibility = "hidden"
|
||||||
|
|
||||||
if (cel.sets[set]) {
|
if (cel.initialPositions[set] != null) {
|
||||||
element.style.visibility = "visible"
|
element.style.visibility = "visible"
|
||||||
let position = Tracker.getCoordinate(cel, set)
|
let position = Tracker.getCoordinate(cel, set)
|
||||||
element.style.left = `${position.x}px`
|
element.style.left = `${position.x}px`
|
||||||
@@ -136,7 +136,7 @@ export default class Tracker {
|
|||||||
this.setPlayArea(this.set)
|
this.setPlayArea(this.set)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.playset.enabledSets.forEach((enabled, index) => {
|
this.playset.sets.forEach((enabled, index) => {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
let button = new Builder("li")
|
let button = new Builder("li")
|
||||||
.addChildren(new Builder("button")
|
.addChildren(new Builder("button")
|
||||||
|
|||||||
@@ -22,9 +22,16 @@ namespace fxl.codes.kisekae.Services
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadConfigurationToDto(Configuration dto, IDictionary<string, Cel> cels, IDictionary<string, Palette> palettes)
|
public void ReadConfiguration(Configuration dto,
|
||||||
|
IDictionary<Configuration, int> backgroundColors,
|
||||||
|
IDictionary<string, Cel> cels,
|
||||||
|
Dictionary<string, Palette> palettes)
|
||||||
{
|
{
|
||||||
|
_logger.LogInformation($"Reading {dto.Name}");
|
||||||
var initialPositions = new StringBuilder();
|
var initialPositions = new StringBuilder();
|
||||||
|
var backgroundColorIndex = 0;
|
||||||
|
var paletteOrder = new List<Palette>();
|
||||||
|
var celLines = new List<string>();
|
||||||
|
|
||||||
foreach (var line in dto.Data.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var line in dto.Data.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries))
|
||||||
switch (line.ToCharArray()[0])
|
switch (line.ToCharArray()[0])
|
||||||
@@ -38,13 +45,13 @@ namespace fxl.codes.kisekae.Services
|
|||||||
case '[':
|
case '[':
|
||||||
var borderValue = line[1..];
|
var borderValue = line[1..];
|
||||||
if (borderValue.Contains(';')) borderValue = borderValue.Split(';')[0].Trim();
|
if (borderValue.Contains(';')) borderValue = borderValue.Split(';')[0].Trim();
|
||||||
dto.BorderIndex = int.Parse(borderValue);
|
backgroundColorIndex = int.Parse(borderValue);
|
||||||
break;
|
break;
|
||||||
case '%':
|
case '%':
|
||||||
UpdatePalette(line, palettes);
|
SetPaletteOrder(line, palettes, paletteOrder);
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
dto.Cels.Add(SetCelConfig(line, dto, cels, palettes.Values.ToArray()));
|
celLines.Add(line);
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
case ' ':
|
case ' ':
|
||||||
@@ -52,7 +59,9 @@ namespace fxl.codes.kisekae.Services
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var line in celLines) dto.Cels.Add(SetCelConfig(line, dto, cels, paletteOrder));
|
||||||
SetInitialPositions(dto, initialPositions.ToString());
|
SetInitialPositions(dto, initialPositions.ToString());
|
||||||
|
backgroundColors.Add(dto, backgroundColorIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CelConfig SetCelConfig(string line, Configuration configuration, IDictionary<string, Cel> cels, IReadOnlyList<Palette> palettes)
|
private static CelConfig SetCelConfig(string line, Configuration configuration, IDictionary<string, Cel> cels, IReadOnlyList<Palette> palettes)
|
||||||
@@ -105,7 +114,7 @@ namespace fxl.codes.kisekae.Services
|
|||||||
var success = int.TryParse(id, out var result);
|
var success = int.TryParse(id, out var result);
|
||||||
if (!success) continue;
|
if (!success) continue;
|
||||||
|
|
||||||
if (cel.Sets == Set.Unset)
|
if (cel.Sets == Set.None)
|
||||||
cel.Sets = (Set)(2 ^ result);
|
cel.Sets = (Set)(2 ^ result);
|
||||||
else
|
else
|
||||||
cel.Sets |= (Set)(2 ^ result);
|
cel.Sets |= (Set)(2 ^ result);
|
||||||
@@ -117,31 +126,36 @@ namespace fxl.codes.kisekae.Services
|
|||||||
return cel;
|
return cel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdatePalette(string line, IDictionary<string, Palette> palettes)
|
private static void SetPaletteOrder(string line, IReadOnlyDictionary<string, Palette> palettes, ICollection<Palette> paletteOrder)
|
||||||
{
|
{
|
||||||
var parts = line.Split(';');
|
var parts = line.Split(';');
|
||||||
var palette = palettes[parts[0].Trim().ToLowerInvariant().Replace("%", "")];
|
var palette = palettes[parts[0].Trim().ToLowerInvariant().Replace("%", "")];
|
||||||
if (parts.Length > 1) palette.Comment = parts[1].Trim();
|
paletteOrder.Add(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetInitialPositions(Configuration dto, string positions)
|
private static void SetInitialPositions(Configuration dto, string positions)
|
||||||
{
|
{
|
||||||
var sets = positions.Split('$', StringSplitOptions.RemoveEmptyEntries);
|
var sets = positions.Split('$', StringSplitOptions.RemoveEmptyEntries);
|
||||||
foreach (var set in sets)
|
for (var index = 0; index < sets.Length; index++)
|
||||||
{
|
{
|
||||||
|
var set = sets[index];
|
||||||
var value = set.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
var value = set.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||||
var paletteGroup = int.Parse(value[0]);
|
var paletteGroup = int.Parse(value[0]);
|
||||||
|
|
||||||
for (var innerIndex = 1; innerIndex < value.Length; innerIndex++)
|
for (var innerIndex = 1; innerIndex < value.Length; innerIndex++)
|
||||||
{
|
{
|
||||||
if (value[innerIndex] == "*") continue;
|
if (value[innerIndex].Contains('*')) continue;
|
||||||
var point = value[innerIndex].Split(',', StringSplitOptions.RemoveEmptyEntries);
|
var point = value[innerIndex].Trim().Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
foreach (var cel in dto.Cels.Where(x => x.Mark == innerIndex - 1))
|
foreach (var cel in dto.Cels.Where(x => x.Mark == innerIndex - 1))
|
||||||
{
|
{
|
||||||
cel.PaletteGroup = paletteGroup;
|
cel.PaletteGroup = paletteGroup;
|
||||||
cel.X = int.Parse(point[0]);
|
cel.Positions.Add(new CelPosition
|
||||||
cel.Y = int.Parse(point[1]);
|
{
|
||||||
|
Set = index,
|
||||||
|
X = int.Parse(point[0]),
|
||||||
|
Y = int.Parse(point[1])
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ using fxl.codes.kisekae.Entities;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SixLabors.ImageSharp;
|
||||||
|
using Configuration = fxl.codes.kisekae.Entities.Configuration;
|
||||||
|
|
||||||
namespace fxl.codes.kisekae.Services
|
namespace fxl.codes.kisekae.Services
|
||||||
{
|
{
|
||||||
@@ -47,6 +49,8 @@ namespace fxl.codes.kisekae.Services
|
|||||||
using var context = _contextFactory.CreateDbContext();
|
using var context = _contextFactory.CreateDbContext();
|
||||||
return context.Configurations
|
return context.Configurations
|
||||||
.Include(x => x.Cels).ThenInclude(x => x.Render)
|
.Include(x => x.Cels).ThenInclude(x => x.Render)
|
||||||
|
.Include(x => x.Cels).ThenInclude(x => x.Cel)
|
||||||
|
.Include(x => x.Cels).ThenInclude(x => x.Positions)
|
||||||
.Include(x => x.Kisekae).ThenInclude(x => x.Palettes).ThenInclude(x => x.Colors)
|
.Include(x => x.Kisekae).ThenInclude(x => x.Palettes).ThenInclude(x => x.Colors)
|
||||||
.AsSplitQuery()
|
.AsSplitQuery()
|
||||||
.FirstOrDefault(x => x.Id == id);
|
.FirstOrDefault(x => x.Id == id);
|
||||||
@@ -55,7 +59,7 @@ namespace fxl.codes.kisekae.Services
|
|||||||
public async void StoreToDatabase(IFormFile file)
|
public async void StoreToDatabase(IFormFile file)
|
||||||
{
|
{
|
||||||
var memoryStream = await GetAsMemoryStream(file);
|
var memoryStream = await GetAsMemoryStream(file);
|
||||||
var checksum = Convert.ToBase64String(await SHA256.Create().ComputeHashAsync(memoryStream));
|
var checksum = Convert.ToBase64String(SHA256.Create().ComputeHash(memoryStream.GetBuffer()));
|
||||||
memoryStream.Position = 0; // Reset for re-read
|
memoryStream.Position = 0; // Reset for re-read
|
||||||
|
|
||||||
await using var context = await _contextFactory.CreateDbContextAsync();
|
await using var context = await _contextFactory.CreateDbContextAsync();
|
||||||
@@ -76,20 +80,24 @@ namespace fxl.codes.kisekae.Services
|
|||||||
var filenames = _storage.GetFileNames($"{Path.Combine(directory, "*")}");
|
var filenames = _storage.GetFileNames($"{Path.Combine(directory, "*")}");
|
||||||
await SetInnerFiles(kisekae, directory, filenames);
|
await SetInnerFiles(kisekae, directory, filenames);
|
||||||
|
|
||||||
|
var backgroundColors = new Dictionary<Configuration, int>();
|
||||||
foreach (var config in kisekae.Configurations)
|
foreach (var config in kisekae.Configurations)
|
||||||
_configurationReaderService.ReadConfigurationToDto(config,
|
_configurationReaderService.ReadConfiguration(config,
|
||||||
|
backgroundColors,
|
||||||
kisekae.Cels.ToDictionary(x => x.FileName.ToLowerInvariant()),
|
kisekae.Cels.ToDictionary(x => x.FileName.ToLowerInvariant()),
|
||||||
kisekae.Palettes.ToDictionary(x => x.FileName.ToLowerInvariant()));
|
kisekae.Palettes.ToDictionary(x => x.FileName.ToLowerInvariant()));
|
||||||
|
|
||||||
SetPaletteColors(kisekae.Palettes);
|
SetPaletteColors(kisekae.Palettes);
|
||||||
|
|
||||||
|
foreach (var (config, colorIndex) in backgroundColors)
|
||||||
|
config.BackgroundColorHex = kisekae.Palettes.First()?.Colors[colorIndex].Hex ?? Color.White.ToHex();
|
||||||
foreach (var celConfig in kisekae.Configurations.SelectMany(config => config.Cels))
|
foreach (var celConfig in kisekae.Configurations.SelectMany(config => config.Cels))
|
||||||
{
|
|
||||||
_fileParserService.RenderCel(celConfig);
|
_fileParserService.RenderCel(celConfig);
|
||||||
}
|
|
||||||
|
|
||||||
await context.AddAsync(kisekae);
|
await context.AddAsync(kisekae);
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
|
//_storage.DeleteDirectory(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SetInnerFiles(Kisekae kisekae, string directory, IEnumerable<string> filenames)
|
private async Task SetInnerFiles(Kisekae kisekae, string directory, IEnumerable<string> filenames)
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ namespace fxl.codes.kisekae
|
|||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
NpgsqlLogManager.Provider = new ConsoleLoggingProvider(NpgsqlLogLevel.Debug);
|
NpgsqlLogManager.Provider = new ConsoleLoggingProvider();
|
||||||
NpgsqlLogManager.IsParameterLoggingEnabled = true;
|
NpgsqlLogManager.IsParameterLoggingEnabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
{
|
{
|
||||||
var cel = Model.Cels[index];
|
var cel = Model.Cels[index];
|
||||||
<div class="cel-image"
|
<div class="cel-image"
|
||||||
style="background-image: url('data:image/gif;base64,@cel.Image');"
|
style="background-image: url('data:image/gif;base64,@cel.Image'); height: @(cel.Height)px; width: @(cel.Width)px; z-index: @cel.ZIndex; opacity: @cel.Opacity"
|
||||||
data-id="@cel.Mark"
|
data-id="@cel.Mark"
|
||||||
data-index="@index"></div>
|
data-index="@index"></div>
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user