Merge branch 'FixingDevelopment' into GUI

This commit is contained in:
SergoDobro 2024-08-18 14:04:48 +03:00 committed by GitHub
commit c196968b04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
110 changed files with 6264 additions and 1021 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,019 KiB

View file

@ -0,0 +1,635 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.5 Chrome/126.0.6478.183 Electron/31.3.0 Safari/537.36" scale="1" border="0" version="24.7.5">
<diagram name="Page-1" id="vN-Mjpsko5mhnfbVd4ZQ">
<mxGraphModel dx="4050" dy="3084" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="lzB2u7mNdVftqM7OZ14K-120" value="" style="group;strokeColor=#996185;dashed=1;dashPattern=12 12;rounded=1;fillColor=#e6d0de;gradientColor=#d5739d;" parent="1" vertex="1" connectable="0">
<mxGeometry x="380" y="-1350" width="1160" height="1110" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-87" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-89" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-86" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="153" y="30" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-100" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-99" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-105" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-102" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="323" y="30" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-103" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-107" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-104" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-109" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-108" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-111" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-110" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-199" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-85" target="lzB2u7mNdVftqM7OZ14K-198" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-85" value="AbstractGUI&lt;div&gt;&lt;br&gt;&lt;div&gt;Update()&lt;/div&gt;&lt;div&gt;Draw()&lt;/div&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-86" value="MainMenuGUI" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="90" y="150" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-87" value="BaseGUI" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="175.5" y="230" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-99" value="GameEndedGUI" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="840" y="180" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-159" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;curved=1;dashed=1;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-103" target="lzB2u7mNdVftqM7OZ14K-158" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="343" y="430" />
<mxPoint x="343" y="730" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-102" value="SelectModeMenu" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="282.5" y="320" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-161" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;curved=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;dashed=1;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-103" target="lzB2u7mNdVftqM7OZ14K-160" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="443" y="850" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-103" value="SelectingServerGUI" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="382.5" y="400" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-104" value="WaitingForPlayersGUI&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Host can start game here&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;У хоста здесь будет кнопка старта игры, у других - нет&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="481.25" y="480" width="132.5" height="180" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-108" value="InventoryGUI" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="740" y="270" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-110" value="HUD" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="605" y="400" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-158" value="&lt;div&gt;MultiPlayerStartHosting&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Server.CreateRoom();&lt;/div&gt;&lt;div&gt;Client.JoinRoom(127.0.0.1);&lt;/div&gt;" style="ellipse;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="5.5" y="670" width="170" height="120" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-138" value="SinglePlayerSelected&lt;div&gt;&lt;br&gt;&lt;div&gt;Server.CreatedRoom();&lt;/div&gt;&lt;div&gt;Client.JoinRoom(127.0.0.1);&lt;/div&gt;&lt;div&gt;Server.StartGame();&lt;/div&gt;&lt;/div&gt;" style="ellipse;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="5.5" y="540" width="170" height="120" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-157" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;curved=1;dashed=1;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-102" target="lzB2u7mNdVftqM7OZ14K-138" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-160" value="&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Join Room&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Client.JoinRoom(ip);&lt;/span&gt;&lt;br&gt;&lt;/div&gt;" style="ellipse;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="10" y="800" width="170" height="120" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-163" value="&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Start Game&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Server.StartGame();&lt;/span&gt;&lt;br&gt;&lt;/div&gt;" style="ellipse;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="10" y="930" width="170" height="120" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-164" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;curved=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="lzB2u7mNdVftqM7OZ14K-120" source="lzB2u7mNdVftqM7OZ14K-104" target="lzB2u7mNdVftqM7OZ14K-163" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-184" value="Обращается к игроку и выводит/ изменяет его данные на экране" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="760" y="300" width="160" height="120" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-198" value="OptionsGUI" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-120" vertex="1">
<mxGeometry x="980" y="120" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-36" value="" style="group;strokeColor=#b85450;dashed=1;rounded=1;glass=1;fillColor=#f8cecc;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-200" y="-220" width="490" height="630" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="TA6NM5vga4TUYUKUYXcC-36" source="lzB2u7mNdVftqM7OZ14K-1" target="lzB2u7mNdVftqM7OZ14K-8" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="300" y="445" />
<mxPoint x="300" y="605" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-94" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="TA6NM5vga4TUYUKUYXcC-36" source="lzB2u7mNdVftqM7OZ14K-1" target="lzB2u7mNdVftqM7OZ14K-93" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="300" y="445" />
<mxPoint x="300" y="536" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-1" value="Server&lt;div&gt;- Логика игры&lt;/div&gt;&lt;div&gt;- Апдейт монсты&lt;/div&gt;&lt;div&gt;Работает на тиках&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;States:&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;Waiting for Players&lt;br&gt;&lt;/div&gt;&lt;div&gt;InGame&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;CreatedRoom(); - начинает слушать и ожидать новых подключений&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;StartGame();&amp;nbsp;&lt;span style=&quot;background-color: initial;&quot;&gt;- Уведомляет о начале игры, перестает ждать новых подключений&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;EndGame();&amp;nbsp;&lt;span style=&quot;background-color: initial;&quot;&gt;- Уведомляет о конце игры, все прослушки отключаются&lt;/span&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-36" vertex="1">
<mxGeometry y="40" width="220" height="290" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-8" value="Лист Entity" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="TA6NM5vga4TUYUKUYXcC-36" vertex="1">
<mxGeometry x="350" y="580" width="110" height="50" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-60" value="Сервер загрузился и все зарегистрировал&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;каждый тик апдейт и отправка данных клиенту&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-36" vertex="1">
<mxGeometry x="240" width="250" height="160" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-93" value="Лист GameObjects" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="TA6NM5vga4TUYUKUYXcC-36" vertex="1">
<mxGeometry x="350" y="510" width="110" height="52.5" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-47" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-1" target="lzB2u7mNdVftqM7OZ14K-46" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-320" y="225" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-139" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-1" target="lzB2u7mNdVftqM7OZ14K-6" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="290" y="-35" />
<mxPoint x="290" y="218" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-140" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-1" target="lzB2u7mNdVftqM7OZ14K-12" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="393" y="-35" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-135" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-2" target="lzB2u7mNdVftqM7OZ14K-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-136" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-2" target="lzB2u7mNdVftqM7OZ14K-4" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-90" y="-795" />
<mxPoint x="-90" y="-273" />
<mxPoint x="-538" y="-273" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-137" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-2" target="lzB2u7mNdVftqM7OZ14K-85" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-90" y="-795" />
<mxPoint x="-90" y="-930" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-168" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-2" target="lzB2u7mNdVftqM7OZ14K-90" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-850" y="-795" />
<mxPoint x="-850" y="-1080" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-173" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-2" target="lzB2u7mNdVftqM7OZ14K-172" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-850" y="-795" />
<mxPoint x="-850" y="-905" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-2" target="TA6NM5vga4TUYUKUYXcC-1" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-420" y="-1430" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-65" value="Adds Data to send if position has changed" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;curved=1;dashed=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-6" target="lzB2u7mNdVftqM7OZ14K-46" edge="1">
<mxGeometry x="0.5191" relative="1" as="geometry">
<Array as="points">
<mxPoint x="-30" y="270" />
<mxPoint x="-30" y="470" />
<mxPoint x="-345" y="320" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-58" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-8" target="lzB2u7mNdVftqM7OZ14K-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-12" value="MapManager&lt;div&gt;Система карты&lt;div&gt;- загружает карту (из заранее сделанных)&lt;/div&gt;&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;fillColor=#6d8764;fontColor=#ffffff;strokeColor=#3A5431;" parent="1" vertex="1">
<mxGeometry x="542.5" y="-110" width="230" height="150" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=link;" parent="1" source="lzB2u7mNdVftqM7OZ14K-49" target="lzB2u7mNdVftqM7OZ14K-50" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-350" y="640" />
<mxPoint x="-1466" y="640" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-90" value="PlayerData&lt;div&gt;Dictionary&amp;lt;string, int&amp;gt; resources&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-1090" y="-1110" width="170" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-95" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="lzB2u7mNdVftqM7OZ14K-93" target="lzB2u7mNdVftqM7OZ14K-39" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-127" value="" style="group;dashed=1;dashPattern=8 8;rounded=1;strokeColor=#d79b00;expand=1;autosize=1;fillColor=#ffe6cc;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-1960" y="820" width="1899.62" height="270" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-123" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="lzB2u7mNdVftqM7OZ14K-83" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="227.15189873417714" y="30" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-124" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="lzB2u7mNdVftqM7OZ14K-66" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-125" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="lzB2u7mNdVftqM7OZ14K-54" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-180" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="lzB2u7mNdVftqM7OZ14K-177" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-193" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="lzB2u7mNdVftqM7OZ14K-192" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="TA6NM5vga4TUYUKUYXcC-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="TA6NM5vga4TUYUKUYXcC-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-50" value="IUpdateData&lt;div&gt;id объекта&lt;/div&gt;&lt;div&gt;updatetype&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry width="147.3417721518987" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-54" value="UpdateAnimation&lt;div&gt;&lt;div&gt;хранит новую анимации&lt;/div&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="589.37" y="170" width="130.63" height="90" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-66" value="UpdateGameObjectCreated&lt;div&gt;Хранит объект, который только отправили&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="356.0759493670885" y="170" width="208.73417721518982" height="92.5" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-83" value="UpdateGameEnded&lt;div&gt;Хранит полученный лут и уведомляет о конце игры&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="122.78481012658223" y="170" width="208.73417721518982" height="92.5" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-177" value="UpdatePosition&lt;div&gt;Хранит новую позицию&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="740" y="172.5" width="129.62" height="90" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-52" value="UpdateInput&lt;div&gt;Хранит новую позицию&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="1580" y="172.5" width="129.62" height="90" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-126" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="lzB2u7mNdVftqM7OZ14K-52" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-182" value="ClientToServer&lt;div&gt;id - это id игрока&lt;/div&gt;" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="1510" y="40" width="130" height="80" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-183" value="ServerToClient" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="1209.62" y="40" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-192" value="&lt;div&gt;Update&lt;span style=&quot;background-color: initial;&quot;&gt;Loot&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Хранит лут&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="880" y="172.5" width="129.62" height="90" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-10" value="UpdatePlayerParametrs&lt;div&gt;Хранит хп, радиацию&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="1020" y="172.5" width="129.62" height="90" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-11" value="UpdateEntityHealth&lt;div&gt;хранит новое хп entity&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="1160" y="172.5" width="129.62" height="90" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-6" value="UpdatePlayerExit&lt;div&gt;Пользователь ушел и сообщил&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-127" vertex="1">
<mxGeometry x="1720" y="172.5" width="129.62" height="90" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-127" source="lzB2u7mNdVftqM7OZ14K-50" target="TA6NM5vga4TUYUKUYXcC-6" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-134" value="" style="group;strokeColor=#82b366;dashed=1;rounded=1;dashPattern=8 8;fillColor=#d5e8d4;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-100" y="1070" width="1020" height="1110" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-43" value="StopObject" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="890" y="570" width="90" height="20" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-72" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-7" target="lzB2u7mNdVftqM7OZ14K-71" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-73" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-7" target="lzB2u7mNdVftqM7OZ14K-70" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="60" y="740" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-7" value="&lt;div&gt;LivingEntity&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="280" y="700" width="185" height="80" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-19" value="Tile" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="780" y="570" width="90" height="20" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-76" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-20" target="lzB2u7mNdVftqM7OZ14K-74" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="770" y="740" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-77" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-20" target="lzB2u7mNdVftqM7OZ14K-75" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="890" y="740" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-20" value="&lt;div&gt;Collectable&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Прописать условия вызова OnInteract&lt;/div&gt;&lt;div&gt;подписывается на OnTriggerZone&lt;/div&gt;&lt;div&gt;OnInteract()&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Это лут&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="480" y="700" width="185" height="160" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-25" target="lzB2u7mNdVftqM7OZ14K-7" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="533" y="530" />
<mxPoint x="390" y="530" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-25" target="lzB2u7mNdVftqM7OZ14K-20" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="533" y="530" />
<mxPoint x="573" y="530" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-25" value="Entity&lt;div&gt;id&lt;br&gt;&lt;div&gt;&lt;div&gt;CollisionComponent&lt;/div&gt;&lt;div&gt;AnimationComponent&lt;br&gt;&lt;div&gt;UpdateLogic()&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;- в апдейте может заявляет изменения позиции&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Методы для клиента&lt;/div&gt;&lt;div&gt;&lt;div&gt;UpdateAnimation()&lt;/div&gt;&lt;div&gt;Draw()&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="428" y="140" width="210" height="230" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-32" value="Все Entity будут передаваться клиенту" style="rounded=1;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="567.5" y="340" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-39" target="lzB2u7mNdVftqM7OZ14K-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-39" target="lzB2u7mNdVftqM7OZ14K-19" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-39" target="lzB2u7mNdVftqM7OZ14K-43" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-39" value="&lt;div&gt;GameObject&lt;/div&gt;&lt;div&gt;Штуки с отрисовкой, их мы отправлять будем&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="440.5" width="185" height="80" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-70" value="Player&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;bool isTryingToInteract&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry y="920" width="140" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-71" value="Enemy" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="150" y="920" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-74" value="Wood" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="710" y="920" width="100" height="40" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-75" value="Ammo" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="840" y="920" width="100" height="40" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-24" value="Projectile&lt;div&gt;Vector2 velocity&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="312.5" y="900" width="167.5" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="lzB2u7mNdVftqM7OZ14K-7" target="TA6NM5vga4TUYUKUYXcC-24" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="396" y="820" />
<mxPoint x="396" y="820" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-27" value="Bullet" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="270" y="1050" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="TA6NM5vga4TUYUKUYXcC-24" target="TA6NM5vga4TUYUKUYXcC-27" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-26" value="Rock" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-134" vertex="1">
<mxGeometry x="420" y="1050" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="lzB2u7mNdVftqM7OZ14K-134" source="TA6NM5vga4TUYUKUYXcC-24" target="TA6NM5vga4TUYUKUYXcC-26" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-146" value="" style="group;strokeColor=#d6b656;dashed=1;dashPattern=8 8;rounded=1;fillColor=#fff2cc;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-1490" y="-100" width="656.25" height="561.35" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-69" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-146" source="lzB2u7mNdVftqM7OZ14K-4" target="lzB2u7mNdVftqM7OZ14K-68" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-142" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-146" source="lzB2u7mNdVftqM7OZ14K-4" target="lzB2u7mNdVftqM7OZ14K-61" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-4" value="Client&lt;br&gt;- Получает данные игры&lt;div&gt;- отправляет инпут игрока&lt;/div&gt;&lt;div&gt;- Рисует все&lt;/div&gt;&lt;div&gt;- всегда сетевой&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;JoinRoom(string ip) - попытка подключиться к комнате&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;OnUpdate(&lt;span style=&quot;background-color: initial;&quot;&gt;IUpdateData&lt;/span&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;GameEndedUnexpectedly() - хост пропал, игра закончилась&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-146" vertex="1">
<mxGeometry x="380" width="276.25" height="249.77" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-61" value="&lt;div&gt;ClientNetworkManager&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;StartListening()&lt;/div&gt;&lt;div&gt;SendData() - отправка инпута игрока&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-146" vertex="1">
<mxGeometry x="436.8800000000001" y="442.2660305343511" width="162.5" height="119.08396946564885" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-68" value="Листы&lt;div&gt;Tiles - только отрисовка&lt;br&gt;&lt;div&gt;Walls - только отрисовка, но поверх тайлов&lt;/div&gt;&lt;div&gt;Entities - у них обнова аниматора&lt;/div&gt;&lt;/div&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;strokeColor=default;" parent="lzB2u7mNdVftqM7OZ14K-146" vertex="1">
<mxGeometry y="49.76709923664123" width="150" height="148.85496183206106" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-150" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-25" target="lzB2u7mNdVftqM7OZ14K-148" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="-1150" y="1430" as="targetPoint" />
<Array as="points">
<mxPoint x="-720" y="1334" />
<mxPoint x="-720" y="1475" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-155" value="" style="group;rounded=1;strokeColor=#b85450;dashed=1;dashPattern=8 8;fillColor=#f8cecc;gradientColor=#ea6b66;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-1670" y="1210" width="630" height="370" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-147" value="AnimationContainer" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-155" vertex="1">
<mxGeometry x="410" y="20" width="220" height="130" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-152" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=link;" parent="lzB2u7mNdVftqM7OZ14K-155" source="lzB2u7mNdVftqM7OZ14K-148" target="lzB2u7mNdVftqM7OZ14K-149" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-148" value="GraphicsComponent&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;StartAnimation()&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start; text-wrap: nowrap; background-color: initial;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22AnimationContainer%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%221210%22%20y%3D%221280%22%20width%3D%22220%22%20height%3D%22130%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;&lt;/div&gt;&lt;div&gt;UpdateAnimation()&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;TODO перенести кусочек про зацикливание кода&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-155" vertex="1">
<mxGeometry x="70" y="240" width="220" height="130" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-153" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;shape=link;" parent="lzB2u7mNdVftqM7OZ14K-155" source="lzB2u7mNdVftqM7OZ14K-149" target="lzB2u7mNdVftqM7OZ14K-147" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-149" value="AnimationBuilder&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;В начале загружает анимации, а затем распределяет анимации по контейнерам&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-155" vertex="1">
<mxGeometry width="360" height="170" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-154" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.637;entryY=1.017;entryDx=0;entryDy=0;entryPerimeter=0;" parent="lzB2u7mNdVftqM7OZ14K-155" source="lzB2u7mNdVftqM7OZ14K-148" target="lzB2u7mNdVftqM7OZ14K-147" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="550" y="300" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-169" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;dashPattern=8 8;curved=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-4" target="lzB2u7mNdVftqM7OZ14K-90" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-170" value="Game Over&lt;div&gt;PlayerData.AddLoot()&lt;/div&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="lzB2u7mNdVftqM7OZ14K-169" vertex="1" connectable="0">
<mxGeometry x="-0.0087" y="2" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-172" value="InputManager&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Здесь эвенты нажатий, на которые можно подписываться тем, кому надо&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;fillColor=#6d8764;fontColor=#ffffff;strokeColor=#3A5431;" parent="1" vertex="1">
<mxGeometry x="-1560" y="-1030" width="260" height="250" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-196" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=link;dashed=1;dashPattern=1 4;fillColor=#fff2cc;strokeColor=#d6b656;strokeWidth=8;" parent="1" source="lzB2u7mNdVftqM7OZ14K-61" target="lzB2u7mNdVftqM7OZ14K-46" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-30" value="" style="group;rounded=1;dashed=1;dashPattern=8 8;strokeColor=#6c8ebf;fillColor=#dae8fc;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-1150" y="-1530" width="370" height="410" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="TA6NM5vga4TUYUKUYXcC-30" source="TA6NM5vga4TUYUKUYXcC-1" target="TA6NM5vga4TUYUKUYXcC-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-1" value="ItemManager&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Dictionary&amp;lt;string, ItemInfo&amp;gt; tagItemPairs - когда нужно получить инфу о текстуре, зная её таг, ищется это тут&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ItemInfo GetItemInfo(string tag)&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div&gt;LoadResourcesTextures()&lt;/div&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-30" vertex="1">
<mxGeometry width="369" height="150" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="TA6NM5vga4TUYUKUYXcC-30" source="TA6NM5vga4TUYUKUYXcC-2" target="TA6NM5vga4TUYUKUYXcC-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-2" value="&lt;div&gt;ItemInfo&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;string tag&lt;/div&gt;&lt;div&gt;string TextureName&lt;/div&gt;&lt;div&gt;Texture2D Itemtexture&lt;/div&gt;&lt;div&gt;bool isCraftable&lt;/div&gt;&lt;div&gt;Dictionary&amp;lt;string, int&amp;gt; resourcesNeededToCraft()&lt;/div&gt;&lt;div&gt;LoadTexture()&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-30" vertex="1">
<mxGeometry y="170" width="370" height="150" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-14" value="&lt;div&gt;WeaponItemInfo&lt;/div&gt;&lt;div&gt;float damage&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-30" vertex="1">
<mxGeometry y="370" width="370" height="40" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-31" value="" style="group;strokeColor=#82b366;rounded=1;dashed=1;fillColor=#d5e8d4;gradientColor=#97d077;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-560" y="1750" width="380" height="670" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-187" value="LootData&lt;div&gt;Контейнер Лута для удобства использования&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;AddLoot(object lootObject, int quantity)&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Dictionary&amp;lt;string, int&amp;gt; loots&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-31" vertex="1">
<mxGeometry x="120" width="180" height="130" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="TA6NM5vga4TUYUKUYXcC-31" source="TA6NM5vga4TUYUKUYXcC-16" target="TA6NM5vga4TUYUKUYXcC-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="TA6NM5vga4TUYUKUYXcC-31" source="TA6NM5vga4TUYUKUYXcC-16" target="TA6NM5vga4TUYUKUYXcC-17" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="190.25" y="500" />
<mxPoint x="70.25" y="500" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="TA6NM5vga4TUYUKUYXcC-31" source="TA6NM5vga4TUYUKUYXcC-16" target="TA6NM5vga4TUYUKUYXcC-19" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="190.25" y="500" />
<mxPoint x="330.25" y="500" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-16" value="IPlayerWeapon&lt;div&gt;Attack()&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-31" vertex="1">
<mxGeometry x="130" y="400" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-17" value="HandAttack" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-31" vertex="1">
<mxGeometry y="610" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-18" value="SwordAttack" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-31" vertex="1">
<mxGeometry x="129.62" y="610" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-19" value="GunAttack" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-31" vertex="1">
<mxGeometry x="260" y="610" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-188" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-70" target="lzB2u7mNdVftqM7OZ14K-187" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-70" target="TA6NM5vga4TUYUKUYXcC-16" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-60" y="2105" />
<mxPoint x="-61" y="2180" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-32" value="" style="group;strokeColor=#6c8ebf;rounded=1;fillColor=#dae8fc;gradientColor=#7ea6e0;" parent="1" vertex="1" connectable="0">
<mxGeometry x="540" y="130" width="640" height="800" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="TA6NM5vga4TUYUKUYXcC-32" source="lzB2u7mNdVftqM7OZ14K-6" target="lzB2u7mNdVftqM7OZ14K-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="TA6NM5vga4TUYUKUYXcC-32" source="lzB2u7mNdVftqM7OZ14K-6" target="lzB2u7mNdVftqM7OZ14K-27" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="230" y="87.5" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-6" value="&lt;div&gt;CollisionManager&lt;/div&gt;Система физики&lt;div&gt;- апедейт позиций, проверив на коллизии&lt;/div&gt;&lt;div&gt;UpdatePositions()&lt;/div&gt;&lt;div&gt;GetObjectsInArea(Rectangle area)&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-32" vertex="1">
<mxGeometry width="230" height="175" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-15" value="&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;ColliderComponent&lt;/span&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Entity myEntity&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;- подключается к объекту&lt;/span&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;- регистрирует себя в CollisionManager&lt;/div&gt;&lt;div&gt;- Rectangle, который не дает на себя пройти&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;bool doesStop - является этот колайдера&lt;br&gt;&lt;/div&gt;&lt;div&gt;Rectangle stopRectangle&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;bool isTrigger&lt;/div&gt;&lt;div&gt;Rectangle triggerRectangle&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;OnTriggerEnter&amp;nbsp;&lt;span style=&quot;background-color: initial;&quot;&gt;- игрок вошел в область взаимодействия объекта&lt;/span&gt;&lt;/div&gt;&lt;div&gt;OnTriggerZone - вызывается пока игрок в области триггера&lt;/div&gt;&lt;div&gt;OnTriggerExit -&lt;span style=&quot;background-color: initial;&quot;&gt;&amp;nbsp;игрок вышел из области взаимодействия объекта&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;На эти эвенты подписываются в вещах, типо лута и дверей. Человек пишет код этих вещей и что происходит, когда к ним кто-то подходит&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-32" vertex="1">
<mxGeometry x="270" y="352.5" width="280" height="437.5" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-175" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=link;" parent="TA6NM5vga4TUYUKUYXcC-32" source="lzB2u7mNdVftqM7OZ14K-16" target="lzB2u7mNdVftqM7OZ14K-15" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="340" y="330" />
<mxPoint x="340" y="330" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-16" value="Лист&amp;nbsp;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;CollisionComponent&lt;/span&gt;&lt;/div&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="TA6NM5vga4TUYUKUYXcC-32" vertex="1">
<mxGeometry x="260" y="168.75" width="160" height="35" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-24" value="Это подключается в&lt;div&gt;игроке, на стенах&lt;/div&gt;&lt;div&gt;на врагах&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-32" vertex="1">
<mxGeometry x="490" y="740" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-176" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=link;" parent="TA6NM5vga4TUYUKUYXcC-32" source="lzB2u7mNdVftqM7OZ14K-27" target="lzB2u7mNdVftqM7OZ14K-15" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="525" y="310" />
<mxPoint x="525" y="310" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-27" value="Лист&amp;nbsp;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;TriggerComponent&lt;/span&gt;&lt;/div&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="TA6NM5vga4TUYUKUYXcC-32" vertex="1">
<mxGeometry x="450" y="168.75" width="140" height="35" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-174" value="Разнести на два компонента?" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-32" vertex="1">
<mxGeometry x="500" y="310" width="140" height="90" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-34" value="" style="group;fillColor=#ffcccc;strokeColor=#36393d;rounded=1;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-620" y="-950" width="380" height="510" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-2" value="App manager&lt;div&gt;&lt;br&gt;&lt;div&gt;- большая стейт машина, каждый стейт - экран (менюшки+игра)&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;AbstractGUI currentGUI - текущий гуи, который мы рисуем&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ChangeGUI()&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Update() - Обновлять по стейту&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;currentGUI&lt;/span&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;.Update()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;GameEnded(Loot)&lt;/div&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-34" vertex="1">
<mxGeometry width="380" height="310" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-119" value="" style="group;strokeColor=default;dashed=1;dashPattern=8 8;rounded=1;" parent="TA6NM5vga4TUYUKUYXcC-34" vertex="1" connectable="0">
<mxGeometry y="340" width="380" height="170" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-114" value="Наша Стейт Машина&lt;div&gt;NotPlaying&lt;div&gt;HostPlaying&lt;/div&gt;&lt;div&gt;ClientPlaying&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-119" vertex="1">
<mxGeometry x="129.99999999999994" width="119.99999999999996" height="100" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-115" value="NotPlaying&lt;div&gt;GUI.update()&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-119" vertex="1">
<mxGeometry y="110" width="119.99999999999996" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-116" value="HostPlaying&lt;div&gt;GUI.update()&lt;/div&gt;&lt;div&gt;Server.update()&lt;br&gt;&lt;/div&gt;&lt;div&gt;client.update()&lt;br&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-119" vertex="1">
<mxGeometry x="129.99999999999994" y="110" width="119.99999999999996" height="60" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-117" value="&lt;br&gt;&lt;div&gt;&lt;div&gt;ClientPlaying&lt;/div&gt;&lt;div&gt;GUI.update()&lt;/div&gt;&lt;div&gt;client.update()&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="lzB2u7mNdVftqM7OZ14K-119" vertex="1">
<mxGeometry x="259.9999999999999" y="110" width="119.99999999999996" height="60" as="geometry" />
</mxCell>
<mxCell id="TA6NM5vga4TUYUKUYXcC-35" value="" style="group;fillColor=#fff2cc;strokeColor=#d6b656;rounded=1;dashed=1;" parent="1" vertex="1" connectable="0">
<mxGeometry x="-440" y="240" width="190" height="323" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-51" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="TA6NM5vga4TUYUKUYXcC-35" source="lzB2u7mNdVftqM7OZ14K-46" target="lzB2u7mNdVftqM7OZ14K-49" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="95" y="311" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-46" value="&lt;div&gt;ServerNetworkManager&lt;/div&gt;&lt;div&gt;StartWaitingForPlayers() - Слушает игроков, которые хотят подключиться&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;StartListening() - начать слушать клиентов в самой игре&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;SendData() - каждый тик&lt;/div&gt;&lt;div&gt;AddData(&lt;span style=&quot;background-color: initial;&quot;&gt;IUpdateData&lt;/span&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="TA6NM5vga4TUYUKUYXcC-35" vertex="1">
<mxGeometry width="190" height="170" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-49" value="Лист Updates" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="TA6NM5vga4TUYUKUYXcC-35" vertex="1">
<mxGeometry x="55" y="298" width="80" height="25" as="geometry" />
</mxCell>
<mxCell id="lzB2u7mNdVftqM7OZ14K-79" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="lzB2u7mNdVftqM7OZ14K-25" target="lzB2u7mNdVftqM7OZ14K-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

