Initial commit

This commit is contained in:
Lncvrt committed 2026-08-22 17:37:47 -07:00
commit 6d2ea5b130
6 files changed
+580

No files matched your search

+102
View File
@@ -0,0 +1,102 @@
using Newtonsoft.Json;
using TrianglesToGD;
var level = JsonConvert.DeserializeObject<Level>(File.ReadAllText("C:\\Users\\Travis\\Downloads\\level.json"));
if (level == null) return;
string gdString = $"kS38,1_{level.data.backgroundColor.R}_2_{level.data.backgroundColor.G}_3_{level.data.backgroundColor.B}_11_255_12_255_13_255_4_-1_6_1000_7_1.000000_15_1.000000_18_0_8_1|1_{level.data.groundColor.R}_2_{level.data.groundColor.G}_3_{level.data.groundColor.B}_11_255_12_255_13_255_4_-1_6_1001_7_1.000000_15_1.000000_18_0_8_1|1_0_2_102_3_255_11_255_12_255_13_255_4_-1_6_1009_7_1.000000_15_1.000000_18_0_8_1|1_255_2_255_3_255_11_255_12_255_13_255_4_-1_6_1002_5_1_7_1.000000_15_1.000000_18_0_8_1|1_40_2_125_3_255_11_255_12_255_13_255_4_-1_6_1013_7_1.000000_15_1.000000_18_0_8_1|1_40_2_125_3_255_11_255_12_255_13_255_4_-1_6_1014_7_1.000000_15_1.000000_18_0_8_1|1_125_2_255_3_0_11_255_12_255_13_255_4_-1_6_1005_5_1_7_1.000000_15_1.000000_18_0_8_1|1_0_2_255_3_255_11_255_12_255_13_255_4_-1_6_1006_5_1_7_1.000000_15_1.000000_18_0_8_1|1_255_2_255_3_255_11_255_12_255_13_255_4_-1_6_1004_7_1.000000_15_1.000000_18_0_8_1|,kA13,0.000000,kA15,0,kA16,0,kA14,,kA6,0,kA7,0,kA25,0,kA17,0,kA18,0,kS39,0,kA2,0,kA3,0,kA8,0,kA4,0,kA9,0,kA10,0,kA22,0,kA23,0,kA24,0,kA27,1,kA40,1,kA48,1,kA41,1,kA42,1,kA28,0,kA29,0,kA31,1,kA32,1,kA36,0,kA43,0,kA44,0,kA45,1,kA46,0,kA47,0,kA33,1,kA34,1,kA35,0,kA37,1,kA38,1,kA39,1,kA19,0,kA26,0,kA20,0,kA21,0,kA11,0";
foreach (var obj in level.data.objects)
{
int id = 1;
float x = obj.pos.X * 30 + 15;
float y = obj.pos.Y * 30 + 15;
switch (obj.id)
{
case 1:
id = 1;
break;
case 2:
id = 40;
break;
case 3:
id = 8;
break;
case 4:
id = 39;
switch (obj.rotation)
{
case 0:
y -= 9f;
break;
case 270:
x -= 9f;
break;
case 180:
y += 9f;
break;
case 90:
x += 9f;
break;
}
break;
case 5:
id = 392;
switch (obj.rotation)
{
case 0:
y -= 9.75f;
break;
case 270:
x -= 9.75f;
break;
case 180:
y += 9.75f;
break;
case 90:
x += 9.75f;
break;
}
break;
case 6:
id = 467;
break;
case 7:
id = 470;
break;
case 8:
id = 471;
break;
case 9:
id = 469;
break;
case 10:
id = 468;
switch (obj.rotation)
{
case 0:
y += 14.25f;
break;
case 270:
x += 14.25f;
break;
case 180:
y -= 14.25f;
break;
case 90:
x -= 14.25f;
break;
}
break;
case 11:
id = 5;
break;
case 12:
id = 3600;
break;
}
gdString += $";1,{id},2,{x},3,{y},6,{-obj.rotation}";
}
gdString += ";";
Console.WriteLine(gdString);
+35
View File
@@ -0,0 +1,35 @@
using System.Drawing;
using System.Numerics;
namespace TrianglesToGD
{
[Serializable]
public class Level
{
public int id = 0;
public string name = string.Empty;
public string description = string.Empty;
public bool verified = false;
public bool uploaded = false;
public int uploadedId = -1;
public Vector3 editorCameraPos = new();
public float editorCameraZoom = 35.0f;
public LevelData data = new();
}
[Serializable]
public class LevelData
{
public Color backgroundColor = Color.FromArgb(90, 90, 255);
public Color groundColor = Color.FromArgb(60, 60, 200);
public List<Object> objects = new();
}
[Serializable]
public class Object
{
public int id = -1;
public Vector2 pos = new();
public int rotation = 0;
}
}
+14
View File
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project>