merge
This commit is contained in:
commit
973584a06e
5 changed files with 189 additions and 1 deletions
17
AnimationsFileCreator/AnimationsFileCreator.csproj
Normal file
17
AnimationsFileCreator/AnimationsFileCreator.csproj
Normal 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>
|
72
AnimationsFileCreator/Program.cs
Normal file
72
AnimationsFileCreator/Program.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
ZoFo.sln
6
ZoFo.sln
|
@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZoFo", "ZoFo\ZoFo.csproj",
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonogameLibrary", "MonogameLibrary\MonogameLibrary.csproj", "{40880E68-4B3A-417B-A39B-95DE46AA2E7E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonogameLibrary", "MonogameLibrary\MonogameLibrary.csproj", "{40880E68-4B3A-417B-A39B-95DE46AA2E7E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationsFileCreator", "AnimationsFileCreator\AnimationsFileCreator.csproj", "{7B143D5C-5198-4ADE-9291-ECC924B78633}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
93
ZoFo/GameCore/GameManagers/SettingsManager.cs
Normal file
93
ZoFo/GameCore/GameManagers/SettingsManager.cs
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Xna;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers
|
||||||
|
{
|
||||||
|
public class SettingsManager //нужно что-то менять с разрешением
|
||||||
|
{
|
||||||
|
private SettingsContainer settingsContainer = new SettingsContainer();
|
||||||
|
public bool IsFullScreen { get => settingsContainer.IsFullScreen; }
|
||||||
|
public float MainVolume { get => settingsContainer.MainVolume; }
|
||||||
|
public float MusicVolume { get => settingsContainer.MusicVolume; }
|
||||||
|
public float SoundEffectsVolume { get => settingsContainer.SoundEffectsVolume; }
|
||||||
|
public Point Resolution { get => settingsContainer.Resolution; }
|
||||||
|
public void SetResolution(Point resolution)
|
||||||
|
{
|
||||||
|
settingsContainer.Resolution = resolution;
|
||||||
|
//AppManager.Instance.resolution = resolution;
|
||||||
|
}
|
||||||
|
public void SetMainVolume(float volume)
|
||||||
|
{
|
||||||
|
settingsContainer.MainVolume = volume;
|
||||||
|
//AppManager.Instance.SoundManager.Update();
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
|
public void SetMusicVolume(float volume)
|
||||||
|
{
|
||||||
|
settingsContainer.MusicVolume = volume;
|
||||||
|
SaveSettings();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void SetSoundEffectsVolume(float volume)
|
||||||
|
{
|
||||||
|
settingsContainer.SoundEffectsVolume = volume;
|
||||||
|
SaveSettings();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void SetIsFullScreen(bool isFullScreen)
|
||||||
|
{
|
||||||
|
settingsContainer.IsFullScreen = isFullScreen;
|
||||||
|
//AppManager.Instance.SetIsFullScreen(isFullScreen);
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
|
public void LoadSettings()
|
||||||
|
{
|
||||||
|
if (!File.Exists("GameSettings.txt"))
|
||||||
|
{
|
||||||
|
SaveSettings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsContainer = JsonConvert.DeserializeObject<SettingsContainer>(File.ReadAllText("GameSettings.txt"));
|
||||||
|
SetIsFullScreen(settingsContainer.IsFullScreen);
|
||||||
|
SetMainVolume(settingsContainer.MainVolume);
|
||||||
|
SetMusicVolume(settingsContainer.MusicVolume);
|
||||||
|
SetResolution(settingsContainer.Resolution);
|
||||||
|
SetSoundEffectsVolume(settingsContainer.SoundEffectsVolume);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public void SaveSettings()
|
||||||
|
{
|
||||||
|
using (StreamWriter streamWriter = new StreamWriter("GameSettings.txt"))
|
||||||
|
{
|
||||||
|
string _str = JsonConvert.SerializeObject(settingsContainer);
|
||||||
|
streamWriter.Write(_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
[Serializable]
|
||||||
|
public class SettingsContainer
|
||||||
|
{
|
||||||
|
[JsonProperty("IsFullScreen")]
|
||||||
|
public bool IsFullScreen { get; set; } = false;
|
||||||
|
[JsonProperty("MainVolume")]
|
||||||
|
public float MainVolume { get; set; } = 1;
|
||||||
|
[JsonProperty("MusicVolume")]
|
||||||
|
public float MusicVolume { get; set; } = 1;
|
||||||
|
[JsonProperty("SoundEffectsVolume")]
|
||||||
|
public float SoundEffectsVolume { get; set; } = 1;
|
||||||
|
[JsonProperty("Resolution")]
|
||||||
|
public Point Resolution { get; set; } = new Point(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
|
||||||
|
}
|
||||||
|
}
|
|
@ -114,7 +114,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
SoundEffect = soundEffect;
|
SoundEffect = soundEffect;
|
||||||
Position = position;
|
Position = position;
|
||||||
}
|
}
|
||||||
/*/ public void UpdateVolume(Vector2 playerPos)
|
/*/public void UpdateVolume(Vector2 playerPos)
|
||||||
{
|
{
|
||||||
if (isAmbient)
|
if (isAmbient)
|
||||||
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||||
|
|
Loading…
Add table
Reference in a new issue