20
.run/ZoFo.run.xml Normal file
View file

@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ZoFo" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/ZoFo/bin/Debug/net8.0/ZoFo" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ZoFo/bin/Debug/net8.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/ZoFo/ZoFo.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net8.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>

View file

@ -1,13 +1,11 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
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;
using ZoFo.GameCore.Graphics;
namespace AnimationsFileCreator
{
class Program
@ -22,7 +20,8 @@ namespace AnimationsFileCreator
{
DialogResult result = Dialog.FileOpen();
textureName = result.Path.Split('\\').Last();
var temp = result.Path.Split('\\');
textureName = temp[temp.Length-2] + "/"+temp[temp.Length - 1];
textureName = textureName.Split('.')[0];
}
Console.WriteLine("Введите количество кадров анимации: ");
@ -60,11 +59,11 @@ namespace AnimationsFileCreator
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.TextureName = "Textures/AnimationTextures/"+textureName;
container.TextureFrameInterval = 0;
container.Id = id;
string json = JsonConvert.SerializeObject(container);
StreamWriter writer = new StreamWriter("../../../../ZoFo/Content/animations/"+id);
StreamWriter writer = new StreamWriter("../../../../ZoFo/Content/Textures/Animations/"+id+ ".animation");
writer.WriteLine(json);
writer.Close();
}

1
GameSettings.txt Normal file
View file

@ -0,0 +1 @@
{"IsFullScreen":false,"MainVolume":1.0,"MusicVolume":1.0,"SoundEffectsVolume":1.0,"Resolution":{"X":1440,"Y":900}}

View file

@ -53,9 +53,9 @@ namespace MonogameLibrary.UI.Elements
public override void LoadTexture(ContentManager content)
{
texture1 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off");
texture2 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off-on");
texture3 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_on");
texture1 = content.Load<Texture2D>("Textures/GUI/checkboxs_off");
texture2 = content.Load<Texture2D>("Textures/GUI/checkboxs_off-on");
texture3 = content.Load<Texture2D>("Textures/GUI/checkboxs_on");
base.LoadTexture(content);
}
public override void Draw(SpriteBatch _spriteBatch)

View file

@ -59,7 +59,7 @@ namespace MonogameLibrary.UI.Elements
public override void LoadTexture(ContentManager content)
{
texture2 = content.Load<Texture2D>("Textures\\GUI\\switch");
texture2 = content.Load<Texture2D>("Textures/GUI/switch");
base.LoadTexture(content);
}

View file

@ -40,8 +40,8 @@
#begin MapData/TileMaps/main.tmx
/copy:MapData/TileMaps/main.tmx
#begin MapData/TileSets/TileSet 1.tsj
/copy:MapData/TileSets/TileSet 1.tsj
#begin MapData/TileSets/CollisionTileSet.tsj
/copy:MapData/TileSets/CollisionTileSet.tsj
#begin sounds/Loot.wav
/importer:WavImporter
@ -73,12 +73,6 @@
/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
@ -91,6 +85,105 @@
/processorParam:Quality=Best
/build:sounds/Zombi stoit.wav
#begin Textures/Animations/player_idle_top_noweapon.animation
/copy:Textures/Animations/player_idle_top_noweapon.animation
#begin Textures/Animations/player_idle_top-right_noweapon.animation
/copy:Textures/Animations/player_idle_top-right_noweapon.animation
#begin Textures/Animations/player_running_top_rotate.animation
/copy:Textures/Animations/player_running_top_rotate.animation
#begin Textures/Animations/running_top.animation
/copy:Textures/Animations/running_top.animation
#begin Textures/Animations/testAnimationExample.animation
/copy:Textures/Animations/testAnimationExample.animation
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.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/AnimationTextures/Character/hr-level1_idle_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_idle.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/AnimationTextures/Character/hr-level1_idle.png
#begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.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/AnimationTextures/Character/hr-level1_mining_tool-1.png
#begin Textures/AnimationTextures/Character/hr-level1_mining_tool-2.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/AnimationTextures/Character/hr-level1_mining_tool-2.png
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.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/AnimationTextures/Character/hr-level1_running_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_running.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/AnimationTextures/Character/hr-level1_running.png
#begin Textures/AnimationTextures/unicorn.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/AnimationTextures/unicorn.png
#begin Textures/GUI/background/base.png
/importer:TextureImporter
/processor:TextureProcessor
@ -269,6 +362,7 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/Test/pickaxe.webp
#begin Textures/Test/rock.jpg
@ -281,9 +375,11 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/Test/rock.jpg
#begin Textures/Test/steel.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -293,9 +389,11 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/Test/steel.png
#begin Textures/Test/wood.jpg
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -305,9 +403,11 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/Test/wood.jpg
#begin Textures/TileSets/TilesetFloor.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -317,5 +417,7 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/TileSets/TilesetFloor.png

View file

@ -0,0 +1,14 @@
{
"automappingRulesFile": "",
"commands": [
],
"compatibilityVersion": 1100,
"extensionsPath": "extensions",
"folders": [
"."
],
"properties": [
],
"propertyTypes": [
]
}

View file

@ -0,0 +1,57 @@
{
"Map/SizeTest": {
"height": 4300,
"width": 2
},
"activeFile": "TileMaps/main.tmj",
"expandedProjectPaths": [
".",
"TileSets",
"TileMaps"
],
"fileStates": {
"TileMaps/TileSets/TileSet 1.tsj": {
"scaleInDock": 1
},
"TileMaps/main.tmj": {
"scale": 0.75,
"selectedLayer": 0,
"viewCenter": {
"x": 578,
"y": 482.66666666666674
}
},
"TileSets/CollisionTileSet.tsj": {
"scaleInDock": 0.75,
"scaleInEditor": 1
},
"TileSets/TileSet 1.tsj": {
"scaleInDock": 1,
"scaleInEditor": 1.5
},
"TileSets/WallSet.tsj": {
"scaleInDock": 1,
"scaleInEditor": 1
}
},
"last.imagePath": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/Textures/TileSetImages",
"openFiles": [
"TileSets/TileSet 1.tsj",
"TileMaps/main.tmj",
"TileSets/CollisionTileSet.tsj"
],
"project": "MapSession.tiled-project",
"recentFiles": [
"TileMaps/main.tmj",
"TileSets/TileSet 1.tsj",
"TileSets/CollisionTileSet.tsj",
"TileSets/WallSet.tsj"
],
"tileset.lastUsedFormat": "json",
"tileset.margin": 2,
"tileset.spacing": 2,
"tileset.tileSize": {
"height": 128,
"width": 128
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,435 @@
{ "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"
}

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,20 @@
{
"id": "player_idle_top-right_noweapon",
"textureName": "Textures/AnimationTextures/Character/hr-level1_idle",
"startSpriteRectangle": {
"X": 0,
"Y": 116,
"Width": 92,
"Height": 116
},
"frameSecond": [
{
"Item1": 0,
"Item2": 5
}
],
"textureFrameInterval": 0,
"framesCount": 22,
"isCycle": true,
"offset": "0, 0"
}

View file

@ -0,0 +1,20 @@
{
"id": "player_idle_top_noweapon",
"textureName": "Textures/AnimationTextures/Character/hr-level1_idle",
"startSpriteRectangle": {
"X": 0,
"Y": 0,
"Width": 92,
"Height": 116
},
"frameSecond": [
{
"Item1": 0,
"Item2": 5
}
],
"textureFrameInterval": 0,
"framesCount": 22,
"isCycle": true,
"offset": "0, 0"
}

View file

@ -0,0 +1 @@
{"id":"player_running_top_rotate","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":0,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1,20 @@
{
"id": "running_top",
"textureName": "unicorn",
"startSpriteRectangle": {
"X": 0,
"Y": 30,
"Width": 30,
"Height": 60
},
"frameSecond": [
{
"Item1": 0,
"Item2": 2
}
],
"textureFrameInterval": 1,
"framesCount": 22,
"isCycle": true,
"offset": "0, 0"
}

View file

@ -0,0 +1 @@
{"id":"testAnimationExample","textureName":"Textures/AnimationTextures/unicorn","startSpriteRectangle":{"X":0,"Y":0,"Width":400,"Height":400},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

View file

@ -10,53 +10,78 @@ 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;
using System.Reflection;
using ZoFo.GameCore.GameObjects.Entities;
using System.Net.Sockets;
using System.Net;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
using System.Linq;
using System.Web;
using ZoFo.GameCore.GUI;
using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
namespace ZoFo.GameCore
{
public class Client
{
#region Network part
ClientNetworkManager networkManager;
public bool IsConnected { get { return networkManager.IsConnected; } }
public IPEndPoint InfoConnect => networkManager.InfoConnect;
public Client()
{
networkManager = new ClientNetworkManager();
networkManager.GetDataSent += OnDataSend;
// Подписка на действия инпутменеджера.
// Отправляются данные апдейтса с обновлением инпута
AppManager.Instance.InputManager.ActionEvent += () => networkManager.AddData(new UpdateInput(){
InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection,
InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection
});
}
public void OnDataSend(string data)
{
List<UpdateData> updateDatas = JsonSerializer.Deserialize<List<UpdateData>>(data);
// тут будет switch
AppManager.Instance.debugHud.Log(data);
foreach (var item in updateDatas)
{
/* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
{
case "Tile":
MapObject map = new MapObject();
break;
}*/
GotData(item);
}
}
public void GameEndedUnexpectedly() { }
public void JoinRoom(string ip)
{
networkManager.JoinRoom(ip);
}
public void JoinYourself() { networkManager.JoinYourself(); }
public void JoinRoom(string ip, int port)
{
networkManager.JoinRoom(ip, port);
}
public void JoinYourself(int port) { networkManager.JoinYourself(port); }
#endregion
List<MapObject> mapObjects = new List<MapObject>();
List<GameObject> gameObjects = new List<GameObject>();
List<StopObject> stopObjects = new List<StopObject>();
/// <summary>
/// Клиент должен обнговлять игру анимаций
/// </summary>
/// <param name="gameTime"></param>
internal void Update(GameTime gameTime)
{
for (int i = 0; i < gameObjects.Count; i++)
{
AppManager.Instance.debugHud.Set("GameTime", gameTime.TotalGameTime.ToString());
gameObjects[i].UpdateAnimations();
}
}
internal void Draw(SpriteBatch spriteBatch)
{
@ -64,6 +89,14 @@ namespace ZoFo.GameCore
{
mapObjects[i].Draw(spriteBatch);
}
for (int i = 0; i < stopObjects.Count; i++)
{
stopObjects[i].Draw(spriteBatch);
}
for (int i = 0; i < gameObjects.Count; i++)
{
gameObjects[i].Draw(spriteBatch);
}
}
internal void GotData(UpdateData update)
@ -78,6 +111,58 @@ namespace ZoFo.GameCore
(update as UpdateTileCreated).tileSetName
));
}
else if (update is UpdateStopObjectCreated)
{
stopObjects.Add(
new StopObject(
(update as UpdateStopObjectCreated).Position,
(update as UpdateStopObjectCreated).Size.ToVector2(),
(update as UpdateStopObjectCreated).sourceRectangle,
(update as UpdateStopObjectCreated).tileSetName,
(update as UpdateStopObjectCreated).collisions
));
}
else if (update is UpdateGameObjectCreated)
{
if ((update as UpdateGameObjectCreated).GameObjectType == "EntittyForAnimationTests")
gameObjects.Add(new EntittyForAnimationTests((update as UpdateGameObjectCreated).position));
if ((update as UpdateGameObjectCreated).GameObjectType == "Player")
gameObjects.Add(new Player((update as UpdateGameObjectCreated).position));
if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo")
gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position));
(gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity);
//var a = Assembly.GetAssembly(typeof(GameObject));
//gameObjects.Add( TODO reflection
//Activator.CreateInstance(Type.GetType("ZoFo.GameCore.GameObjects.Entities.EntittyForAnimationTests")
///*(update as UpdateGameObjectCreated).GameObjectType*/, new []{ new Vector2(100, 100) })
//as GameObject
//);
}
else if (update is UpdatePosition)
{
var ent = FindEntityById(update.IdEntity);
ent.position = (update as UpdatePosition).NewPosition;
DebugHUD.Instance.Log("newPosition " + ent.position);
}
}
public Entity FindEntityById(int id)
{
for (int i = 0; i < gameObjects.Count; i++)
{
if (gameObjects[i] is Entity)
{
if ((gameObjects[i] as Entity).Id == id)
{
return gameObjects[i] as Entity;
}
}
}
return null;
}
}
}

View file

@ -39,7 +39,7 @@ public abstract class AbstractGUI
public virtual void LoadContent()
{
Manager.LoadContent(AppManager.Instance.Content, "Font");
mouse = AppManager.Instance.Content.Load<Texture2D>("Textures\\GUI\\mouse");
mouse = AppManager.Instance.Content.Load<Texture2D>("Textures/GUI/mouse");
}
public virtual void Update(GameTime gameTime)

View file

@ -13,14 +13,16 @@ public class DebugHUD
private SpriteFont _spriteFont;
private Dictionary<string, string> _text = new();
private List<string> _log = new();
public static DebugHUD Instance { get; private set; }
public void Initialize()
{
Instance = this;
}
public void LoadContent()
{
_spriteFont = AppManager.Instance.Content.Load<SpriteFont>("Fonts\\Font2");
_spriteFont = AppManager.Instance.Content.Load<SpriteFont>("Fonts/Font2");
}
public void Update(GameTime gameTime)

View file

