Merge pull request #15 from progtime-net/AnimationFileCreator

Add cross-platform support
This commit is contained in:
Andrey 2024-08-16 11:28:44 +03:00 committed by GitHub
commit 1683fb7564
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ZoFo\ZoFo.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NativeFileDialogSharp" Version="0.6.0-alpha" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
</ItemGroup>
</Project>

View file

@ -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<Tuple<int, int>>();
container.FrameTime.Add(new Tuple<int, int>(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();
}
}
}

View file

@ -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