diff --git a/MonogameLibrary/UI/Elements/CheckBox.cs b/MonogameLibrary/UI/Elements/CheckBox.cs
index 5d927ca..b8eec17 100644
--- a/MonogameLibrary/UI/Elements/CheckBox.cs
+++ b/MonogameLibrary/UI/Elements/CheckBox.cs
@@ -24,6 +24,10 @@ namespace MonogameLibrary.UI.Elements
private bool isChecked;
HoverState hoverState = HoverState.None;
public bool GetChecked { get { return isChecked; } }
+ public void SetIsChecked(bool isChecked)
+ {
+ this.isChecked=isChecked;
+ }
public bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
{
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb
index f9ac38a..e47b105 100644
--- a/ZoFo/Content/Content.mgcb
+++ b/ZoFo/Content/Content.mgcb
@@ -34,6 +34,63 @@
/processorParam:TextureFormat=Compressed
/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
/importer:TextureImporter
/processor:TextureProcessor
@@ -166,3 +223,15 @@
/processorParam:TextureFormat=Color
/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
+
diff --git a/ZoFo/Content/MapData/TileMaps/main.tmj b/ZoFo/Content/MapData/TileMaps/main.tmj
new file mode 100644
index 0000000..ae7c346
--- /dev/null
+++ b/ZoFo/Content/MapData/TileMaps/main.tmj
@@ -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
+}
\ No newline at end of file
diff --git a/ZoFo/Content/MapData/TileMaps/main.tmx b/ZoFo/Content/MapData/TileMaps/main.tmx
new file mode 100644
index 0000000..4cafd72
--- /dev/null
+++ b/ZoFo/Content/MapData/TileMaps/main.tmx
@@ -0,0 +1,116 @@
+
+
diff --git a/ZoFo/Content/MapData/TileSets/TileSet 1.tsj b/ZoFo/Content/MapData/TileSets/TileSet 1.tsj
new file mode 100644
index 0000000..3388a9e
--- /dev/null
+++ b/ZoFo/Content/MapData/TileSets/TileSet 1.tsj
@@ -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]
+ }]
+ }]
+}
\ No newline at end of file
diff --git a/ZoFo/Content/Textures/TileSets/TilesetFloor.png b/ZoFo/Content/Textures/TileSets/TilesetFloor.png
new file mode 100644
index 0000000..abba7bf
Binary files /dev/null and b/ZoFo/Content/Textures/TileSets/TilesetFloor.png differ
diff --git a/ZoFo/Content/sounds/Loot.wav b/ZoFo/Content/sounds/Loot.wav
new file mode 100644
index 0000000..a382185
Binary files /dev/null and b/ZoFo/Content/sounds/Loot.wav differ
diff --git a/ZoFo/Content/sounds/Odevanie odezdi.wav b/ZoFo/Content/sounds/Odevanie odezdi.wav
new file mode 100644
index 0000000..348d8e0
Binary files /dev/null and b/ZoFo/Content/sounds/Odevanie odezdi.wav differ
diff --git a/ZoFo/Content/sounds/Pieot wodichky.wav b/ZoFo/Content/sounds/Pieot wodichky.wav
new file mode 100644
index 0000000..3105cdb
Binary files /dev/null and b/ZoFo/Content/sounds/Pieot wodichky.wav differ
diff --git a/ZoFo/Content/sounds/Sshetchik geigera.wav b/ZoFo/Content/sounds/Sshetchik geigera.wav
new file mode 100644
index 0000000..c57f374
Binary files /dev/null and b/ZoFo/Content/sounds/Sshetchik geigera.wav differ
diff --git a/ZoFo/Content/sounds/Tabletki 2.wav b/ZoFo/Content/sounds/Tabletki 2.wav
new file mode 100644
index 0000000..166f3ca
Binary files /dev/null and b/ZoFo/Content/sounds/Tabletki 2.wav differ
diff --git a/ZoFo/Content/sounds/Tabletki.mp3 b/ZoFo/Content/sounds/Tabletki.mp3
new file mode 100644
index 0000000..1a44967
Binary files /dev/null and b/ZoFo/Content/sounds/Tabletki.mp3 differ
diff --git a/ZoFo/Content/sounds/Zombi napal.wav b/ZoFo/Content/sounds/Zombi napal.wav
new file mode 100644
index 0000000..df0b208
Binary files /dev/null and b/ZoFo/Content/sounds/Zombi napal.wav differ
diff --git a/ZoFo/Content/sounds/Zombi stoit.wav b/ZoFo/Content/sounds/Zombi stoit.wav
new file mode 100644
index 0000000..7b64f89
Binary files /dev/null and b/ZoFo/Content/sounds/Zombi stoit.wav differ
diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs
index 484e82a..ad153d7 100644
--- a/ZoFo/GameCore/Client.cs
+++ b/ZoFo/GameCore/Client.cs
@@ -7,6 +7,11 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
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
{
@@ -22,21 +27,57 @@ namespace ZoFo.GameCore
}
public void OnDataSend(string data)
- {
- List updateDatas = JsonSerializer.Deserialize>(data);
+ {
+ List updateDatas = JsonSerializer.Deserialize>(data);
// тут будет switch
+ foreach (var item in updateDatas)
+ {
+ /* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
+ {
+ case "Tile":
+ MapObject map = new MapObject();
+
+ break;
+ }*/
+ }
+
}
- public void GameEndedUnexpectedly(){ }
+ public void GameEndedUnexpectedly() { }
public void JoinRoom(string ip)
{
networkManager.JoinRoom(ip);
}
- public void JoinYourself(){ networkManager.JoinYourself(); }
+ public void JoinYourself() { networkManager.JoinYourself(); }
+
+
+ List mapObjects = new List();
+ ///
+ /// Клиент должен обнговлять игру анимаций
+ ///
+ ///
internal void Update(GameTime gameTime)
{
}
internal void Draw(SpriteBatch spriteBatch)
- {
+ {
+ for (int i = 0; i < mapObjects.Count; i++)
+ {
+ mapObjects[i].Draw(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
+ ));
+ }
}
}
}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GUI/HUD.cs b/ZoFo/GameCore/GUI/HUD.cs
index c20ead1..2a65222 100644
--- a/ZoFo/GameCore/GUI/HUD.cs
+++ b/ZoFo/GameCore/GUI/HUD.cs
@@ -12,7 +12,7 @@ using MonogameLibrary.UI.Elements;
namespace ZoFo.GameCore.GUI;
-public class HUD
+public class HUD : AbstractGUI
{
protected UIManager Manager = new();
protected List Elements = new();
@@ -39,6 +39,10 @@ public class HUD
public virtual void Draw(SpriteBatch spriteBatch)
{
- Manager.Draw(spriteBatch);
+ //Manager.Draw(spriteBatch);
+ }
+
+ protected override void CreateUI()
+ {
}
}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GUI/OptionsGUI.cs b/ZoFo/GameCore/GUI/OptionsGUI.cs
index a60611b..991c04b 100644
--- a/ZoFo/GameCore/GUI/OptionsGUI.cs
+++ b/ZoFo/GameCore/GUI/OptionsGUI.cs
@@ -35,9 +35,10 @@ public class OptionsGUI : AbstractGUI
var slider_OverallVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
+ slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume);
slider_OverallVolume.SliderChanged += (newVal) =>
{
-
+ AppManager.Instance.SettingsManager.SetMainVolume(newVal);
};
Elements.Add(slider_OverallVolume);
@@ -47,9 +48,10 @@ public class OptionsGUI : AbstractGUI
var slider_MusicVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
+ slider_MusicVolume.SetValue(AppManager.Instance.SettingsManager.MusicVolume);
slider_MusicVolume.SliderChanged += (newVal) =>
{
-
+ AppManager.Instance.SettingsManager.SetMusicVolume(newVal);
};
Elements.Add(slider_MusicVolume);
@@ -60,9 +62,10 @@ public class OptionsGUI : AbstractGUI
var slider_EffectsVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
+ slider_EffectsVolume.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume);
slider_EffectsVolume.SliderChanged += (newVal) =>
{
-
+ AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal);
};
Elements.Add(slider_EffectsVolume);
@@ -80,9 +83,10 @@ public class OptionsGUI : AbstractGUI
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) };
+ button_FullScreen.SetIsChecked(AppManager.Instance.SettingsManager.IsFullScreen);
button_FullScreen.Checked += (newCheckState) =>
{
-
+ AppManager.Instance.SettingsManager.SetIsFullScreen(newCheckState);
};
Elements.Add(button_FullScreen);
diff --git a/ZoFo/GameCore/GUI/SelectModeMenu.cs b/ZoFo/GameCore/GUI/SelectModeMenu.cs
index 5af58a8..af3dad0 100644
--- a/ZoFo/GameCore/GUI/SelectModeMenu.cs
+++ b/ZoFo/GameCore/GUI/SelectModeMenu.cs
@@ -39,13 +39,19 @@ public class SelectModeMenu : AbstractGUI
singleButton.LeftButtonPressed += () =>
{
// single
- Server server = new Server(); //Server Logic SinglePlayer
+ 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");
@@ -65,12 +71,14 @@ public class SelectModeMenu : AbstractGUI
{
AppManager.Instance.SetGUI(new SelectingServerGUI());
// multi
- Server server = new Server(); //Server Logic SinglePlayer
+ Server server = new Server(); //Server Logic MultiPlayer
Client client = new Client();
- server.CreateRoom(1);
- client.JoinYourself();
+ 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);
diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs
index c2c8756..83f0382 100644
--- a/ZoFo/GameCore/GameManagers/AppManager.cs
+++ b/ZoFo/GameCore/GameManagers/AppManager.cs
@@ -36,6 +36,8 @@ namespace ZoFo.GameCore.GameManagers
public InputManager InputManager;
public ItemManager.ItemManager ItemManager;
+ public SettingsManager SettingsManager;
+ public SoundManager SoundManager;
public AnimationBuilder animationBuilder { get; set; }
@@ -53,8 +55,11 @@ namespace ZoFo.GameCore.GameManagers
Instance = this;
InputManager = new InputManager();
-
-
+ SettingsManager = new SettingsManager();
+ SettingsManager.LoadSettings();
+ SoundManager = new SoundManager();
+ SoundManager.LoadSounds();
+
currentGUI = new MainMenuGUI();
debugHud = new DebugHUD();
@@ -115,6 +120,7 @@ namespace ZoFo.GameCore.GameManagers
currentGUI.Draw(_spriteBatch);
debugHud.Draw(_spriteBatch);
+ _spriteBatch.Begin();
switch (gamestate)
{
case GameState.ClientPlaying:
@@ -125,6 +131,7 @@ namespace ZoFo.GameCore.GameManagers
default:
break;
}
+ _spriteBatch.End();
base.Draw(gameTime);
}
diff --git a/ZoFo/GameCore/GameManagers/InputManager.cs b/ZoFo/GameCore/GameManagers/InputManager.cs
index 0dfbc1b..4ee0980 100644
--- a/ZoFo/GameCore/GameManagers/InputManager.cs
+++ b/ZoFo/GameCore/GameManagers/InputManager.cs
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers
{
public enum ScopeState { Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight }
+
public class InputManager
{
public delegate void Delegat();
diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapElements/Layer.cs b/ZoFo/GameCore/GameManagers/MapManager/MapElements/Layer.cs
index f598efe..09f9894 100644
--- a/ZoFo/GameCore/GameManagers/MapManager/MapElements/Layer.cs
+++ b/ZoFo/GameCore/GameManagers/MapManager/MapElements/Layer.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
@@ -13,5 +14,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
public int Width { get; set; }
public int Id { get; set; }
public bool Visibility { get; set; }
+ public string Class { get; set; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapElements/TileMap.cs b/ZoFo/GameCore/GameManagers/MapManager/MapElements/TileMap.cs
index 6c7e958..dda6f25 100644
--- a/ZoFo/GameCore/GameManagers/MapManager/MapElements/TileMap.cs
+++ b/ZoFo/GameCore/GameManagers/MapManager/MapElements/TileMap.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs
index a02a5aa..fd67cd1 100644
--- a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs
+++ b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs
@@ -8,12 +8,17 @@ using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
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
{
public class MapManager
{
- private static readonly string _path = "TileMaps/{0}.tmj";
+
+ private static readonly string _templatePath = "Content/MapData/TileMaps/{0}.tmj";
+ private static readonly float _scale = 1.0f;
private List _tileSets = new List();
///
@@ -23,39 +28,54 @@ namespace ZoFo.GameCore.GameManagers.MapManager
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();
- tileMap = JsonSerializer.Deserialize(data);
- }
+ PropertyNameCaseInsensitive = true
+ };
+ TileMap tileMap = JsonSerializer.Deserialize(File.ReadAllText(string.Format(_templatePath, mapName)), options);
// Загрузка TileSet-ов по TileSetInfo
List tileSets = new List();
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
{
- TileSet tileSet = LoadTileSet(tileSetInfo.Source);
+ TileSet tileSet = LoadTileSet("Content/MapData/"+tileSetInfo.Source);
tileSet.FirstGid = tileSetInfo.FirstGid;
tileSets.Add(tileSet);
}
- foreach (var chunk in tileMap.Layers[0].Chunks)
+ foreach (var layer in tileMap.Layers)
{
- for (int i = 0; i < chunk.Data.Length; i++)
+ foreach (var chunk in layer.Chunks)
{
- foreach (var tileSet in tileSets)
+ for (int i = 0; i < chunk.Data.Length; i++)
{
- if (tileSet.FirstGid - chunk.Data[i] < 0)
+ foreach (var tileSet in tileSets)
{
- int number = chunk.Data[i] - tileSet.FirstGid;
+ if (tileSet.FirstGid - chunk.Data[i] < 0)
+ {
+ int number = chunk.Data[i] - tileSet.FirstGid;
- int relativeColumn = number % tileSet.Columns * tileSet.TileWidth;
- int relativeRow = number / tileSet.Columns * tileSet.TileHeight;
+ int relativeColumn = (number % tileSet.Columns) * tileSet.TileWidth;
+ int relativeRow = (number / tileSet.Columns) * tileSet.TileHeight;
- Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * tileSet.TileHeight,
- relativeColumn * tileSet.TileWidth + tileSet.TileWidth, relativeRow * tileSet.TileHeight + tileSet.TileHeight);
+ Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * 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;
+ }
+
+ }
}
}
}
@@ -71,8 +91,12 @@ namespace ZoFo.GameCore.GameManagers.MapManager
{
using (StreamReader reader = new StreamReader(path))
{
+ var options = new JsonSerializerOptions //TODO Remove
+ {
+ PropertyNameCaseInsensitive = true
+ };
string data = reader.ReadToEnd();
- return JsonSerializer.Deserialize(data);
+ return JsonSerializer.Deserialize(data, options);
}
}
}
diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapSession.tiled-session b/ZoFo/GameCore/GameManagers/MapManager/MapSession.tiled-session
index 9f02627..cec4797 100644
--- a/ZoFo/GameCore/GameManagers/MapManager/MapSession.tiled-session
+++ b/ZoFo/GameCore/GameManagers/MapManager/MapSession.tiled-session
@@ -10,7 +10,7 @@
},
"last.imagePath": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/Textures/Background",
"map.fixedSize": false,
- "map.lastUsedFormat": "tmx",
+ "map.lastUsedFormat": "json",
"map.tileHeight": 16,
"map.tileWidth": 16,
"openFiles": [
diff --git a/ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmj b/ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmj
new file mode 100644
index 0000000..a5d33d8
--- /dev/null
+++ b/ZoFo/GameCore/GameManagers/MapManager/TileMaps/main.tmj
@@ -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
+}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs
index eeb69b3..c178154 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs
@@ -18,7 +18,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
private int port = 7632;
private EndPoint endPoint;
private Socket socket;
- List updates = new List();
+ List updates = new List();
public delegate void OnDataSent(string Data);
public event OnDataSent GetDataSent; // event
public bool IsConnected { get { return socket.Connected; } }
@@ -28,6 +28,11 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
Init();
}
+ public bool SocketConnected()
+ {
+ return socket.Connected;
+ }
+
public void Init() //create endPoint, socket
{
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@@ -39,7 +44,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
socket.Send(bytes);
}
- public void AddData(IUpdateData UpdateData)
+ public void AddData(UpdateData UpdateData)
{
updates.Add(UpdateData);
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs
index b4213e7..46d8281 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
+using System.Net.Http;
using System.Net.Sockets;
using System.Text;
using System.Text.Json;
@@ -21,7 +22,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
private IPEndPoint endPoint;
private Socket socket;
private List clients;
- private List updates;
+ public List updates;
public delegate void OnDataSend(string data);
public event OnDataSend GetDataSend; // event
Dictionary managerThread;
@@ -38,7 +39,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
managerThread = new Dictionary();
clients = new List();
- updates = new List();
+ updates = new List();
managerThread = new Dictionary();
socket.Bind(endPoint);
}
@@ -48,6 +49,14 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
///
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);
var databytes = Encoding.UTF8.GetBytes(data);
foreach (var item in clients)
@@ -60,7 +69,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
/// добавляет в лист updates новую data
///
///
- public void AddData(IUpdateData data)
+ public void AddData(UpdateData data)
{
updates.Add(data);
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs
index 81af1d9..bb2ea93 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs
@@ -6,9 +6,12 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
{
- public class UpdateInput :IUpdateData
+ public class UpdateInput :UpdateData
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ // public int IdEntity { get; set; }
+ public UpdateInput()
+ {
+ UpdateType = "UpdateInput";
+ }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdatePlayerExit.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdatePlayerExit.cs
index ba6c6ca..7cb0b44 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdatePlayerExit.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdatePlayerExit.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
{
- public class UpdatePlayerExit : IUpdateData
+ public class UpdatePlayerExit : UpdateData
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdatePlayerExit() { UpdateType = "UpdatePlayerExit"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs
index 6f07770..92fdc73 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdateAnimation : IUpdateData //хранит новую анимации
+ public class UpdateAnimation : UpdateData //хранит новую анимации
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdateAnimation() { UpdateType = "UpdateAnimation"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs
index 618770e..7e1efd3 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdateEntityHealth : IUpdateData//хранит новое хп entity
+ public class UpdateEntityHealth : UpdateData//хранит новое хп entity
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdateEntityHealth() { UpdateType = "UpdateEntityHealth"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs
index 10173b7..193f6c1 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdateGameEnded : IUpdateData //хранит полученый лут и уведомляет о конце игры
+ public class UpdateGameEnded : UpdateData //хранит полученый лут и уведомляет о конце игры
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdateGameEnded() { UpdateType = "UpdateGameEnded"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs
index 4cf8a42..d3a154f 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdateGameObjectCreated : IUpdateData //Хранит объект, который только отправили
+ public class UpdateGameObjectCreated : UpdateData //Хранит объект, который только отправили
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdateGameObjectCreated() { UpdateType = "UpdateGameObjectCreated"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs
index e7f8a51..19d390c 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdateLoot : IUpdateData //Хранит лут
+ public class UpdateLoot : UpdateData //Хранит лут
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdateLoot() { UpdateType = "UpdateLoot"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs
index 36a2544..818dcce 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdatePlayerParametrs : IUpdateData //Хранит хп, радиацию
+ public class UpdatePlayerParametrs : UpdateData //Хранит хп, радиацию
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdatePlayerParametrs() { UpdateType = "UpdatePlayerParametrs"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs
index fda8a39..ae58334 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs
@@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
- public class UpdatePosition : IUpdateData //Хранит новую позицию
+ public class UpdatePosition : UpdateData //Хранит новую позицию
{
- public int IdEntity { get; set; }
- public string UpdateType { get; set; }
+ public UpdatePosition() { UpdateType = "UpdatePosition"; }
}
}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs
new file mode 100644
index 0000000..2002a34
--- /dev/null
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs
@@ -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; }
+ }
+}
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/IUpdateData.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs
similarity index 83%
rename from ZoFo/GameCore/GameManagers/NetworkManager/Updates/IUpdateData.cs
rename to ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs
index a90aaf4..bb462ad 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/IUpdateData.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs
@@ -17,11 +17,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
[JsonDerivedType(typeof(UpdateLoot))]
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
[JsonDerivedType(typeof(UpdatePosition))]
+ [JsonDerivedType(typeof(UpdateTileCreated))]
[JsonDerivedType(typeof(UpdateInput))]
[JsonDerivedType(typeof(UpdatePlayerExit))]
- public interface IUpdateData
+
+ public class UpdateData
{
public int IdEntity { get; set; } //Id объекта
- public string UpdateType { get; set; } //тип обновления
+ public string UpdateType { get; protected set; } //тип обновления
}
}
diff --git a/ZoFo/GameCore/GameManagers/SoundManager.cs b/ZoFo/GameCore/GameManagers/SoundManager.cs
index d99211e..0494dae 100644
--- a/ZoFo/GameCore/GameManagers/SoundManager.cs
+++ b/ZoFo/GameCore/GameManagers/SoundManager.cs
@@ -20,12 +20,12 @@ namespace ZoFo.GameCore.GameManagers
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)
{
- 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)
{
Sounds.Add(soundFile, AppManager.Instance.Content.Load("sounds//" + soundFile));
@@ -42,7 +42,7 @@ namespace ZoFo.GameCore.GameManagers
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
{
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.Play();
@@ -57,7 +57,7 @@ namespace ZoFo.GameCore.GameManagers
{
var sound = new Sound(Sounds[soundName].CreateInstance(), soundPos, false) { baseVolume = baseVolume, basePich = pitch };
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.Play();
PlayingSounds.Add(sound);
@@ -78,7 +78,7 @@ namespace ZoFo.GameCore.GameManagers
{
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)
{
PlayingSounds.Remove(PlayingSounds[i]);
@@ -114,14 +114,14 @@ namespace ZoFo.GameCore.GameManagers
SoundEffect = soundEffect;
Position = position;
}
- /*/public void UpdateVolume(Vector2 playerPos)
+ public void UpdateVolume(Vector2 playerPos)
{
if (isAmbient)
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
else
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;// * (float)Math.Clamp(1 - GetDistanceVol(playerPos),0,1);
- }/*/
+ }
public double GetDistanceVol(Vector2 playerPos) // получение дистанции до объедка от игрока
{
diff --git a/ZoFo/GameCore/GameObjects/Entities/Entity.cs b/ZoFo/GameCore/GameObjects/Entities/Entity.cs
index a1ab30b..a9e8670 100644
--- a/ZoFo/GameCore/GameObjects/Entities/Entity.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/Entity.cs
@@ -10,14 +10,16 @@ namespace ZoFo.GameCore.GameObjects.Entities
{
public abstract class Entity : GameObject
{
- protected override GraphicsComponent graphicsComponent => null;
+ public override GraphicsComponent graphicsComponent => null;
public CollisionComponent collisionComponent { get; protected set; }
public int Id { get; set; }
protected Entity(Vector2 position) : base(position)
{
}
-
+ public virtual void Update()
+ {
+ }
}
}
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs
index 05a27ec..1d73ead 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs
@@ -3,20 +3,26 @@ using Microsoft.Xna.Framework.Graphics;
using System;
using ZoFo.GameCore.GameObjects.Entities;
using ZoFo.GameCore.ZoFo_graphics;
+using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
public class LivingEntity : Entity
{
public Vector2 velocity;
+ private InputManager inputManager;
+
public LivingEntity(Vector2 position) : base(position)
{
+ inputManager = new InputManager();
}
- public void TextureLoad(SpriteBatch spriteBatch)
+ #region Server side
+ /*public override void Update()
{
-
- }
+
+ }*/
+ #endregion
}
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
index 744b2c4..20bbe18 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
@@ -1,25 +1,27 @@
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;
+
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;
- Server server = new Server();
-
public Player(Vector2 position) : base(position)
{
+ //InputWeaponRotation = new Vector2(0, 0);
+ //InputPlayerRotation = new Vector2(0, 0);
}
public void Update(GameTime gameTime)
{
- // server.AddData();
- }
-
- public void TextureLoad(SpriteBatch spriteBatch)
- {
-
+
}
}
diff --git a/ZoFo/GameCore/GameObjects/GameObject.cs b/ZoFo/GameCore/GameObjects/GameObject.cs
index d309bf9..01dce1b 100644
--- a/ZoFo/GameCore/GameObjects/GameObject.cs
+++ b/ZoFo/GameCore/GameObjects/GameObject.cs
@@ -4,19 +4,26 @@ using Microsoft.Xna.Framework.Graphics;
using System;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.ZoFo_graphics;
+using ZoFo.GameCore;
namespace ZoFo.GameCore.GameObjects;
public abstract class GameObject
{
public Vector2 position;
+
+ private Server server;
public Vector2 rotation; //вектор направления объекта
- protected abstract GraphicsComponent graphicsComponent { get; }
+ public abstract GraphicsComponent graphicsComponent { get; }
#region ServerSide
public GameObject(Vector2 position)
{
this.position = position;
+ server = new Server();
+ server.RegisterGameObject(this);
+
+ graphicsComponent.LoadContent();
}
public virtual void UpdateLogic(GameTime gameTime)
{
diff --git a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
index 642b8fb..ae7b8b1 100644
--- a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
+++ b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
@@ -6,20 +6,25 @@ 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;
- private Rectangle _sourceRectangle;
- protected override GraphicsComponent graphicsComponent => new("tiles");
+ 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(0,0, (int)size.X, (int)size.Y);
+ 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)
{
diff --git a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs
index 862c6bb..02f828e 100644
--- a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs
+++ b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs
@@ -11,5 +11,7 @@ public class StopObject : MapObject
protected StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position, size, sourceRectangle, textureName)
{
+ // TODO: Написать коллизию, пусть тразмер будет чисто таким же как и текстурка.
+ // Поменяйте уровень защиты конструктора, после снимите в MapManager комментарий в методе LoadMap с создания StopObject-а
}
}
diff --git a/ZoFo/GameCore/GameObjects/StopObjects/StopObject.cs b/ZoFo/GameCore/GameObjects/StopObjects/StopObject.cs
deleted file mode 100644
index 85f95b4..0000000
--- a/ZoFo/GameCore/GameObjects/StopObjects/StopObject.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace ZoFo.GameCore.GameObjects.StopObjects;
-
-public class StopObject
-{
-
-}
diff --git a/ZoFo/GameCore/GameObjects/Tiles/Tile.cs b/ZoFo/GameCore/GameObjects/Tiles/Tile.cs
deleted file mode 100644
index 16cc1c9..0000000
--- a/ZoFo/GameCore/GameObjects/Tiles/Tile.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace ZoFo.GameCore.GameObjects;
-
-public class Tile
-{
-
-}
diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs
index 5385ce5..0834835 100644
--- a/ZoFo/GameCore/Server.cs
+++ b/ZoFo/GameCore/Server.cs
@@ -5,33 +5,52 @@ using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
+using ZoFo.GameCore.GameManagers.MapManager;
using ZoFo.GameCore.GameManagers.NetworkManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameObjects;
using ZoFo.GameCore.GameObjects.Entities;
+using ZoFo.GameCore.GameObjects.MapObjects;
namespace ZoFo.GameCore
{
public class Server
{
private ServerNetworkManager networkManager;
+ private int ticks = 0;
public Server()
{
networkManager = new ServerNetworkManager();
networkManager.GetDataSend += OnDataSend;
+
}
+ #region server logic as App
+ //TODO Comment pls
public void OnDataSend(string data)
{
- List updateDatas = JsonSerializer.Deserialize>(data);
+ List updateDatas = JsonSerializer.Deserialize>(data);
+ for (int i = 0; i < updateDatas.Count; i++)
+ {
+ ProcessIUpdateData(updateDatas[i]);
+ }
+ }
+ ///
+ /// Обработка апдейтсов, которые нам прислал клиент
+ ///
+ ///
+ public void ProcessIUpdateData(UpdateData updateData)
+ {
//ТУТ Switch case будет честное слово
}
+
///
/// Для красоты) Отдел Серверов
+ /// добавляет в лист updates новую data
///
///
- public void AddData(IUpdateData data)//добавляет в лист updates новую data
+ public void AddData(UpdateData data)//добавляет в лист updates новую data
{
networkManager.AddData(data);
}
@@ -40,12 +59,24 @@ namespace ZoFo.GameCore
/// Создает комнату и запускает ожидание подключений
///
///
- public void CreateRoom(int players)
+ public void CreateRoom(int players)
{
networkManager.Start(players);
}
- // public void StartGame() { } принудительный запуск
+ ///
+ /// Запуск игры в комнате
+ ///
+ public void StartGame()
+ {
+
+ //TODO начинает рассылку и обмен пакетами игры
+ //Грузит карту
+
+ gameObjects = new List();
+ entities = new List();
+ new MapManager().LoadMap();
+ }
///
/// Добавляет UpdateGameEnded и отключает игроков
@@ -56,24 +87,42 @@ namespace ZoFo.GameCore
networkManager.AddData(gameEnded);
networkManager.CloseConnection();
}
-
- private List gameObjects;
+ private List gameObjects = new List();
private List entities; //entity
- public void Update(GameTime gameTime)
+ public void Update(GameTime gameTime)
{
- foreach (var go in gameObjects)
+ if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ
{
- go.UpdateLogic(gameTime);
+ foreach (var go in gameObjects)
+ {
+ go.UpdateLogic(gameTime);
+ }
+ ticks = 0;
+ networkManager.SendData();
}
+ ticks++;
}
+
+
///
/// Регистрирует игровой объект
///
///
- public void RegisterEntity(GameObject gameObject)
+ 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
}
diff --git a/ZoFo/GameCore/ZoFo_grafics/GraphicsComponent.cs b/ZoFo/GameCore/ZoFo_grafics/GraphicsComponent.cs
index b6ab88a..f10b40a 100644
--- a/ZoFo/GameCore/ZoFo_grafics/GraphicsComponent.cs
+++ b/ZoFo/GameCore/ZoFo_grafics/GraphicsComponent.cs
@@ -22,9 +22,9 @@ namespace ZoFo.GameCore.ZoFo_graphics
public event Action actionOfAnimationEnd;
private List animations;
private List textures;
- private List texturesNames;
+ public List texturesNames; //rethink public and following that errors
private AnimationContainer currentAnimation;
- static public int scaling = 4;
+ static public int scaling = 5;
public int parentId;
public AnimationContainer CurrentAnimation
{
@@ -64,8 +64,18 @@ namespace ZoFo.GameCore.ZoFo_graphics
buildSourceRectangle();
}
+ public string mainTextureName;//TODO костыль - пофиксить
public GraphicsComponent(string textureName)
{
+ BuildComponent(textureName);
+ }
+ public GraphicsComponent()
+ {
+ }
+ public void BuildComponent(string textureName)
+ {
+ mainTextureName = textureName;
+ //texturesNames.Add(textureName);//Added by SD
animations = new List();
textures = new List();
var texture = AppManager.Instance.Content.Load(textureName);
@@ -101,6 +111,11 @@ namespace ZoFo.GameCore.ZoFo_graphics
textures = new List();
texturesNames = new List();
+ if (animations is null)
+ {
+ return;
+ }
+
foreach (var animation in animations)
{
if (!texturesNames.Contains(animation.TextureName))
@@ -141,6 +156,10 @@ namespace ZoFo.GameCore.ZoFo_graphics
public void Update()
{
+ if (currentAnimation is null)
+ {
+ return;
+ }
if (interval == 0)
{
currentFrame++;
@@ -281,6 +300,6 @@ namespace ZoFo.GameCore.ZoFo_graphics
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);
}
}
diff --git a/ZoFo/ZoFo.csproj b/ZoFo/ZoFo.csproj
index 4c3c3f7..c3a2b36 100644
--- a/ZoFo/ZoFo.csproj
+++ b/ZoFo/ZoFo.csproj
@@ -32,6 +32,7 @@
+