@ -22,11 +22,11 @@ public class MainMenuGUI : AbstractGUI
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\mainMenu" };
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/mainMenu" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
Button playButton = new Button(Manager)
@ -36,10 +36,11 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
playButton.LeftButtonPressed += () =>
{
AppManager.Instance.SoundManager.StartAmbientSound("Loot");
AppManager.Instance.SetGUI(new SelectModeMenu());
};
Elements.Add(playButton);
@ -64,10 +65,11 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
optionButton.LeftButtonPressed += () =>
{
AppManager.Instance.SoundManager.StartAmbientSound("Loot");
AppManager.Instance.SetGUI(new OptionsGUI());
};
Elements.Add(optionButton);
@ -78,7 +80,7 @@ public class MainMenuGUI : AbstractGUI
scale = 0.2f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
exitButton.LeftButtonPressed += () =>
{

View file

@ -21,24 +21,24 @@ public class OptionsGUI : AbstractGUI
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\options" };
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/options" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "Options", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "Options", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
Label label_OverallVolume = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "All Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font", scale = 0.2f, text = "All Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_OverallVolume);
Label label_OverallVolume_Percent = new Label(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_OverallVolume_Percent);
var slider_OverallVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 };
slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume);
label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%";
slider_OverallVolume.SliderChanged += (newVal) =>
@ -51,15 +51,15 @@ public class OptionsGUI : AbstractGUI
//--------------------------------------
Label label_MusicVolume = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Music Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font", scale = 0.2f, text = "Music Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_MusicVolume);
Label label_MusicVolume_Percent = new Label(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_MusicVolume_Percent);
var slider_MusicVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 };
slider_MusicVolume.SetValue(AppManager.Instance.SettingsManager.MusicVolume);
label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%";
slider_MusicVolume.SliderChanged += (newVal) =>
@ -72,15 +72,15 @@ public class OptionsGUI : AbstractGUI
//--------------------------------------
Label label_EffectsVolume = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_EffectsVolume);
Label label_EffectsVolume_Percent = new Label(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_EffectsVolume_Percent);
var slider_EffectsVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 };
slider_EffectsVolume.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume);
label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%";
slider_EffectsVolume.SliderChanged += (newVal) =>
@ -93,7 +93,7 @@ public class OptionsGUI : AbstractGUI
//--------------------------------------
Label lblSwitchMode = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Resolution set", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font", scale = 0.2f, text = "Resolution set", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(lblSwitchMode);
//var button_left_right_mode = new CheckBox(Manager) { rectangle = new Rectangle(rightBorder - checkboxlength, lblSwitchMode.rectangle.Y - 12, checkboxlength, checkboxlength) };
@ -102,7 +102,7 @@ public class OptionsGUI : AbstractGUI
Label label_IsFullScreen = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Full Screen", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
{ fontName = "Fonts/Font", scale = 0.2f, text = "Full Screen", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
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) };
@ -116,7 +116,7 @@ public class OptionsGUI : AbstractGUI
//--------------------------------------
Button bTExit = new Button(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -21,11 +21,11 @@ public class SelectModeMenu : AbstractGUI
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\selectMode" };
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/selectMode" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 6, (int)(width / 4), (int)(height / 20)), text = "Select mode", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 6, (int)(width / 4), (int)(height / 20)), text = "Select mode", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
Button singleButton = new Button(Manager)
{
@ -34,7 +34,7 @@ public class SelectModeMenu : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
singleButton.LeftButtonPressed += () =>
{
@ -42,8 +42,7 @@ public class SelectModeMenu : AbstractGUI
Server server = new Server();
Client client = new Client();
server.CreateRoom(1);
client.JoinYourself();
client.JoinYourself(server.MyIp.Port);
AppManager.Instance.SetServer(server);
AppManager.Instance.SetClient(client);
AppManager.Instance.ChangeState(GameState.HostPlaying);
@ -65,26 +64,19 @@ public class SelectModeMenu : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
optionButton.LeftButtonPressed += () =>
{
AppManager.Instance.SetGUI(new SelectingServerGUI());
// 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);
Button bTExit = new Button(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Xml;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
@ -21,29 +22,31 @@ public class SelectingServerGUI : AbstractGUI
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\join" };
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/join" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font" });
TextBox ipBox = new TextBox(Manager)
{
rectangle = new Rectangle(width / 4 - (width / 4) / 2, height / 4, (int)(width / 4), (int)(height / 20)),
text = "ip",
scale = 0.2f,
scale = 0.5f,
fontColor = Color.White,
mainColor = Color.Gray,
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left,
fontName = "Fonts\\Font"
fontName = "Fonts/Font3"
};
ipBox.TextChanged += input => {
ipBox.TextChanged += input =>
{
if (input == "ip")
{
ipBox.text = ""; ipBox.fontColor = Color.White;
}
};
ipBox.StopChanging += input => {
ipBox.StopChanging += input =>
{
if (input.Length == 0)
{
ipBox.fontColor = Color.White;
@ -58,12 +61,29 @@ public class SelectingServerGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
joinButton.LeftButtonPressed += () =>
{
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
// join
Client client = new Client();
var endpoint = ipBox.text.Split(':');
int port;
try
{
if (int.TryParse(endpoint[1], out port))
{
client.JoinRoom(endpoint[0], port);
AppManager.Instance.SetClient(client);
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
}
}
catch (Exception)
{
// throw;
}
// ваш код здесь
};
@ -75,19 +95,27 @@ public class SelectingServerGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
hostButton.LeftButtonPressed += () =>
{
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(true));
// host
// host
Server server = new Server(); //Server Logic MultiPlayer
Client client = new Client();
server.CreateRoom(2);
client.JoinYourself(server.MyIp.Port);
AppManager.Instance.SetServer(server);
AppManager.Instance.SetClient(client);
string key = server.MyIp.ToString();
AppManager.Instance.debugHud.Set(key, "MultiPlayer");
// ваш код здесь
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(true));
};
Elements.Add(hostButton);
Button bTExit = new Button(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off" };
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -17,6 +17,7 @@ public class WaitingForPlayersGUI : AbstractGUI
{
private DrawableUIElement menuBackground;
private bool isHost;
private Label ip;
public WaitingForPlayersGUI(bool isHost)
{
@ -27,14 +28,18 @@ public class WaitingForPlayersGUI : AbstractGUI
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\Waiting" };
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/Waiting" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
// string pcIp =
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Waiting", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
// string pcIp =
ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font3" };
Elements.Add(ip);
if (isHost)
{
ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font3" };
Elements.Add(ip);
Button startButton = new Button(Manager)
{
rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)),
@ -42,19 +47,39 @@ public class WaitingForPlayersGUI : AbstractGUI
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
fontName = "Fonts/Font"
};
startButton.LeftButtonPressed += () =>
{
// start
AppManager.Instance.ChangeState(GameState.HostPlaying);
// ваш код здесь
};
Elements.Add(startButton);
}
else {
ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.client.InfoConnect.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font3" };
Elements.Add(ip);
Button waitButton = new Button(Manager)
{
rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)),
text = "WAITING",
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts/Font"
};
waitButton.LeftButtonPressed += () =>
{
// start
AppManager.Instance.ChangeState(GameState.ClientPlaying);
// ваш код здесь
};
Elements.Add(waitButton);
}
Button bTExit = new Button(Manager)
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using DangerousD.GameCore.Graphics;
using ZoFo.GameCore.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
@ -12,6 +12,7 @@ using ZoFo.GameCore.GameManagers.ItemManager;
using ZoFo.GameCore.GUI;
using static System.Collections.Specialized.BitVector32;
using MonogameLibrary.UI.Base;
using ZoFo.GameCore.GameObjects;
namespace ZoFo.GameCore.GameManagers
{
@ -74,6 +75,7 @@ namespace ZoFo.GameCore.GameManagers
protected override void Initialize()
{
currentGUI.Initialize();
debugHud.Initialize();
ItemManager.Initialize();
@ -90,15 +92,19 @@ namespace ZoFo.GameCore.GameManagers
animationBuilder = new AnimationBuilder();
animationBuilder.LoadAnimations();
GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1);
GameObject.debugTexture.SetData(new Color[] { Color.White });
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
Keyboard.GetState().IsKeyDown(Keys.Escape)) { server.CloseConnection(); Exit(); }
debugHud.Set("key", "value");
// debugHud.Set("key", "value");
InputManager.Update();
currentGUI.Update(gameTime);
@ -111,7 +117,7 @@ namespace ZoFo.GameCore.GameManagers
client.Update(gameTime);
break;
case GameState.ClientPlaying:
server.Update(gameTime);
client.Update(gameTime);
break;
default:
break;
@ -124,7 +130,9 @@ namespace ZoFo.GameCore.GameManagers
{
GraphicsDevice.Clear(Color.CornflowerBlue);
_spriteBatch.Begin();
// Pointwrap
_spriteBatch.Begin(samplerState: SamplerState.PointWrap);
switch (gamestate)
{
case GameState.ClientPlaying:
@ -135,8 +143,8 @@ namespace ZoFo.GameCore.GameManagers
default:
break;
}
_spriteBatch.End();
_spriteBatch.End();
currentGUI.Draw(_spriteBatch);
debugHud.Draw(_spriteBatch);

View file

@ -1,57 +1,69 @@
using System;
using Microsoft.Win32;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameObjects;
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
namespace ZoFo.GameCore.GameManagers.CollisionManager
{
public class CollisionComponent
{
//поля
public Rectangle Bounds { get; set; }
//==КОНСТРУКТОР==
public CollisionComponent(GameObject gameObject)
{
this.gameObject = gameObject;
hasCollision = false;
this.isTrigger = false;
}
public CollisionComponent(GameObject gameObject, bool hasCollision = false, Rectangle? collisionRectangle = null, bool isTrigger = false, Rectangle? triggerRectangle = null)
{
this.gameObject = gameObject;
this.hasCollision = hasCollision;
this.isTrigger = isTrigger;
if (hasCollision)
this.stopRectangle = collisionRectangle.Value;
if (isTrigger)
this.triggerRectangle = triggerRectangle.Value;
}
//==ПОЛЯ==
public GameObject gameObject { get; set; }
//остановлен ли перс
bool doesStop;
Rectangle stopRectangle;
bool hasCollision;
public Rectangle stopRectangle;
// triggers for rectangle
bool isTrigger;
Rectangle triggerRectangle;
public Rectangle triggerRectangle;
//delegate
public delegate void EventHandler(object sender, EventArgs e);
public CollisionComponent(int x, int y, int width, int height)
{
Bounds = new Rectangle(x, y, width, height);
}
//events
//events DoorInteraction
public event EventHandler<CollisionComponent> OnTriggerEnter;
public event EventHandler<CollisionComponent> OnTriggerZone;
public event EventHandler<CollisionComponent> OnTriggerExit;
// methods-event
public void TriggerEnter(object component, Player player,
EventArgs e)
{
public event EventHandler<CollisionComponent> OnCollision;
}
public void TriggerZone(object component,Player player,
EventArgs e)
{
}
public void TriggerExit(object component,Player player,
EventArgs e)
{
}
}

View file

@ -1,7 +1,6 @@
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,49 +8,146 @@ using ZoFo.GameCore.GameObjects;
using ZoFo.GameCore.GameManagers.CollisionManager;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers.MapManager.MapElements;
using ZoFo.GameCore.GameObjects.Entities;
using ZoFo.GameCore.GameObjects.Entities.LivingEntities;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameManagers.CollisionManager
{
public class CollisionManager
{
public List<CollisionComponent> CollisionComponent;
public List<CollisionComponent> TriggerComponent;
//листики
public List<CollisionComponent> ObjectsWithCollisions;
public List<CollisionComponent> EntitiesWithMovements;
public List<CollisionComponent> ObjectsWithTriggers;
//чекаем коллизии в листе
public void CheckComponentCollision(CollisionComponent componentOfEntity)
{
var entity = componentOfEntity.gameObject as LivingEntity;
//for (int i = 0; i < ObjectsWithCollisions.Count; i++)
//{
var currentRect = entity.collisionComponent.stopRectangle;//задаём РЕК
currentRect.X+=(int)entity.position.X;
currentRect.Y+=(int)entity.position.Y;
public static bool CheckComponentCollision(List<CollisionComponent> collisionComponents, CollisionComponent component)
var newRect = currentRect; // задаём значение старого РЕК новому РЕК
var collidedX = false; // соприкосновение
var tryingRectX = currentRect;//переменная для попытки перемещения по X
tryingRectX.Offset((int)(entity.velocity.X), 0);//задаём значения для tryingRectX по X и по Y
foreach (var item in ObjectsWithCollisions)//фильтрация
{
foreach (var collisionComponent in collisionComponents)
if (item == componentOfEntity) continue;
Rectangle rectChecking = item.stopRectangle.SetOrigin(item.gameObject.position);
if (Math.Abs(item.gameObject.position.X - componentOfEntity.gameObject.position.X) < 550
&& Math.Abs(item.gameObject.position.Y - componentOfEntity.gameObject.position.Y) < 550
&& tryingRectX.Intersects(rectChecking))
{
if (component.Bounds.IntersectsWith(collisionComponent.Bounds))
{
return true;
collidedX = true;// меняем значение соприкосновения на true
entity.OnCollision(item);//подписываем entity на ивент коллизии
break;// выход
}
}
return false;
}
public void UpdateComponentCollision(List<CollisionComponent> collisionComponents)
if (collidedX)// срабатывает, если перемещение блокируется
{
entity.velocity.X = 0;// задаём значение смещения entity на 0
}
else
{
entity.position.X += entity.velocity.X; //update player position
newRect.X = tryingRectX.X;//значение по X для нового РЕК приравниваем к значению испытуемого РЕК
}
//==ПОВТОРЯЕМ ТОЖЕ САМОЕ ДЛЯ Y==
var collidedY = false; // соприкосновение
var tryingRectY = currentRect;//переменная для попытки перемещения по X
tryingRectY.Offset(new Point(0, (int)entity.velocity.Y));//задаём значения для tryingRectX по X и по Y
foreach (var item in ObjectsWithCollisions)//фильтрация
{
if (item == componentOfEntity) continue;
Rectangle rectChecking = item.stopRectangle.SetOrigin(item.gameObject.position);
if (Math.Abs(item.gameObject.position.X - componentOfEntity.gameObject.position.X) < 550
&& Math.Abs(item.gameObject.position.Y - componentOfEntity.gameObject.position.Y) < 550
&& tryingRectY.Intersects(rectChecking))
{
collidedY = true;// меняем значение соприкосновения на true
entity.OnCollision(item);//подписываем entity на ивент коллизии
break;// выход
}
}
if (collidedY)// срабатывает, если перемещение блокируется
{
entity.velocity.Y = 0;// задаём значение смещения entity на 0
}
else
{
entity.position.Y += entity.velocity.Y;
newRect.Y = tryingRectY.Y;//значение по X для нового РЕК приравниваем к значению испытуемого РЕК
}
entity.graphicsComponent.ObjectDrawRectangle.X = (int)entity.position.X;
entity.graphicsComponent.ObjectDrawRectangle.Y = (int)entity.position.Y;
AppManager.Instance.server.AddData(new UpdatePosition() { NewPosition = entity.position, IdEntity = entity.Id });
AppManager.Instance.debugHud.Set("testPos", entity.position.ToString()); //TODO remove
entity.velocity = Vector2.Zero;
}
//обновление позиции объекта
public void UpdatePositions()
{
foreach (var item in EntitiesWithMovements)
{
CheckComponentCollision(item);
}
}
//public void GetObjectInArea(Rectangle area)
//{
//}
public CollisionManager()
{
//graphicsComponent
//.ObjectDrawRectangle = new Rectangle(0, 0, 16 * 12, 16 * 16);
EntitiesWithMovements = new List<CollisionComponent>();
ObjectsWithCollisions = new List<CollisionComponent>();
}
//регистрация компонента(его коллизии)
public void Register(CollisionComponent component)
{
ObjectsWithCollisions.Add(component);
if (component.gameObject is LivingEntity)
{
EntitiesWithMovements.Add(component);
}
}
//public void Register(Rectangle rectangle)
//{
//}
}
public static class ExtentionClass
{
public static Rectangle SetOrigin(this Rectangle rectangle, Vector2 origin)
{
rectangle.X = (int)origin.X;
rectangle.Y = (int)origin.Y;
return rectangle;
}
}
}

View file

@ -1,29 +1,37 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics.PackedVector;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Formats.Tar;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers
{
public enum ScopeState { Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight }
public enum ScopeState { Idle, Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight }
public class InputManager
{
public delegate void Delegat();
public event Delegat ShootEvent; // событие удара(когда нажат X, событие срабатывает)
public event Action ShootEvent; // событие удара(когда нажат X, событие срабатывает)
public event Delegat OnInteract; // событие взаимодействия с collectable(например, лутом)
public event Action OnInteract; // событие взаимодействия с collectable(например, лутом)
//с помощью кнопки E.
public event Delegat TalkEvent;
public event Action ActionEvent;
public Vector2 InputMovementDirection;
private Vector2 prevInputMovementDirection;
public Vector2 InputAttackDirection;
private Vector2 prevInputAttackDirection;
Vector2 vectorMovementDirection;
ScopeState currentScopeState; // Положение оружия. Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight.
public event Action TalkEvent;
public ScopeState currentScopeState; // Положение оружия. Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight.
private ScopeState prevCurrentScopeState;
private bool _cheatsEnabled = false;
public bool InvincibilityCheat { get; private set; } = false;
public bool CollisionsCheat { get; private set; } = false;
@ -34,18 +42,16 @@ namespace ZoFo.GameCore.GameManagers
private KeyboardState lastKeyboardState;
private GamePadState lastGamePadState;
public Vector2 VectorMovementDirection { get => vectorMovementDirection; }
public ScopeState ScopeState { get => currentScopeState; }
public string currentControlsState;
public ScopeState CurrentScopeState { get => currentScopeState; } // получить текущее состояние
public InputManager()
{
InputMovementDirection = new Vector2(0, 0);
InputAttackDirection = new Vector2(0, 0);
this.isShoot = false;
currentScopeState = ScopeState.Straight;
vectorMovementDirection = new Vector2(0, 0);
currentScopeState = ScopeState.Idle;
}
public void Update()
{
@ -59,7 +65,8 @@ namespace ZoFo.GameCore.GameManagers
#region Работа с GamePad
#region Обработка гейм-пада. Задает Vector2 vectorMovementDirection являющийся вектором отклонения левого стика.
GamePadState gamePadState = GamePad.GetState(0);
vectorMovementDirection = gamePadState.ThumbSticks.Left;
InputMovementDirection = gamePadState.ThumbSticks.Left;
InputAttackDirection = gamePadState.ThumbSticks.Right;
#endregion
#region читы
@ -75,39 +82,38 @@ namespace ZoFo.GameCore.GameManagers
}
#endregion // Cheats
#region Обработка положения оружия. Задает значение полю scopeState.
if (vectorMovementDirection.Y >= 0.6)
{
currentScopeState = ScopeState.Straight;
}
else if(vectorMovementDirection.Y <= 0.6)
{
currentScopeState = ScopeState.Back;
}
else if(vectorMovementDirection.X >= 0.6)
{
#region set ScopeState
int currentSection = (int)Math.Ceiling(Math.Atan2(InputMovementDirection.Y,
InputMovementDirection.X) * 180 / Math.PI * 16 / 360);
switch(currentSection){
case 1 or 0 or 16:
currentScopeState = ScopeState.Right;
}
else if(vectorMovementDirection.X <= 0.6)
{
currentScopeState = ScopeState.Left;
}
else if(vectorMovementDirection.Y >= 0.6 && vectorMovementDirection.X >= 0.6)
{
break;
case 2 or 3:
currentScopeState = ScopeState.StraightRight;
}
else if(vectorMovementDirection.Y >= 0.6 && vectorMovementDirection.X <= 0.6)
{
break;
case 4 or 5:
currentScopeState = ScopeState.Straight;
break;
case 6 or 7:
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)
{
break;
case 8 or 9:
currentScopeState = ScopeState.Left;
break;
case 10 or 11:
currentScopeState = ScopeState.BackLeft;
break;
case 12 or 13:
currentScopeState = ScopeState.Back;
break;
case 14 or 15:
currentScopeState = ScopeState.BackRight;
break;
default:
break;
}
#endregion
#region Обработка нажатия выстрела. Вызывает событие ShootEvent
@ -126,6 +132,17 @@ namespace ZoFo.GameCore.GameManagers
lastGamePadState = gamePadState;
#endregion
#region Работа с KeyBoard
#region InputAttack with mouse
MouseState mouseState = Mouse.GetState();
AppManager.Instance.debugHud.Set("mouse position", $"({mouseState.X}, {mouseState.Y}");
// TODO: CurentScreenResolution
Vector2 a = (AppManager.Instance.CurentScreenResolution / new Point(2, 2)).ToVector2();
InputAttackDirection = Vector2.Normalize(new Vector2(mouseState.X - a.X, mouseState.Y - a.Y));
AppManager.Instance.debugHud.Set("AttackDir(normalize)", $"({a.X}, {a.Y})");
#endregion
#region Состояние клавиатуры
KeyboardState keyBoardState = Keyboard.GetState(); // Состояние клавиатуры
#endregion
@ -219,6 +236,17 @@ namespace ZoFo.GameCore.GameManagers
lastKeyboardState = keyBoardState;
#endregion
#region ActionEvent
if(InputMovementDirection != prevInputMovementDirection ||
InputAttackDirection != prevInputAttackDirection ||
currentScopeState != prevCurrentScopeState)
{
ActionEvent?.Invoke();
}
prevInputMovementDirection = InputMovementDirection;
prevInputAttackDirection = InputAttackDirection;
prevCurrentScopeState = currentScopeState;
#endregion
}
}
}

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
{
public class Object
{
public double Height { get; set; }
public double Width { get; set; }
public double X { get; set; }
public double Y { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
{
public class ObjectGroup
{
public string Name { get; set; }
public List<Object> Objects { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
{
public class Tile
{
public int Id { get; set; }
public string Type { get; set; }
public ObjectGroup Objectgroup { get; set; }
}
}

View file

@ -20,5 +20,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
public int TileWidth { get; set; }
public int Columns { get; set; }
public int FirstGid { get; set; }
public List<Tile> Tiles { get; set; }
}
}

View file

@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
@ -10,15 +11,14 @@ 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 _templatePath = "Content/MapData/TileMaps/{0}.tmj";
private static readonly float _scale = 1.0f;
//private static readonly float _scale = 1.0f;
private List<TileSet> _tileSets = new List<TileSet>();
/// <summary>
@ -32,16 +32,18 @@ namespace ZoFo.GameCore.GameManagers.MapManager
{
PropertyNameCaseInsensitive = true
};
TileMap tileMap = JsonSerializer.Deserialize<TileMap>(File.ReadAllText(string.Format(_templatePath, mapName)), options);
TileMap tileMap =
JsonSerializer.Deserialize<TileMap>(File.ReadAllText(string.Format(_templatePath, mapName)), options);
// Загрузка TileSet-ов по TileSetInfo
List<TileSet> tileSets = new List<TileSet>();
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
{
TileSet tileSet = LoadTileSet("Content/MapData/"+tileSetInfo.Source);
TileSet tileSet = LoadTileSet(Path.Combine("Content", "MapData", "TileMaps", tileSetInfo.Source));
tileSet.FirstGid = tileSetInfo.FirstGid;
tileSets.Add(tileSet);
}
tileSets.Reverse();
foreach (var layer in tileMap.Layers)
{
@ -51,30 +53,45 @@ namespace ZoFo.GameCore.GameManagers.MapManager
{
foreach (var tileSet in tileSets)
{
if (tileSet.FirstGid - chunk.Data[i] < 0)
if (tileSet.FirstGid <= chunk.Data[i])
{
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;
int relativeRow = number / tileSet.Columns; // относительно левого угла чанка
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,
tileSet.TileWidth, tileSet.TileHeight);
Vector2 position = new Vector2((i % chunk.Width) * tileSet.TileWidth + chunk.X * chunk.Width, (i / chunk.Height)*tileSet.TileHeight + chunk.Y * chunk.Height) ;
Vector2 position = new Vector2(
(i % chunk.Width) * tileSet.TileWidth + chunk.X * tileSet.TileWidth,
(i / chunk.Height) * tileSet.TileHeight + chunk.Y * tileSet.TileHeight);
switch (layer.Class)
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
switch (tile.Type)
{
case "Tile":
AppManager.Instance.server.RegisterGameObject(new MapObject(position, new Vector2(tileSet.TileWidth * _scale, tileSet.TileHeight * _scale), sourceRectangle, "Textures\\TileSets\\"+tileSet.Name)); //fix naming
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":
// new StopObject(position, new Vector2(tileSet.TileWidth * _scale, tileSet.TileHeight * _scale), sourceRectangle, tileSet.Name);
var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов
AppManager.Instance.server.RegisterGameObject(new StopObject(position/4,//TODO
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
sourceRectangle,
"Textures/TileSetImages/" +
Path.GetFileName(tileSet.Image).Replace(".png", ""),
collisionRectangles.ToArray()));
break;
default:
break;
}
break;
}
}
}
@ -99,5 +116,26 @@ namespace ZoFo.GameCore.GameManagers.MapManager
return JsonSerializer.Deserialize<TileSet>(data, options);
}
}
/// <summary>
/// Загружает все квадраты коллизии тайла.
/// </summary>
/// <param name="tile"></param>
/// <returns></returns>
private List<Rectangle> LoadRectangles(Tile tile)
{
if (tile.Objectgroup == null)
{
return new List<Rectangle>();
}
List<Rectangle> collisionRectangles = new List<Rectangle>();
foreach (var obj in tile.Objectgroup.Objects)
{
collisionRectangles.Add(new Rectangle((int)obj.X, (int)obj.Y, (int)obj.Width, (int)obj.Height));
}
return collisionRectangles;
}
}
}

View file

@ -1,167 +0,0 @@
{ "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
}

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,166 +0,0 @@
{ "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]
}]
}]
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography.X509Certificates;
@ -15,13 +16,14 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
{
public class ClientNetworkManager
{
private int port = 7632;
private EndPoint endPoint;
private int port = 0;
private IPEndPoint endPoint;
private Socket socket;
List<UpdateData> updates = new List<UpdateData>();
public delegate void OnDataSent(string Data);
public event OnDataSent GetDataSent; // event
public bool IsConnected { get { return socket.Connected; } }
public IPEndPoint InfoConnect => (IPEndPoint)socket.LocalEndPoint ?? endPoint;
public ClientNetworkManager()
{
@ -60,35 +62,55 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
public void JoinRoom(string ip) // multyplayer
public void JoinRoom(string ip, int port) // multyplayer
{
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
socket.Connect(endPoint);
SendData();
Thread listen = new Thread(StartListening);
listen.IsBackground = true;
listen.Start();
}
public void JoinRoom(IPEndPoint endPoint) // multyplayer
{
this.endPoint = endPoint;
socket.Connect(endPoint);
SendData();
Thread listen = new Thread(StartListening);
listen.IsBackground = true;
listen.Start();
}
/// <summary>
/// создается одиночная комната к которой ты подключаешься
/// </summary>
public void JoinYourself() // single player
public void JoinYourself(int port) // single player
{
endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
endPoint = new IPEndPoint(GetIp(), port);
socket.Connect(endPoint);
SendData();
Thread listen = new Thread(StartListening);
listen.IsBackground = true;
listen.Start();
}
public static IPAddress GetIp()
{
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
var ipList = Dns.GetHostByName(hostName).AddressList;
string myIP = ipList[ipList.Count() - 1].ToString();// Get the IP
return IPAddress.Parse(myIP);
}
//поток 2
public void StartListening()
{
while(socket.Connected)
{
byte[] bytes = new byte[2048];
var countAnsw = socket.Receive(bytes);
var countAnsw = socket.Receive(bytes); //Вылетает если кто то закрыл
string update = Encoding.UTF8.GetString(bytes, 0, countAnsw); // обновление отосланные сервером
GetDataSent(update);
}

View file

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Graphics.PackedVector;
using System;
using System.Collections.Generic;
@ -17,8 +18,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
{
public class ServerNetworkManager
{
private IPAddress ip =IPAddress.Parse("127.0.0.1"); //IPAddress.Any
private int port = 7632;
private IPAddress ip = IPAddress.Parse("127.0.0.1");
private const int port = 0;
private IPEndPoint endPoint;
private Socket socket;
private List<Socket> clients;
@ -27,6 +28,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
public event OnDataSend GetDataSend; // event
Dictionary<Socket, Thread> managerThread;
Thread serverTheread;
public IPEndPoint InfoConnect => (IPEndPoint)socket.LocalEndPoint ?? endPoint;
public ServerNetworkManager() { Init(); }
@ -35,7 +37,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
/// </summary>
private void Init()
{
endPoint = new IPEndPoint(ip, port);
endPoint = new IPEndPoint(GetIp(), port);
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
managerThread = new Dictionary<Socket, Thread>();
clients = new List<Socket>();
@ -44,6 +46,18 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
socket.Bind(endPoint);
}
/// <summary>
/// Получает IP устройства
/// </summary>
/// <returns></returns>
public static IPAddress GetIp()
{
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
var ipList = Dns.GetHostByName(hostName).AddressList;
string myIP = ipList[ipList.Count()-1].ToString();// Get the IP
return IPAddress.Parse(myIP);
}
/// <summary>
/// отправляет клиенту Data
/// </summary>
@ -56,13 +70,19 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
}
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);
//Что это?
//по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT
List<UpdateData> datasToSend = new List<UpdateData>();
for (int i = 0; i < 5 && i<updates.Count; i++)
datasToSend.Add(updates[i]);
string data = JsonSerializer.Serialize(datasToSend);
var databytes = Encoding.UTF8.GetBytes(data);
foreach (var item in clients)
{
item.SendAsync(databytes);
}
for (int i = 0; i < 5 && i< datasToSend.Count; i++)
updates.RemoveAt(0);
}
/// <summary>
@ -105,11 +125,11 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
public void Start(object players)
{
serverTheread = new Thread(StartWaitingForPlayers);
serverTheread.IsBackground = true;
serverTheread.Start(players);
}
//Потоки Клиентов
/// <summary>
/// Слушает игроков, которые хотят подключиться
/// </summary>
@ -122,12 +142,16 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
for (int i = 0; i < playNumber; i++)
{
Socket client = socket.Accept();
AppManager.Instance.debugHud.Log($"Connect {client.LocalEndPoint.ToString()}");
Thread thread = new Thread(StartListening);
thread.IsBackground = true;
thread.Start(client);
managerThread.Add(client, thread);
clients.Add(client); //добавляем клиентов в лист
clients.Add(client);
//AppManager.Instance.ChangeState(GameState.HostPlaying);
//добавляем клиентов в лист
}
AppManager.Instance.ChangeState(GameState.HostPlaying);
}
/// <summary>
@ -145,7 +169,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
string response = Encoding.UTF8.GetString(buff, 0, answ);
GetDataSend(response);
}
Thread.Sleep(-1);
Task.Delay(-1);
}
}

View file

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
@ -9,9 +11,12 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer
public class UpdateInput :UpdateData
{
// public int IdEntity { get; set; }
public Vector2 InputMovementDirection{get;set;}
public Vector2 InputAttackDirection {get;set;}
public UpdateInput()
{
UpdateType = "UpdateInput";
}
}
}

View file

@ -6,7 +6,10 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateAnimation : UpdateData //хранит новую анимации
/// <summary>
/// Хранит новое сосотяние анимации
/// </summary>
public class UpdateAnimation : UpdateData
{
public UpdateAnimation() { UpdateType = "UpdateAnimation"; }
}

View file

@ -6,7 +6,10 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateEntityHealth : UpdateData//хранит новое хп entity
/// <summary>
/// Обнивляет хп сущности
/// </summary>
public class UpdateEntityHealth : UpdateData
{
public UpdateEntityHealth() { UpdateType = "UpdateEntityHealth"; }
}

View file

@ -6,7 +6,10 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateGameEnded : UpdateData //хранит полученый лут и уведомляет о конце игры
/// <summary>
/// Хранит полученый лут и уведомляет о конце игры
/// </summary>
public class UpdateGameEnded : UpdateData
{
public UpdateGameEnded() { UpdateType = "UpdateGameEnded"; }
}

View file

@ -1,4 +1,5 @@
using System;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,8 +7,14 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateGameObjectCreated : UpdateData //Хранит объект, который только отправили
/// <summary>
/// Хранит объект, который только отправили
/// </summary>
public class UpdateGameObjectCreated : UpdateData
{
public UpdateGameObjectCreated() { UpdateType = "UpdateGameObjectCreated"; }
public string GameObjectType;
public string GameObjectId;
public Vector2 position;
}
}

View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
/// <summary>
/// Хранит объект, который надо удлить
/// </summary>
public class UpdateGameObjectDeleted : UpdateData
{
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; }
public string GameObjectType;
}
}

View file

@ -0,0 +1,16 @@
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
/// <summary>
/// При попытке взаимодействия с объектом
/// </summary>
public class UpdateInteraction : UpdateData
{
public UpdateInteraction() { UpdateType = "UpdateInteraction"; }
public UpdateInteraction(int id)
{
IdEntity = id;
}
public int IdEntity { get; set; }
public string UpdateType { get; set; }
}

View file

@ -0,0 +1,14 @@
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
/// <summary>
/// При изменении возможности повзаимодействовать с объектом
/// </summary>
/// <param name="idEntity"></param>
/// <param name="isReady"></param>
public class UpdateInteractionReady(int idEntity, bool isReady)
: UpdateData
{
public int IdEntity { get; set; } = idEntity;
public string UpdateType { get; set; } = "UpdateInteractionReady";
public bool IsReady { get; set; } = isReady;
}

View file

@ -6,8 +6,17 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateLoot : UpdateData //Хранит лут
/// <summary>
/// Хранит лут
/// </summary>
public class UpdateLoot : UpdateData
{
public string lootName;
public UpdateLoot() { UpdateType = "UpdateLoot"; }
public UpdateLoot(string lootName)
{
UpdateType = "UpdateLoot";
this.lootName = lootName;
}
}
}

View file

@ -6,7 +6,10 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdatePlayerParametrs : UpdateData //Хранит хп, радиацию
/// <summary>
/// Хранит хп, радиацию
/// </summary>
public class UpdatePlayerParametrs : UpdateData
{
public UpdatePlayerParametrs() { UpdateType = "UpdatePlayerParametrs"; }
}

View file

@ -1,13 +1,20 @@
using System;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameObjects.Entities.LivingEntities;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdatePosition : UpdateData //Хранит новую позицию
/// <summary>
/// Хранит новую позицию
/// </summary>
public class UpdatePosition : UpdateData
{
public UpdatePosition() { UpdateType = "UpdatePosition"; }
public Vector2 NewPosition { get; set; }
}
}

View file

@ -11,6 +11,9 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
/// <summary>
/// При создании тайла
/// </summary>
public class UpdateTileCreated : UpdateData
{
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; }
@ -20,4 +23,17 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
public Rectangle sourceRectangle { get; set; }
public string tileSetName { get; set; }
}
/// <summary>
/// При создании тайла TODO move to another file
/// </summary>
public class UpdateStopObjectCreated : UpdateData
{
public UpdateStopObjectCreated() { UpdateType = "UpdateStopObjectCreated"; }
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; }
public Rectangle[] collisions { get; set; }
}
}

View file

@ -14,16 +14,29 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
[JsonDerivedType(typeof(UpdateEntityHealth))]
[JsonDerivedType(typeof(UpdateGameEnded))]
[JsonDerivedType(typeof(UpdateGameObjectCreated))]
[JsonDerivedType(typeof(UpdateGameObjectDeleted))]
[JsonDerivedType(typeof(UpdateLoot))]
[JsonDerivedType(typeof(UpdatePlayerParametrs))]
[JsonDerivedType(typeof(UpdatePosition))]
[JsonDerivedType(typeof(UpdateTileCreated))]
[JsonDerivedType(typeof(UpdateInput))]
[JsonDerivedType(typeof(UpdatePlayerExit))]
[JsonDerivedType(typeof(UpdateInteractionReady))]
[JsonDerivedType(typeof(UpdateInteraction))]
public class UpdateData
{
public int IdEntity { get; set; } //Id объекта
public string UpdateType { get; protected set; } //тип обновления
public UpdateData()
{
}
public UpdateData(int idEntity)
{
this.IdEntity = idEntity;
}
}
}

View file

@ -6,7 +6,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using System.Linq;
using DangerousD.GameCore.Graphics;
using Newtonsoft.Json;
using Microsoft.Xna.Framework.Media;
@ -20,23 +20,28 @@ namespace ZoFo.GameCore.GameManagers
public void LoadSounds() // метод для загрузки звуков из папки
{
var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("wav"));
//List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/");
var k = Directory.GetFiles(Directory.GetCurrentDirectory() + "//Content//sounds").Where(x => x.EndsWith("xnb"));
if (k.Count() > 0)
{
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".wav", "")).ToArray();// папка со звуками там где exe
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".xnb", "")).ToArray();// папка со звуками там где exe
foreach (var soundFile in soundFiles)
{
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds//" + soundFile));
}
}
if (k.Count() > 0)
/*/if (sounds.Count() > 0)
{
foreach (var soundFile in sounds)
{
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds/" + soundFile));
}
}/*/
}
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции

View file

@ -0,0 +1,28 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities
{
internal class EntittyForAnimationTests : Entity
{
//public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List<string> { "тут пишите название анимации" }, "сдублируйте " +
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "player_idle_rotate_weapon" }, "player_idle_rotate_weapon");
public EntittyForAnimationTests(Vector2 position) : base(position)
{
graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*12, 16 * 16);
position = new Vector2(10, 10);
}
}
}

View file

@ -4,21 +4,37 @@ using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.ZoFo_graphics;
namespace ZoFo.GameCore.GameObjects.Entities
{
public abstract class Entity : GameObject
{
public override GraphicsComponent graphicsComponent => null;
//public override GraphicsComponent graphicsComponent => null;
public CollisionComponent collisionComponent { get; protected set; }
public int Id { get; set; }
static int totalEntitiesCreated = 0;
protected Entity(Vector2 position) : base(position)
{
Id = totalEntitiesCreated;
totalEntitiesCreated++;
collisionComponent = new CollisionComponent(this);
}
/// <summary>
/// For initialisation on Client
/// </summary>
/// <param name="newId"></param>
public void SetIdByClient(int newId)
{
Id = newId;
}
public virtual void Update()
{
}
public override void UpdateLogic()
{
Update();
base.UpdateLogic();
}
}
}

View file

