This commit is contained in:
Kaktus200020 2024-08-18 18:03:18 +03:00
parent e848bd77be
commit 58adb036a4
38 changed files with 5080 additions and 1439 deletions

View file

@ -5,20 +5,20 @@
},
"activeFile": "TileMaps/main.tmj",
"expandedProjectPaths": [
".",
"TileSets",
"TileMaps"
"TileMaps",
"."
],
"fileStates": {
"TileMaps/TileSets/TileSet 1.tsj": {
"scaleInDock": 1
},
"TileMaps/main.tmj": {
"scale": 0.75,
"selectedLayer": 0,
"scale": 0.5,
"selectedLayer": 1,
"viewCenter": {
"x": 578,
"y": 482.66666666666674
"x": 895,
"y": 270
}
},
"TileSets/CollisionTileSet.tsj": {
@ -43,15 +43,16 @@
"project": "MapSession.tiled-project",
"recentFiles": [
"TileMaps/main.tmj",
"TileSets/TileSet 1.tsj",
"TileSets/CollisionTileSet.tsj",
"TileSets/TileSet 1.tsj",
"TileSets/WallSet.tsj"
],
"stampsFolder": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/MapData/TileStamps",
"tileset.lastUsedFormat": "json",
"tileset.margin": 2,
"tileset.spacing": 2,
"tileset.margin": 0,
"tileset.spacing": 0,
"tileset.tileSize": {
"height": 128,
"width": 128
"height": 16,
"width": 16
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,116 +0,0 @@
<?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>

View file

@ -1,435 +0,0 @@
{ "columns":5,
"image":"..\/..\/Textures\/TileSetImages\/Tilelist2.png",
"imageheight":1302,
"imagewidth":652,
"margin":2,
"name":"CollisionTileSet",
"spacing":2,
"tilecount":50,
"tiledversion":"1.10.2",
"tileheight":128,
"tiles":[
{
"id":0,
"type":"Tiles"
},
{
"id":1,
"type":"Tiles"
},
{
"id":2,
"type":"Tiles"
},
{
"id":3,
"type":"Tiles"
},
{
"id":4,
"type":"Tiles"
},
{
"id":5,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":128,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":37,
"x":0,
"y":0
},
{
"height":36.3333333333333,
"id":2,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":127.333333333333,
"x":0.666666666666671,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":6,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":128.333333333333,
"id":4,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":35.6666666666667,
"x":0.666666666666667,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":7,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":128,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":36,
"x":0,
"y":0
},
{
"height":36.6666666666667,
"id":2,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":128.666666666667,
"x":0,
"y":91.3333333333333
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":8,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":36,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":127.666666666667,
"x":0,
"y":91.6666666666667
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":9,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":36,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":127.666666666667,
"x":0,
"y":0.333333333333333
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":10,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":36.6666666666667,
"id":2,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":128.333333333333,
"x":0,
"y":0
},
{
"height":127.666666666667,
"id":3,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":36.6666666666667,
"x":91.6666666666667,
"y":0.333333333333329
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":11,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":127.666666666667,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":37,
"x":91,
"y":0.333333333333333
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":12,
"objectgroup":
{
"draworder":"index",
"name":"",
"objects":[
{
"height":128,
"id":4,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":37,
"x":91,
"y":0
},
{
"height":36.6666666666667,
"id":5,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":128,
"x":0,
"y":91.3333333333333
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"StopObject"
},
{
"id":13,
"type":"StopObject"
},
{
"id":14,
"type":"StopObject"
},
{
"id":15,
"type":"StopObject"
},
{
"id":16,
"type":"StopObject"
},
{
"id":17,
"type":"StopObject"
},
{
"id":18,
"type":"StopObject"
},
{
"id":19,
"type":"StopObject"
},
{
"id":20,
"type":"StopObject"
},
{
"id":21,
"type":"StopObject"
},
{
"id":22,
"type":"StopObject"
},
{
"id":23,
"type":"StopObject"
},
{
"id":24,
"type":"StopObject"
},
{
"id":25,
"type":"StopObject"
},
{
"id":26,
"type":"StopObject"
},
{
"id":27,
"type":"StopObject"
},
{
"id":28,
"type":"StopObject"
},
{
"id":29,
"type":"StopObject"
},
{
"id":30,
"type":"StopObject"
},
{
"id":31,
"type":"StopObject"
},
{
"id":32,
"type":"StopObject"
},
{
"id":33,
"type":"StopObject"
},
{
"id":34,
"type":"StopObject"
},
{
"id":35,
"type":"StopObject"
},
{
"id":36,
"type":"StopObject"
},
{
"id":37,
"type":"StopObject"
},
{
"id":38,
"type":"StopObject"
},
{
"id":39,
"type":"StopObject"
},
{
"id":40,
"type":"StopObject"
},
{
"id":41,
"type":"StopObject"
},
{
"id":42,
"type":"StopObject"
},
{
"id":43,
"type":"StopObject"
},
{
"id":44,
"type":"StopObject"
},
{
"id":45,
"type":"StopObject"
},
{
"id":46,
"type":"StopObject"
},
{
"id":47,
"type":"StopObject"
},
{
"id":48,
"type":"StopObject"
},
{
"id":49,
"type":"StopObject"
}],
"tilewidth":128,
"type":"tileset",
"version":"1.10"
}

View file

@ -8,15 +8,15 @@
"width":24
},
"image":"..\/..\/Textures\/TileSetImages\/TilesetFloor.png",
"imageheight":832,
"imagewidth":704,
"imageheight":417,
"imagewidth":352,
"margin":0,
"name":"TileSet 1",
"objectalignment":"topleft",
"spacing":0,
"tilecount":572,
"tiledversion":"1.10.2",
"tileheight":32,
"tileheight":16,
"tiles":[
{
"id":0,
@ -2315,7 +2315,7 @@
"id":571,
"type":"Tile"
}],
"tilewidth":32,
"tilewidth":16,
"type":"tileset",
"version":"1.10",
"wangsets":[

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"name":"Stone Buildings","variations":[{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALBxLMCwwPGvjzZpiYhqszucpsvt8fr8EWABDw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjZWBgYANidiDmAGJJIJYCYmkglgFiXSDWA2J9IDYAYgAWQAE/","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZGBg4AJibiCWBWI5IJYHYkMgNgJiYyAGAA+EAQ8=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjYWBg4AViPiBWAGJFIFYCYhMgNgViMyAGABGgASo=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzY2Bg8AfiACBOAuJkIE4BYgAb1AIX","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"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 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 769 KiB

After

Width:  |  Height:  |  Size: 769 KiB

View file

Before

Width:  |  Height:  |  Size: 578 KiB

After

Width:  |  Height:  |  Size: 578 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 KiB

View file

@ -15,5 +15,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
public int Id { get; set; }
public bool Visibility { get; set; }
public string Class { get; set; }
public string Type { get; set; }
}
}

View file

@ -47,51 +47,59 @@ namespace ZoFo.GameCore.GameManagers.MapManager
foreach (var layer in tileMap.Layers)
{
foreach (var chunk in layer.Chunks)
if (layer.Type == "objectgroup")
{
for (int i = 0; i < chunk.Data.Length; i++)
}
else
{
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])
foreach (var tileSet in tileSets)
{
int number = chunk.Data[i] - tileSet.FirstGid;
int relativeColumn = number % tileSet.Columns;
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth,
relativeRow * tileSet.TileHeight,
tileSet.TileWidth, tileSet.TileHeight);
Vector2 position = new Vector2(
(i % chunk.Width) * tileSet.TileWidth + chunk.X * tileSet.TileWidth,
(i / chunk.Height) * tileSet.TileHeight + chunk.Y * tileSet.TileHeight);
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
switch (tile.Type)
if (tileSet.FirstGid <= chunk.Data[i])
{
case "Tile":
AppManager.Instance.server.RegisterGameObject(new MapObject(position,
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
sourceRectangle,
"Textures/TileSets/" +
Path.GetFileName(tileSet.Image).Replace(".png", "")));
break;
case "StopObject":
var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов
AppManager.Instance.server.RegisterGameObject(new StopObject(position/4,//TODO
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
sourceRectangle,
"Textures/TileSets/" +
Path.GetFileName(tileSet.Image).Replace(".png", ""),
collisionRectangles.ToArray()));
break;
default:
break;
int number = chunk.Data[i] - tileSet.FirstGid;
int relativeColumn = number % tileSet.Columns;
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
Rectangle sourceRectangle = new Rectangle(relativeColumn * (tileSet.TileWidth + tileSet.Spacing) + tileSet.Margin,
relativeRow * (tileSet.TileHeight + tileSet.Spacing) + tileSet.Margin,
tileSet.TileWidth, tileSet.TileHeight);
Vector2 position = new Vector2(
(i % chunk.Width) * tileMap.TileWidth + chunk.X * tileMap.TileWidth,
(i / chunk.Height) * tileMap.TileHeight + chunk.Y * tileMap.TileHeight);
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
switch (tile.Type)
{
case "Tile":
AppManager.Instance.server.RegisterGameObject(new MapObject(position,
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
sourceRectangle,
"Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", "")));
break;
case "StopObject":
var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов
AppManager.Instance.server.RegisterGameObject(new StopObject(position,
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
sourceRectangle,
"Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""),
collisionRectangles.ToArray()));
break;
default:
break;
}
break;
}
break;
}
}
}
@ -126,7 +134,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager
{
if (tile.Objectgroup == null)
{
return new List<Rectangle>();
return new List<Rectangle>() { new Rectangle(0, 0, 0, 0) };
}
List<Rectangle> collisionRectangles = new List<Rectangle>();

View file

@ -100,6 +100,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
{
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
var ipList = Dns.GetHostByName(hostName).AddressList;
foreach (var ip in ipList)
{
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
@ -108,7 +109,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
}
}
return IPAddress.Loopback;
}
//поток 2

View file

@ -54,6 +54,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
{
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
var ipList = Dns.GetHostByName(hostName).AddressList;
foreach (var ip in ipList)
{
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
@ -61,8 +62,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
return ip;
}
}
return IPAddress.Loopback;
return IPAddress.Loopback;
}
/// <summary>

View file

@ -9,6 +9,7 @@ using System.Linq;
using Newtonsoft.Json;
using Microsoft.Xna.Framework.Media;
using System.Runtime.InteropServices;
using ZoFo.GameCore.GUI;
namespace ZoFo.GameCore.GameManagers
@ -22,8 +23,17 @@ namespace ZoFo.GameCore.GameManagers
public void LoadSounds() // метод для загрузки звуков из папки
{
//List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/");
var k = Directory.GetFiles(Path.Combine(AppContext.BaseDirectory, "Content", "sounds")).Where(x => x.EndsWith("xnb"));
if (k.Count() > 0)
string a = Path.Combine("Content", "sounds");
string[] k;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
k = Directory.GetFiles(Path.Combine("bin", "Debug", "net8.0", "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
}
else{
k = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
}
if (k.Length > 0)
{
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".xnb", "")).ToArray();// папка со звуками там где exe

View file

@ -20,13 +20,10 @@ public class StopObject : MapObject
{
collisionComponents[i] = new CollisionComponent(this, true, new Rectangle(0,0, (int)size.X, (int)size.Y)/*collisions[i]*/);
}
//REDO
// TODO: Написать коллизию, пусть тразмер будет чисто таким же как и текстурка.
// Поменяйте уровень защиты конструктора, после снимите в MapManager комментарий в методе LoadMap с создания StopObject-а
}
public override void Draw(SpriteBatch spriteBatch)
{
base.Draw(spriteBatch);
DrawDebugRectangle(spriteBatch, new Rectangle((int)position.X, (int)position.Y, collisionComponents[0].stopRectangle.Width, collisionComponents[0].stopRectangle.Height));
DrawDebugRectangle(spriteBatch, new Rectangle((int)position.X, (int)position.Y, collisionComponents[0].stopRectangle.Width, collisionComponents[0].stopRectangle.Height));
}
}

View file

@ -127,7 +127,7 @@ namespace ZoFo.GameCore
players = new List<Player>();
new MapManager().LoadMap();
AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0)));
//AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0)));
AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140)));
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1000, 1000)));
AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440)));