werge rranch 'GUI' of github.com:progtime-net/ZoFo into GUI
This commit is contained in:
commit
a453ba9990
66 changed files with 1920 additions and 271 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,10 @@ namespace MonogameLibrary.UI.Elements
|
||||||
private bool isChecked;
|
private bool isChecked;
|
||||||
HoverState hoverState = HoverState.None;
|
HoverState hoverState = HoverState.None;
|
||||||
public bool GetChecked { get { return isChecked; } }
|
public bool GetChecked { get { return isChecked; } }
|
||||||
|
public void SetIsChecked(bool isChecked)
|
||||||
|
{
|
||||||
|
this.isChecked=isChecked;
|
||||||
|
}
|
||||||
public bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
public bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
||||||
{
|
{
|
||||||
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
||||||
|
|
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
|
||||||
|
|
|
@ -34,6 +34,63 @@
|
||||||
/processorParam:TextureFormat=Compressed
|
/processorParam:TextureFormat=Compressed
|
||||||
/build:Fonts/Font3.spritefont
|
/build:Fonts/Font3.spritefont
|
||||||
|
|
||||||
|
#begin MapData/TileMaps/main.tmj
|
||||||
|
/copy:MapData/TileMaps/main.tmj
|
||||||
|
|
||||||
|
#begin MapData/TileMaps/main.tmx
|
||||||
|
/copy:MapData/TileMaps/main.tmx
|
||||||
|
|
||||||
|
#begin MapData/TileSets/TileSet 1.tsj
|
||||||
|
/copy:MapData/TileSets/TileSet 1.tsj
|
||||||
|
|
||||||
|
#begin sounds/Loot.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Loot.wav
|
||||||
|
|
||||||
|
#begin sounds/Odevanie odezdi.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Odevanie odezdi.wav
|
||||||
|
|
||||||
|
#begin sounds/Pieot wodichky.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Pieot wodichky.wav
|
||||||
|
|
||||||
|
#begin sounds/Sshetchik geigera.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Sshetchik geigera.wav
|
||||||
|
|
||||||
|
#begin sounds/Tabletki 2.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Tabletki 2.wav
|
||||||
|
|
||||||
|
#begin sounds/Tabletki.mp3
|
||||||
|
/importer:Mp3Importer
|
||||||
|
/processor:SongProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Tabletki.mp3
|
||||||
|
|
||||||
|
#begin sounds/Zombi napal.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Zombi napal.wav
|
||||||
|
|
||||||
|
#begin sounds/Zombi stoit.wav
|
||||||
|
/importer:WavImporter
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:sounds/Zombi stoit.wav
|
||||||
|
|
||||||
#begin Textures/GUI/background/base.png
|
#begin Textures/GUI/background/base.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -202,3 +259,15 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/switch.png
|
/build:Textures/GUI/switch.png
|
||||||
|
|
||||||
|
#begin Textures/TileSets/TilesetFloor.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:Textures/TileSets/TilesetFloor.png;Textures/TileSets/TileSet 1.png
|
||||||
|
|
||||||
|
|
167
ZoFo/Content/MapData/TileMaps/main.tmj
Normal file
167
ZoFo/Content/MapData/TileMaps/main.tmj
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
{ "compressionlevel":-1,
|
||||||
|
"height":20,
|
||||||
|
"infinite":true,
|
||||||
|
"layers":[
|
||||||
|
{
|
||||||
|
"chunks":[
|
||||||
|
{
|
||||||
|
"data":[24, 24, 24, 28, 29, 24, 24, 24, 28, 46, 29, 24, 25, 115, 45, 46,
|
||||||
|
24, 24, 24, 25, 23, 24, 24, 24, 50, 2, 51, 24, 50, 2, 2, 2,
|
||||||
|
24, 24, 24, 50, 32, 29, 24, 24, 24, 24, 24, 24, 24, 24, 24, 28,
|
||||||
|
28, 29, 24, 28, 10, 32, 29, 24, 24, 28, 46, 29, 24, 24, 24, 50,
|
||||||
|
47, 23, 24, 50, 32, 10, 32, 46, 29, 50, 2, 51, 24, 24, 24, 24,
|
||||||
|
1, 32, 29, 90, 25, 23, 50, 2, 32, 29, 24, 90, 28, 29, 24, 24,
|
||||||
|
51, 50, 32, 29, 50, 51, 90, 24, 25, 45, 46, 29, 25, 23, 24, 90,
|
||||||
|
24, 24, 50, 32, 46, 29, 24, 28, 10, 2, 2, 51, 50, 51, 24, 90,
|
||||||
|
24, 24, 24, 50, 2, 32, 46, 10, 32, 29, 24, 90, 24, 24, 24, 90,
|
||||||
|
29, 24, 89, 24, 24, 50, 3, 23, 50, 32, 46, 46, 46, 46, 29, 24,
|
||||||
|
51, 24, 24, 28, 29, 24, 25, 23, 24, 25, 1, 2, 3, 111, 45, 29,
|
||||||
|
24, 90, 24, 50, 51, 24, 25, 23, 28, 47, 23, 89, 50, 3, 115, 23,
|
||||||
|
24, 24, 24, 24, 24, 89, 50, 32, 47, 1, 51, 24, 24, 50, 2, 51,
|
||||||
|
28, 29, 24, 24, 24, 24, 28, 10, 2, 51, 24, 24, 24, 24, 24, 28,
|
||||||
|
10, 32, 29, 24, 24, 24, 25, 23, 28, 29, 90, 24, 24, 90, 24, 50,
|
||||||
|
32, 10, 51, 24, 24, 24, 50, 32, 10, 32, 29, 24, 90, 28, 29, 24],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":-16,
|
||||||
|
"y":-16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[10, 51, 24, 90, 24, 25, 23, 28, 29, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
51, 24, 28, 29, 24, 50, 32, 10, 51, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
29, 28, 10, 32, 46, 29, 50, 32, 29, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
51, 25, 23, 50, 2, 32, 29, 25, 23, 24, 24, 28, 29, 24, 90, 24,
|
||||||
|
24, 25, 23, 24, 24, 25, 23, 50, 51, 24, 24, 50, 32, 29, 24, 90,
|
||||||
|
24, 50, 32, 29, 90, 25, 45, 29, 24, 24, 24, 24, 50, 51, 24, 89,
|
||||||
|
24, 89, 50, 51, 24, 25, 114, 23, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
24, 24, 28, 29, 24, 50, 2, 51, 24, 24, 90, 28, 29, 24, 24, 28,
|
||||||
|
24, 24, 25, 23, 89, 24, 24, 24, 28, 46, 29, 25, 23, 24, 24, 50,
|
||||||
|
28, 46, 10, 51, 24, 28, 46, 29, 25, 111, 45, 10, 51, 28, 29, 24,
|
||||||
|
50, 2, 51, 24, 24, 25, 115, 45, 10, 3, 1, 51, 24, 25, 23, 24,
|
||||||
|
24, 24, 24, 24, 24, 50, 2, 2, 32, 10, 51, 24, 90, 25, 23, 24,
|
||||||
|
24, 24, 24, 24, 24, 24, 24, 24, 50, 51, 24, 24, 24, 25, 23, 24,
|
||||||
|
46, 29, 24, 24, 24, 24, 24, 89, 24, 24, 24, 28, 46, 47, 23, 90,
|
||||||
|
2, 32, 29, 24, 24, 28, 46, 46, 29, 24, 24, 25, 1, 3, 23, 89,
|
||||||
|
24, 50, 32, 29, 24, 25, 1, 3, 23, 24, 89, 50, 32, 10, 51, 24],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":-16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[24, 24, 24, 24, 90, 24, 89, 24, 89, 24, 50, 51, 89, 24, 24, 24,
|
||||||
|
24, 28, 29, 28, 29, 24, 24, 24, 24, 28, 29, 24, 24, 24, 28, 29,
|
||||||
|
24, 25, 23, 50, 51, 24, 24, 28, 29, 50, 51, 24, 24, 24, 25, 45,
|
||||||
|
90, 50, 51, 28, 29, 24, 24, 25, 23, 24, 24, 28, 29, 24, 50, 3,
|
||||||
|
24, 24, 28, 10, 51, 90, 90, 50, 51, 24, 24, 50, 51, 24, 24, 50,
|
||||||
|
24, 24, 25, 45, 29, 24, 28, 29, 24, 24, 24, 24, 24, 28, 29, 24,
|
||||||
|
90, 24, 50, 2, 51, 28, 10, 51, 90, 24, 28, 29, 24, 25, 45, 46,
|
||||||
|
29, 90, 24, 24, 24, 50, 51, 24, 24, 28, 10, 32, 46, 10, 3, 1,
|
||||||
|
32, 29, 24, 90, 24, 24, 24, 24, 28, 47, 23, 50, 2, 51, 50, 51,
|
||||||
|
25, 23, 24, 24, 28, 46, 46, 46, 47, 114, 45, 29, 24, 24, 24, 24,
|
||||||
|
50, 32, 29, 24, 50, 3, 111, 111, 115, 111, 1, 32, 29, 24, 24, 24,
|
||||||
|
24, 50, 51, 24, 28, 10, 2, 2, 2, 2, 32, 10, 51, 24, 24, 89,
|
||||||
|
24, 24, 89, 90, 25, 23, 24, 24, 24, 24, 50, 32, 46, 46, 29, 89,
|
||||||
|
24, 24, 24, 90, 25, 23, 89, 24, 28, 29, 90, 50, 2, 2, 51, 24,
|
||||||
|
24, 24, 24, 28, 10, 51, 24, 28, 47, 45, 29, 24, 24, 24, 24, 24,
|
||||||
|
24, 24, 24, 25, 23, 24, 90, 50, 2, 2, 32, 46, 46, 46, 46, 46],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":16,
|
||||||
|
"y":-16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[10, 32, 46, 29, 24, 24, 24, 25, 23, 50, 32, 29, 24, 50, 32, 46,
|
||||||
|
51, 50, 2, 32, 29, 24, 24, 25, 45, 29, 25, 23, 24, 24, 25, 1,
|
||||||
|
24, 24, 24, 25, 23, 28, 46, 10, 2, 51, 50, 51, 24, 24, 50, 51,
|
||||||
|
90, 89, 90, 50, 51, 50, 2, 51, 24, 24, 28, 29, 90, 24, 24, 24,
|
||||||
|
90, 28, 46, 29, 90, 24, 24, 24, 90, 24, 50, 51, 90, 24, 90, 28,
|
||||||
|
29, 50, 2, 51, 24, 24, 24, 89, 24, 24, 24, 24, 24, 89, 24, 50,
|
||||||
|
23, 24, 24, 28, 46, 29, 90, 90, 24, 89, 24, 28, 29, 24, 24, 24,
|
||||||
|
32, 46, 29, 25, 115, 45, 29, 24, 90, 24, 24, 25, 23, 24, 24, 28,
|
||||||
|
10, 2, 32, 47, 115, 1, 51, 24, 24, 24, 24, 25, 23, 24, 28, 10,
|
||||||
|
32, 29, 50, 2, 2, 51, 24, 24, 24, 24, 24, 25, 23, 28, 10, 51,
|
||||||
|
50, 51, 89, 24, 24, 89, 24, 28, 29, 24, 24, 50, 32, 10, 32, 46,
|
||||||
|
24, 24, 90, 90, 28, 46, 29, 50, 51, 24, 24, 24, 25, 23, 25, 115,
|
||||||
|
24, 90, 24, 24, 50, 2, 32, 29, 24, 24, 90, 24, 25, 45, 10, 2,
|
||||||
|
24, 24, 24, 24, 24, 24, 50, 32, 29, 24, 24, 28, 10, 3, 23, 24,
|
||||||
|
90, 24, 24, 24, 24, 89, 90, 50, 32, 29, 90, 50, 51, 50, 32, 46,
|
||||||
|
46, 29, 24, 90, 24, 24, 24, 24, 50, 51, 28, 29, 24, 24, 50, 2],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":-16,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[46, 46, 10, 32, 46, 47, 23, 25, 23, 89, 24, 24, 25, 23, 90, 24,
|
||||||
|
2, 2, 32, 47, 1, 2, 51, 25, 23, 24, 28, 29, 50, 32, 29, 24,
|
||||||
|
24, 90, 50, 3, 23, 24, 28, 10, 51, 28, 47, 45, 29, 25, 23, 28,
|
||||||
|
24, 24, 24, 50, 51, 28, 47, 23, 24, 50, 3, 114, 45, 10, 51, 50,
|
||||||
|
29, 24, 24, 89, 24, 25, 114, 45, 46, 46, 10, 2, 2, 32, 29, 89,
|
||||||
|
51, 24, 24, 24, 24, 50, 3, 111, 115, 115, 23, 24, 24, 50, 32, 29,
|
||||||
|
24, 28, 29, 24, 24, 24, 25, 1, 2, 2, 51, 90, 24, 90, 50, 51,
|
||||||
|
29, 50, 32, 29, 28, 29, 25, 23, 24, 24, 89, 28, 29, 24, 24, 24,
|
||||||
|
51, 24, 50, 51, 50, 32, 10, 32, 46, 29, 24, 50, 51, 24, 90, 24,
|
||||||
|
24, 24, 24, 24, 89, 50, 32, 10, 2, 32, 46, 29, 89, 28, 29, 24,
|
||||||
|
29, 90, 24, 24, 24, 24, 50, 51, 28, 10, 3, 23, 28, 10, 51, 24,
|
||||||
|
23, 89, 24, 24, 90, 24, 24, 24, 50, 32, 10, 51, 50, 51, 24, 24,
|
||||||
|
51, 24, 24, 24, 24, 24, 24, 24, 24, 50, 32, 46, 46, 29, 28, 46,
|
||||||
|
24, 24, 24, 90, 24, 24, 24, 24, 24, 24, 50, 3, 1, 32, 47, 115,
|
||||||
|
46, 29, 24, 89, 24, 24, 24, 89, 24, 24, 24, 25, 45, 10, 3, 111,
|
||||||
|
2, 51, 28, 29, 28, 29, 24, 28, 46, 46, 46, 10, 2, 51, 50, 2],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[28, 29, 28, 10, 32, 46, 29, 24, 24, 28, 10, 2, 2, 2, 2, 2,
|
||||||
|
50, 51, 50, 51, 25, 115, 45, 46, 29, 50, 51, 24, 24, 24, 24, 24,
|
||||||
|
29, 24, 89, 24, 50, 3, 115, 114, 23, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
51, 90, 24, 89, 24, 50, 2, 2, 51, 24, 89, 24, 24, 28, 46, 29,
|
||||||
|
24, 90, 24, 24, 89, 24, 90, 28, 29, 24, 24, 24, 28, 10, 2, 51,
|
||||||
|
24, 24, 24, 24, 28, 29, 90, 50, 51, 28, 29, 24, 25, 23, 24, 24,
|
||||||
|
28, 29, 24, 24, 50, 32, 29, 28, 29, 50, 51, 89, 50, 32, 29, 24,
|
||||||
|
50, 51, 24, 24, 24, 50, 32, 10, 51, 24, 89, 24, 24, 25, 23, 24,
|
||||||
|
24, 24, 24, 24, 24, 24, 50, 32, 29, 24, 24, 24, 24, 50, 51, 24,
|
||||||
|
90, 24, 24, 24, 24, 24, 24, 25, 45, 29, 24, 24, 24, 89, 28, 29,
|
||||||
|
24, 24, 24, 24, 28, 29, 24, 25, 1, 51, 24, 24, 24, 24, 50, 32,
|
||||||
|
28, 29, 28, 29, 50, 32, 46, 10, 51, 28, 29, 24, 24, 24, 24, 50,
|
||||||
|
47, 45, 10, 51, 24, 50, 2, 32, 46, 47, 23, 24, 89, 90, 24, 24,
|
||||||
|
111, 115, 23, 24, 24, 90, 24, 50, 2, 2, 32, 29, 24, 89, 28, 46,
|
||||||
|
1, 2, 51, 28, 46, 46, 29, 24, 28, 29, 50, 32, 29, 28, 47, 111,
|
||||||
|
51, 24, 24, 50, 3, 114, 23, 24, 50, 32, 46, 47, 23, 25, 111, 111],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":16,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"class":"Tile",
|
||||||
|
"height":48,
|
||||||
|
"id":1,
|
||||||
|
"name":"\u0421\u043b\u043e\u0439 \u0442\u0430\u0439\u043b\u043e\u0432 1",
|
||||||
|
"opacity":1,
|
||||||
|
"startx":-16,
|
||||||
|
"starty":-32,
|
||||||
|
"type":"tilelayer",
|
||||||
|
"visible":true,
|
||||||
|
"width":48,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"nextlayerid":2,
|
||||||
|
"nextobjectid":1,
|
||||||
|
"orientation":"orthogonal",
|
||||||
|
"renderorder":"right-down",
|
||||||
|
"tiledversion":"1.10.2",
|
||||||
|
"tileheight":16,
|
||||||
|
"tilesets":[
|
||||||
|
{
|
||||||
|
"firstgid":1,
|
||||||
|
"source":"TileSets\/TileSet 1.tsj"
|
||||||
|
}],
|
||||||
|
"tilewidth":16,
|
||||||
|
"type":"map",
|
||||||
|
"version":"1.10",
|
||||||
|
"width":30
|
||||||
|
}
|
116
ZoFo/Content/MapData/TileMaps/main.tmx
Normal file
116
ZoFo/Content/MapData/TileMaps/main.tmx
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="2" nextobjectid="1">
|
||||||
|
<tileset firstgid="1" source="../TileSets/TileSet 1.tsj"/>
|
||||||
|
<layer id="1" name="Слой тайлов 1" width="30" height="20">
|
||||||
|
<data encoding="csv">
|
||||||
|
<chunk x="-16" y="-16" width="16" height="16">
|
||||||
|
24,24,24,28,29,24,24,24,28,46,29,24,25,115,45,46,
|
||||||
|
24,24,24,25,23,24,24,24,50,2,51,24,50,2,2,2,
|
||||||
|
24,24,24,50,32,29,24,24,24,24,24,24,24,24,24,28,
|
||||||
|
28,29,24,28,10,32,29,24,24,28,46,29,24,24,24,50,
|
||||||
|
47,23,24,50,32,10,32,46,29,50,2,51,24,24,24,24,
|
||||||
|
1,32,29,90,25,23,50,2,32,29,24,90,28,29,24,24,
|
||||||
|
51,50,32,29,50,51,90,24,25,45,46,29,25,23,24,90,
|
||||||
|
24,24,50,32,46,29,24,28,10,2,2,51,50,51,24,90,
|
||||||
|
24,24,24,50,2,32,46,10,32,29,24,90,24,24,24,90,
|
||||||
|
29,24,89,24,24,50,3,23,50,32,46,46,46,46,29,24,
|
||||||
|
51,24,24,28,29,24,25,23,24,25,1,2,3,111,45,29,
|
||||||
|
24,90,24,50,51,24,25,23,28,47,23,89,50,3,115,23,
|
||||||
|
24,24,24,24,24,89,50,32,47,1,51,24,24,50,2,51,
|
||||||
|
28,29,24,24,24,24,28,10,2,51,24,24,24,24,24,28,
|
||||||
|
10,32,29,24,24,24,25,23,28,29,90,24,24,90,24,50,
|
||||||
|
32,10,51,24,24,24,50,32,10,32,29,24,90,28,29,24
|
||||||
|
</chunk>
|
||||||
|
<chunk x="0" y="-16" width="16" height="16">
|
||||||
|
10,51,24,90,24,25,23,28,29,24,24,24,24,24,24,24,
|
||||||
|
51,24,28,29,24,50,32,10,51,24,24,24,24,24,24,24,
|
||||||
|
29,28,10,32,46,29,50,32,29,24,24,24,24,24,24,24,
|
||||||
|
51,25,23,50,2,32,29,25,23,24,24,28,29,24,90,24,
|
||||||
|
24,25,23,24,24,25,23,50,51,24,24,50,32,29,24,90,
|
||||||
|
24,50,32,29,90,25,45,29,24,24,24,24,50,51,24,89,
|
||||||
|
24,89,50,51,24,25,114,23,24,24,24,24,24,24,24,24,
|
||||||
|
24,24,28,29,24,50,2,51,24,24,90,28,29,24,24,28,
|
||||||
|
24,24,25,23,89,24,24,24,28,46,29,25,23,24,24,50,
|
||||||
|
28,46,10,51,24,28,46,29,25,111,45,10,51,28,29,24,
|
||||||
|
50,2,51,24,24,25,115,45,10,3,1,51,24,25,23,24,
|
||||||
|
24,24,24,24,24,50,2,2,32,10,51,24,90,25,23,24,
|
||||||
|
24,24,24,24,24,24,24,24,50,51,24,24,24,25,23,24,
|
||||||
|
46,29,24,24,24,24,24,89,24,24,24,28,46,47,23,90,
|
||||||
|
2,32,29,24,24,28,46,46,29,24,24,25,1,3,23,89,
|
||||||
|
24,50,32,29,24,25,1,3,23,24,89,50,32,10,51,24
|
||||||
|
</chunk>
|
||||||
|
<chunk x="16" y="-16" width="16" height="16">
|
||||||
|
24,24,24,24,90,24,89,24,89,24,50,51,89,24,24,24,
|
||||||
|
24,28,29,28,29,24,24,24,24,28,29,24,24,24,28,29,
|
||||||
|
24,25,23,50,51,24,24,28,29,50,51,24,24,24,25,45,
|
||||||
|
90,50,51,28,29,24,24,25,23,24,24,28,29,24,50,3,
|
||||||
|
24,24,28,10,51,90,90,50,51,24,24,50,51,24,24,50,
|
||||||
|
24,24,25,45,29,24,28,29,24,24,24,24,24,28,29,24,
|
||||||
|
90,24,50,2,51,28,10,51,90,24,28,29,24,25,45,46,
|
||||||
|
29,90,24,24,24,50,51,24,24,28,10,32,46,10,3,1,
|
||||||
|
32,29,24,90,24,24,24,24,28,47,23,50,2,51,50,51,
|
||||||
|
25,23,24,24,28,46,46,46,47,114,45,29,24,24,24,24,
|
||||||
|
50,32,29,24,50,3,111,111,115,111,1,32,29,24,24,24,
|
||||||
|
24,50,51,24,28,10,2,2,2,2,32,10,51,24,24,89,
|
||||||
|
24,24,89,90,25,23,24,24,24,24,50,32,46,46,29,89,
|
||||||
|
24,24,24,90,25,23,89,24,28,29,90,50,2,2,51,24,
|
||||||
|
24,24,24,28,10,51,24,28,47,45,29,24,24,24,24,24,
|
||||||
|
24,24,24,25,23,24,90,50,2,2,32,46,46,46,46,46
|
||||||
|
</chunk>
|
||||||
|
<chunk x="-16" y="0" width="16" height="16">
|
||||||
|
10,32,46,29,24,24,24,25,23,50,32,29,24,50,32,46,
|
||||||
|
51,50,2,32,29,24,24,25,45,29,25,23,24,24,25,1,
|
||||||
|
24,24,24,25,23,28,46,10,2,51,50,51,24,24,50,51,
|
||||||
|
90,89,90,50,51,50,2,51,24,24,28,29,90,24,24,24,
|
||||||
|
90,28,46,29,90,24,24,24,90,24,50,51,90,24,90,28,
|
||||||
|
29,50,2,51,24,24,24,89,24,24,24,24,24,89,24,50,
|
||||||
|
23,24,24,28,46,29,90,90,24,89,24,28,29,24,24,24,
|
||||||
|
32,46,29,25,115,45,29,24,90,24,24,25,23,24,24,28,
|
||||||
|
10,2,32,47,115,1,51,24,24,24,24,25,23,24,28,10,
|
||||||
|
32,29,50,2,2,51,24,24,24,24,24,25,23,28,10,51,
|
||||||
|
50,51,89,24,24,89,24,28,29,24,24,50,32,10,32,46,
|
||||||
|
24,24,90,90,28,46,29,50,51,24,24,24,25,23,25,115,
|
||||||
|
24,90,24,24,50,2,32,29,24,24,90,24,25,45,10,2,
|
||||||
|
24,24,24,24,24,24,50,32,29,24,24,28,10,3,23,24,
|
||||||
|
90,24,24,24,24,89,90,50,32,29,90,50,51,50,32,46,
|
||||||
|
46,29,24,90,24,24,24,24,50,51,28,29,24,24,50,2
|
||||||
|
</chunk>
|
||||||
|
<chunk x="0" y="0" width="16" height="16">
|
||||||
|
46,46,10,32,46,47,23,25,23,89,24,24,25,23,90,24,
|
||||||
|
2,2,32,47,1,2,51,25,23,24,28,29,50,32,29,24,
|
||||||
|
24,90,50,3,23,24,28,10,51,28,47,45,29,25,23,28,
|
||||||
|
24,24,24,50,51,28,47,23,24,50,3,114,45,10,51,50,
|
||||||
|
29,24,24,89,24,25,114,45,46,46,10,2,2,32,29,89,
|
||||||
|
51,24,24,24,24,50,3,111,115,115,23,24,24,50,32,29,
|
||||||
|
24,28,29,24,24,24,25,1,2,2,51,90,24,90,50,51,
|
||||||
|
29,50,32,29,28,29,25,23,24,24,89,28,29,24,24,24,
|
||||||
|
51,24,50,51,50,32,10,32,46,29,24,50,51,24,90,24,
|
||||||
|
24,24,24,24,89,50,32,10,2,32,46,29,89,28,29,24,
|
||||||
|
29,90,24,24,24,24,50,51,28,10,3,23,28,10,51,24,
|
||||||
|
23,89,24,24,90,24,24,24,50,32,10,51,50,51,24,24,
|
||||||
|
51,24,24,24,24,24,24,24,24,50,32,46,46,29,28,46,
|
||||||
|
24,24,24,90,24,24,24,24,24,24,50,3,1,32,47,115,
|
||||||
|
46,29,24,89,24,24,24,89,24,24,24,25,45,10,3,111,
|
||||||
|
2,51,28,29,28,29,24,28,46,46,46,10,2,51,50,2
|
||||||
|
</chunk>
|
||||||
|
<chunk x="16" y="0" width="16" height="16">
|
||||||
|
28,29,28,10,32,46,29,24,24,28,10,2,2,2,2,2,
|
||||||
|
50,51,50,51,25,115,45,46,29,50,51,24,24,24,24,24,
|
||||||
|
29,24,89,24,50,3,115,114,23,24,24,24,24,24,24,24,
|
||||||
|
51,90,24,89,24,50,2,2,51,24,89,24,24,28,46,29,
|
||||||
|
24,90,24,24,89,24,90,28,29,24,24,24,28,10,2,51,
|
||||||
|
24,24,24,24,28,29,90,50,51,28,29,24,25,23,24,24,
|
||||||
|
28,29,24,24,50,32,29,28,29,50,51,89,50,32,29,24,
|
||||||
|
50,51,24,24,24,50,32,10,51,24,89,24,24,25,23,24,
|
||||||
|
24,24,24,24,24,24,50,32,29,24,24,24,24,50,51,24,
|
||||||
|
90,24,24,24,24,24,24,25,45,29,24,24,24,89,28,29,
|
||||||
|
24,24,24,24,28,29,24,25,1,51,24,24,24,24,50,32,
|
||||||
|
28,29,28,29,50,32,46,10,51,28,29,24,24,24,24,50,
|
||||||
|
47,45,10,51,24,50,2,32,46,47,23,24,89,90,24,24,
|
||||||
|
111,115,23,24,24,90,24,50,2,2,32,29,24,89,28,46,
|
||||||
|
1,2,51,28,46,46,29,24,28,29,50,32,29,28,47,111,
|
||||||
|
51,24,24,50,3,114,23,24,50,32,46,47,23,25,111,111
|
||||||
|
</chunk>
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
166
ZoFo/Content/MapData/TileSets/TileSet 1.tsj
Normal file
166
ZoFo/Content/MapData/TileSets/TileSet 1.tsj
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
{ "class":"Tile",
|
||||||
|
"columns":22,
|
||||||
|
"grid":
|
||||||
|
{
|
||||||
|
"height":24,
|
||||||
|
"orientation":"orthogonal",
|
||||||
|
"width":24
|
||||||
|
},
|
||||||
|
"image":"..\/..\/..\/..\/Content\/Textures\/Background\/TilesetFloor.png",
|
||||||
|
"imageheight":417,
|
||||||
|
"imagewidth":352,
|
||||||
|
"margin":0,
|
||||||
|
"name":"TileSet 1",
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":572,
|
||||||
|
"tiledversion":"1.10.2",
|
||||||
|
"tileheight":16,
|
||||||
|
"tiles":[
|
||||||
|
{
|
||||||
|
"id":27,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":28,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":49,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":50,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":88,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":89,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":110,
|
||||||
|
"probability":2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":111,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":112,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
}],
|
||||||
|
"tilewidth":16,
|
||||||
|
"type":"tileset",
|
||||||
|
"version":"1.10",
|
||||||
|
"wangsets":[
|
||||||
|
{
|
||||||
|
"colors":[
|
||||||
|
{
|
||||||
|
"color":"#ff0000",
|
||||||
|
"name":"Sand",
|
||||||
|
"probability":1,
|
||||||
|
"tile":23
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color":"#00ff00",
|
||||||
|
"name":"SandStone",
|
||||||
|
"probability":0.3,
|
||||||
|
"tile":110
|
||||||
|
}],
|
||||||
|
"name":"\u041f\u0435\u0441\u0447\u0430\u043d\u044b\u0439",
|
||||||
|
"tile":-1,
|
||||||
|
"type":"corner",
|
||||||
|
"wangtiles":[
|
||||||
|
{
|
||||||
|
"tileid":0,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":1,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":2,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":9,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":22,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":23,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":24,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":27,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":28,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":31,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":44,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":45,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":46,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":49,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":50,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":88,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":89,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":110,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":111,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":112,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":113,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":114,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}
|
BIN
ZoFo/Content/Textures/Background/TilesetFloor.png
Normal file
BIN
ZoFo/Content/Textures/Background/TilesetFloor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
ZoFo/Content/Textures/TileSets/TilesetFloor.png
Normal file
BIN
ZoFo/Content/Textures/TileSets/TilesetFloor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
ZoFo/Content/sounds/Loot.wav
Normal file
BIN
ZoFo/Content/sounds/Loot.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Odevanie odezdi.wav
Normal file
BIN
ZoFo/Content/sounds/Odevanie odezdi.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Pieot wodichky.wav
Normal file
BIN
ZoFo/Content/sounds/Pieot wodichky.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Sshetchik geigera.wav
Normal file
BIN
ZoFo/Content/sounds/Sshetchik geigera.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Tabletki 2.wav
Normal file
BIN
ZoFo/Content/sounds/Tabletki 2.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Tabletki.mp3
Normal file
BIN
ZoFo/Content/sounds/Tabletki.mp3
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Zombi napal.wav
Normal file
BIN
ZoFo/Content/sounds/Zombi napal.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Zombi stoit.wav
Normal file
BIN
ZoFo/Content/sounds/Zombi stoit.wav
Normal file
Binary file not shown.
|
@ -7,12 +7,19 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using ZoFo.GameCore.GameObjects;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects.Tiles;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace ZoFo.GameCore
|
namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
public class Client
|
public class Client
|
||||||
{
|
{
|
||||||
ClientNetworkManager networkManager;
|
ClientNetworkManager networkManager;
|
||||||
|
|
||||||
|
public bool IsConnected { get { return networkManager.IsConnected; } }
|
||||||
public Client()
|
public Client()
|
||||||
{
|
{
|
||||||
networkManager = new ClientNetworkManager();
|
networkManager = new ClientNetworkManager();
|
||||||
|
@ -20,23 +27,57 @@ namespace ZoFo.GameCore
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDataSend(string data)
|
public void OnDataSend(string data)
|
||||||
{
|
{
|
||||||
List<IUpdateData> updateDatas = JsonSerializer.Deserialize<List<IUpdateData>>(data);
|
List<UpdateData> updateDatas = JsonSerializer.Deserialize<List<UpdateData>>(data);
|
||||||
// тут будет switch
|
// тут будет switch
|
||||||
|
foreach (var item in updateDatas)
|
||||||
|
{
|
||||||
|
/* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
|
||||||
|
{
|
||||||
|
case "Tile":
|
||||||
|
MapObject map = new MapObject();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void GameEndedUnexpectedly() { }
|
||||||
|
public void JoinRoom(string ip)
|
||||||
|
{
|
||||||
|
networkManager.JoinRoom(ip);
|
||||||
|
}
|
||||||
|
public void JoinYourself() { networkManager.JoinYourself(); }
|
||||||
|
|
||||||
public void GameEndedUnexpectedly(){ }
|
|
||||||
|
|
||||||
public void JoinRoom(){ }
|
|
||||||
|
|
||||||
public void JoinYourself(){ }
|
|
||||||
|
|
||||||
|
List<MapObject> mapObjects = new List<MapObject>();
|
||||||
|
/// <summary>
|
||||||
|
/// Клиент должен обнговлять игру анимаций
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameTime"></param>
|
||||||
internal void Update(GameTime gameTime)
|
internal void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
internal void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mapObjects.Count; i++)
|
||||||
|
{
|
||||||
|
mapObjects[i].Draw(spriteBatch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Draw(SpriteBatch spriteBatch)
|
internal void GotData(UpdateData update)
|
||||||
{
|
{
|
||||||
|
if (update is UpdateTileCreated)
|
||||||
|
{
|
||||||
|
mapObjects.Add(
|
||||||
|
new MapObject(
|
||||||
|
(update as UpdateTileCreated).Position,
|
||||||
|
(update as UpdateTileCreated).Size.ToVector2(),
|
||||||
|
(update as UpdateTileCreated).sourceRectangle,
|
||||||
|
(update as UpdateTileCreated).tileSetName
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ using MonogameLibrary.UI.Elements;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GUI;
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class HUD
|
public class HUD : AbstractGUI
|
||||||
{
|
{
|
||||||
protected UIManager Manager = new();
|
protected UIManager Manager = new();
|
||||||
protected List<DrawableUIElement> Elements = new();
|
protected List<DrawableUIElement> Elements = new();
|
||||||
|
@ -39,6 +39,10 @@ public class HUD
|
||||||
|
|
||||||
public virtual void Draw(SpriteBatch spriteBatch)
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
Manager.Draw(spriteBatch);
|
//Manager.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateUI()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
@ -37,12 +38,12 @@ public class MainMenuGUI : AbstractGUI
|
||||||
mainColor = Color.Gray,
|
mainColor = Color.Gray,
|
||||||
fontName = "Fonts\\Font"
|
fontName = "Fonts\\Font"
|
||||||
};
|
};
|
||||||
playButton.LeftButtonPressed += () =>
|
playButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.SetGUI(new SelectModeMenu());
|
AppManager.Instance.SetGUI(new SelectModeMenu());
|
||||||
};
|
};
|
||||||
Elements.Add(playButton);
|
Elements.Add(playButton);
|
||||||
Button optionButton = new Button(Manager)
|
Button optionButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 2, (int)(width / 5), (int)(height / 20)),
|
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 2, (int)(width / 5), (int)(height / 20)),
|
||||||
text = "Options",
|
text = "Options",
|
||||||
|
@ -51,12 +52,12 @@ public class MainMenuGUI : AbstractGUI
|
||||||
mainColor = Color.Gray,
|
mainColor = Color.Gray,
|
||||||
fontName = "Fonts\\Font"
|
fontName = "Fonts\\Font"
|
||||||
};
|
};
|
||||||
optionButton.LeftButtonPressed += () =>
|
optionButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.SetGUI(new OptionsGUI());
|
AppManager.Instance.SetGUI(new OptionsGUI());
|
||||||
};
|
};
|
||||||
Elements.Add(optionButton);
|
Elements.Add(optionButton);
|
||||||
Button exitButton = new Button(Manager)
|
Button exitButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 3, (int)(width / 5), (int)(height / 20)),
|
rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 3, (int)(width / 5), (int)(height / 20)),
|
||||||
text = "Exit",
|
text = "Exit",
|
||||||
|
@ -65,15 +66,14 @@ public class MainMenuGUI : AbstractGUI
|
||||||
mainColor = Color.Gray,
|
mainColor = Color.Gray,
|
||||||
fontName = "Fonts\\Font"
|
fontName = "Fonts\\Font"
|
||||||
};
|
};
|
||||||
exitButton.LeftButtonPressed += () =>
|
exitButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.Exit();
|
AppManager.Instance.Exit();
|
||||||
};
|
};
|
||||||
Elements.Add(exitButton);
|
Elements.Add(exitButton);
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class OptionsGUI : AbstractGUI
|
||||||
slider_OverallVolume.SliderChanged += (newVal) =>
|
slider_OverallVolume.SliderChanged += (newVal) =>
|
||||||
{
|
{
|
||||||
label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%";
|
label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%";
|
||||||
|
AppManager.Instance.SettingsManager.SetMainVolume(newVal);
|
||||||
};
|
};
|
||||||
Elements.Add(slider_OverallVolume);
|
Elements.Add(slider_OverallVolume);
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ public class OptionsGUI : AbstractGUI
|
||||||
slider_MusicVolume.SliderChanged += (newVal) =>
|
slider_MusicVolume.SliderChanged += (newVal) =>
|
||||||
{
|
{
|
||||||
label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%";
|
label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%";
|
||||||
|
AppManager.Instance.SettingsManager.SetMusicVolume(newVal);
|
||||||
};
|
};
|
||||||
Elements.Add(slider_MusicVolume);
|
Elements.Add(slider_MusicVolume);
|
||||||
|
|
||||||
|
@ -81,6 +83,7 @@ public class OptionsGUI : AbstractGUI
|
||||||
slider_EffectsVolume.SliderChanged += (newVal) =>
|
slider_EffectsVolume.SliderChanged += (newVal) =>
|
||||||
{
|
{
|
||||||
label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%";
|
label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%";
|
||||||
|
AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal);
|
||||||
};
|
};
|
||||||
Elements.Add(slider_EffectsVolume);
|
Elements.Add(slider_EffectsVolume);
|
||||||
|
|
||||||
|
@ -100,9 +103,10 @@ public class OptionsGUI : AbstractGUI
|
||||||
Elements.Add(label_IsFullScreen);
|
Elements.Add(label_IsFullScreen);
|
||||||
|
|
||||||
var button_FullScreen = new CheckBox(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40) };
|
var button_FullScreen = new CheckBox(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40) };
|
||||||
|
button_FullScreen.SetIsChecked(AppManager.Instance.SettingsManager.IsFullScreen);
|
||||||
button_FullScreen.Checked += (newCheckState) =>
|
button_FullScreen.Checked += (newCheckState) =>
|
||||||
{
|
{
|
||||||
|
AppManager.Instance.SettingsManager.SetIsFullScreen(newCheckState);
|
||||||
};
|
};
|
||||||
Elements.Add(button_FullScreen);
|
Elements.Add(button_FullScreen);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,22 @@ public class SelectModeMenu : AbstractGUI
|
||||||
singleButton.LeftButtonPressed += () =>
|
singleButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// single
|
// single
|
||||||
|
Server server = new Server();
|
||||||
|
Client client = new Client();
|
||||||
|
server.CreateRoom(1);
|
||||||
|
client.JoinYourself();
|
||||||
|
|
||||||
|
AppManager.Instance.SetServer(server);
|
||||||
|
AppManager.Instance.SetClient(client);
|
||||||
|
AppManager.Instance.ChangeState(GameState.HostPlaying);
|
||||||
|
AppManager.Instance.SetGUI(new HUD());
|
||||||
|
|
||||||
|
//server.CreateRoom(1);
|
||||||
|
//client.JoinYourself();
|
||||||
|
server.StartGame();
|
||||||
|
|
||||||
|
string key = client.IsConnected.ToString();
|
||||||
|
AppManager.Instance.debugHud.Set(key,"SinglePlayer");
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(singleButton);
|
Elements.Add(singleButton);
|
||||||
|
@ -56,7 +71,14 @@ public class SelectModeMenu : AbstractGUI
|
||||||
{
|
{
|
||||||
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
||||||
// multi
|
// multi
|
||||||
|
Server server = new Server(); //Server Logic MultiPlayer
|
||||||
|
Client client = new Client();
|
||||||
|
server.CreateRoom(5);
|
||||||
|
client.JoinRoom("127.0.0.1"); //указать айпишник
|
||||||
|
AppManager.Instance.SetServer(server);
|
||||||
|
AppManager.Instance.SetClient(client);
|
||||||
|
string key = client.IsConnected.ToString();
|
||||||
|
AppManager.Instance.debugHud.Set(key, "MultiPlayer");
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(optionButton);
|
Elements.Add(optionButton);
|
||||||
|
|
|
@ -20,9 +20,9 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
private GraphicsDeviceManager _graphics;
|
private GraphicsDeviceManager _graphics;
|
||||||
private SpriteBatch _spriteBatch;
|
private SpriteBatch _spriteBatch;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static AppManager Instance { get; private set; }
|
public static AppManager Instance { get; private set; }
|
||||||
public GameState gamestate;
|
public GameState gamestate;
|
||||||
public AbstractGUI currentGUI;
|
public AbstractGUI currentGUI;
|
||||||
|
@ -31,13 +31,15 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
public Client client;
|
public Client client;
|
||||||
public Server server;
|
public Server server;
|
||||||
|
|
||||||
|
|
||||||
#region Managers
|
#region Managers
|
||||||
|
|
||||||
public InputManager InputManager;
|
public InputManager InputManager;
|
||||||
public ItemManager.ItemManager ItemManager;
|
public ItemManager.ItemManager ItemManager;
|
||||||
|
public SettingsManager SettingsManager;
|
||||||
|
public SoundManager SoundManager;
|
||||||
|
|
||||||
public AnimationBuilder animationBuilder{get;set; }
|
public AnimationBuilder animationBuilder { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -45,15 +47,18 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
_graphics = new GraphicsDeviceManager(this);
|
_graphics = new GraphicsDeviceManager(this);
|
||||||
SetResolution(CurentScreenResolution.X, CurentScreenResolution.Y);
|
SetResolution(CurentScreenResolution.X, CurentScreenResolution.Y);
|
||||||
FulscrreenSwitch();
|
// FulscrreenSwitch();
|
||||||
|
|
||||||
|
|
||||||
Content.RootDirectory = "Content";
|
Content.RootDirectory = "Content";
|
||||||
IsMouseVisible = true;
|
IsMouseVisible = true;
|
||||||
|
|
||||||
Instance = this;
|
Instance = this;
|
||||||
InputManager = new InputManager();
|
InputManager = new InputManager();
|
||||||
|
SettingsManager = new SettingsManager();
|
||||||
|
SettingsManager.LoadSettings();
|
||||||
|
SoundManager = new SoundManager();
|
||||||
|
SoundManager.LoadSounds();
|
||||||
|
|
||||||
|
|
||||||
currentGUI = new MainMenuGUI();
|
currentGUI = new MainMenuGUI();
|
||||||
|
@ -65,9 +70,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
currentGUI.Initialize();
|
currentGUI.Initialize();
|
||||||
debugHud.Initialize();
|
debugHud.Initialize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
@ -88,9 +91,9 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
||||||
Keyboard.GetState().IsKeyDown(Keys.Escape))
|
Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||||
Exit();
|
Exit();
|
||||||
|
|
||||||
debugHud.Set("key", "value");
|
debugHud.Set("key", "value");
|
||||||
|
|
||||||
InputManager.Update();
|
InputManager.Update();
|
||||||
currentGUI.Update(gameTime);
|
currentGUI.Update(gameTime);
|
||||||
switch (gamestate)
|
switch (gamestate)
|
||||||
|
@ -115,20 +118,20 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
currentGUI.Draw(_spriteBatch);
|
currentGUI.Draw(_spriteBatch);
|
||||||
debugHud.Draw(_spriteBatch);
|
debugHud.Draw(_spriteBatch);
|
||||||
|
_spriteBatch.Begin();
|
||||||
switch (gamestate)
|
switch (gamestate)
|
||||||
{
|
{
|
||||||
case GameState.ClientPlaying:
|
case GameState.ClientPlaying:
|
||||||
case GameState.HostPlaying:
|
case GameState.HostPlaying:
|
||||||
client.Draw(_spriteBatch);
|
client.Draw(_spriteBatch);
|
||||||
break;
|
break;
|
||||||
case GameState.NotPlaying:
|
case GameState.NotPlaying:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
_spriteBatch.End();
|
||||||
|
|
||||||
base.Draw(gameTime);
|
base.Draw(gameTime);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +141,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
}
|
}
|
||||||
public void SetGUI(AbstractGUI gui)
|
public void SetGUI(AbstractGUI gui)
|
||||||
{
|
{
|
||||||
currentGUI = gui;
|
currentGUI = gui;
|
||||||
currentGUI.Initialize();
|
currentGUI.Initialize();
|
||||||
currentGUI.LoadContent();
|
currentGUI.LoadContent();
|
||||||
|
|
||||||
|
@ -160,5 +163,8 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
_graphics.IsFullScreen = !_graphics.IsFullScreen;
|
_graphics.IsFullScreen = !_graphics.IsFullScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetServer(Server server) { this.server = server; }
|
||||||
|
public void SetClient(Client client) { this.client = client; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,63 +3,60 @@ using Microsoft.Xna.Framework.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Formats.Tar;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers
|
namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
public enum ScopeState { Up, Middle, Down }
|
public enum ScopeState { Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight }
|
||||||
public enum ControlsState { Gamepad, Keyboard }
|
|
||||||
public class InputManager
|
public class InputManager
|
||||||
{
|
{
|
||||||
public delegate void Delegat();
|
public delegate void Delegat();
|
||||||
public event Delegat MovEventJump;
|
public event Delegat ShootEvent; // событие удара(когда нажат X, событие срабатывает)
|
||||||
public event Delegat MovEventDown;
|
|
||||||
public event Delegat ShootEvent;
|
public event Delegat OnInteract; // событие взаимодействия с collectable(например, лутом)
|
||||||
|
//с помощью кнопки E.
|
||||||
|
|
||||||
|
public event Delegat TalkEvent;
|
||||||
|
|
||||||
Vector2 vectorMovementDirection;
|
Vector2 vectorMovementDirection;
|
||||||
ScopeState scopeState; // Положение оружия. Up, Middle, Down.
|
ScopeState currentScopeState; // Положение оружия. Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight.
|
||||||
ControlsState controlsState;
|
|
||||||
private bool _overrideControls = false;
|
|
||||||
private bool _cheatsEnabled = false;
|
private bool _cheatsEnabled = false;
|
||||||
public bool InvincibilityCheat { get; private set; } = false;
|
public bool InvincibilityCheat { get; private set; } = false;
|
||||||
public bool CollisionsCheat { get; private set; } = false;
|
public bool CollisionsCheat { get; private set; } = false;
|
||||||
public bool InfiniteAmmoCheat { get; private set; } = false;
|
public bool InfiniteAmmoCheat { get; private set; } = false;
|
||||||
|
|
||||||
private bool isJumpDown; // Блокирует физическое нажатие прыжка и спуска
|
|
||||||
private bool isShoot;
|
private bool isShoot;
|
||||||
|
private bool isInteract;
|
||||||
|
|
||||||
private KeyboardState lastKeyboardState;
|
private KeyboardState lastKeyboardState;
|
||||||
private GamePadState lastGamePadState;
|
private GamePadState lastGamePadState;
|
||||||
|
|
||||||
|
|
||||||
public Vector2 VectorMovementDirection { get => vectorMovementDirection; }
|
public Vector2 VectorMovementDirection { get => vectorMovementDirection; }
|
||||||
public ScopeState ScopeState { get => scopeState; }
|
public ScopeState ScopeState { get => currentScopeState; }
|
||||||
public string currentControlsState;
|
public string currentControlsState;
|
||||||
|
public ScopeState CurrentScopeState { get => currentScopeState; } // получить текущее состояние
|
||||||
|
|
||||||
public InputManager()
|
public InputManager()
|
||||||
{
|
{
|
||||||
this.isJumpDown = false;
|
|
||||||
this.isShoot = false;
|
this.isShoot = false;
|
||||||
scopeState = ScopeState.Middle;
|
currentScopeState = ScopeState.Straight;
|
||||||
controlsState = ControlsState.Keyboard;
|
|
||||||
vectorMovementDirection = new Vector2(0, 0);
|
vectorMovementDirection = new Vector2(0, 0);
|
||||||
}
|
}
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (_cheatsEnabled)
|
if (_cheatsEnabled)
|
||||||
{
|
{
|
||||||
//AppManager.Instance.DebugHUD.Set("cheats", _cheatsEnabled.ToString());
|
AppManager.Instance.debugHud.Set("cheats", _cheatsEnabled.ToString());
|
||||||
//AppManager.Instance.DebugHUD.Set("invincible", InvincibilityCheat.ToString());
|
AppManager.Instance.debugHud.Set("invincible", InvincibilityCheat.ToString());
|
||||||
//AppManager.Instance.DebugHUD.Set("infinite ammo", InfiniteAmmoCheat.ToString()); //TODO
|
AppManager.Instance.debugHud.Set("infinite ammo", InfiniteAmmoCheat.ToString()); //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Работа с GamePad
|
#region Работа с GamePad
|
||||||
if (_overrideControls ? controlsState == ControlsState.Gamepad : GamePad.GetState(0).IsConnected)
|
|
||||||
{
|
|
||||||
controlsState = ControlsState.Gamepad;
|
|
||||||
|
|
||||||
#region Обработка гейм-пада. Задает Vector2 vectorMovementDirection являющийся вектором отклонения левого стика.
|
#region Обработка гейм-пада. Задает Vector2 vectorMovementDirection являющийся вектором отклонения левого стика.
|
||||||
GamePadState gamePadState = GamePad.GetState(0);
|
GamePadState gamePadState = GamePad.GetState(0);
|
||||||
vectorMovementDirection = gamePadState.ThumbSticks.Left;
|
vectorMovementDirection = gamePadState.ThumbSticks.Left;
|
||||||
|
@ -78,56 +75,57 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
}
|
}
|
||||||
#endregion // Cheats
|
#endregion // Cheats
|
||||||
|
|
||||||
#region Обработка нажатия прыжка и спуска. Вызывает события MovEvent.
|
|
||||||
if (vectorMovementDirection.Y < -0.2 && gamePadState.Buttons.A == ButtonState.Pressed && !isJumpDown)
|
|
||||||
{
|
|
||||||
isJumpDown = true;
|
|
||||||
MovEventDown?.Invoke();
|
|
||||||
Debug.WriteLine("Спуск");
|
|
||||||
}
|
|
||||||
else if (gamePadState.Buttons.A == ButtonState.Pressed && lastGamePadState.Buttons.A == ButtonState.Released)
|
|
||||||
{
|
|
||||||
MovEventJump?.Invoke();
|
|
||||||
Debug.WriteLine("Прыжок");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Обработка положения оружия. Задает значение полю scopeState.
|
#region Обработка положения оружия. Задает значение полю scopeState.
|
||||||
if (vectorMovementDirection.Y >= 0.7)
|
if (vectorMovementDirection.Y >= 0.6)
|
||||||
{
|
{
|
||||||
scopeState = ScopeState.Up;
|
currentScopeState = ScopeState.Straight;
|
||||||
}
|
}
|
||||||
else if (vectorMovementDirection.Y <= -0.7 && !isJumpDown)
|
else if(vectorMovementDirection.Y <= 0.6)
|
||||||
{
|
{
|
||||||
scopeState = ScopeState.Down;
|
currentScopeState = ScopeState.Back;
|
||||||
}
|
}
|
||||||
else
|
else if(vectorMovementDirection.X >= 0.6)
|
||||||
{
|
{
|
||||||
scopeState = ScopeState.Middle;
|
currentScopeState = ScopeState.Right;
|
||||||
|
}
|
||||||
|
else if(vectorMovementDirection.X <= 0.6)
|
||||||
|
{
|
||||||
|
currentScopeState = ScopeState.Left;
|
||||||
|
}
|
||||||
|
else if(vectorMovementDirection.Y >= 0.6 && vectorMovementDirection.X >= 0.6)
|
||||||
|
{
|
||||||
|
currentScopeState = ScopeState.StraightRight;
|
||||||
|
}
|
||||||
|
else if(vectorMovementDirection.Y >= 0.6 && vectorMovementDirection.X <= 0.6)
|
||||||
|
{
|
||||||
|
currentScopeState = ScopeState.StraightLeft;
|
||||||
|
}
|
||||||
|
else if(vectorMovementDirection.Y <= 0.6 && vectorMovementDirection.X >= 0.6)
|
||||||
|
{
|
||||||
|
currentScopeState = ScopeState.BackRight;
|
||||||
|
}
|
||||||
|
else if(vectorMovementDirection.Y <= 0.6 && vectorMovementDirection.X <= 0.6)
|
||||||
|
{
|
||||||
|
currentScopeState = ScopeState.BackLeft;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
||||||
if (gamePadState.Buttons.X == ButtonState.Pressed && !isJumpDown && !isShoot)
|
if (gamePadState.Buttons.X == ButtonState.Pressed && !isShoot)
|
||||||
{
|
{
|
||||||
isShoot = true;
|
isShoot = true;
|
||||||
ShootEvent?.Invoke();
|
ShootEvent?.Invoke();
|
||||||
Debug.WriteLine("Выстрел");
|
Debug.WriteLine("Выстрел");
|
||||||
}
|
}
|
||||||
else if (gamePadState.Buttons.X == ButtonState.Released && !isJumpDown)
|
else if (gamePadState.Buttons.X == ButtonState.Released)
|
||||||
{
|
{
|
||||||
isShoot = false;
|
isShoot = false;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
lastGamePadState = gamePadState;
|
lastGamePadState = gamePadState;
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Работа с KeyBoard
|
#region Работа с KeyBoard
|
||||||
else
|
|
||||||
{
|
|
||||||
controlsState = ControlsState.Keyboard;
|
|
||||||
|
|
||||||
#region Состояние клавиатуры
|
#region Состояние клавиатуры
|
||||||
KeyboardState keyBoardState = Keyboard.GetState(); // Состояние клавиатуры
|
KeyboardState keyBoardState = Keyboard.GetState(); // Состояние клавиатуры
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -154,76 +152,73 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
}
|
}
|
||||||
#endregion // Cheats
|
#endregion // Cheats
|
||||||
|
|
||||||
#region Обработка движения вправо-влево. Меняет у вектора vectorMovementDirection значение X на -1/0/1.
|
#region Обработка состояния объекта. Задает значение полю scopeState.
|
||||||
if (keyBoardState.IsKeyDown(Keys.Left))
|
if (keyBoardState.IsKeyDown(Keys.Up) || keyBoardState.IsKeyDown(Keys.W))
|
||||||
{
|
{
|
||||||
vectorMovementDirection.X = -1;
|
currentScopeState = ScopeState.Straight;
|
||||||
}
|
}
|
||||||
else if (keyBoardState.IsKeyDown(Keys.Right))
|
else if (keyBoardState.IsKeyDown(Keys.Down) || keyBoardState.IsKeyDown(Keys.S))
|
||||||
{
|
{
|
||||||
vectorMovementDirection.X = 1;
|
currentScopeState = ScopeState.Back;
|
||||||
}
|
}
|
||||||
else
|
else if(keyBoardState.IsKeyDown(Keys.Left) || keyBoardState.IsKeyDown(Keys.A))
|
||||||
{
|
{
|
||||||
vectorMovementDirection.X = 0;
|
currentScopeState = ScopeState.Left;
|
||||||
}
|
}
|
||||||
#endregion
|
else if(keyBoardState.IsKeyDown(Keys.Right) || keyBoardState.IsKeyDown(Keys.D))
|
||||||
|
|
||||||
#region Обработка прыжка и спуска. Вызываются события MovEvent.
|
|
||||||
if (keyBoardState.IsKeyDown(Keys.LeftShift) && !isJumpDown && keyBoardState.IsKeyDown(Keys.Down))
|
|
||||||
{
|
{
|
||||||
isJumpDown = true;
|
currentScopeState = ScopeState.Right;
|
||||||
MovEventDown?.Invoke();
|
|
||||||
Debug.WriteLine("Спуск");
|
|
||||||
}
|
}
|
||||||
else if (keyBoardState.IsKeyDown(Keys.LeftShift) && !isJumpDown)
|
else if(keyBoardState.IsKeyDown(Keys.Right) && keyBoardState.IsKeyDown(Keys.Up) ||
|
||||||
|
keyBoardState.IsKeyDown(Keys.D) && keyBoardState.IsKeyDown(Keys.W))
|
||||||
{
|
{
|
||||||
isJumpDown = true;
|
currentScopeState = ScopeState.StraightRight;
|
||||||
MovEventJump?.Invoke();
|
|
||||||
Debug.WriteLine("Прыжок");
|
|
||||||
}
|
}
|
||||||
else if (keyBoardState.IsKeyUp(Keys.LeftShift))
|
else if(keyBoardState.IsKeyDown(Keys.Left) && keyBoardState.IsKeyDown(Keys.Up) ||
|
||||||
|
keyBoardState.IsKeyDown(Keys.A) && keyBoardState.IsKeyDown(Keys.W))
|
||||||
{
|
{
|
||||||
isJumpDown = false;
|
currentScopeState = ScopeState.StraightLeft;
|
||||||
}
|
}
|
||||||
#endregion
|
else if(keyBoardState.IsKeyDown(Keys.Right) && keyBoardState.IsKeyDown(Keys.Down) ||
|
||||||
|
keyBoardState.IsKeyDown(Keys.D) && keyBoardState.IsKeyDown(Keys.S))
|
||||||
#region Обработка положения оружия. Задает значение полю scopeState.
|
|
||||||
if (keyBoardState.IsKeyDown(Keys.Up))
|
|
||||||
{
|
{
|
||||||
scopeState = ScopeState.Up;
|
currentScopeState = ScopeState.BackRight;
|
||||||
}
|
}
|
||||||
else if (keyBoardState.IsKeyDown(Keys.Down) && !isJumpDown)
|
else if(keyBoardState.IsKeyDown(Keys.Left) && keyBoardState.IsKeyDown(Keys.Down) ||
|
||||||
|
keyBoardState.IsKeyDown(Keys.A) && keyBoardState.IsKeyDown(Keys.S))
|
||||||
{
|
{
|
||||||
scopeState = ScopeState.Down;
|
currentScopeState = ScopeState.BackLeft;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scopeState = ScopeState.Middle;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
|
||||||
if (keyBoardState.IsKeyDown(Keys.X) && !isJumpDown && !isShoot)
|
if (keyBoardState.IsKeyDown(Keys.P) && !isShoot)
|
||||||
{
|
{
|
||||||
isShoot = true;
|
isShoot = true;
|
||||||
ShootEvent?.Invoke();
|
ShootEvent?.Invoke();
|
||||||
Debug.WriteLine("Выстрел");
|
Debug.WriteLine("Выстрел");
|
||||||
}
|
}
|
||||||
else if (keyBoardState.IsKeyUp(Keys.X) && !isJumpDown)
|
else if (keyBoardState.IsKeyUp(Keys.P))
|
||||||
{
|
{
|
||||||
isShoot = false;
|
isShoot = false;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
SetState(ControlsState.Keyboard);
|
#region Обработка взаимодействия с collectable(например лутом). Вызывает событие OnInteract
|
||||||
|
if (keyBoardState.IsKeyDown(Keys.E) && !isInteract)
|
||||||
|
{
|
||||||
|
|
||||||
|
OnInteract?.Invoke();
|
||||||
|
Debug.WriteLine("взаимодействие с Collectable");
|
||||||
|
}
|
||||||
|
else if (keyBoardState.IsKeyUp(Keys.E))
|
||||||
|
{
|
||||||
|
isInteract = false;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
lastKeyboardState = keyBoardState;
|
lastKeyboardState = keyBoardState;
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public void SetState(ControlsState controlsState)
|
|
||||||
{
|
|
||||||
currentControlsState = controlsState.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
|
@ -13,5 +14,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public bool Visibility { get; set; }
|
public bool Visibility { get; set; }
|
||||||
|
public string Class { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
|
||||||
|
|
|
@ -8,65 +8,96 @@ using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.GameManagers.MapManager.MapElements;
|
using ZoFo.GameCore.GameManagers.MapManager.MapElements;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects.Tiles;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.MapManager
|
namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
{
|
{
|
||||||
public class MapManager
|
public class MapManager
|
||||||
{
|
{
|
||||||
private static readonly string _path = "/{0}.tmj";
|
|
||||||
|
private static readonly string _templatePath = "Content/MapData/TileMaps/{0}.tmj";
|
||||||
|
private static readonly float _scale = 1.0f;
|
||||||
private List<TileSet> _tileSets = new List<TileSet>();
|
private List<TileSet> _tileSets = new List<TileSet>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка карты. Передаётся название файла карты. По умолчанию main.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mapName"></param>
|
||||||
public void LoadMap(string mapName = "main")
|
public void LoadMap(string mapName = "main")
|
||||||
{
|
{
|
||||||
TileMap tileMap;
|
// Загрузка TileMap
|
||||||
using (StreamReader reader = new StreamReader(string.Format(_path, mapName)))
|
var options = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
string data = reader.ReadToEnd();
|
PropertyNameCaseInsensitive = true
|
||||||
tileMap = JsonSerializer.Deserialize<TileMap>(data);
|
};
|
||||||
}
|
TileMap tileMap = JsonSerializer.Deserialize<TileMap>(File.ReadAllText(string.Format(_templatePath, mapName)), options);
|
||||||
|
|
||||||
|
// Загрузка TileSet-ов по TileSetInfo
|
||||||
List<TileSet> tileSets = new List<TileSet>();
|
List<TileSet> tileSets = new List<TileSet>();
|
||||||
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
|
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
|
||||||
{
|
{
|
||||||
TileSet tileSet = LoadTileSet(tileSetInfo.Source);
|
TileSet tileSet = LoadTileSet("Content/MapData/"+tileSetInfo.Source);
|
||||||
tileSet.FirstGid = tileSetInfo.FirstGid;
|
tileSet.FirstGid = tileSetInfo.FirstGid;
|
||||||
tileSets.Add(tileSet);
|
tileSets.Add(tileSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var chunk in tileMap.Layers[0].Chunks)
|
foreach (var layer in tileMap.Layers)
|
||||||
{
|
{
|
||||||
int i = 0;
|
foreach (var chunk in layer.Chunks)
|
||||||
foreach (var id in chunk.Data)
|
|
||||||
{
|
{
|
||||||
foreach (var tileSet in tileSets)
|
for (int i = 0; i < chunk.Data.Length; i++)
|
||||||
{
|
{
|
||||||
if (tileSet.FirstGid - id < 0)
|
foreach (var tileSet in tileSets)
|
||||||
{
|
{
|
||||||
int number = id - tileSet.FirstGid;
|
if (tileSet.FirstGid - chunk.Data[i] < 0)
|
||||||
|
{
|
||||||
|
int number = chunk.Data[i] - tileSet.FirstGid;
|
||||||
|
|
||||||
int relativeColumn = number % tileSet.Columns * tileSet.TileWidth;
|
int relativeColumn = (number % tileSet.Columns) * tileSet.TileWidth;
|
||||||
int relativeRow = number / tileSet.Columns * tileSet.TileHeight;
|
int relativeRow = (number / tileSet.Columns) * tileSet.TileHeight;
|
||||||
|
|
||||||
Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * tileSet.TileHeight,
|
Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * tileSet.TileHeight,
|
||||||
relativeColumn * tileSet.TileWidth + tileSet.TileWidth, relativeRow * tileSet.TileHeight + tileSet.TileHeight);
|
/* relativeColumn * tileSet.TileWidth +*/ tileSet.TileWidth, /*relativeRow * tileSet.TileHeight +*/ tileSet.TileHeight);
|
||||||
|
|
||||||
Vector2 position = new Vector2(i % chunk.Width, i / chunk.Height);
|
Vector2 position = new Vector2((i % chunk.Width) * tileSet.TileWidth + chunk.X * chunk.Width, (i / chunk.Height)*tileSet.TileHeight + chunk.Y * chunk.Height) ;
|
||||||
|
|
||||||
|
switch (layer.Class)
|
||||||
|
{
|
||||||
|
case "Tile":
|
||||||
|
AppManager.Instance.server.RegisterGameObject(new MapObject(position, new Vector2(tileSet.TileWidth * _scale, tileSet.TileHeight * _scale), sourceRectangle, "Textures\\TileSets\\"+tileSet.Name)); //fix naming
|
||||||
|
break;
|
||||||
|
case "StopObject":
|
||||||
|
// new StopObject(position, new Vector2(tileSet.TileWidth * _scale, tileSet.TileHeight * _scale), sourceRectangle, tileSet.Name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Загружает и парсит TileSet по его пути.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private TileSet LoadTileSet(string path)
|
private TileSet LoadTileSet(string path)
|
||||||
{
|
{
|
||||||
using (StreamReader reader = new StreamReader(path))
|
using (StreamReader reader = new StreamReader(path))
|
||||||
{
|
{
|
||||||
|
var options = new JsonSerializerOptions //TODO Remove
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
string data = reader.ReadToEnd();
|
string data = reader.ReadToEnd();
|
||||||
return JsonSerializer.Deserialize<TileSet>(data);
|
return JsonSerializer.Deserialize<TileSet>(data, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"activeFile": "",
|
||||||
|
"expandedProjectPaths": [
|
||||||
|
],
|
||||||
|
"fileStates": {
|
||||||
|
"TileSets/TileSet 1.tsj": {
|
||||||
|
"scaleInDock": 1,
|
||||||
|
"scaleInEditor": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"openFiles": [
|
||||||
|
],
|
||||||
|
"project": "",
|
||||||
|
"recentFiles": [
|
||||||
|
"TileSets/TileSet 1.tsj"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"automappingRulesFile": "",
|
||||||
|
"commands": [
|
||||||
|
],
|
||||||
|
"compatibilityVersion": 1100,
|
||||||
|
"extensionsPath": "extensions",
|
||||||
|
"folders": [
|
||||||
|
"."
|
||||||
|
],
|
||||||
|
"properties": [
|
||||||
|
],
|
||||||
|
"propertyTypes": [
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"Map/SizeTest": {
|
||||||
|
"height": 4300,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
"activeFile": "",
|
||||||
|
"expandedProjectPaths": [
|
||||||
|
],
|
||||||
|
"fileStates": {
|
||||||
|
},
|
||||||
|
"last.imagePath": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/Textures/Background",
|
||||||
|
"map.fixedSize": false,
|
||||||
|
"map.lastUsedFormat": "json",
|
||||||
|
"map.tileHeight": 16,
|
||||||
|
"map.tileWidth": 16,
|
||||||
|
"openFiles": [
|
||||||
|
],
|
||||||
|
"project": "MapSession.tiled-project",
|
||||||
|
"recentFiles": [
|
||||||
|
]
|
||||||
|
}
|
167
ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmj
Normal file
167
ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmj
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
{ "compressionlevel":-1,
|
||||||
|
"height":20,
|
||||||
|
"infinite":true,
|
||||||
|
"layers":[
|
||||||
|
{
|
||||||
|
"chunks":[
|
||||||
|
{
|
||||||
|
"data":[24, 24, 24, 28, 29, 24, 24, 24, 28, 46, 29, 24, 25, 115, 45, 46,
|
||||||
|
24, 24, 24, 25, 23, 24, 24, 24, 50, 2, 51, 24, 50, 2, 2, 2,
|
||||||
|
24, 24, 24, 50, 32, 29, 24, 24, 24, 24, 24, 24, 24, 24, 24, 28,
|
||||||
|
28, 29, 24, 28, 10, 32, 29, 24, 24, 28, 46, 29, 24, 24, 24, 50,
|
||||||
|
47, 23, 24, 50, 32, 10, 32, 46, 29, 50, 2, 51, 24, 24, 24, 24,
|
||||||
|
1, 32, 29, 90, 25, 23, 50, 2, 32, 29, 24, 90, 28, 29, 24, 24,
|
||||||
|
51, 50, 32, 29, 50, 51, 90, 24, 25, 45, 46, 29, 25, 23, 24, 90,
|
||||||
|
24, 24, 50, 32, 46, 29, 24, 28, 10, 2, 2, 51, 50, 51, 24, 90,
|
||||||
|
24, 24, 24, 50, 2, 32, 46, 10, 32, 29, 24, 90, 24, 24, 24, 90,
|
||||||
|
29, 24, 89, 24, 24, 50, 3, 23, 50, 32, 46, 46, 46, 46, 29, 24,
|
||||||
|
51, 24, 24, 28, 29, 24, 25, 23, 24, 25, 1, 2, 3, 111, 45, 29,
|
||||||
|
24, 90, 24, 50, 51, 24, 25, 23, 28, 47, 23, 89, 50, 3, 115, 23,
|
||||||
|
24, 24, 24, 24, 24, 89, 50, 32, 47, 1, 51, 24, 24, 50, 2, 51,
|
||||||
|
28, 29, 24, 24, 24, 24, 28, 10, 2, 51, 24, 24, 24, 24, 24, 28,
|
||||||
|
10, 32, 29, 24, 24, 24, 25, 23, 28, 29, 90, 24, 24, 90, 24, 50,
|
||||||
|
32, 10, 51, 24, 24, 24, 50, 32, 10, 32, 29, 24, 90, 28, 29, 24],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":-16,
|
||||||
|
"y":-16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[10, 51, 24, 90, 24, 25, 23, 28, 29, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
51, 24, 28, 29, 24, 50, 32, 10, 51, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
29, 28, 10, 32, 46, 29, 50, 32, 29, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
51, 25, 23, 50, 2, 32, 29, 25, 23, 24, 24, 28, 29, 24, 90, 24,
|
||||||
|
24, 25, 23, 24, 24, 25, 23, 50, 51, 24, 24, 50, 32, 29, 24, 90,
|
||||||
|
24, 50, 32, 29, 90, 25, 45, 29, 24, 24, 24, 24, 50, 51, 24, 89,
|
||||||
|
24, 89, 50, 51, 24, 25, 114, 23, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
24, 24, 28, 29, 24, 50, 2, 51, 24, 24, 90, 28, 29, 24, 24, 28,
|
||||||
|
24, 24, 25, 23, 89, 24, 24, 24, 28, 46, 29, 25, 23, 24, 24, 50,
|
||||||
|
28, 46, 10, 51, 24, 28, 46, 29, 25, 111, 45, 10, 51, 28, 29, 24,
|
||||||
|
50, 2, 51, 24, 24, 25, 115, 45, 10, 3, 1, 51, 24, 25, 23, 24,
|
||||||
|
24, 24, 24, 24, 24, 50, 2, 2, 32, 10, 51, 24, 90, 25, 23, 24,
|
||||||
|
24, 24, 24, 24, 24, 24, 24, 24, 50, 51, 24, 24, 24, 25, 23, 24,
|
||||||
|
46, 29, 24, 24, 24, 24, 24, 89, 24, 24, 24, 28, 46, 47, 23, 90,
|
||||||
|
2, 32, 29, 24, 24, 28, 46, 46, 29, 24, 24, 25, 1, 3, 23, 89,
|
||||||
|
24, 50, 32, 29, 24, 25, 1, 3, 23, 24, 89, 50, 32, 10, 51, 24],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":-16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[24, 24, 24, 24, 90, 24, 89, 24, 89, 24, 50, 51, 89, 24, 24, 24,
|
||||||
|
24, 28, 29, 28, 29, 24, 24, 24, 24, 28, 29, 24, 24, 24, 28, 29,
|
||||||
|
24, 25, 23, 50, 51, 24, 24, 28, 29, 50, 51, 24, 24, 24, 25, 45,
|
||||||
|
90, 50, 51, 28, 29, 24, 24, 25, 23, 24, 24, 28, 29, 24, 50, 3,
|
||||||
|
24, 24, 28, 10, 51, 90, 90, 50, 51, 24, 24, 50, 51, 24, 24, 50,
|
||||||
|
24, 24, 25, 45, 29, 24, 28, 29, 24, 24, 24, 24, 24, 28, 29, 24,
|
||||||
|
90, 24, 50, 2, 51, 28, 10, 51, 90, 24, 28, 29, 24, 25, 45, 46,
|
||||||
|
29, 90, 24, 24, 24, 50, 51, 24, 24, 28, 10, 32, 46, 10, 3, 1,
|
||||||
|
32, 29, 24, 90, 24, 24, 24, 24, 28, 47, 23, 50, 2, 51, 50, 51,
|
||||||
|
25, 23, 24, 24, 28, 46, 46, 46, 47, 114, 45, 29, 24, 24, 24, 24,
|
||||||
|
50, 32, 29, 24, 50, 3, 111, 111, 115, 111, 1, 32, 29, 24, 24, 24,
|
||||||
|
24, 50, 51, 24, 28, 10, 2, 2, 2, 2, 32, 10, 51, 24, 24, 89,
|
||||||
|
24, 24, 89, 90, 25, 23, 24, 24, 24, 24, 50, 32, 46, 46, 29, 89,
|
||||||
|
24, 24, 24, 90, 25, 23, 89, 24, 28, 29, 90, 50, 2, 2, 51, 24,
|
||||||
|
24, 24, 24, 28, 10, 51, 24, 28, 47, 45, 29, 24, 24, 24, 24, 24,
|
||||||
|
24, 24, 24, 25, 23, 24, 90, 50, 2, 2, 32, 46, 46, 46, 46, 46],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":16,
|
||||||
|
"y":-16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[10, 32, 46, 29, 24, 24, 24, 25, 23, 50, 32, 29, 24, 50, 32, 46,
|
||||||
|
51, 50, 2, 32, 29, 24, 24, 25, 45, 29, 25, 23, 24, 24, 25, 1,
|
||||||
|
24, 24, 24, 25, 23, 28, 46, 10, 2, 51, 50, 51, 24, 24, 50, 51,
|
||||||
|
90, 89, 90, 50, 51, 50, 2, 51, 24, 24, 28, 29, 90, 24, 24, 24,
|
||||||
|
90, 28, 46, 29, 90, 24, 24, 24, 90, 24, 50, 51, 90, 24, 90, 28,
|
||||||
|
29, 50, 2, 51, 24, 24, 24, 89, 24, 24, 24, 24, 24, 89, 24, 50,
|
||||||
|
23, 24, 24, 28, 46, 29, 90, 90, 24, 89, 24, 28, 29, 24, 24, 24,
|
||||||
|
32, 46, 29, 25, 115, 45, 29, 24, 90, 24, 24, 25, 23, 24, 24, 28,
|
||||||
|
10, 2, 32, 47, 115, 1, 51, 24, 24, 24, 24, 25, 23, 24, 28, 10,
|
||||||
|
32, 29, 50, 2, 2, 51, 24, 24, 24, 24, 24, 25, 23, 28, 10, 51,
|
||||||
|
50, 51, 89, 24, 24, 89, 24, 28, 29, 24, 24, 50, 32, 10, 32, 46,
|
||||||
|
24, 24, 90, 90, 28, 46, 29, 50, 51, 24, 24, 24, 25, 23, 25, 115,
|
||||||
|
24, 90, 24, 24, 50, 2, 32, 29, 24, 24, 90, 24, 25, 45, 10, 2,
|
||||||
|
24, 24, 24, 24, 24, 24, 50, 32, 29, 24, 24, 28, 10, 3, 23, 24,
|
||||||
|
90, 24, 24, 24, 24, 89, 90, 50, 32, 29, 90, 50, 51, 50, 32, 46,
|
||||||
|
46, 29, 24, 90, 24, 24, 24, 24, 50, 51, 28, 29, 24, 24, 50, 2],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":-16,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[46, 46, 10, 32, 46, 47, 23, 25, 23, 89, 24, 24, 25, 23, 90, 24,
|
||||||
|
2, 2, 32, 47, 1, 2, 51, 25, 23, 24, 28, 29, 50, 32, 29, 24,
|
||||||
|
24, 90, 50, 3, 23, 24, 28, 10, 51, 28, 47, 45, 29, 25, 23, 28,
|
||||||
|
24, 24, 24, 50, 51, 28, 47, 23, 24, 50, 3, 114, 45, 10, 51, 50,
|
||||||
|
29, 24, 24, 89, 24, 25, 114, 45, 46, 46, 10, 2, 2, 32, 29, 89,
|
||||||
|
51, 24, 24, 24, 24, 50, 3, 111, 115, 115, 23, 24, 24, 50, 32, 29,
|
||||||
|
24, 28, 29, 24, 24, 24, 25, 1, 2, 2, 51, 90, 24, 90, 50, 51,
|
||||||
|
29, 50, 32, 29, 28, 29, 25, 23, 24, 24, 89, 28, 29, 24, 24, 24,
|
||||||
|
51, 24, 50, 51, 50, 32, 10, 32, 46, 29, 24, 50, 51, 24, 90, 24,
|
||||||
|
24, 24, 24, 24, 89, 50, 32, 10, 2, 32, 46, 29, 89, 28, 29, 24,
|
||||||
|
29, 90, 24, 24, 24, 24, 50, 51, 28, 10, 3, 23, 28, 10, 51, 24,
|
||||||
|
23, 89, 24, 24, 90, 24, 24, 24, 50, 32, 10, 51, 50, 51, 24, 24,
|
||||||
|
51, 24, 24, 24, 24, 24, 24, 24, 24, 50, 32, 46, 46, 29, 28, 46,
|
||||||
|
24, 24, 24, 90, 24, 24, 24, 24, 24, 24, 50, 3, 1, 32, 47, 115,
|
||||||
|
46, 29, 24, 89, 24, 24, 24, 89, 24, 24, 24, 25, 45, 10, 3, 111,
|
||||||
|
2, 51, 28, 29, 28, 29, 24, 28, 46, 46, 46, 10, 2, 51, 50, 2],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[28, 29, 28, 10, 32, 46, 29, 24, 24, 28, 10, 2, 2, 2, 2, 2,
|
||||||
|
50, 51, 50, 51, 25, 115, 45, 46, 29, 50, 51, 24, 24, 24, 24, 24,
|
||||||
|
29, 24, 89, 24, 50, 3, 115, 114, 23, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
51, 90, 24, 89, 24, 50, 2, 2, 51, 24, 89, 24, 24, 28, 46, 29,
|
||||||
|
24, 90, 24, 24, 89, 24, 90, 28, 29, 24, 24, 24, 28, 10, 2, 51,
|
||||||
|
24, 24, 24, 24, 28, 29, 90, 50, 51, 28, 29, 24, 25, 23, 24, 24,
|
||||||
|
28, 29, 24, 24, 50, 32, 29, 28, 29, 50, 51, 89, 50, 32, 29, 24,
|
||||||
|
50, 51, 24, 24, 24, 50, 32, 10, 51, 24, 89, 24, 24, 25, 23, 24,
|
||||||
|
24, 24, 24, 24, 24, 24, 50, 32, 29, 24, 24, 24, 24, 50, 51, 24,
|
||||||
|
90, 24, 24, 24, 24, 24, 24, 25, 45, 29, 24, 24, 24, 89, 28, 29,
|
||||||
|
24, 24, 24, 24, 28, 29, 24, 25, 1, 51, 24, 24, 24, 24, 50, 32,
|
||||||
|
28, 29, 28, 29, 50, 32, 46, 10, 51, 28, 29, 24, 24, 24, 24, 50,
|
||||||
|
47, 45, 10, 51, 24, 50, 2, 32, 46, 47, 23, 24, 89, 90, 24, 24,
|
||||||
|
111, 115, 23, 24, 24, 90, 24, 50, 2, 2, 32, 29, 24, 89, 28, 46,
|
||||||
|
1, 2, 51, 28, 46, 46, 29, 24, 28, 29, 50, 32, 29, 28, 47, 111,
|
||||||
|
51, 24, 24, 50, 3, 114, 23, 24, 50, 32, 46, 47, 23, 25, 111, 111],
|
||||||
|
"height":16,
|
||||||
|
"width":16,
|
||||||
|
"x":16,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"class":"Tile",
|
||||||
|
"height":48,
|
||||||
|
"id":1,
|
||||||
|
"name":"\u0421\u043b\u043e\u0439 \u0442\u0430\u0439\u043b\u043e\u0432 1",
|
||||||
|
"opacity":1,
|
||||||
|
"startx":-16,
|
||||||
|
"starty":-32,
|
||||||
|
"type":"tilelayer",
|
||||||
|
"visible":true,
|
||||||
|
"width":48,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"nextlayerid":2,
|
||||||
|
"nextobjectid":1,
|
||||||
|
"orientation":"orthogonal",
|
||||||
|
"renderorder":"right-down",
|
||||||
|
"tiledversion":"1.10.2",
|
||||||
|
"tileheight":16,
|
||||||
|
"tilesets":[
|
||||||
|
{
|
||||||
|
"firstgid":1,
|
||||||
|
"source":"..\/TileSets\/TileSet 1.tsj"
|
||||||
|
}],
|
||||||
|
"tilewidth":16,
|
||||||
|
"type":"map",
|
||||||
|
"version":"1.10",
|
||||||
|
"width":30
|
||||||
|
}
|
116
ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmx
Normal file
116
ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmx
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="2" nextobjectid="1">
|
||||||
|
<tileset firstgid="1" source="../TileSets/TileSet 1.tsj"/>
|
||||||
|
<layer id="1" name="Слой тайлов 1" width="30" height="20">
|
||||||
|
<data encoding="csv">
|
||||||
|
<chunk x="-16" y="-16" width="16" height="16">
|
||||||
|
24,24,24,28,29,24,24,24,28,46,29,24,25,115,45,46,
|
||||||
|
24,24,24,25,23,24,24,24,50,2,51,24,50,2,2,2,
|
||||||
|
24,24,24,50,32,29,24,24,24,24,24,24,24,24,24,28,
|
||||||
|
28,29,24,28,10,32,29,24,24,28,46,29,24,24,24,50,
|
||||||
|
47,23,24,50,32,10,32,46,29,50,2,51,24,24,24,24,
|
||||||
|
1,32,29,90,25,23,50,2,32,29,24,90,28,29,24,24,
|
||||||
|
51,50,32,29,50,51,90,24,25,45,46,29,25,23,24,90,
|
||||||
|
24,24,50,32,46,29,24,28,10,2,2,51,50,51,24,90,
|
||||||
|
24,24,24,50,2,32,46,10,32,29,24,90,24,24,24,90,
|
||||||
|
29,24,89,24,24,50,3,23,50,32,46,46,46,46,29,24,
|
||||||
|
51,24,24,28,29,24,25,23,24,25,1,2,3,111,45,29,
|
||||||
|
24,90,24,50,51,24,25,23,28,47,23,89,50,3,115,23,
|
||||||
|
24,24,24,24,24,89,50,32,47,1,51,24,24,50,2,51,
|
||||||
|
28,29,24,24,24,24,28,10,2,51,24,24,24,24,24,28,
|
||||||
|
10,32,29,24,24,24,25,23,28,29,90,24,24,90,24,50,
|
||||||
|
32,10,51,24,24,24,50,32,10,32,29,24,90,28,29,24
|
||||||
|
</chunk>
|
||||||
|
<chunk x="0" y="-16" width="16" height="16">
|
||||||
|
10,51,24,90,24,25,23,28,29,24,24,24,24,24,24,24,
|
||||||
|
51,24,28,29,24,50,32,10,51,24,24,24,24,24,24,24,
|
||||||
|
29,28,10,32,46,29,50,32,29,24,24,24,24,24,24,24,
|
||||||
|
51,25,23,50,2,32,29,25,23,24,24,28,29,24,90,24,
|
||||||
|
24,25,23,24,24,25,23,50,51,24,24,50,32,29,24,90,
|
||||||
|
24,50,32,29,90,25,45,29,24,24,24,24,50,51,24,89,
|
||||||
|
24,89,50,51,24,25,114,23,24,24,24,24,24,24,24,24,
|
||||||
|
24,24,28,29,24,50,2,51,24,24,90,28,29,24,24,28,
|
||||||
|
24,24,25,23,89,24,24,24,28,46,29,25,23,24,24,50,
|
||||||
|
28,46,10,51,24,28,46,29,25,111,45,10,51,28,29,24,
|
||||||
|
50,2,51,24,24,25,115,45,10,3,1,51,24,25,23,24,
|
||||||
|
24,24,24,24,24,50,2,2,32,10,51,24,90,25,23,24,
|
||||||
|
24,24,24,24,24,24,24,24,50,51,24,24,24,25,23,24,
|
||||||
|
46,29,24,24,24,24,24,89,24,24,24,28,46,47,23,90,
|
||||||
|
2,32,29,24,24,28,46,46,29,24,24,25,1,3,23,89,
|
||||||
|
24,50,32,29,24,25,1,3,23,24,89,50,32,10,51,24
|
||||||
|
</chunk>
|
||||||
|
<chunk x="16" y="-16" width="16" height="16">
|
||||||
|
24,24,24,24,90,24,89,24,89,24,50,51,89,24,24,24,
|
||||||
|
24,28,29,28,29,24,24,24,24,28,29,24,24,24,28,29,
|
||||||
|
24,25,23,50,51,24,24,28,29,50,51,24,24,24,25,45,
|
||||||
|
90,50,51,28,29,24,24,25,23,24,24,28,29,24,50,3,
|
||||||
|
24,24,28,10,51,90,90,50,51,24,24,50,51,24,24,50,
|
||||||
|
24,24,25,45,29,24,28,29,24,24,24,24,24,28,29,24,
|
||||||
|
90,24,50,2,51,28,10,51,90,24,28,29,24,25,45,46,
|
||||||
|
29,90,24,24,24,50,51,24,24,28,10,32,46,10,3,1,
|
||||||
|
32,29,24,90,24,24,24,24,28,47,23,50,2,51,50,51,
|
||||||
|
25,23,24,24,28,46,46,46,47,114,45,29,24,24,24,24,
|
||||||
|
50,32,29,24,50,3,111,111,115,111,1,32,29,24,24,24,
|
||||||
|
24,50,51,24,28,10,2,2,2,2,32,10,51,24,24,89,
|
||||||
|
24,24,89,90,25,23,24,24,24,24,50,32,46,46,29,89,
|
||||||
|
24,24,24,90,25,23,89,24,28,29,90,50,2,2,51,24,
|
||||||
|
24,24,24,28,10,51,24,28,47,45,29,24,24,24,24,24,
|
||||||
|
24,24,24,25,23,24,90,50,2,2,32,46,46,46,46,46
|
||||||
|
</chunk>
|
||||||
|
<chunk x="-16" y="0" width="16" height="16">
|
||||||
|
10,32,46,29,24,24,24,25,23,50,32,29,24,50,32,46,
|
||||||
|
51,50,2,32,29,24,24,25,45,29,25,23,24,24,25,1,
|
||||||
|
24,24,24,25,23,28,46,10,2,51,50,51,24,24,50,51,
|
||||||
|
90,89,90,50,51,50,2,51,24,24,28,29,90,24,24,24,
|
||||||
|
90,28,46,29,90,24,24,24,90,24,50,51,90,24,90,28,
|
||||||
|
29,50,2,51,24,24,24,89,24,24,24,24,24,89,24,50,
|
||||||
|
23,24,24,28,46,29,90,90,24,89,24,28,29,24,24,24,
|
||||||
|
32,46,29,25,115,45,29,24,90,24,24,25,23,24,24,28,
|
||||||
|
10,2,32,47,115,1,51,24,24,24,24,25,23,24,28,10,
|
||||||
|
32,29,50,2,2,51,24,24,24,24,24,25,23,28,10,51,
|
||||||
|
50,51,89,24,24,89,24,28,29,24,24,50,32,10,32,46,
|
||||||
|
24,24,90,90,28,46,29,50,51,24,24,24,25,23,25,115,
|
||||||
|
24,90,24,24,50,2,32,29,24,24,90,24,25,45,10,2,
|
||||||
|
24,24,24,24,24,24,50,32,29,24,24,28,10,3,23,24,
|
||||||
|
90,24,24,24,24,89,90,50,32,29,90,50,51,50,32,46,
|
||||||
|
46,29,24,90,24,24,24,24,50,51,28,29,24,24,50,2
|
||||||
|
</chunk>
|
||||||
|
<chunk x="0" y="0" width="16" height="16">
|
||||||
|
46,46,10,32,46,47,23,25,23,89,24,24,25,23,90,24,
|
||||||
|
2,2,32,47,1,2,51,25,23,24,28,29,50,32,29,24,
|
||||||
|
24,90,50,3,23,24,28,10,51,28,47,45,29,25,23,28,
|
||||||
|
24,24,24,50,51,28,47,23,24,50,3,114,45,10,51,50,
|
||||||
|
29,24,24,89,24,25,114,45,46,46,10,2,2,32,29,89,
|
||||||
|
51,24,24,24,24,50,3,111,115,115,23,24,24,50,32,29,
|
||||||
|
24,28,29,24,24,24,25,1,2,2,51,90,24,90,50,51,
|
||||||
|
29,50,32,29,28,29,25,23,24,24,89,28,29,24,24,24,
|
||||||
|
51,24,50,51,50,32,10,32,46,29,24,50,51,24,90,24,
|
||||||
|
24,24,24,24,89,50,32,10,2,32,46,29,89,28,29,24,
|
||||||
|
29,90,24,24,24,24,50,51,28,10,3,23,28,10,51,24,
|
||||||
|
23,89,24,24,90,24,24,24,50,32,10,51,50,51,24,24,
|
||||||
|
51,24,24,24,24,24,24,24,24,50,32,46,46,29,28,46,
|
||||||
|
24,24,24,90,24,24,24,24,24,24,50,3,1,32,47,115,
|
||||||
|
46,29,24,89,24,24,24,89,24,24,24,25,45,10,3,111,
|
||||||
|
2,51,28,29,28,29,24,28,46,46,46,10,2,51,50,2
|
||||||
|
</chunk>
|
||||||
|
<chunk x="16" y="0" width="16" height="16">
|
||||||
|
28,29,28,10,32,46,29,24,24,28,10,2,2,2,2,2,
|
||||||
|
50,51,50,51,25,115,45,46,29,50,51,24,24,24,24,24,
|
||||||
|
29,24,89,24,50,3,115,114,23,24,24,24,24,24,24,24,
|
||||||
|
51,90,24,89,24,50,2,2,51,24,89,24,24,28,46,29,
|
||||||
|
24,90,24,24,89,24,90,28,29,24,24,24,28,10,2,51,
|
||||||
|
24,24,24,24,28,29,90,50,51,28,29,24,25,23,24,24,
|
||||||
|
28,29,24,24,50,32,29,28,29,50,51,89,50,32,29,24,
|
||||||
|
50,51,24,24,24,50,32,10,51,24,89,24,24,25,23,24,
|
||||||
|
24,24,24,24,24,24,50,32,29,24,24,24,24,50,51,24,
|
||||||
|
90,24,24,24,24,24,24,25,45,29,24,24,24,89,28,29,
|
||||||
|
24,24,24,24,28,29,24,25,1,51,24,24,24,24,50,32,
|
||||||
|
28,29,28,29,50,32,46,10,51,28,29,24,24,24,24,50,
|
||||||
|
47,45,10,51,24,50,2,32,46,47,23,24,89,90,24,24,
|
||||||
|
111,115,23,24,24,90,24,50,2,2,32,29,24,89,28,46,
|
||||||
|
1,2,51,28,46,46,29,24,28,29,50,32,29,28,47,111,
|
||||||
|
51,24,24,50,3,114,23,24,50,32,46,47,23,25,111,111
|
||||||
|
</chunk>
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
166
ZoFo/GameCore/GameManagers/MapManager/TileSets/TileSet 1.tsj
Normal file
166
ZoFo/GameCore/GameManagers/MapManager/TileSets/TileSet 1.tsj
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
{ "class":"Tile",
|
||||||
|
"columns":22,
|
||||||
|
"grid":
|
||||||
|
{
|
||||||
|
"height":24,
|
||||||
|
"orientation":"orthogonal",
|
||||||
|
"width":24
|
||||||
|
},
|
||||||
|
"image":"..\/..\/..\/..\/Content\/Textures\/Background\/TilesetFloor.png",
|
||||||
|
"imageheight":417,
|
||||||
|
"imagewidth":352,
|
||||||
|
"margin":0,
|
||||||
|
"name":"TileSet 1",
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":572,
|
||||||
|
"tiledversion":"1.10.2",
|
||||||
|
"tileheight":16,
|
||||||
|
"tiles":[
|
||||||
|
{
|
||||||
|
"id":27,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":28,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":49,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":50,
|
||||||
|
"probability":0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":88,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":89,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":110,
|
||||||
|
"probability":2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":111,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":112,
|
||||||
|
"probability":0.100000001490116
|
||||||
|
}],
|
||||||
|
"tilewidth":16,
|
||||||
|
"type":"tileset",
|
||||||
|
"version":"1.10",
|
||||||
|
"wangsets":[
|
||||||
|
{
|
||||||
|
"colors":[
|
||||||
|
{
|
||||||
|
"color":"#ff0000",
|
||||||
|
"name":"Sand",
|
||||||
|
"probability":1,
|
||||||
|
"tile":23
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color":"#00ff00",
|
||||||
|
"name":"SandStone",
|
||||||
|
"probability":0.3,
|
||||||
|
"tile":110
|
||||||
|
}],
|
||||||
|
"name":"\u041f\u0435\u0441\u0447\u0430\u043d\u044b\u0439",
|
||||||
|
"tile":-1,
|
||||||
|
"type":"corner",
|
||||||
|
"wangtiles":[
|
||||||
|
{
|
||||||
|
"tileid":0,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":1,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":2,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":9,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":22,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":23,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":24,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":27,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":28,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":31,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":44,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":45,
|
||||||
|
"wangid":[0, 1, 0, 2, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":46,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":49,
|
||||||
|
"wangid":[0, 2, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":50,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":88,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":89,
|
||||||
|
"wangid":[0, 1, 0, 1, 0, 1, 0, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":110,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":111,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":112,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":113,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tileid":114,
|
||||||
|
"wangid":[0, 2, 0, 2, 0, 2, 0, 2]
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||||
|
@ -17,9 +18,21 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
private int port = 7632;
|
private int port = 7632;
|
||||||
private EndPoint endPoint;
|
private EndPoint endPoint;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
List<IUpdateData> updates = new List<IUpdateData>();
|
List<UpdateData> updates = new List<UpdateData>();
|
||||||
public delegate void OnDataSent(string Data);
|
public delegate void OnDataSent(string Data);
|
||||||
public event OnDataSent GetDataSent; // event
|
public event OnDataSent GetDataSent; // event
|
||||||
|
public bool IsConnected { get { return socket.Connected; } }
|
||||||
|
|
||||||
|
public ClientNetworkManager()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SocketConnected()
|
||||||
|
{
|
||||||
|
return socket.Connected;
|
||||||
|
}
|
||||||
|
|
||||||
public void Init() //create endPoint, socket
|
public void Init() //create endPoint, socket
|
||||||
{
|
{
|
||||||
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
@ -27,11 +40,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
|
|
||||||
public void SendData()
|
public void SendData()
|
||||||
{
|
{
|
||||||
while(socket.Connected)
|
byte[] bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(updates)); //нужно сериализовать
|
||||||
{
|
|
||||||
byte[] bytes = Encoding.UTF8.GetBytes(updates.ToString());
|
|
||||||
socket.Send(bytes);
|
socket.Send(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddData(UpdateData UpdateData)
|
||||||
|
{
|
||||||
|
updates.Add(UpdateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopConnection()
|
public void StopConnection()
|
||||||
|
@ -47,24 +62,21 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
public void JoinRoom(string ip) // multyplayer
|
public void JoinRoom(string ip) // multyplayer
|
||||||
{
|
{
|
||||||
|
|
||||||
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
|
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
|
||||||
|
|
||||||
socket.Connect(endPoint);
|
socket.Connect(endPoint);
|
||||||
|
|
||||||
SendData();
|
SendData();
|
||||||
Thread listen = new Thread(StartListening);
|
Thread listen = new Thread(StartListening);
|
||||||
listen.Start();
|
listen.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// создается
|
/// создается одиночная комната к которой ты подключаешься
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void JoinYourself() // single player
|
public void JoinYourself() // single player
|
||||||
{
|
{
|
||||||
endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
|
endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
|
||||||
|
|
||||||
socket.Connect(endPoint);
|
socket.Connect(endPoint);
|
||||||
|
|
||||||
SendData();
|
SendData();
|
||||||
Thread listen = new Thread(StartListening);
|
Thread listen = new Thread(StartListening);
|
||||||
listen.Start();
|
listen.Start();
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
@ -16,24 +17,46 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
{
|
{
|
||||||
public class ServerNetworkManager
|
public class ServerNetworkManager
|
||||||
{
|
{
|
||||||
private IPAddress ip = IPAddress.Any;
|
private IPAddress ip =IPAddress.Parse("127.0.0.1"); //IPAddress.Any
|
||||||
private int port = 7632;
|
private int port = 7632;
|
||||||
private IPEndPoint endPoint;
|
private IPEndPoint endPoint;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
private List<Socket> clients;
|
private List<Socket> clients;
|
||||||
private List<IUpdateData> updates;
|
public List<UpdateData> updates;
|
||||||
public delegate void OnDataSend(string data);
|
public delegate void OnDataSend(string data);
|
||||||
public event OnDataSend GetDataSend; // event
|
public event OnDataSend GetDataSend; // event
|
||||||
Dictionary<Socket, Thread> managerThread;
|
Dictionary<Socket, Thread> managerThread;
|
||||||
|
Thread serverTheread;
|
||||||
|
|
||||||
public void Init() //create Socket
|
public ServerNetworkManager() { Init(); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize varibles and Sockets
|
||||||
|
/// </summary>
|
||||||
|
private void Init()
|
||||||
{
|
{
|
||||||
endPoint = new IPEndPoint(ip, port);
|
endPoint = new IPEndPoint(ip, port);
|
||||||
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
managerThread = new Dictionary<Socket, Thread>();
|
managerThread = new Dictionary<Socket, Thread>();
|
||||||
|
clients = new List<Socket>();
|
||||||
|
updates = new List<UpdateData>();
|
||||||
|
managerThread = new Dictionary<Socket, Thread>();
|
||||||
|
socket.Bind(endPoint);
|
||||||
}
|
}
|
||||||
public void SendData() //отправляет клиенту Data
|
|
||||||
|
/// <summary>
|
||||||
|
/// отправляет клиенту Data
|
||||||
|
/// </summary>
|
||||||
|
public void SendData()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < updates.Count; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
AppManager.Instance.client.GotData(updates[i]);
|
||||||
|
}
|
||||||
|
updates.Clear();
|
||||||
|
return; //TODO TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK
|
||||||
|
|
||||||
string data = JsonSerializer.Serialize(updates);
|
string data = JsonSerializer.Serialize(updates);
|
||||||
var databytes = Encoding.UTF8.GetBytes(data);
|
var databytes = Encoding.UTF8.GetBytes(data);
|
||||||
foreach (var item in clients)
|
foreach (var item in clients)
|
||||||
|
@ -41,11 +64,20 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
item.SendAsync(databytes);
|
item.SendAsync(databytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void AddData(IUpdateData data)//добавляет в лист updates новую data
|
|
||||||
|
/// <summary>
|
||||||
|
/// добавляет в лист updates новую data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
public void AddData(UpdateData data)
|
||||||
{
|
{
|
||||||
updates.Add(data);
|
updates.Add(data);
|
||||||
}
|
}
|
||||||
public void CloseConnection() //По сути коне игры и отключение игроков
|
|
||||||
|
/// <summary>
|
||||||
|
/// По сути конец игры и отключение игроков
|
||||||
|
/// </summary>
|
||||||
|
public void CloseConnection()
|
||||||
{
|
{
|
||||||
foreach (var item in clients)
|
foreach (var item in clients)
|
||||||
{
|
{
|
||||||
|
@ -66,11 +98,26 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
clients.Clear();
|
clients.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Начинает работу сервера (Ожидает подключений)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="players"></param>
|
||||||
|
public void Start(object players)
|
||||||
|
{
|
||||||
|
serverTheread = new Thread(StartWaitingForPlayers);
|
||||||
|
serverTheread.Start(players);
|
||||||
|
}
|
||||||
|
|
||||||
//Потоки Клиентов
|
//Потоки Клиентов
|
||||||
public void StartWaitingForPlayers(object players)//Слушает игроков, которые хотят подключиться
|
|
||||||
|
/// <summary>
|
||||||
|
/// Слушает игроков, которые хотят подключиться
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="players"></param>
|
||||||
|
public void StartWaitingForPlayers(object players)
|
||||||
{
|
{
|
||||||
int playNumber = (int)players;
|
int playNumber = (int)players;
|
||||||
socket.Bind(endPoint);
|
|
||||||
socket.Listen(playNumber);
|
socket.Listen(playNumber);
|
||||||
for (int i = 0; i < playNumber; i++)
|
for (int i = 0; i < playNumber; i++)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +129,12 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void StartListening(object socket)//начать слушать клиентов в самой игре активируют Ивент
|
|
||||||
|
/// <summary>
|
||||||
|
/// начать слушать клиентов в самой игре активируют Ивент
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="socket"></param>
|
||||||
|
private void StartListening(object socket)
|
||||||
{
|
{
|
||||||
// obj to Socket
|
// obj to Socket
|
||||||
Socket client = (Socket)socket;
|
Socket client = (Socket)socket;
|
||||||
|
|
|
@ -6,9 +6,12 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
|
||||||
{
|
{
|
||||||
public class UpdateInput :IUpdateData
|
public class UpdateInput :UpdateData
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
// public int IdEntity { get; set; }
|
||||||
public string UpdateType { get; set; }
|
public UpdateInput()
|
||||||
|
{
|
||||||
|
UpdateType = "UpdateInput";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
|
||||||
{
|
{
|
||||||
public class UpdatePlayerExit : IUpdateData
|
public class UpdatePlayerExit : UpdateData
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdatePlayerExit() { UpdateType = "UpdatePlayerExit"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdateAnimation : IUpdateData //хранит новую анимации
|
public class UpdateAnimation : UpdateData //хранит новую анимации
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdateAnimation() { UpdateType = "UpdateAnimation"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdateEntityHealth : IUpdateData//хранит новое хп entity
|
public class UpdateEntityHealth : UpdateData//хранит новое хп entity
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdateEntityHealth() { UpdateType = "UpdateEntityHealth"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdateGameEnded : IUpdateData //хранит полученый лут и уведомляет о конце игры
|
public class UpdateGameEnded : UpdateData //хранит полученый лут и уведомляет о конце игры
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdateGameEnded() { UpdateType = "UpdateGameEnded"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdateGameObjectCreated : IUpdateData //Хранит объект, который только отправили
|
public class UpdateGameObjectCreated : UpdateData //Хранит объект, который только отправили
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdateGameObjectCreated() { UpdateType = "UpdateGameObjectCreated"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdateLoot : IUpdateData //Хранит лут
|
public class UpdateLoot : UpdateData //Хранит лут
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdateLoot() { UpdateType = "UpdateLoot"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdatePlayerParametrs : IUpdateData //Хранит хп, радиацию
|
public class UpdatePlayerParametrs : UpdateData //Хранит хп, радиацию
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdatePlayerParametrs() { UpdateType = "UpdatePlayerParametrs"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
{
|
{
|
||||||
public class UpdatePosition : IUpdateData //Хранит новую позицию
|
public class UpdatePosition : UpdateData //Хранит новую позицию
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; }
|
public UpdatePosition() { UpdateType = "UpdatePosition"; }
|
||||||
public string UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
|
{
|
||||||
|
|
||||||
|
public class UpdateTileCreated : UpdateData
|
||||||
|
{
|
||||||
|
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; }
|
||||||
|
public Texture2D TextureTile { get; set; }
|
||||||
|
public Vector2 Position { get; set; }
|
||||||
|
public Point Size { get; set; }
|
||||||
|
public Rectangle sourceRectangle { get; set; }
|
||||||
|
public string tileSetName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,11 +17,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
||||||
[JsonDerivedType(typeof(UpdateLoot))]
|
[JsonDerivedType(typeof(UpdateLoot))]
|
||||||
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
|
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
|
||||||
[JsonDerivedType(typeof(UpdatePosition))]
|
[JsonDerivedType(typeof(UpdatePosition))]
|
||||||
|
[JsonDerivedType(typeof(UpdateTileCreated))]
|
||||||
[JsonDerivedType(typeof(UpdateInput))]
|
[JsonDerivedType(typeof(UpdateInput))]
|
||||||
[JsonDerivedType(typeof(UpdatePlayerExit))]
|
[JsonDerivedType(typeof(UpdatePlayerExit))]
|
||||||
public interface IUpdateData
|
|
||||||
|
public class UpdateData
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; } //Id объекта
|
public int IdEntity { get; set; } //Id объекта
|
||||||
public string UpdateType { get; set; } //тип обновления
|
public string UpdateType { get; protected set; } //тип обновления
|
||||||
}
|
}
|
||||||
}
|
}
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,12 +20,12 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
|
|
||||||
public void LoadSounds() // метод для загрузки звуков из папки
|
public void LoadSounds() // метод для загрузки звуков из папки
|
||||||
{
|
{
|
||||||
var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("mp3"));
|
var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("wav"));
|
||||||
|
|
||||||
if (k.Count() > 0)
|
if (k.Count() > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
|
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".wav", "")).ToArray();// папка со звуками там где exe
|
||||||
foreach (var soundFile in soundFiles)
|
foreach (var soundFile in soundFiles)
|
||||||
{
|
{
|
||||||
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds//" + soundFile));
|
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds//" + soundFile));
|
||||||
|
@ -42,7 +42,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
||||||
{
|
{
|
||||||
var sound = new Sound(Sounds[soundName].CreateInstance(), Vector2.One, true);
|
var sound = new Sound(Sounds[soundName].CreateInstance(), Vector2.One, true);
|
||||||
// ждать пока настройки появятся sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||||
sound.SoundEffect.IsLooped = false;
|
sound.SoundEffect.IsLooped = false;
|
||||||
|
|
||||||
sound.SoundEffect.Play();
|
sound.SoundEffect.Play();
|
||||||
|
@ -57,7 +57,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
var sound = new Sound(Sounds[soundName].CreateInstance(), soundPos, false) { baseVolume = baseVolume, basePich = pitch };
|
var sound = new Sound(Sounds[soundName].CreateInstance(), soundPos, false) { baseVolume = baseVolume, basePich = pitch };
|
||||||
sound.SoundEffect.IsLooped = false;
|
sound.SoundEffect.IsLooped = false;
|
||||||
//ждать пока настройки появятся sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;
|
sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||||
sound.SoundEffect.Pitch = pitch;
|
sound.SoundEffect.Pitch = pitch;
|
||||||
sound.SoundEffect.Play();
|
sound.SoundEffect.Play();
|
||||||
PlayingSounds.Add(sound);
|
PlayingSounds.Add(sound);
|
||||||
|
@ -78,7 +78,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
for (int i = 0; i < PlayingSounds.Count; i++)
|
for (int i = 0; i < PlayingSounds.Count; i++)
|
||||||
{
|
{
|
||||||
//PlayingSounds[i].UpdateVolume(Vector2.Zero);
|
PlayingSounds[i].UpdateVolume(Vector2.Zero);
|
||||||
if (PlayingSounds[i].SoundEffect.State == SoundState.Stopped)
|
if (PlayingSounds[i].SoundEffect.State == SoundState.Stopped)
|
||||||
{
|
{
|
||||||
PlayingSounds.Remove(PlayingSounds[i]);
|
PlayingSounds.Remove(PlayingSounds[i]);
|
||||||
|
@ -114,14 +114,14 @@ 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;
|
||||||
else
|
else
|
||||||
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;// * (float)Math.Clamp(1 - GetDistanceVol(playerPos),0,1);
|
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;// * (float)Math.Clamp(1 - GetDistanceVol(playerPos),0,1);
|
||||||
|
|
||||||
}/*/
|
}
|
||||||
|
|
||||||
public double GetDistanceVol(Vector2 playerPos) // получение дистанции до объедка от игрока
|
public double GetDistanceVol(Vector2 playerPos) // получение дистанции до объедка от игрока
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,28 +10,16 @@ namespace ZoFo.GameCore.GameObjects.Entities
|
||||||
{
|
{
|
||||||
public abstract class Entity : GameObject
|
public abstract class Entity : GameObject
|
||||||
{
|
{
|
||||||
protected override GraphicsComponent graphicsComponent => null;
|
public override GraphicsComponent graphicsComponent => null;
|
||||||
public CollisionComponent collisionComponent { get; protected set; }
|
public CollisionComponent collisionComponent { get; protected set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public void CollisionComponent()
|
protected Entity(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public virtual void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AnimationComponent()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateLogic()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//вектор
|
|
||||||
//вилосити
|
|
||||||
//поситион
|
|
||||||
//текстура
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
||||||
public class Collectable : Entity
|
public class Collectable : Entity
|
||||||
{
|
{
|
||||||
|
public Collectable(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
|
||||||
public class Enemy : LivingEntity
|
public class Enemy : LivingEntity
|
||||||
{
|
{
|
||||||
|
public Enemy(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,18 +3,27 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using ZoFo.GameCore.GameObjects.Entities;
|
using ZoFo.GameCore.GameObjects.Entities;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
using ZoFo.GameCore.ZoFo_graphics;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
||||||
public class LivingEntity : Entity
|
public class LivingEntity : Entity
|
||||||
{
|
{
|
||||||
public Vector2 velocity;
|
public Vector2 velocity;
|
||||||
|
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
public void TextureLoad(SpriteBatch spriteBatch)
|
public LivingEntity(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
inputManager = new InputManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Server side
|
||||||
|
/*public override void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||||
|
|
||||||
public class Player : LivingEntity
|
public class Player : LivingEntity
|
||||||
{
|
{
|
||||||
|
public Vector2 InputWeaponRotation{ get; set; }
|
||||||
|
public Vector2 InputPlayerRotation{ get; set;}
|
||||||
|
public bool IsTryingToShoot{get;set;}
|
||||||
|
Texture2D texture;
|
||||||
|
private float speed;
|
||||||
|
private int health;
|
||||||
|
public Player(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
//InputWeaponRotation = new Vector2(0, 0);
|
||||||
|
//InputPlayerRotation = new Vector2(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
||||||
public class Bullet : Projectile
|
public class Bullet : Projectile
|
||||||
{
|
{
|
||||||
|
public Bullet(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
||||||
public class Projectile : LivingEntity
|
public class Projectile : LivingEntity
|
||||||
{
|
{
|
||||||
|
public Projectile(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
|
||||||
public class Rock : Projectile
|
public class Rock : Projectile
|
||||||
{
|
{
|
||||||
|
public Rock(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,96 @@
|
||||||
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
using ZoFo.GameCore.ZoFo_graphics;
|
||||||
|
using ZoFo.GameCore;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
|
|
||||||
public abstract class GameObject
|
public abstract class GameObject
|
||||||
{
|
{
|
||||||
public Vector2 position;
|
public Vector2 position;
|
||||||
public Vector2 rotation;
|
|
||||||
|
|
||||||
protected abstract GraphicsComponent graphicsComponent { get; }
|
private Server server;
|
||||||
public void Draw() { }
|
public Vector2 rotation; //вектор направления объекта
|
||||||
|
public abstract GraphicsComponent graphicsComponent { get; }
|
||||||
|
|
||||||
|
#region ServerSide
|
||||||
|
public GameObject(Vector2 position)
|
||||||
|
{
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
graphicsComponent.LoadContent();
|
||||||
|
}
|
||||||
|
public virtual void UpdateLogic(GameTime gameTime)
|
||||||
|
{
|
||||||
|
PlayAnimation_OnServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Это вызывается в логике игры, которая на сервере, здесь будет вызываться уведомление об анимации
|
||||||
|
/// </summary>
|
||||||
|
public void PlayAnimation_OnServer()
|
||||||
|
{
|
||||||
|
graphicsComponent.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Client Side
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Для клиента
|
||||||
|
/// Это вызывается в клиентской части игры
|
||||||
|
/// </summary>
|
||||||
|
public void PlayAnimation_OnClient()
|
||||||
|
{
|
||||||
|
graphicsComponent.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Для клиента
|
||||||
|
/// Загрузка графического компонента
|
||||||
|
/// </summary>
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
graphicsComponent.LoadContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Для клиента
|
||||||
|
/// Обновление, которое вызывается у клиента, для просмотра анимаций
|
||||||
|
/// </summary>
|
||||||
|
public virtual void UpdateAnimations(GameTime gameTime)
|
||||||
|
{
|
||||||
|
PlayAnimation_OnClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Для клиента
|
||||||
|
/// </summary>
|
||||||
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch);
|
||||||
|
//debug
|
||||||
|
if (AppManager.Instance.InputManager.CollisionsCheat)
|
||||||
|
DrawDebugRectangle(spriteBatch, graphicsComponent.ObjectDrawRectangle);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void DrawDebugRectangle(SpriteBatch spriteBatch, Rectangle _rectangle, Nullable<Color> color = null)
|
||||||
|
{
|
||||||
|
if (color is null) color = new Color(1, 0, 0, 0.25f);
|
||||||
|
if (color.Value.A == 255) color = new Color(color.Value, 0.25f);
|
||||||
|
//spriteBatch.Draw(debugTexture,
|
||||||
|
// new Rectangle((_rectangle.X - GraphicsComponent.CameraPosition.X) * GraphicsComponent.scaling,
|
||||||
|
// (_rectangle.Y - GraphicsComponent.CameraPosition.Y) * GraphicsComponent.scaling,
|
||||||
|
// _rectangle.Width * GraphicsComponent.scaling,
|
||||||
|
// _rectangle.Height * GraphicsComponent.scaling), color.Value);
|
||||||
|
|
||||||
|
//TODO: debugTexture
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
35
ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
Normal file
35
ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
using ZoFo.GameCore.ZoFo_graphics;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameObjects.MapObjects
|
||||||
|
{
|
||||||
|
public class MapObject : GameObject
|
||||||
|
{
|
||||||
|
public virtual bool IsColliderOn { get; protected set; } = true;//Who added that?
|
||||||
|
public Rectangle _sourceRectangle;
|
||||||
|
public override GraphicsComponent graphicsComponent { get; } = new();
|
||||||
|
|
||||||
|
public MapObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position)
|
||||||
|
{
|
||||||
|
_sourceRectangle = sourceRectangle;
|
||||||
|
graphicsComponent.ObjectDrawRectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
|
||||||
|
graphicsComponent.BuildComponent(textureName);
|
||||||
|
|
||||||
|
graphicsComponent.LoadContent();
|
||||||
|
|
||||||
|
}
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, _sourceRectangle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
using ZoFo.GameCore.ZoFo_graphics;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
|
|
||||||
|
public class StopObject : MapObject
|
||||||
|
{
|
||||||
|
CollisionComponent collisionComponent;
|
||||||
|
|
||||||
|
protected StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position, size, sourceRectangle, textureName)
|
||||||
|
{
|
||||||
|
// TODO: Написать коллизию, пусть тразмер будет чисто таким же как и текстурка.
|
||||||
|
// Поменяйте уровень защиты конструктора, после снимите в MapManager комментарий в методе LoadMap с создания StopObject-а
|
||||||
|
}
|
||||||
|
}
|
8
ZoFo/GameCore/GameObjects/MapObjects/Tiles/Tile.cs
Normal file
8
ZoFo/GameCore/GameObjects/MapObjects/Tiles/Tile.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameObjects.MapObjects.Tiles;
|
||||||
|
|
||||||
|
public class Tile
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.StopObjects;
|
|
||||||
|
|
||||||
public class StopObject
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
|
||||||
|
|
||||||
public class Tile
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,57 +5,124 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.MapManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager;
|
using ZoFo.GameCore.GameManagers.NetworkManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameObjects;
|
using ZoFo.GameCore.GameObjects;
|
||||||
using ZoFo.GameCore.GameObjects.Entities;
|
using ZoFo.GameCore.GameObjects.Entities;
|
||||||
|
using ZoFo.GameCore.GameObjects.MapObjects;
|
||||||
|
|
||||||
namespace ZoFo.GameCore
|
namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
public class Server
|
public class Server
|
||||||
{
|
{
|
||||||
private List<GameObject> gameObjects;
|
|
||||||
private ServerNetworkManager networkManager;
|
private ServerNetworkManager networkManager;
|
||||||
private List<Entity> entity; //entity
|
private int ticks = 0;
|
||||||
public Server()
|
public Server()
|
||||||
{
|
{
|
||||||
networkManager = new ServerNetworkManager();
|
networkManager = new ServerNetworkManager();
|
||||||
networkManager.GetDataSend += OnDataSend;
|
networkManager.GetDataSend += OnDataSend;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#region server logic as App
|
||||||
|
//TODO Comment pls
|
||||||
public void OnDataSend(string data)
|
public void OnDataSend(string data)
|
||||||
{
|
{
|
||||||
List<IUpdateData> updateDatas = JsonSerializer.Deserialize<List<IUpdateData>>(data);
|
List<UpdateData> updateDatas = JsonSerializer.Deserialize<List<UpdateData>>(data);
|
||||||
|
for (int i = 0; i < updateDatas.Count; i++)
|
||||||
|
{
|
||||||
|
ProcessIUpdateData(updateDatas[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка апдейтсов, которые нам прислал клиент
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updateData"></param>
|
||||||
|
public void ProcessIUpdateData(UpdateData updateData)
|
||||||
|
{
|
||||||
|
|
||||||
//ТУТ Switch case будет честное слово
|
//ТУТ Switch case будет честное слово
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Для красоты) Отдел Серверов
|
/// Для красоты) Отдел Серверов
|
||||||
|
/// добавляет в лист updates новую data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void AddData(IUpdateData data)//добавляет в лист updates новую data
|
public void AddData(UpdateData data)//добавляет в лист updates новую data
|
||||||
{
|
{
|
||||||
networkManager.AddData(data);
|
networkManager.AddData(data);
|
||||||
}
|
}
|
||||||
public void CreateRoom(int players) //Создает комнату и запускает ожидание подключений
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создает комнату и запускает ожидание подключений
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="players"></param>
|
||||||
|
public void CreateRoom(int players)
|
||||||
{
|
{
|
||||||
networkManager.StartWaitingForPlayers(players);
|
networkManager.Start(players);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void StartGame() { } принудительный запуск
|
/// <summary>
|
||||||
public void EndGame() //Добавляет UpdateGameEnded и отключает игроков
|
/// Запуск игры в комнате
|
||||||
|
/// </summary>
|
||||||
|
public void StartGame()
|
||||||
|
{
|
||||||
|
|
||||||
|
//TODO начинает рассылку и обмен пакетами игры
|
||||||
|
//Грузит карту
|
||||||
|
|
||||||
|
gameObjects = new List<GameObject>();
|
||||||
|
entities = new List<Entity>();
|
||||||
|
new MapManager().LoadMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавляет UpdateGameEnded и отключает игроков
|
||||||
|
/// </summary>
|
||||||
|
public void EndGame()
|
||||||
{
|
{
|
||||||
UpdateGameEnded gameEnded = new UpdateGameEnded();
|
UpdateGameEnded gameEnded = new UpdateGameEnded();
|
||||||
networkManager.AddData(gameEnded);
|
networkManager.AddData(gameEnded);
|
||||||
networkManager.CloseConnection();
|
networkManager.CloseConnection();
|
||||||
}
|
}
|
||||||
internal void Update(GameTime gameTime)
|
private List<GameObject> gameObjects = new List<GameObject>();
|
||||||
{
|
private List<Entity> entities; //entity
|
||||||
|
public void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ
|
||||||
|
{
|
||||||
|
foreach (var go in gameObjects)
|
||||||
|
{
|
||||||
|
go.UpdateLogic(gameTime);
|
||||||
|
}
|
||||||
|
ticks = 0;
|
||||||
|
networkManager.SendData();
|
||||||
|
}
|
||||||
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterEntity(GameObject gameObject)
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Регистрирует игровой объект
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObject"></param>
|
||||||
|
public void RegisterGameObject(GameObject gameObject)
|
||||||
{
|
{
|
||||||
gameObjects.Add(gameObject);
|
gameObjects.Add(gameObject);
|
||||||
}
|
if (gameObject is MapObject)
|
||||||
|
{
|
||||||
|
AddData(new UpdateTileCreated()
|
||||||
|
{
|
||||||
|
Position = (gameObject as MapObject).position,
|
||||||
|
sourceRectangle = (gameObject as MapObject)._sourceRectangle,
|
||||||
|
Size = (gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size,
|
||||||
|
tileSetName = (gameObject as MapObject).graphicsComponent.mainTextureName
|
||||||
|
});//TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,16 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
|
|
||||||
public class GraphicsComponent
|
public class GraphicsComponent
|
||||||
{
|
{
|
||||||
|
public Rectangle ObjectDrawRectangle { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public event Action<string> actionOfAnimationEnd;
|
public event Action<string> actionOfAnimationEnd;
|
||||||
private List<AnimationContainer> animations;
|
private List<AnimationContainer> animations;
|
||||||
private List<Texture2D> textures;
|
private List<Texture2D> textures;
|
||||||
private List<string> texturesNames;
|
public List<string> texturesNames; //rethink public and following that errors
|
||||||
private AnimationContainer currentAnimation;
|
private AnimationContainer currentAnimation;
|
||||||
static public int scaling = 4;
|
static public int scaling = 5;
|
||||||
public int parentId;
|
public int parentId;
|
||||||
public AnimationContainer CurrentAnimation
|
public AnimationContainer CurrentAnimation
|
||||||
{
|
{
|
||||||
|
@ -60,8 +64,18 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
buildSourceRectangle();
|
buildSourceRectangle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string mainTextureName;//TODO костыль - пофиксить
|
||||||
public GraphicsComponent(string textureName)
|
public GraphicsComponent(string textureName)
|
||||||
{
|
{
|
||||||
|
BuildComponent(textureName);
|
||||||
|
}
|
||||||
|
public GraphicsComponent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public void BuildComponent(string textureName)
|
||||||
|
{
|
||||||
|
mainTextureName = textureName;
|
||||||
|
//texturesNames.Add(textureName);//Added by SD
|
||||||
animations = new List<AnimationContainer>();
|
animations = new List<AnimationContainer>();
|
||||||
textures = new List<Texture2D>();
|
textures = new List<Texture2D>();
|
||||||
var texture = AppManager.Instance.Content.Load<Texture2D>(textureName);
|
var texture = AppManager.Instance.Content.Load<Texture2D>(textureName);
|
||||||
|
@ -97,6 +111,11 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
textures = new List<Texture2D>();
|
textures = new List<Texture2D>();
|
||||||
texturesNames = new List<string>();
|
texturesNames = new List<string>();
|
||||||
|
|
||||||
|
if (animations is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var animation in animations)
|
foreach (var animation in animations)
|
||||||
{
|
{
|
||||||
if (!texturesNames.Contains(animation.TextureName))
|
if (!texturesNames.Contains(animation.TextureName))
|
||||||
|
@ -137,6 +156,10 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
if (currentAnimation is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (interval == 0)
|
if (interval == 0)
|
||||||
{
|
{
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
|
@ -277,6 +300,6 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
AppManager.Instance.DebugHUD.Set("CameraPosition", $"{CameraPosition.X}, {CameraPosition.Y}");
|
AppManager.Instance.DebugHUD.Set("CameraPosition", $"{CameraPosition.X}, {CameraPosition.Y}");
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
public static Point CameraPosition = new Point(-700, 300);
|
public static Point CameraPosition = new Point(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<ProjectReference Include="..\MonogameLibrary\MonogameLibrary.csproj" />
|
<ProjectReference Include="..\MonogameLibrary\MonogameLibrary.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Content\sounds\Zombie\" />
|
||||||
<Folder Include="Content\Textures\GUI\" />
|
<Folder Include="Content\Textures\GUI\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
|
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
|
||||||
|
|
Loading…
Add table
Reference in a new issue