@ -0,0 +1,28 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class Ammo:Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("Textures/icons/8");
public Ammo(Vector2 position) : base(position)
{
graphicsComponent.ObjectDrawRectangle.Width = 20;
graphicsComponent.ObjectDrawRectangle.Height = 20;
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Ammo"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class Antiradine:Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("Antiradine");
public Antiradine(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Antiradine"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.Graphics;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
public class BottleOfWater : Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("BottleOfWater");
public BottleOfWater(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("BottleOfWater"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -1,10 +1,20 @@
using Microsoft.Xna.Framework;
using System;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
public class Collectable : Entity
public class Collectable : Interactable
{
public Collectable(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
//
AppManager.Instance.server.AddData(new UpdateLoot());
AppManager.Instance.server.DeleteObject(this);
}
}

View file

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.Graphics;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
public class Peeble:Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("Peeble");
public Peeble(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Peeble"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class PureBottleOfWater:Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("PureBottleOfWater");
public PureBottleOfWater(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("PureBottleOfWater"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class RottenFlesh:Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("RottenFlesh");
public RottenFlesh(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("RottenFlesh"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class Steel:Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("Steel");
public Steel(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Steel"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,23 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
public class Wood : Collectable
{
public override StaticGraphicsComponent graphicsComponent { get; } = new("Wood");
public Wood(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Wood"));
AppManager.Instance.server.DeleteObject(this);
}
}

View file

@ -0,0 +1,24 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
public class Door : Interactable
{
public bool isOpened;
public override StaticGraphicsComponent graphicsComponent { get; } = new("DoorInteraction");
public Door(Vector2 position) : base(position)
{
//graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - SD
}
public override void OnInteraction(object sender, CollisionComponent e)
{
//graphicsComponent.AnimationSelect("DoorInteraction", isOpened);
//graphicsComponent.AnimationStep();
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
public class Interactable : Entity
{
public override StaticGraphicsComponent graphicsComponent => throw new System.NotImplementedException();
public Interactable(Vector2 position) : base(position)
{
collisionComponent.OnTriggerEnter += (sender, e) => ChangeInteraction(sender, e, true);
collisionComponent.OnTriggerExit += (sender, e) => ChangeInteraction(sender, e, false);
collisionComponent.OnTriggerZone += OnInteraction;
}
private void ChangeInteraction(object sender, CollisionComponent e, bool isReady)
{
AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady));
}
public virtual void OnInteraction(object sender, CollisionComponent e)
{
}
}

View file

@ -2,12 +2,16 @@
using Microsoft.Xna.Framework.Graphics;
using System;
using ZoFo.GameCore.GameObjects.Entities;
using ZoFo.GameCore.ZoFo_graphics;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
public class LivingEntity : Entity
{
/// <summary>
/// Переменная для заявки на передвижения, т.е. то, на сколько вы хотите, чтобы в этом кадре переместился объект
/// </summary>
public Vector2 velocity;
private InputManager inputManager;
@ -17,6 +21,8 @@ public class LivingEntity : Entity
inputManager = new InputManager();
}
public override GraphicsComponent graphicsComponent { get; } = null;
#region Server side
/*public override void Update()
{
@ -24,6 +30,12 @@ public class LivingEntity : Entity
}*/
#endregion
public void OnCollision(CollisionComponent component)
{
}
}

View file

@ -6,12 +6,13 @@ using System.Threading.Tasks;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player
{
internal class LootData
class LootData
{
public Dictionary<string, int> loots;
public void AddLoot(object lootObject, int quantity)
{
public void AddLoot(string lootName, int quantity)
{
loots.Add(lootName, quantity);
}
}
}

View file

@ -1,8 +1,13 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Input;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
@ -10,17 +15,42 @@ public class Player : LivingEntity
{
public Vector2 InputWeaponRotation { get; set; }
public Vector2 InputPlayerRotation { get; set; }
/// <summary>
/// Факт того, что плеер в этом апдейте пытается стрелять
/// </summary>
public bool IsTryingToShoot { get; set; }
Texture2D texture;
private float speed;
private int health;
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "player_running_top_rotate" }, "player_running_top_rotate");
private LootData lootData;
public Player(Vector2 position) : base(position)
{
//InputWeaponRotation = new Vector2(0, 0);
//InputPlayerRotation = new Vector2(0, 0);
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100);
collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100);
}
public void Update(GameTime gameTime)
public override void Update()
{
MovementLogic();
}
float t;
public void MovementLogic()
{
//velocity.X = 3+(float)Math.Sin(t);
t++;
if (InputPlayerRotation.X > 0.9)
{
}
if (Keyboard.GetState().IsKeyDown(Keys.D)) velocity.X = 5;
if (Keyboard.GetState().IsKeyDown(Keys.A)) velocity.X = -5;
if (Keyboard.GetState().IsKeyDown(Keys.S)) velocity.Y = 5;
if (Keyboard.GetState().IsKeyDown(Keys.W)) velocity.Y = -5;
}
public void HandleNewInput(UpdateInput updateInput)
{
}

View file

@ -3,8 +3,8 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.ZoFo_graphics;
using ZoFo.GameCore;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects;
@ -12,20 +12,24 @@ public abstract class GameObject
{
public Vector2 position;
private Server server;
public Vector2 rotation; //вектор направления объекта
public abstract GraphicsComponent graphicsComponent { get; }
public virtual GraphicsComponent graphicsComponent { get; }
#region ServerSide
public GameObject(Vector2 position)
{
this.position = position;
graphicsComponent.LoadContent();
graphicsComponent.ObjectDrawRectangle.X = (int)position.X;
graphicsComponent.ObjectDrawRectangle.Y = (int)position.Y;
}
public virtual void UpdateLogic(GameTime gameTime)
public virtual void UpdateLogic()
{
PlayAnimation_OnServer();
}
@ -42,6 +46,7 @@ public abstract class GameObject
#region Client Side
public static Texture2D debugTexture;
/// <summary>
/// Для клиента
/// Это вызывается в клиентской части игры
@ -64,8 +69,10 @@ public abstract class GameObject
/// Для клиента
/// Обновление, которое вызывается у клиента, для просмотра анимаций
/// </summary>
public virtual void UpdateAnimations(GameTime gameTime)
public virtual void UpdateAnimations()
{
graphicsComponent.ObjectDrawRectangle.X = (int)position.X; //Move To place where Updates Sets your position
graphicsComponent.ObjectDrawRectangle.Y = (int)position.Y;
PlayAnimation_OnClient();
}
@ -74,21 +81,23 @@ public abstract class GameObject
/// </summary>
public virtual void Draw(SpriteBatch spriteBatch)
{
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch);
graphicsComponent.Draw(graphicsComponent.ObjectDrawRectangle, spriteBatch);
//debug
DrawDebugRectangle(spriteBatch, graphicsComponent.ObjectDrawRectangle);
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 is null) color = new Color(1, 0, 0, 0.1f);
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);
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
}

View file

@ -2,33 +2,42 @@
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Diagnostics;
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;
using ZoFo.GameCore.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 Rectangle sourceRectangle;
public override GraphicsComponent graphicsComponent { get; }
= new StaticGraphicsComponent();
/// <summary>
/// Создается простой объект на карте - no animations, только где, насколько крупно рисовать, по какой сорс ректанглу рисовать и из какой текстуры
/// </summary>
/// <param name="position"></param>
/// <param name="size"></param>
/// <param name="sourceRectangle"></param>
/// <param name="textureName"></param>
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();
(graphicsComponent as StaticGraphicsComponent)._textureName = textureName;
(graphicsComponent as StaticGraphicsComponent).BuildComponent(textureName);
(graphicsComponent as StaticGraphicsComponent).ObjectDrawRectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
(graphicsComponent as StaticGraphicsComponent).LoadContent();
this.sourceRectangle = sourceRectangle;
}
public override void Draw(SpriteBatch spriteBatch)
{
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, _sourceRectangle);
graphicsComponent.Draw(graphicsComponent.ObjectDrawRectangle, spriteBatch, sourceRectangle);
}
}

View file

@ -1,17 +1,32 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Diagnostics;
using System.Security.Cryptography.X509Certificates;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.ZoFo_graphics;
namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
public class StopObject : MapObject
{
CollisionComponent collisionComponent;
public CollisionComponent[] collisionComponents;
protected StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position, size, sourceRectangle, textureName)
public StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName, Rectangle[] collisions) : base(position, size, sourceRectangle, textureName)
{
collisionComponents = new CollisionComponent[collisions.Length];
for (int i = 0; i < collisionComponents.Length; i++)
{
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));
}
}

View file

@ -1,8 +0,0 @@
using System;
namespace ZoFo.GameCore.GameObjects.MapObjects.Tiles;
public class Tile
{
}

View file

@ -1,30 +1,25 @@
using ZoFo.GameCore.GameObjects;
using ZoFo.GameCore.GameManagers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Zofo.GameCore.ZoFo_grafics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GUI;
namespace ZoFo.GameCore.ZoFo_graphics
namespace ZoFo.GameCore.Graphics
{
public class GraphicsComponent
public class AnimatedGraphicsComponent : GraphicsComponent
{
public Rectangle ObjectDrawRectangle { get; set; }
public event Action<string> actionOfAnimationEnd;
private List<AnimationContainer> animations;
public List<AnimationContainer> animations;
private List<Texture2D> textures;
public List<string> texturesNames; //rethink public and following that errors
private List<string> texturesNames;
private AnimationContainer currentAnimation;
static public int scaling = 5;
static public int Camera_XW=800;
static public int Camera_YH = 400;
static public Vector2 CameraSize = new Vector2(1800, 960);
public int parentId;
public AnimationContainer CurrentAnimation
{
@ -50,10 +45,22 @@ namespace ZoFo.GameCore.ZoFo_graphics
return currentFrame;
}
}
// Needed to ckeck whether the frame has changed since last update call
private int lastUpdateCallFrame;
public int LastUpdateCallFrame
{
get
{
return lastUpdateCallFrame;
}
}
public int CurrentFrameInterval { get => interval; }
public void Force_Set_CurrentFrameInterval(int newFrameInterval) { }
private int interval;
private int lastInterval;
private Rectangle sourceRectangle;
public GraphicsComponent(List<string> animationsId, string neitralAnimationId)
public AnimatedGraphicsComponent(List<string> animationsId, string neitralAnimationId)
{
//this._spriteBatch = _spriteBatch;
currentFrame = 0;
@ -64,18 +71,8 @@ namespace ZoFo.GameCore.ZoFo_graphics
buildSourceRectangle();
}
public string mainTextureName;//TODO костыль - пофиксить
public GraphicsComponent(string textureName)
public AnimatedGraphicsComponent(string textureName)
{
BuildComponent(textureName);
}
public GraphicsComponent()
{
}
public void BuildComponent(string textureName)
{
mainTextureName = textureName;
//texturesNames.Add(textureName);//Added by SD
animations = new List<AnimationContainer>();
textures = new List<Texture2D>();
var texture = AppManager.Instance.Content.Load<Texture2D>(textureName);
@ -106,16 +103,11 @@ namespace ZoFo.GameCore.ZoFo_graphics
}
}
public void LoadContent()
public override void LoadContent()
{
textures = new List<Texture2D>();
texturesNames = new List<string>();
if (animations is null)
{
return;
}
foreach (var animation in animations)
{
if (!texturesNames.Contains(animation.TextureName))
@ -128,16 +120,6 @@ namespace ZoFo.GameCore.ZoFo_graphics
public void StartAnimation(string startedanimationId)
{
/*
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
{
LivingEntity entity = AppManager.Instance.GameManager.livingEntities.Find(x => x.id == parentId);
if (((entity is Player) || AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host) && startedanimationId != GetCurrentAnimation)
{
AppManager.Instance.NetworkTasks.Add(new NetworkTask(parentId, startedanimationId, Vector2.Zero));
}
}
*/
currentFrame = 0;
currentAnimation = animations.Find(x => x.Id == startedanimationId);
@ -154,12 +136,9 @@ namespace ZoFo.GameCore.ZoFo_graphics
SetInterval();
}
public void Update()
public override void Update()
{
if (currentAnimation is null)
{
return;
}
lastUpdateCallFrame = currentFrame;
if (interval == 0)
{
currentFrame++;
@ -186,7 +165,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
interval--;
}
public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch)
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch)
{
Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)];
float scale;
@ -211,7 +190,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
_spriteBatch.Draw(texture,
destinationRectangle, sourceRectangle, Color.White);
}
public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
{
Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)];
float scale;
@ -236,14 +215,6 @@ namespace ZoFo.GameCore.ZoFo_graphics
_spriteBatch.Draw(texture,
destinationRectangle, sourceRectangle, Color.White);
}
private Rectangle Scaling(Rectangle destinationRectangle)
{
destinationRectangle.X *= scaling;
destinationRectangle.Y *= scaling;
destinationRectangle.Width *= scaling;
destinationRectangle.Height *= scaling;
return destinationRectangle;
}
private void buildSourceRectangle()
{
sourceRectangle = new Rectangle();
@ -271,35 +242,6 @@ namespace ZoFo.GameCore.ZoFo_graphics
interval = lastInterval;
}
}
public static void SetCameraPosition(Vector2 playerPosition)
{
CameraPosition = (playerPosition).ToPoint();
CameraPosition.X -= 200;
CameraPosition.Y -= 120;
// TODO
/*
if (CameraPosition.X > AppManager.Instance.GameManager.CameraBorder.Y - 460)
{
CameraPosition.X = (int)AppManager.Instance.GameManager.CameraBorder.Y - 460;
}
if (CameraPosition.Y < AppManager.Instance.GameManager.CameraBorder.Z)
{
CameraPosition.Y = (int)AppManager.Instance.GameManager.CameraBorder.Z;
}
if (CameraPosition.X < AppManager.Instance.GameManager.CameraBorder.X)
{
CameraPosition.X = (int)AppManager.Instance.GameManager.CameraBorder.X;
}
if (CameraPosition.Y > AppManager.Instance.GameManager.CameraBorder.W - 240)
{
CameraPosition.Y = (int)AppManager.Instance.GameManager.CameraBorder.W - 240;
}
AppManager.Instance.DebugHUD.Set("CameraPosition", $"{CameraPosition.X}, {CameraPosition.Y}");
*/
}
public static Point CameraPosition = new Point(0, 0);
}
}

View file

@ -3,9 +3,8 @@ using System.Collections.Generic;
using System.Text;
using System.IO;
using Newtonsoft.Json;
using Zofo.GameCore.ZoFo_grafics;
namespace DangerousD.GameCore.Graphics
namespace ZoFo.GameCore.Graphics
{
public class AnimationBuilder
{
@ -13,11 +12,12 @@ namespace DangerousD.GameCore.Graphics
public void LoadAnimations()
{
Animations = new List<AnimationContainer>();
string[] animationFilesNames = Directory.GetFiles("../../../Content/animations");
string[] animationFilesNames = Directory.GetFiles("Content/Textures/Animations");
StreamReader reader;
foreach (var fileName in animationFilesNames)
{
if (!fileName.EndsWith(".animation")) continue;
reader = new StreamReader(fileName);
string json = reader.ReadToEnd();
AnimationContainer animation = JsonConvert.DeserializeObject<AnimationContainer>(json);

Some files were not shown because too many files have changed in this diff Show more