From c2f3c8404840fe034bba590bb7c4c855371afa1f Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Fri, 16 Aug 2024 11:25:12 +0300 Subject: [PATCH] Add cross-platform support --- .../AnimationsFileCreator.csproj | 17 +++++ AnimationsFileCreator/Program.cs | 72 +++++++++++++++++++ ZoFo.sln | 6 ++ 3 files changed, 95 insertions(+) create mode 100644 AnimationsFileCreator/AnimationsFileCreator.csproj create mode 100644 AnimationsFileCreator/Program.cs diff --git a/AnimationsFileCreator/AnimationsFileCreator.csproj b/AnimationsFileCreator/AnimationsFileCreator.csproj new file mode 100644 index 0000000..b8c3b86 --- /dev/null +++ b/AnimationsFileCreator/AnimationsFileCreator.csproj @@ -0,0 +1,17 @@ + + + + Exe + net8.0 + + + + + + + + + + + + diff --git a/AnimationsFileCreator/Program.cs b/AnimationsFileCreator/Program.cs new file mode 100644 index 0000000..68768cf --- /dev/null +++ b/AnimationsFileCreator/Program.cs @@ -0,0 +1,72 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; +using Newtonsoft.Json; +using System; +using NativeFileDialogSharp; +using System.IO; +using System.Linq; +using System.Reflection.Metadata; +using Zofo.GameCore.ZoFo_grafics; + +namespace AnimationsFileCreator +{ + class Program + { + [STAThread] + static void Main(string[] args) + { + Console.WriteLine("Добро пожаловать в костыльную программу по созданию файлов анимации для игры DungerousD"); + Console.Write("Введите название текстуры (нажмите enter, чтобы выбрать файл во всплывающем окошке): "); + string textureName = Console.ReadLine(); + if (textureName == "") + { + + DialogResult result = Dialog.FileOpen(); + textureName = result.Path.Split('\\').Last(); + textureName = textureName.Split('.')[0]; + } + Console.WriteLine("Введите количество кадров анимации: "); + int framesCount = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите длительность кадра в анимации: "); + int interval = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите начальную позицию X ректенгла анимации: "); + Rectangle rectangle = new Rectangle(); + rectangle.X = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите начальную позицию Y ректенгла анимации: "); + rectangle.Y = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите начальную позицию Width ректенгла анимации: "); + rectangle.Width = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите начальную позицию Height ректенгла анимации: "); + rectangle.Height = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите название для этого файла - id анимации"); + string id = Console.ReadLine(); + Console.WriteLine("Введите 1 если анимация зациклена, и 0 если нет"); + AnimationContainer container = new AnimationContainer(); + + int a = int.Parse(Console.ReadLine()); + if (a==1) + { + container.IsCycle = true; + } + else + { + container.IsCycle = false; + } + Console.WriteLine("Введите отклонение анимации от стандартной (сначала X, потом enter, потом Y): "); + int otklx = int.Parse(Console.ReadLine()); + int otkly = int.Parse(Console.ReadLine()); + container.Offset =new Vector2(otklx,otkly); + container.FramesCount = framesCount; + container.FrameTime = new System.Collections.Generic.List>(); + container.FrameTime.Add(new Tuple(0, interval)); + container.StartSpriteRectangle = rectangle; + container.TextureName = textureName; + container.TextureFrameInterval = 1; + container.Id = id; + string json = JsonConvert.SerializeObject(container); + StreamWriter writer = new StreamWriter("../../../../ZoFo/Content/animations/"+id); + writer.WriteLine(json); + writer.Close(); + } + } +} diff --git a/ZoFo.sln b/ZoFo.sln index 81a0c18..3ea9985 100644 --- a/ZoFo.sln +++ b/ZoFo.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZoFo", "ZoFo\ZoFo.csproj", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonogameLibrary", "MonogameLibrary\MonogameLibrary.csproj", "{40880E68-4B3A-417B-A39B-95DE46AA2E7E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationsFileCreator", "AnimationsFileCreator\AnimationsFileCreator.csproj", "{7B143D5C-5198-4ADE-9291-ECC924B78633}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU {40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU {40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Release|Any CPU.Build.0 = Release|Any CPU + {7B143D5C-5198-4ADE-9291-ECC924B78633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B143D5C-5198-4ADE-9291-ECC924B78633}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B143D5C-5198-4ADE-9291-ECC924B78633}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B143D5C-5198-4ADE-9291-ECC924B78633}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE