Merge branch 'main' of https://github.com/progtime-net/DangerousD
This commit is contained in:
commit
ba0135bf29
38 changed files with 1004 additions and 151 deletions
|
@ -140,7 +140,7 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:menuFon.jpg
|
/build:menuFon.jpg
|
||||||
|
|
||||||
#begin MenuFon2.jpg
|
#begin menuFon2.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
/processorParam:MakeSquare=False
|
/processorParam:MakeSquare=False
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:MenuFon2.jpg
|
/build:menuFon2.jpg
|
||||||
|
|
||||||
#begin menuFon3.jpg
|
#begin menuFon3.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
|
@ -200,6 +200,13 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
||||||
|
|
||||||
|
#begin PixelFont.spritefont
|
||||||
|
/importer:FontDescriptionImporter
|
||||||
|
/processor:FontDescriptionProcessor
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:TextureFormat=Compressed
|
||||||
|
/build:PixelFont.spritefont
|
||||||
|
|
||||||
#begin playerAnimation.png
|
#begin playerAnimation.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -248,7 +255,7 @@
|
||||||
/processorParam:Quality=Best
|
/processorParam:Quality=Best
|
||||||
/build:sounds/shotgun_shot.mp3
|
/build:sounds/shotgun_shot.mp3
|
||||||
|
|
||||||
#begin SmokeAnimation2.png
|
#begin smokeAnimation2.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
@ -258,7 +265,7 @@
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
/processorParam:MakeSquare=False
|
/processorParam:MakeSquare=False
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:SmokeAnimation2.png
|
/build:smokeAnimation2.png
|
||||||
|
|
||||||
#begin textboxbackground1-1.png
|
#begin textboxbackground1-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<tileset version="1.10" tiledversion="1.10.2" name="Door" tilewidth="32" tileheight="48" tilecount="2" columns="2">
|
<tileset version="1.10" tiledversion="1.10.2" name="Door" tilewidth="32" tileheight="48" tilecount="2" columns="2">
|
||||||
<image source="door.png" width="64" height="48"/>
|
<image source="doors.png" width="64" height="48"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
|
|
130
DangerousD/Content/LastLvl.tmx
Normal file
130
DangerousD/Content/LastLvl.tmx
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="7" nextobjectid="5">
|
||||||
|
<tileset firstgid="1" source="map.tsx"/>
|
||||||
|
<layer id="2" name="Platform" class="StopTile" width="30" height="20">
|
||||||
|
<data encoding="csv">
|
||||||
|
<chunk x="-32" y="0" width="16" height="16">
|
||||||
|
410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
</chunk>
|
||||||
|
<chunk x="-16" y="0" width="16" height="16">
|
||||||
|
410,410,410,410,410,410,410,410,410,410,410,410,410,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0
|
||||||
|
</chunk>
|
||||||
|
<chunk x="-32" y="16" width="16" height="16">
|
||||||
|
410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
</chunk>
|
||||||
|
<chunk x="-16" y="16" width="16" height="16">
|
||||||
|
410,410,410,410,410,410,410,410,410,410,410,410,410,410,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
</chunk>
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<layer id="3" name="BackGround" class="Tile" width="30" height="20">
|
||||||
|
<data encoding="csv">
|
||||||
|
<chunk x="-32" y="0" width="16" height="16">
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,376,375,369,370,388,389,726,390,369,370,376,389,376,388,726,
|
||||||
|
0,376,389,369,370,390,726,388,388,369,370,390,726,388,389,389,
|
||||||
|
0,388,726,369,370,390,377,375,377,369,370,431,389,389,431,431,
|
||||||
|
0,389,431,369,370,377,377,389,388,369,370,431,389,375,375,431,
|
||||||
|
0,377,377,369,370,390,376,389,431,369,370,375,375,726,388,390,
|
||||||
|
0,388,431,369,370,388,390,376,726,369,370,375,377,376,388,377,
|
||||||
|
0,388,375,369,370,376,375,377,388,369,370,376,375,389,388,431,
|
||||||
|
0,390,726,369,370,377,431,431,388,369,370,389,390,390,376,377,
|
||||||
|
0,377,376,369,370,389,377,431,376,369,370,389,431,726,431,388,
|
||||||
|
0,377,431,369,370,375,390,390,377,369,370,375,377,389,388,376,
|
||||||
|
0,390,390,369,370,431,376,389,390,369,370,390,431,376,389,390,
|
||||||
|
0,431,377,369,370,376,390,388,388,369,370,377,375,390,389,377,
|
||||||
|
0,390,726,369,370,375,377,726,390,369,370,389,376,388,388,375,
|
||||||
|
0,390,389,382,383,388,377,388,390,382,383,431,726,390,388,431,
|
||||||
|
0,389,377,395,396,389,431,377,431,395,396,375,388,726,376,389
|
||||||
|
</chunk>
|
||||||
|
<chunk x="-16" y="0" width="16" height="16">
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
389,388,375,369,370,388,377,389,389,369,370,390,375,0,0,0,
|
||||||
|
390,388,726,369,370,375,726,376,726,369,370,388,375,0,0,0,
|
||||||
|
388,389,431,369,370,726,377,726,431,369,370,377,375,0,0,0,
|
||||||
|
388,376,431,369,370,377,375,726,726,369,370,431,376,0,0,0,
|
||||||
|
376,389,388,369,370,377,390,431,389,369,370,376,431,0,0,0,
|
||||||
|
389,388,389,369,370,376,726,390,377,369,370,389,377,0,0,0,
|
||||||
|
431,377,389,369,370,431,726,726,389,369,370,431,390,0,0,0,
|
||||||
|
390,389,377,369,370,390,390,376,431,369,370,390,376,0,0,0,
|
||||||
|
388,388,377,369,370,388,431,390,388,369,370,389,377,0,0,0,
|
||||||
|
388,389,390,369,370,726,377,377,388,369,370,390,390,0,0,0,
|
||||||
|
388,376,390,369,370,377,377,389,726,369,370,375,726,0,0,0,
|
||||||
|
431,726,390,369,370,375,431,377,726,369,370,389,389,0,0,0,
|
||||||
|
390,388,726,369,370,389,375,390,388,369,370,377,726,0,0,0,
|
||||||
|
375,375,375,382,383,376,390,726,388,382,383,431,726,0,0,0,
|
||||||
|
389,389,390,395,396,390,390,726,390,395,396,431,390,0,0,0
|
||||||
|
</chunk>
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<objectgroup id="5" name="SilasMaster" class="LivingEntities.Monsters.SilasMaster">
|
||||||
|
<object id="1" x="-279.333" y="121.333">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
<objectgroup id="6" name="player" class="LivingEntities.Player">
|
||||||
|
<object id="3" x="-329.333" y="111.333">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
</map>
|
64
DangerousD/Content/PixelFont.spritefont
Normal file
64
DangerousD/Content/PixelFont.spritefont
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file contains an xml description of a font, and will be read by the XNA
|
||||||
|
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||||
|
of the font in your game, and to change the characters which are available to draw
|
||||||
|
with.
|
||||||
|
-->
|
||||||
|
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||||
|
<Asset Type="Graphics:FontDescription">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Modify this string to change the font that will be imported.
|
||||||
|
-->
|
||||||
|
<FontName>PublicPixel-z84yD.ttf</FontName>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Size is a float value, measured in points. Modify this value to change
|
||||||
|
the size of the font.
|
||||||
|
-->
|
||||||
|
<Size>12</Size>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Spacing is a float value, measured in pixels. Modify this value to change
|
||||||
|
the amount of spacing in between characters.
|
||||||
|
-->
|
||||||
|
<Spacing>0</Spacing>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||||
|
will be used when placing characters.
|
||||||
|
-->
|
||||||
|
<UseKerning>true</UseKerning>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||||
|
and "Bold, Italic", and are case sensitive.
|
||||||
|
-->
|
||||||
|
<Style>Regular</Style>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If you uncomment this line, the default character will be substituted if you draw
|
||||||
|
or measure text that contains characters which were not included in the font.
|
||||||
|
-->
|
||||||
|
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
CharacterRegions control what letters are available in the font. Every
|
||||||
|
character from Start to End will be built and made available for drawing. The
|
||||||
|
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||||
|
character set. The characters are ordered according to the Unicode standard.
|
||||||
|
See the documentation for more information.
|
||||||
|
-->
|
||||||
|
<CharacterRegions>
|
||||||
|
<CharacterRegion>
|
||||||
|
<Start> </Start>
|
||||||
|
<End>~</End>
|
||||||
|
</CharacterRegion>
|
||||||
|
<CharacterRegion>
|
||||||
|
<Start>а</Start>
|
||||||
|
<End>я</End>
|
||||||
|
</CharacterRegion>
|
||||||
|
</CharacterRegions>
|
||||||
|
</Asset>
|
||||||
|
</XnaContent>
|
BIN
DangerousD/Content/PublicPixel-z84yD.ttf
Normal file
BIN
DangerousD/Content/PublicPixel-z84yD.ttf
Normal file
Binary file not shown.
1
DangerousD/Content/animations/DeathFromSilasHand
Normal file
1
DangerousD/Content/animations/DeathFromSilasHand
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromSilasHand","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":295,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
1
DangerousD/Content/animations/playerShootUpLeft
Normal file
1
DangerousD/Content/animations/playerShootUpLeft
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"playerShootUpLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":267,"Y":34,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}
|
1
DangerousD/Content/animations/playerShootUpRight
Normal file
1
DangerousD/Content/animations/playerShootUpRight
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"playerShootUpRight","textureName":"playerAnimation","startSpriteRectangle":{"X":267,"Y":1,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="15" nextobjectid="80">
|
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="18" nextobjectid="105">
|
||||||
<tileset firstgid="1" name="map" tilewidth="16" tileheight="16" tilecount="871" columns="13">
|
<tileset firstgid="1" name="map" tilewidth="16" tileheight="16" tilecount="871" columns="13">
|
||||||
<image source="tiles.BMP" width="208" height="1072"/>
|
<image source="tiles.BMP" width="208" height="1072"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
|
@ -683,7 +683,7 @@
|
||||||
<object id="36" x="70" y="181">
|
<object id="36" x="70" y="181">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="37" x="20" y="87">
|
<object id="37" x="39.3333" y="87.6667">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="38" x="99.5" y="84.5">
|
<object id="38" x="99.5" y="84.5">
|
||||||
|
@ -698,13 +698,47 @@
|
||||||
<object id="41" x="582" y="83">
|
<object id="41" x="582" y="83">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
|
<object id="80" x="-139.333" y="84">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="81" x="620.667" y="180">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="103" x="-96.6667" y="270">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="104" x="693.333" y="477.333">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
<objectgroup id="15" name="Monster" class="LivingEntities.Monsters">
|
||||||
|
<object id="82" type="FlameSkull" x="68.6667" y="279.333">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="97" type="Werewolf" x="536" y="88.6667">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
<objectgroup id="17" name="Hunchman" class="LivingEntities.Monsters.Hunchman">
|
||||||
|
<object id="98" x="-92" y="144">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="99" x="115.333" y="182">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="100" x="191.333" y="277.333">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="101" x="249.333" y="88.6667">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="10" name="Player" class="LivingEntities.Player">
|
<objectgroup id="10" name="Player" class="LivingEntities.Player">
|
||||||
<object id="47" x="-500" y="461.333">
|
<object id="47" x="-500" y="461.333">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="12" name="Doors" class="Entities.Door">
|
<objectgroup id="12" name="Doors" class="Entities.Door" visible="0">
|
||||||
<object id="69" gid="873" x="640" y="64" width="32" height="48"/>
|
<object id="69" gid="873" x="640" y="64" width="32" height="48"/>
|
||||||
<object id="70" gid="872" x="672" y="192" width="32" height="48"/>
|
<object id="70" gid="872" x="672" y="192" width="32" height="48"/>
|
||||||
<object id="71" gid="872" x="672" y="288" width="32" height="48"/>
|
<object id="71" gid="872" x="672" y="288" width="32" height="48"/>
|
||||||
|
|
Before Width: | Height: | Size: 464 KiB After Width: | Height: | Size: 464 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
@ -1,8 +1,14 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
|
using MonogameLibrary.UI.Elements;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GUI;
|
namespace DangerousD.GameCore.GUI;
|
||||||
|
|
||||||
|
@ -10,6 +16,10 @@ public abstract class AbstractGui : IDrawableObject
|
||||||
{
|
{
|
||||||
protected UIManager Manager = new();
|
protected UIManager Manager = new();
|
||||||
protected List<DrawableUIElement> Elements = new();
|
protected List<DrawableUIElement> Elements = new();
|
||||||
|
private List<DrawableUIElement> ActiveElements;
|
||||||
|
protected DrawableUIElement SelectedElement;
|
||||||
|
private bool isStartedPrint = false;
|
||||||
|
private bool isPressed = false;
|
||||||
|
|
||||||
public AbstractGui()
|
public AbstractGui()
|
||||||
{
|
{
|
||||||
|
@ -21,6 +31,16 @@ public abstract class AbstractGui : IDrawableObject
|
||||||
{
|
{
|
||||||
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||||
CreateUI();
|
CreateUI();
|
||||||
|
ActiveElements = new List<DrawableUIElement>();
|
||||||
|
foreach (var element in Elements)
|
||||||
|
{
|
||||||
|
if (CheckOnBadElements(element))
|
||||||
|
{
|
||||||
|
ActiveElements.Add(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ActiveElements.Count > 0) { SelectedElement = ActiveElements.First(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void LoadContent()
|
public virtual void LoadContent()
|
||||||
|
@ -30,11 +50,163 @@ public abstract class AbstractGui : IDrawableObject
|
||||||
|
|
||||||
public virtual void Update(GameTime gameTime)
|
public virtual void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
string state = AppManager.Instance.InputManager.currentControlsState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (ActiveElements.Count != 0)
|
||||||
|
{
|
||||||
|
if (state == "Gamepad")
|
||||||
|
{
|
||||||
|
GamePadState gamePadState = GamePad.GetState(0);
|
||||||
|
GamepadInput(gamePadState);
|
||||||
|
}
|
||||||
|
else if (state == "Keyboard" || state == "Mouse")
|
||||||
|
{
|
||||||
|
KeyboardState keyBoardState = Keyboard.GetState();
|
||||||
|
KeyBoardInput(keyBoardState);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Manager.Update(gameTime);
|
Manager.Update(gameTime);
|
||||||
|
|
||||||
|
if (SelectedElement is not null)
|
||||||
|
{
|
||||||
|
if (SelectedElement is Button)
|
||||||
|
{
|
||||||
|
(SelectedElement as Button).hoverState = MonogameLibrary.UI.Enums.HoverState.Hovering;
|
||||||
|
}
|
||||||
|
if (SelectedElement is ButtonText)
|
||||||
|
{
|
||||||
|
(SelectedElement as ButtonText).hoverState = MonogameLibrary.UI.Enums.HoverState.Hovering;
|
||||||
|
}
|
||||||
|
if (SelectedElement is TextBox)
|
||||||
|
{
|
||||||
|
TextBox box = (TextBox)SelectedElement;
|
||||||
|
box.hoverState = MonogameLibrary.UI.Enums.HoverState.Hovering;
|
||||||
|
if (isStartedPrint)
|
||||||
|
{
|
||||||
|
box.SelectIt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Draw(SpriteBatch spriteBatch)
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
Manager.Draw(spriteBatch);
|
Manager.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
protected virtual void GamepadInput(GamePadState gamePadState)
|
||||||
|
{
|
||||||
|
if (gamePadState.DPad.Up == ButtonState.Pressed && !isPressed)
|
||||||
|
{
|
||||||
|
isPressed = true;
|
||||||
|
ChangeSelectedElement(-1);
|
||||||
|
Debug.WriteLine("switch");
|
||||||
|
}
|
||||||
|
else if (gamePadState.DPad.Down == ButtonState.Pressed && !isPressed)
|
||||||
|
{
|
||||||
|
isPressed = true;
|
||||||
|
ChangeSelectedElement(1);
|
||||||
|
}
|
||||||
|
else if (gamePadState.Buttons.A == ButtonState.Pressed && !isPressed)
|
||||||
|
{
|
||||||
|
isPressed = true;
|
||||||
|
if (SelectedElement is Button)
|
||||||
|
{
|
||||||
|
Button button = SelectedElement as Button;
|
||||||
|
button.CallLeftBtnEvent();
|
||||||
|
}
|
||||||
|
else if (SelectedElement is TextBox)
|
||||||
|
{
|
||||||
|
TextBox textBox = SelectedElement as TextBox;
|
||||||
|
isStartedPrint = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isPressed && (gamePadState.Buttons.A == ButtonState.Released &&
|
||||||
|
gamePadState.DPad.Down == ButtonState.Released &&
|
||||||
|
gamePadState.DPad.Up == ButtonState.Released))
|
||||||
|
{
|
||||||
|
isPressed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected virtual void KeyBoardInput(KeyboardState keyboardState)
|
||||||
|
{
|
||||||
|
if (keyboardState.IsKeyDown(Keys.Up) && !isPressed)
|
||||||
|
{
|
||||||
|
isPressed = true;
|
||||||
|
isStartedPrint = false;
|
||||||
|
ChangeSelectedElement(-1);
|
||||||
|
}
|
||||||
|
else if (keyboardState.IsKeyDown(Keys.Down) && !isPressed)
|
||||||
|
{
|
||||||
|
isPressed = true;
|
||||||
|
isStartedPrint = false;
|
||||||
|
ChangeSelectedElement(1);
|
||||||
|
}
|
||||||
|
else if (keyboardState.IsKeyDown(Keys.Enter) && !isPressed)
|
||||||
|
{
|
||||||
|
isPressed = true;
|
||||||
|
if (SelectedElement is Button)
|
||||||
|
{
|
||||||
|
Button button = SelectedElement as Button;
|
||||||
|
button.CallLeftBtnEvent();
|
||||||
|
}
|
||||||
|
else if (SelectedElement is TextBox)
|
||||||
|
{
|
||||||
|
TextBox textBox = SelectedElement as TextBox;
|
||||||
|
isStartedPrint = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isPressed && (keyboardState.IsKeyUp(Keys.Enter) &&
|
||||||
|
keyboardState.IsKeyUp(Keys.Down) &&
|
||||||
|
keyboardState.IsKeyUp(Keys.Up)))
|
||||||
|
{
|
||||||
|
isPressed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeSelectedElement(int x) // Меняет выбранный элемент
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ActiveElements.Count; i++)
|
||||||
|
{
|
||||||
|
if (ActiveElements[i] == SelectedElement)
|
||||||
|
{
|
||||||
|
if (i + x >= ActiveElements.Count)
|
||||||
|
{
|
||||||
|
SelectedElement = ActiveElements.First();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (i + x < 0)
|
||||||
|
{
|
||||||
|
SelectedElement = ActiveElements.Last();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedElement = ActiveElements[i + x];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool CheckOnBadElements(DrawableUIElement element)
|
||||||
|
{
|
||||||
|
if (element is Button)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (element is ButtonText)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (element is TextBox)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -13,17 +13,29 @@ internal class DeathGUI : AbstractGui
|
||||||
{
|
{
|
||||||
int wigth = AppManager.Instance.inGameResolution.X;
|
int wigth = AppManager.Instance.inGameResolution.X;
|
||||||
int height = AppManager.Instance.inGameResolution.Y;
|
int height = AppManager.Instance.inGameResolution.Y;
|
||||||
|
float scaler = AppManager.Instance.inGameResolution.Y / (float)AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "deathBackground" };
|
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "deathBackground" };
|
||||||
Elements.Add(menuBackground);
|
Elements.Add(menuBackground);
|
||||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, (height - 50) / 2 - 80, 50, 50), text = "You death", mainColor = Color.Transparent, scale = 0.7f, fontName = "ButtonFont", fontColor = Color.White });
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, (height - 50) / 2 - 80, 50, 50), text = "You died", mainColor = Color.Transparent, scale = 0.7f, fontName = "ButtonFont", fontColor = Color.White });
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, (height - 50) / 2, 50, 50), text = $"Score = {0}", mainColor = Color.Transparent, scale = 0.7f, fontName = "ButtonFont", fontColor = Color.White });
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, (height - 50) / 2, 50, 50), text = $"Score: {0}", mainColor = Color.Transparent, scale = 0.7f, fontName = "ButtonFont", fontColor = Color.White });
|
||||||
var butMenu = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, (height - 50) / 2 + 80, 300, 50), text = "Back to menu", scale = 0.7f, fontName = "ButtonFont" };
|
var butMenu = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, (height - 50) / 2 + 80, 300, 50), text = "Back to menu", scale = 0.7f, fontName = "ButtonFont" };
|
||||||
Elements.Add(butMenu);
|
Elements.Add(butMenu);
|
||||||
butMenu.LeftButtonPressed += () =>
|
butMenu.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
};
|
};
|
||||||
|
foreach (var item in Elements)
|
||||||
|
{
|
||||||
|
item.rectangle.X = (int)(scaler * item.rectangle.X);
|
||||||
|
item.rectangle.Y = (int)(scaler * item.rectangle.Y);
|
||||||
|
item.rectangle.Width = (int)(scaler * item.rectangle.Width);
|
||||||
|
item.rectangle.Height = (int)(scaler * item.rectangle.Height);
|
||||||
|
if (item is DrawableTextedUiElement)
|
||||||
|
{
|
||||||
|
(item as DrawableTextedUiElement).scale *= scaler;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
|
|
|
@ -6,34 +6,84 @@ using System.Xml.Linq;
|
||||||
using DangerousD.GameCore.Managers;
|
using DangerousD.GameCore.Managers;
|
||||||
using DangerousD.GameCore;
|
using DangerousD.GameCore;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using static System.Formats.Asn1.AsnWriter;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GUI
|
namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
public class HUD : AbstractGui
|
public class HUD : IDrawableObject
|
||||||
{
|
{
|
||||||
List<Rect> rects = new List<Rect> { };
|
|
||||||
int wigth = AppManager.Instance.inGameResolution.X;
|
int wigth = AppManager.Instance.inGameResolution.X;
|
||||||
int height = AppManager.Instance.inGameResolution.Y;
|
int height = AppManager.Instance.inGameResolution.Y;
|
||||||
protected override void CreateUI()
|
float scaler = AppManager.Instance.inGameResolution.Y / (float)AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
{
|
Texture2D texture;
|
||||||
DrawableUIElement background = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), mainColor = Color.Transparent };
|
SpriteFont spriteFont;
|
||||||
Elements.Add(background);
|
|
||||||
Rect rect = new Rect(Manager) { rectangle = new Rectangle(wigth / 35, height / 35, 120, 70), mainColor = Color.DarkRed };
|
|
||||||
Elements.Add(rect);
|
|
||||||
Label label = new Label(Manager) { rectangle = new Rectangle(wigth / 34, height / 30, 120, 20), text = "ammout", fontName = "font2", scale = 0.2f, mainColor = Color.Transparent, fontColor = Color.Black };
|
|
||||||
Elements.Add(label);
|
|
||||||
|
|
||||||
}
|
public void Draw(SpriteBatch spriteBatch)
|
||||||
public override void Update(GameTime gameTime)
|
|
||||||
{
|
{
|
||||||
rects.Clear();
|
spriteBatch.Begin();
|
||||||
for (int i = 0; i < AppManager.Instance.GameManager.GetPlayer1.Bullets; i++)
|
spriteBatch.Draw(texture, new Rectangle(
|
||||||
|
(int)((wigth / 35 - 2) * scaler),
|
||||||
|
(int)((height / 35 - 2) * scaler),
|
||||||
|
(int)((120 + 2) * scaler),
|
||||||
|
(int)((70 + 2) * scaler)), Color.DarkRed);
|
||||||
|
spriteBatch.DrawString(spriteFont, "AMMO", new Vector2((wigth / 34 + 4)* scaler, height / 30 - 6), Color.Gray, 0, Vector2.Zero, 1.8f, SpriteEffects.None, 0);
|
||||||
|
spriteBatch.DrawString(spriteFont, "AMMO", new Vector2((wigth / 34 + 1 )* scaler, height / 30 - 6), Color.White, 0, Vector2.Zero, 1.8f, SpriteEffects.None, 0);
|
||||||
|
for (int i = 1; i < 6; i++)
|
||||||
{
|
{
|
||||||
rects.Add(new Rect(Manager) { rectangle = new Rectangle(wigth / 29 + i * 13, height / 17, 5, 20), mainColor = Color.Yellow });
|
if (i <= AppManager.Instance.GameManager.players[0].Bullets)
|
||||||
rects[i].LoadTexture(AppManager.Instance.Content);
|
{
|
||||||
|
spriteBatch.Draw(texture, new Rectangle((int)((wigth / 30 + i * 13 + 2) * scaler), (int)((height / 17 + 4) * scaler), (int)((5) * scaler), (int)((20) * scaler)), new Color(0.8f, 0.8f, 0, 1f));
|
||||||
|
spriteBatch.Draw(texture, new Rectangle((int)((wigth / 30 + i * 13) * scaler), (int)((height / 17 + 4) * scaler), (int)((5) * scaler), (int)((20) * scaler)), Color.Yellow);
|
||||||
}
|
}
|
||||||
base.Update(gameTime);
|
else
|
||||||
|
{
|
||||||
|
spriteBatch.Draw(texture, new Rectangle(wigth / 30 + i * 13, height / 17 + 4, 7, 20), new Color(0.2f, 0.2f, 0, 1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
spriteBatch.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
texture = new Texture2D(AppManager.Instance.GraphicsDevice, 1, 1);
|
||||||
|
texture.SetData<Color>(new Color[] { Color.White });
|
||||||
|
spriteFont = AppManager.Instance.Content.Load<SpriteFont>("PixelFont");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//public class HUD1 : AbstractGui
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// protected override void CreateUI()
|
||||||
|
// {
|
||||||
|
// DrawableUIElement background = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), mainColor = Color.Transparent };
|
||||||
|
// Elements.Add(background);
|
||||||
|
// Rect rect = new Rect(Manager) { rectangle = new Rectangle(wigth / 35, height / 35, 120, 70), mainColor = Color.DarkRed };
|
||||||
|
// Elements.Add(rect);
|
||||||
|
// Label label = new Label(Manager) { rectangle = new Rectangle(wigth / 34, height / 30, 120, 20), text = "ammout", fontName = "font2", scale = 0.2f, mainColor = Color.Transparent, fontColor = Color.Black };
|
||||||
|
// Elements.Add(label);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// public override void Update(GameTime gameTime)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// rects.Clear();
|
||||||
|
// for (int i = 0; i < ammout; i++)
|
||||||
|
// {
|
||||||
|
// rects.Add(new Rect(Manager) { rectangle = new Rectangle(wigth / 29 + i * 13, height / 17, 5, 20), mainColor = Color.Yellow });
|
||||||
|
// rects[i].LoadTexture(AppManager.Instance.Content);
|
||||||
|
// }
|
||||||
|
// base.Update(gameTime);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
int screenWidth = AppManager.Instance.inGameResolution.X;
|
int screenWidth = AppManager.Instance.inGameResolution.X;
|
||||||
int screenHeight = AppManager.Instance.inGameResolution.Y;
|
int screenHeight = AppManager.Instance.inGameResolution.Y;
|
||||||
|
float scaler = AppManager.Instance.inGameResolution.Y / (float)AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
|
|
||||||
var lobbyBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, screenWidth, screenHeight), textureName = "menuFon3" };
|
var lobbyBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, screenWidth, screenHeight), textureName = "menuFon3" };
|
||||||
Elements.Add(lobbyBackground);
|
Elements.Add(lobbyBackground);
|
||||||
|
@ -51,6 +52,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
textureName = "textboxbackground6-1"
|
textureName = "textboxbackground6-1"
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Elements.Add(searchBarTextBox);
|
||||||
searchBarTextBox.TextChanged += input => {
|
searchBarTextBox.TextChanged += input => {
|
||||||
if (searchBarTextBox.fontColor == Color.Gray)
|
if (searchBarTextBox.fontColor == Color.Gray)
|
||||||
{
|
{
|
||||||
|
@ -73,6 +75,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "font2",
|
fontName = "font2",
|
||||||
textureName = "textboxbackground1-1"
|
textureName = "textboxbackground1-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(backButton);
|
||||||
backButton.LeftButtonPressed += () => {
|
backButton.LeftButtonPressed += () => {
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
};
|
};
|
||||||
|
@ -86,6 +89,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "buttonFont",
|
fontName = "buttonFont",
|
||||||
textureName = "textboxbackground2-1"
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(hostButton);
|
||||||
hostButton.LeftButtonPressed += () => {
|
hostButton.LeftButtonPressed += () => {
|
||||||
AppManager.Instance.ChangeGameState(GameState.Game);
|
AppManager.Instance.ChangeGameState(GameState.Game);
|
||||||
AppManager.Instance.NetworkManager.HostInit(AppManager.Instance.IpAddress);
|
AppManager.Instance.NetworkManager.HostInit(AppManager.Instance.IpAddress);
|
||||||
|
@ -101,6 +105,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "buttonFont",
|
fontName = "buttonFont",
|
||||||
textureName = "textboxbackground2-1"
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(refreshButton);
|
||||||
refreshButton.LeftButtonPressed += () => {
|
refreshButton.LeftButtonPressed += () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -114,6 +119,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "buttonFont",
|
fontName = "buttonFont",
|
||||||
textureName = "textboxbackground2-1"
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(joinSelectedButton);
|
||||||
joinSelectedButton.LeftButtonPressed += () => {
|
joinSelectedButton.LeftButtonPressed += () => {
|
||||||
AppManager.Instance.ChangeGameState(GameState.Game);
|
AppManager.Instance.ChangeGameState(GameState.Game);
|
||||||
AppManager.Instance.NetworkManager.ClientInit(AppManager.Instance.IpAddress);
|
AppManager.Instance.NetworkManager.ClientInit(AppManager.Instance.IpAddress);
|
||||||
|
@ -127,10 +133,25 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "buttonFont",
|
fontName = "buttonFont",
|
||||||
textureName = "textboxbackground2-1"
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(joinByIpButton);
|
||||||
joinByIpButton.LeftButtonPressed += () => {
|
joinByIpButton.LeftButtonPressed += () => {
|
||||||
AppManager.Instance.NetworkManager.ClientInit(searchBarTextBox.text);
|
AppManager.Instance.NetworkManager.ClientInit(searchBarTextBox.text);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in Elements)
|
||||||
|
{
|
||||||
|
item.rectangle.X = (int)(scaler * item.rectangle.X);
|
||||||
|
item.rectangle.Y = (int)(scaler * item.rectangle.Y);
|
||||||
|
item.rectangle.Width = (int)(scaler * item.rectangle.Width);
|
||||||
|
item.rectangle.Height = (int)(scaler * item.rectangle.Height);
|
||||||
|
if (item is DrawableTextedUiElement)
|
||||||
|
{
|
||||||
|
(item as DrawableTextedUiElement).scale *= scaler;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
int screenWidth = AppManager.Instance.inGameResolution.X;
|
int screenWidth = AppManager.Instance.inGameResolution.X;
|
||||||
int screenHeight = AppManager.Instance.inGameResolution.Y;
|
int screenHeight = AppManager.Instance.inGameResolution.Y;
|
||||||
|
float scaler = AppManager.Instance.inGameResolution.Y / (float)AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
|
|
||||||
var loginBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, screenWidth, screenHeight), textureName = "menuFon2" };
|
var loginBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, screenWidth, screenHeight), textureName = "menuFon2" };
|
||||||
Elements.Add(loginBackground);
|
Elements.Add(loginBackground);
|
||||||
|
@ -40,6 +41,19 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "ButtonFont"
|
fontName = "ButtonFont"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button backButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, (int)(40 * 2.4), (int)(40 * 2.4)),
|
||||||
|
fontColor = Color.Black,
|
||||||
|
fontName = "font2",
|
||||||
|
textureName = "textboxbackground1-1"
|
||||||
|
};
|
||||||
|
backButton.LeftButtonPressed += () => {
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
|
};
|
||||||
|
Elements.Add(backButton);
|
||||||
|
|
||||||
|
|
||||||
// TextBox-ы
|
// TextBox-ы
|
||||||
{
|
{
|
||||||
TextBox loginTextBox = new TextBox(Manager)
|
TextBox loginTextBox = new TextBox(Manager)
|
||||||
|
@ -53,6 +67,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
textureName = "textboxbackground6-1"
|
textureName = "textboxbackground6-1"
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Elements.Add(loginTextBox);
|
||||||
loginTextBox.LoadTexture(AppManager.Instance.Content);
|
loginTextBox.LoadTexture(AppManager.Instance.Content);
|
||||||
loginTextBox.TextChanged += input => {
|
loginTextBox.TextChanged += input => {
|
||||||
if (loginTextBox.fontColor == Color.Gray)
|
if (loginTextBox.fontColor == Color.Gray)
|
||||||
|
@ -67,6 +82,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
loginTextBox.fontColor = Color.Gray;
|
loginTextBox.fontColor = Color.Gray;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Elements.Add(loginTextBox);
|
||||||
|
|
||||||
TextBox passwordTextBox = new TextBox(Manager)
|
TextBox passwordTextBox = new TextBox(Manager)
|
||||||
{
|
{
|
||||||
|
@ -78,6 +94,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
textAligment = TextAligment.Left,
|
textAligment = TextAligment.Left,
|
||||||
textureName = "textboxbackground6-1"
|
textureName = "textboxbackground6-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(passwordTextBox);
|
||||||
passwordTextBox.LoadTexture(AppManager.Instance.Content);
|
passwordTextBox.LoadTexture(AppManager.Instance.Content);
|
||||||
passwordTextBox.TextChanged += input => {
|
passwordTextBox.TextChanged += input => {
|
||||||
if (passwordTextBox.fontColor == Color.Gray)
|
if (passwordTextBox.fontColor == Color.Gray)
|
||||||
|
@ -92,6 +109,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
passwordTextBox.fontColor = Color.Gray;
|
passwordTextBox.fontColor = Color.Gray;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Elements.Add(passwordTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Кнопки
|
// Кнопки
|
||||||
|
@ -104,12 +122,14 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "ButtonFont",
|
fontName = "ButtonFont",
|
||||||
textureName = "textboxbackground2-1"
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(logButton);
|
||||||
logButton.LeftButtonPressed += () => {
|
logButton.LeftButtonPressed += () => {
|
||||||
if (CheckUser())
|
if (CheckUser())
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Lobby);
|
AppManager.Instance.ChangeGameState(GameState.Lobby);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Elements.Add(logButton);
|
||||||
|
|
||||||
Button regButton = new Button(Manager)
|
Button regButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
|
@ -120,20 +140,22 @@ namespace DangerousD.GameCore.GUI
|
||||||
fontName = "ButtonFont",
|
fontName = "ButtonFont",
|
||||||
textureName = "textboxbackground2-1"
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
|
Elements.Add(regButton);
|
||||||
regButton.LeftButtonPressed += GoToRegWebServer;
|
regButton.LeftButtonPressed += GoToRegWebServer;
|
||||||
|
Elements.Add(regButton);
|
||||||
|
|
||||||
Button backButton = new Button(Manager)
|
|
||||||
|
}
|
||||||
|
foreach (var item in Elements)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, (int)(40 * 2.4), (int)(40 * 2.4)),
|
item.rectangle.X = (int)(scaler * item.rectangle.X);
|
||||||
text = "<-",
|
item.rectangle.Y = (int)(scaler * item.rectangle.Y);
|
||||||
scale = 0.72f,
|
item.rectangle.Width = (int)(scaler * item.rectangle.Width);
|
||||||
fontColor = Color.Black,
|
item.rectangle.Height = (int)(scaler * item.rectangle.Height);
|
||||||
fontName = "font2",
|
if (item is DrawableTextedUiElement)
|
||||||
textureName = "textboxbackground1-1"
|
{
|
||||||
};
|
(item as DrawableTextedUiElement).scale *= scaler;
|
||||||
backButton.LeftButtonPressed += () => {
|
}
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,9 @@ internal class MenuGUI : AbstractGui
|
||||||
List<Vector2> BigLetterPositions = new List<Vector2>();
|
List<Vector2> BigLetterPositions = new List<Vector2>();
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int wigth = AppManager.Instance.inGameResolution.X;
|
int wigth = AppManager.Instance.inGameHUDHelperResolution.X;
|
||||||
int height = AppManager.Instance.inGameResolution.Y;
|
int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
|
float scaler = AppManager.Instance.inGameResolution.Y / (float)AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
|
|
||||||
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "menuFon" };
|
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "menuFon" };
|
||||||
Elements.Add(menuBackground);
|
Elements.Add(menuBackground);
|
||||||
|
@ -50,6 +51,7 @@ internal class MenuGUI : AbstractGui
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Game);
|
AppManager.Instance.ChangeGameState(GameState.Game);
|
||||||
AppManager.Instance.SetMultiplayerState(MultiPlayerStatus.SinglePlayer);
|
AppManager.Instance.SetMultiplayerState(MultiPlayerStatus.SinglePlayer);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var butMulti = new ButtonText(Manager) { rectangle = new Rectangle((wigth - (int)(300 * 2.4)) / 2, 470, (int)(300 * 2.4), (int)(50 * 2.4)), text = "Multiplayer", scale = 1.2f, fontName = "ButtonFont" };
|
var butMulti = new ButtonText(Manager) { rectangle = new Rectangle((wigth - (int)(300 * 2.4)) / 2, 470, (int)(300 * 2.4), (int)(50 * 2.4)), text = "Multiplayer", scale = 1.2f, fontName = "ButtonFont" };
|
||||||
|
@ -72,6 +74,18 @@ internal class MenuGUI : AbstractGui
|
||||||
{
|
{
|
||||||
AppManager.Instance.Exit();
|
AppManager.Instance.Exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
foreach ( var item in Elements)
|
||||||
|
{
|
||||||
|
item.rectangle.X = (int)(scaler * item.rectangle.X);
|
||||||
|
item.rectangle.Y = (int)(scaler * item.rectangle.Y);
|
||||||
|
item.rectangle.Width = (int)(scaler * item.rectangle.Width);
|
||||||
|
item.rectangle.Height = (int)(scaler * item.rectangle.Height);
|
||||||
|
if (item is DrawableTextedUiElement)
|
||||||
|
{
|
||||||
|
(item as DrawableTextedUiElement).scale *= scaler;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,11 @@ namespace DangerousD.GameCore.GUI
|
||||||
int selectedGUI = 0;
|
int selectedGUI = 0;
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int wigth = AppManager.Instance.inGameResolution.X;
|
int wigth = AppManager.Instance.inGameHUDHelperResolution.X;
|
||||||
int height = AppManager.Instance.inGameResolution.Y;
|
int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
|
float scaler = AppManager.Instance.inGameResolution.Y / (float)AppManager.Instance.inGameHUDHelperResolution.Y;
|
||||||
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "optionsBackground" };
|
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "optionsBackground" };
|
||||||
Elements.Add(menuBackground);
|
//Elements.Add(menuBackground);
|
||||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
var slider = new Slider(Manager)
|
var slider = new Slider(Manager)
|
||||||
|
@ -27,6 +28,8 @@ namespace DangerousD.GameCore.GUI
|
||||||
indentation = 5,
|
indentation = 5,
|
||||||
textureName = "sliderBackground"
|
textureName = "sliderBackground"
|
||||||
};
|
};
|
||||||
|
//Elements.Add(slider);
|
||||||
|
//AppManager.Instance.SettingsManager.SetMainVolume(slider.GetSliderValue);
|
||||||
|
|
||||||
var cB = new CheckBox(Manager);
|
var cB = new CheckBox(Manager);
|
||||||
cB.rectangle = new Rectangle(wigth / 2 + 440, 405, (int)(40 * 2.4), (int)(40 * 2.4));
|
cB.rectangle = new Rectangle(wigth / 2 + 440, 405, (int)(40 * 2.4), (int)(40 * 2.4));
|
||||||
|
@ -35,26 +38,28 @@ namespace DangerousD.GameCore.GUI
|
||||||
SettingsManager sM = new SettingsManager();
|
SettingsManager sM = new SettingsManager();
|
||||||
};
|
};
|
||||||
cB.LoadTexture(AppManager.Instance.Content);
|
cB.LoadTexture(AppManager.Instance.Content);
|
||||||
|
Elements.Add(cB);
|
||||||
|
|
||||||
var checkBox = new CheckBox(Manager);
|
var checkBox = new CheckBox(Manager);
|
||||||
checkBox.rectangle = new Rectangle(wigth / 2 + 360, 540, (int)(40 * 2.4), (int)(40 * 2.4));
|
checkBox.rectangle = new Rectangle(wigth / 2 + 360, 540, (int)(40 * 2.4), (int)(40 * 2.4));
|
||||||
checkBox.Checked += (newCheckState) =>
|
checkBox.Checked += (newCheckState) =>
|
||||||
{
|
{
|
||||||
SettingsManager sM = new SettingsManager();
|
AppManager.Instance.SettingsManager.SetIsFullScreen(newCheckState);
|
||||||
};
|
};
|
||||||
checkBox.LoadTexture(AppManager.Instance.Content);
|
checkBox.LoadTexture(AppManager.Instance.Content);
|
||||||
|
Elements.Add(checkBox);
|
||||||
|
|
||||||
Label lblOptions = new Label(Manager)
|
Label lblOptions = new Label(Manager)
|
||||||
{ fontName = "buttonFont", scale = 1.2f, text = "Options", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 40, 50, 50), mainColor = Color.Transparent };
|
{ fontName = "buttonFont", scale = 1.2f, text = "Options", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 40, 50, 50), mainColor = Color.Transparent };
|
||||||
Elements.Add(lblOptions);
|
Elements.Add(lblOptions);
|
||||||
|
|
||||||
Label lblValue = new Label(Manager)
|
Label lblValue = new Label(Manager)
|
||||||
{ fontName = "buttonFont", scale = 1f, text = "Volume", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 250, 50, 50), mainColor = Color.Transparent };
|
{ fontName = "buttonFont", scale = 1f , text = "Volume", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 250, 50, 50), mainColor = Color.Transparent };
|
||||||
Elements.Add(lblValue);
|
Elements.Add(lblValue);
|
||||||
|
|
||||||
Label lblIsFullScreen = new Label(Manager)
|
Label lblIsFullScreen = new Label(Manager)
|
||||||
{ fontName = "buttonFont", scale = 1f, text = "Full Screen", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 580, 50, 50), mainColor = Color.Transparent };
|
{ fontName = "buttonFont", scale = 1f , text = "Full Screen", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 580, 50, 50), mainColor = Color.Transparent };
|
||||||
Elements.Add(lblOptions);
|
Elements.Add(lblIsFullScreen);
|
||||||
|
|
||||||
Label lblSwitchMode = new Label(Manager)
|
Label lblSwitchMode = new Label(Manager)
|
||||||
{ fontName = "buttonFont", scale = 1f, text = "Left/Right Mode", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 415, 50, 50), mainColor = Color.Transparent };
|
{ fontName = "buttonFont", scale = 1f, text = "Left/Right Mode", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 415, 50, 50), mainColor = Color.Transparent };
|
||||||
|
@ -67,6 +72,26 @@ namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
foreach (var item in Elements)
|
||||||
|
{
|
||||||
|
item.rectangle.X = (int)(scaler * item.rectangle.X);
|
||||||
|
item.rectangle.Y = (int)(scaler * item.rectangle.Y);
|
||||||
|
item.rectangle.Width = (int)(scaler * item.rectangle.Width);
|
||||||
|
item.rectangle.Height = (int)(scaler * item.rectangle.Height);
|
||||||
|
if (item is DrawableTextedUiElement)
|
||||||
|
{
|
||||||
|
(item as DrawableTextedUiElement).scale *= scaler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
slider.rectangle.X = (int)(scaler * slider.rectangle.X);
|
||||||
|
slider.rectangle.Y = (int)(scaler * slider.rectangle.Y);
|
||||||
|
//slider.rectangle.Width = (int)(scaler * slider.rectangle.Width);
|
||||||
|
//slider.rectangle.Height = (int)(scaler * slider.rectangle.Height);
|
||||||
|
if (slider is DrawableTextedUiElement)
|
||||||
|
{
|
||||||
|
(slider as DrawableTextedUiElement).scale *= scaler;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
public override void OnCollision(GameObject gameObject)
|
public override void OnCollision(GameObject gameObject)
|
||||||
{
|
{
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
|
if (this is not TeleportingDoor)
|
||||||
|
{
|
||||||
if (gameObject is Player)
|
if (gameObject is Player)
|
||||||
{
|
{
|
||||||
Player player = (Player)gameObject;
|
Player player = (Player)gameObject;
|
||||||
|
@ -47,5 +49,7 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using DangerousD.GameCore.Graphics;
|
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||||
|
using DangerousD.GameCore.Graphics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
@ -14,11 +15,14 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
{
|
{
|
||||||
|
|
||||||
private Vector2 v;
|
private Vector2 v;
|
||||||
|
public string name;
|
||||||
public SilasBall(Vector2 position) : base(position)
|
public SilasBall(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
Height = 24;
|
Height = 24;
|
||||||
Width = 24;
|
Width = 24;
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
|
name = "SilasHand";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public SilasBall(Vector2 position, Vector2 velosity) : base(position)
|
public SilasBall(Vector2 position, Vector2 velosity) : base(position)
|
||||||
|
@ -28,6 +32,7 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
velocity = velosity;
|
velocity = velosity;
|
||||||
v = velosity;
|
v = velosity;
|
||||||
|
name = "SilasHand";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,5 +53,21 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void Attack()
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.GetPlayer1.Death(name);
|
||||||
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
base.OnCollision(gameObject);
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
54
DangerousD/GameCore/GameObjects/Entities/TeleportingDoor.cs
Normal file
54
DangerousD/GameCore/GameObjects/Entities/TeleportingDoor.cs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
|
{
|
||||||
|
internal class TeleportingDoor : Door
|
||||||
|
{
|
||||||
|
public Vector2 Target;
|
||||||
|
public bool IsVisible = true;
|
||||||
|
public Action action;
|
||||||
|
public TeleportingDoor(Vector2 position, Vector2 size, Rectangle sourceRectangle, Vector2 target, Action action) : base(position, size, sourceRectangle)
|
||||||
|
{
|
||||||
|
Target = target;
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (IsVisible)
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
Player player = (Player)gameObject;
|
||||||
|
if (player.isUping)
|
||||||
|
{
|
||||||
|
IsVisible = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
Player player = (Player)gameObject;
|
||||||
|
if (player.isUping)
|
||||||
|
{
|
||||||
|
player.SetPosition(Target);
|
||||||
|
if (action!=null)
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ namespace DangerousD.GameCore
|
||||||
protected Vector2 _pos;
|
protected Vector2 _pos;
|
||||||
public Vector2 Pos => _pos;
|
public Vector2 Pos => _pos;
|
||||||
public int id;
|
public int id;
|
||||||
|
public bool isChildEntity = false;
|
||||||
public bool isIdFromHost = false;
|
public bool isIdFromHost = false;
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
|
@ -63,9 +64,7 @@ namespace DangerousD.GameCore
|
||||||
if (AppManager.Instance.InputManager.CollisionsCheat)
|
if (AppManager.Instance.InputManager.CollisionsCheat)
|
||||||
{
|
{
|
||||||
spriteBatch.Draw(debugTexture,
|
spriteBatch.Draw(debugTexture,
|
||||||
new Rectangle(Rectangle.X - GraphicsComponent.CameraPosition.X,
|
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.White);
|
||||||
Rectangle.Y - GraphicsComponent.CameraPosition.Y, Rectangle.Width, Rectangle.Height),
|
|
||||||
Color.White);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
private Rectangle collision;
|
private Rectangle collision;
|
||||||
private Vector2 position;
|
private Vector2 position;
|
||||||
private bool isFlyRight = true;
|
private bool isFlyRight = true;
|
||||||
|
private bool isFlyUp = true;
|
||||||
private bool isAttacking = false;
|
private bool isAttacking = false;
|
||||||
|
|
||||||
public Rectangle Collision
|
public Rectangle Collision
|
||||||
|
@ -29,34 +30,32 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Width = 40;
|
Width = 40;
|
||||||
Height = 40;
|
Height = 40;
|
||||||
monster_speed = 3;
|
monster_speed = 3;
|
||||||
|
velocity = new Vector2(3,-3);
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "BallMoveRight" }, "BallMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "BallMoveRight" }, "BallMoveRight");
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
|
||||||
if(!isAttacking)
|
|
||||||
{
|
{
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
}
|
AppManager.Instance.DebugHUD.Set(name, velocity.ToString());
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
collision = new Rectangle((int)position.X, (int)position.Y, 40, 40);
|
|
||||||
isAttacking = true;
|
|
||||||
|
|
||||||
if(isFlyRight)
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
{
|
{
|
||||||
AppManager.Instance.GameManager.players[0].Death(name);
|
AppManager.Instance.GameManager.players[0].Death(name);
|
||||||
}
|
}
|
||||||
else if(!isFlyRight)
|
|
||||||
{
|
|
||||||
AppManager.Instance.GameManager.players[0].Death(name);
|
|
||||||
}
|
}
|
||||||
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
|
@ -66,20 +65,50 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
velocity.X = 0;
|
|
||||||
velocity.Y = 0;
|
|
||||||
|
|
||||||
if(isFlyRight)
|
var getColsHor = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
|
var getColsVer= AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2)); ;
|
||||||
|
if (isFlyRight)
|
||||||
{
|
{
|
||||||
velocity.X += monster_speed;
|
getColsHor = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y , 42, 40));
|
||||||
velocity.Y += monster_speed;
|
if(getColsHor.Count > 0)
|
||||||
}
|
|
||||||
else if(!isFlyRight)
|
|
||||||
{
|
{
|
||||||
velocity.X -= monster_speed;
|
isFlyRight = false;
|
||||||
velocity.Y -= monster_speed;
|
velocity.X = -velocity.X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getColsHor = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X-2, (int)Pos.Y, 42, 40));
|
||||||
|
if (getColsHor.Count > 0)
|
||||||
|
{
|
||||||
|
isFlyRight = true;
|
||||||
|
velocity.X = -velocity.X;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isFlyUp)
|
||||||
|
{
|
||||||
|
|
||||||
|
getColsVer = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X , (int)Pos.Y-3, 40, 43));
|
||||||
|
if (getColsVer.Count > 0)
|
||||||
|
{
|
||||||
|
isFlyUp = false;
|
||||||
|
velocity.Y = -velocity.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getColsVer = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, 40, 43));
|
||||||
|
if (getColsVer.Count > 0)
|
||||||
|
{
|
||||||
|
isFlyUp = true;
|
||||||
|
velocity.Y = -velocity.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Target()
|
public void Target()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Width = 16;
|
Width = 16;
|
||||||
Height = 16;
|
Height = 16;
|
||||||
monster_health = 2;
|
monster_health = 2;
|
||||||
monster_speed = 2;
|
monster_speed = 1;
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
AppManager.Instance.GameManager.GetPlayer1.Death(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
|
@ -38,7 +38,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
|
@ -71,12 +77,30 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
if ((Pos.X + 20 <= AppManager.Instance.GameManager.GetPlayer1.Pos.X || Pos.X - 20 >= AppManager.Instance.GameManager.GetPlayer1.Pos.X)&&(Pos.Y + 20 <= AppManager.Instance.GameManager.GetPlayer1.Pos.Y || Pos.Y - 20 >= AppManager.Instance.GameManager.GetPlayer1.Pos.Y))
|
|
||||||
{
|
|
||||||
|
|
||||||
AppManager.Instance.GameManager.GetPlayer1.Death(name);
|
|
||||||
}
|
|
||||||
GraphicsComponent.Update();
|
GraphicsComponent.Update();
|
||||||
}
|
}
|
||||||
|
public void TakeDamage()
|
||||||
|
{
|
||||||
|
monster_health--;
|
||||||
|
GraphicsComponent.StartAnimation("SilasHandMove");
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
if (monster_health <= 0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.OnCollision(gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
private int attackTime = 60;
|
private int attackTime = 60;
|
||||||
private int moveTime = 360;
|
private int moveTime = 360;
|
||||||
private int currentTime = 0;
|
private int currentTime = 0;
|
||||||
|
private int interval = 0;
|
||||||
int leftBorder;
|
int leftBorder;
|
||||||
int rightBorder;
|
int rightBorder;
|
||||||
List<SilasHands> hands = new List<SilasHands>();
|
List<SilasHands> hands = new List<SilasHands>();
|
||||||
|
@ -119,9 +120,18 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
|
for (int i = 0; i < hands.Count; i++)
|
||||||
|
{
|
||||||
|
if (!AppManager.Instance.GameManager.GetAllGameObjects.Contains(hands[i]))
|
||||||
|
{
|
||||||
|
hands.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (hands.Count<2)
|
if (hands.Count<2)
|
||||||
{
|
{
|
||||||
hands.Add(new SilasHands(new Vector2(Pos.X + 60, Pos.Y + 120)));
|
hands.Add(new SilasHands(new Vector2(Pos.X + 30, Pos.Y + 30)));
|
||||||
}
|
}
|
||||||
if (GraphicsComponent.CurrentAnimation.Id == "SilasMove")
|
if (GraphicsComponent.CurrentAnimation.Id == "SilasMove")
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DangerousD.GameCore.Managers;
|
using DangerousD.GameCore.Managers;
|
||||||
|
using DangerousD.GameCore.Network;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
@ -24,7 +25,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
Width = 24;
|
Width = 24;
|
||||||
Height = 40;
|
Height = 40;
|
||||||
monster_speed = 3;
|
monster_speed = 2;
|
||||||
name = "Zombie";
|
name = "Zombie";
|
||||||
monster_health = 2;
|
monster_health = 2;
|
||||||
leftBorder = (int)position.X - 100;
|
leftBorder = (int)position.X - 100;
|
||||||
|
@ -62,6 +63,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.GetPlayer1.Death(name);
|
||||||
|
}
|
||||||
|
public void PlayAttackAnimation()
|
||||||
{
|
{
|
||||||
velocity.X = 0;
|
velocity.X = 0;
|
||||||
isAttaking = true;
|
isAttaking = true;
|
||||||
|
@ -71,7 +76,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("ZombieRightAttack");
|
GraphicsComponent.StartAnimation("ZombieRightAttack");
|
||||||
}
|
}
|
||||||
AppManager.Instance.GameManager.players[0].Death(name);
|
|
||||||
}
|
}
|
||||||
else if (!isGoRight)
|
else if (!isGoRight)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +83,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("ZombieLeftAttack");
|
GraphicsComponent.StartAnimation("ZombieLeftAttack");
|
||||||
}
|
}
|
||||||
AppManager.Instance.GameManager.players[0].Death(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,12 +123,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
public override void OnCollision(GameObject gameObject)
|
public override void OnCollision(GameObject gameObject)
|
||||||
{
|
{
|
||||||
if(gameObject is Player)
|
if (gameObject.id == AppManager.Instance.GameManager.GetPlayer1.id && AppManager.Instance.GameManager.GetPlayer1.IsAlive)
|
||||||
{
|
{
|
||||||
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.Client)
|
||||||
{
|
{
|
||||||
Attack();
|
Attack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host)
|
||||||
|
{
|
||||||
|
NetworkTask task = new NetworkTask();
|
||||||
|
AppManager.Instance.NetworkTasks.Add(task.KillPlayer(gameObject.id, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
|
@ -133,7 +143,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public void Target()
|
public void Target()
|
||||||
{
|
{
|
||||||
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 50, (int)Pos.Y, Width + 100, Height), typeof(Player)).Count > 0)
|
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 50, (int)Pos.Y, Width + 200, Height), typeof(Player)).Count > 0)
|
||||||
{
|
{
|
||||||
if(isGoRight && this._pos.X <= AppManager.Instance.GameManager.players[0].Pos.X)
|
if(isGoRight && this._pos.X <= AppManager.Instance.GameManager.players[0].Pos.X)
|
||||||
{
|
{
|
||||||
|
@ -184,4 +194,4 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.PlayerDeath
|
||||||
PlayDeath(DeathType);
|
PlayDeath(DeathType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> {"DeathFromZombie"},
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> {"DeathFromZombie", "DeathFromSilasHand" },
|
||||||
"DeathFromZombie");
|
"DeathFromZombie");
|
||||||
|
|
||||||
public GraphicsComponent Gr => GraphicsComponent;
|
public GraphicsComponent Gr => GraphicsComponent;
|
||||||
|
@ -29,6 +29,10 @@ namespace DangerousD.GameCore.GameObjects.PlayerDeath
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("DeathFromZombie");
|
GraphicsComponent.StartAnimation("DeathFromZombie");
|
||||||
}
|
}
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "DeathFromSilasHand")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("DeathFromSilasHand");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public bool IsAlive { get { return isAlive; } }
|
public bool IsAlive { get { return isAlive; } }
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
|
||||||
"playerJumpRight" , "playerJumpLeft", "playerShootLeft", "playerShootRight", "playerReload", "smokeAfterShoot"}, "playerReload");
|
"playerJumpRight" , "playerJumpLeft", "playerShootLeft", "playerShootRight", "playerReload", "smokeAfterShoot", "playerShootUpRight", "playerShootUpLeft"}, "playerReload");
|
||||||
|
|
||||||
public void Attack()
|
public void Attack()
|
||||||
{
|
{
|
||||||
|
@ -87,12 +87,29 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
public Rectangle GetShootRectangle(bool isRight)
|
||||||
|
{
|
||||||
|
if (isRight)
|
||||||
|
return new Rectangle((int)Pos.X, (int)(Pos.Y) + 10, shootLength + Width, Height / 2);
|
||||||
|
else
|
||||||
|
return new Rectangle((int)Pos.X-shootLength, (int)(Pos.Y) + 10, shootLength, Height / 2);
|
||||||
|
}
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
if (isVisible)
|
if (isVisible)
|
||||||
{
|
{
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
if (AppManager.Instance.InputManager.CollisionsCheat)
|
||||||
|
{
|
||||||
|
Rectangle attackRect = GetShootRectangle(isRight);
|
||||||
|
spriteBatch.Draw(debugTexture,
|
||||||
|
new Rectangle((attackRect.X - GraphicsComponent.CameraPosition.X) * GraphicsComponent.scaling,
|
||||||
|
(attackRect.Y - GraphicsComponent.CameraPosition.Y) * GraphicsComponent.scaling,
|
||||||
|
attackRect.Width * GraphicsComponent.scaling,
|
||||||
|
attackRect.Height * GraphicsComponent.scaling), Color.White);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void Death(string monsterName)
|
public void Death(string monsterName)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +140,28 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (monsterName == "SilasHand")
|
||||||
|
{
|
||||||
|
AnimationRectangle deathRectangle = new AnimationRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
|
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
||||||
|
{
|
||||||
|
if (a == "DeathFrom" + monsterName)
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Death);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (monsterName == "SilasBall")
|
||||||
|
{
|
||||||
|
AnimationRectangle deathRectangle = new AnimationRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
|
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
||||||
|
{
|
||||||
|
if (a == "DeathFrom" + monsterName)
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Death);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
isAlive = false;
|
isAlive = false;
|
||||||
}
|
}
|
||||||
public void Jump()
|
public void Jump()
|
||||||
|
@ -151,6 +190,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
Zombie targetZombie = (Zombie)targets.First();
|
Zombie targetZombie = (Zombie)targets.First();
|
||||||
targetZombie.TakeDamage();
|
targetZombie.TakeDamage();
|
||||||
|
|
||||||
|
}
|
||||||
|
targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(SilasHands)).OrderBy(x => (x.Pos - Pos).LengthSquared());
|
||||||
|
if (targets.Count() > 0)
|
||||||
|
{
|
||||||
|
SilasHands targetHand = (SilasHands)targets.First();
|
||||||
|
targetHand.TakeDamage();
|
||||||
}
|
}
|
||||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
||||||
}
|
}
|
||||||
|
@ -166,6 +212,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
targetZombie.TakeDamage();
|
targetZombie.TakeDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(SilasHands));
|
||||||
|
if (targets.Count() > 0)
|
||||||
|
{
|
||||||
|
SilasHands targetHand = (SilasHands)targets.First();
|
||||||
|
targetHand.TakeDamage();
|
||||||
|
}
|
||||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,15 +290,35 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isRight)
|
else if (isRight)
|
||||||
|
{
|
||||||
|
if (isUping)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "playerShootUpRight")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("playerShootUpRight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("playerRightStay");
|
GraphicsComponent.StartAnimation("playerRightStay");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (!isRight)
|
else if (!isRight)
|
||||||
|
{
|
||||||
|
if (isUping)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "playerShootUpLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("playerShootUpLeft");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("playerStayLeft");
|
GraphicsComponent.StartAnimation("playerStayLeft");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||||
{
|
{
|
||||||
NetworkTask task = new NetworkTask(id, Pos);
|
NetworkTask task = new NetworkTask(id, Pos);
|
||||||
|
@ -258,5 +330,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
FallingThroughPlatform = true;
|
FallingThroughPlatform = true;
|
||||||
isOnGround = false;
|
isOnGround = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Bullet : GameObjects.LivingEntity
|
||||||
|
{
|
||||||
|
public Bullet(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected override GraphicsComponent GraphicsComponent { get; } = new("ZombieMoveLeft");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using Microsoft.Xna.Framework;
|
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||||
|
using DangerousD.GameCore.Network;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects;
|
namespace DangerousD.GameCore.GameObjects;
|
||||||
|
|
||||||
|
@ -15,6 +17,14 @@ public abstract class LivingEntity : Entity
|
||||||
public override void SetPosition(Vector2 position)
|
public override void SetPosition(Vector2 position)
|
||||||
{
|
{
|
||||||
_pos = position;
|
_pos = position;
|
||||||
|
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||||
|
{
|
||||||
|
NetworkTask task = new NetworkTask(id, _pos);
|
||||||
|
if (this is Player || AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host)
|
||||||
|
{
|
||||||
|
AppManager.Instance.NetworkTasks.Add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} //TODO befrend targetpos and physics engine
|
} //TODO befrend targetpos and physics engine
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using DangerousD.GameCore.Managers;
|
using DangerousD.GameCore.GameObjects;
|
||||||
|
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||||
|
using DangerousD.GameCore.Managers;
|
||||||
using DangerousD.GameCore.Network;
|
using DangerousD.GameCore.Network;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
@ -6,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.Graphics
|
namespace DangerousD.GameCore.Graphics
|
||||||
|
@ -18,7 +21,7 @@ namespace DangerousD.GameCore.Graphics
|
||||||
private List<Texture2D> textures;
|
private List<Texture2D> textures;
|
||||||
private List<string> texturesNames;
|
private List<string> texturesNames;
|
||||||
private AnimationContainer currentAnimation;
|
private AnimationContainer currentAnimation;
|
||||||
static private int scaling = 4;
|
static public int scaling = 4;
|
||||||
public int parentId;
|
public int parentId;
|
||||||
public AnimationContainer CurrentAnimation
|
public AnimationContainer CurrentAnimation
|
||||||
{
|
{
|
||||||
|
@ -107,14 +110,14 @@ namespace DangerousD.GameCore.Graphics
|
||||||
|
|
||||||
public void StartAnimation(string startedanimationId)
|
public void StartAnimation(string startedanimationId)
|
||||||
{
|
{
|
||||||
if (startedanimationId == "playerShootRight" && parentId == 17)
|
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||||
{
|
{
|
||||||
string a = "2";
|
LivingEntity entity = AppManager.Instance.GameManager.livingEntities.Find(x => x.id == parentId);
|
||||||
}
|
if (((entity is Player) || AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host) && startedanimationId != GetCurrentAnimation)
|
||||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer && startedanimationId != GetCurrentAnimation)
|
|
||||||
{
|
{
|
||||||
AppManager.Instance.NetworkTasks.Add(new NetworkTask(parentId, startedanimationId, Vector2.Zero));
|
AppManager.Instance.NetworkTasks.Add(new NetworkTask(parentId, startedanimationId, Vector2.Zero));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
currentAnimation = animations.Find(x => x.Id == startedanimationId);
|
currentAnimation = animations.Find(x => x.Id == startedanimationId);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace DangerousD.GameCore
|
||||||
|
|
||||||
public Vector2 VectorMovementDirection { get => vectorMovementDirection; }
|
public Vector2 VectorMovementDirection { get => vectorMovementDirection; }
|
||||||
public ScopeState ScopeState { get => scopeState; }
|
public ScopeState ScopeState { get => scopeState; }
|
||||||
|
public string currentControlsState;
|
||||||
|
|
||||||
public InputManager()
|
public InputManager()
|
||||||
{
|
{
|
||||||
|
@ -205,7 +206,12 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
isShoot = false;
|
isShoot = false;
|
||||||
}
|
}
|
||||||
|
SetState(ControlsState.Keyboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void SetState(ControlsState controlsState)
|
||||||
|
{
|
||||||
|
currentControlsState = controlsState.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,9 @@ namespace DangerousD.GameCore
|
||||||
private SpriteBatch _spriteBatch;
|
private SpriteBatch _spriteBatch;
|
||||||
public GameState gameState { get; private set; }
|
public GameState gameState { get; private set; }
|
||||||
public MultiPlayerStatus multiPlayerStatus { get; private set; } = MultiPlayerStatus.SinglePlayer;
|
public MultiPlayerStatus multiPlayerStatus { get; private set; } = MultiPlayerStatus.SinglePlayer;
|
||||||
public Point resolution = new Point(1920, 1080);
|
public Point resolution;
|
||||||
public Point inGameResolution = new Point(1920, 1080);
|
public Point inGameResolution = new Point(1920, 1080);
|
||||||
|
public Point inGameHUDHelperResolution= new Point(1920, 1080);
|
||||||
IDrawableObject MenuGUI;
|
IDrawableObject MenuGUI;
|
||||||
IDrawableObject OptionsGUI;
|
IDrawableObject OptionsGUI;
|
||||||
IDrawableObject LoginGUI;
|
IDrawableObject LoginGUI;
|
||||||
|
@ -38,7 +39,7 @@ namespace DangerousD.GameCore
|
||||||
IDrawableObject HUD;
|
IDrawableObject HUD;
|
||||||
public DebugHUD DebugHUD;
|
public DebugHUD DebugHUD;
|
||||||
public List<NetworkTask> NetworkTasks = new List<NetworkTask>();
|
public List<NetworkTask> NetworkTasks = new List<NetworkTask>();
|
||||||
|
public string currentMap;
|
||||||
public GameManager GameManager { get; private set; } = new();
|
public GameManager GameManager { get; private set; } = new();
|
||||||
public AnimationBuilder AnimationBuilder { get; private set; } = new AnimationBuilder();
|
public AnimationBuilder AnimationBuilder { get; private set; } = new AnimationBuilder();
|
||||||
public NetworkManager NetworkManager { get; private set; } = new NetworkManager();
|
public NetworkManager NetworkManager { get; private set; } = new NetworkManager();
|
||||||
|
@ -61,6 +62,8 @@ namespace DangerousD.GameCore
|
||||||
NetworkManager.GetReceivingMessages += NetworkSync;
|
NetworkManager.GetReceivingMessages += NetworkSync;
|
||||||
|
|
||||||
resolution = SettingsManager.Resolution;
|
resolution = SettingsManager.Resolution;
|
||||||
|
SetIsFullScreen(!SettingsManager.IsFullScreen);
|
||||||
|
SetIsFullScreen(SettingsManager.IsFullScreen);
|
||||||
_graphics.PreferredBackBufferWidth = resolution.X;
|
_graphics.PreferredBackBufferWidth = resolution.X;
|
||||||
_graphics.PreferredBackBufferHeight = resolution.Y;
|
_graphics.PreferredBackBufferHeight = resolution.Y;
|
||||||
_graphics.IsFullScreen = false;
|
_graphics.IsFullScreen = false;
|
||||||
|
@ -74,6 +77,7 @@ namespace DangerousD.GameCore
|
||||||
DebugHUD = new DebugHUD();
|
DebugHUD = new DebugHUD();
|
||||||
UIManager.resolution = resolution;
|
UIManager.resolution = resolution;
|
||||||
UIManager.resolutionInGame = inGameResolution;
|
UIManager.resolutionInGame = inGameResolution;
|
||||||
|
currentMap = "lvl";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
|
@ -133,11 +137,10 @@ namespace DangerousD.GameCore
|
||||||
case GameState.Death:
|
case GameState.Death:
|
||||||
DeathGUI.Update(gameTime);
|
DeathGUI.Update(gameTime);
|
||||||
break;
|
break;
|
||||||
case GameState.HUD:
|
|
||||||
HUD.Update(gameTime);
|
|
||||||
break;
|
|
||||||
case GameState.Game:
|
case GameState.Game:
|
||||||
|
HUD.Update(gameTime);
|
||||||
GameManager.Update(gameTime);
|
GameManager.Update(gameTime);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -176,6 +179,7 @@ namespace DangerousD.GameCore
|
||||||
_spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
|
_spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
|
||||||
GameManager.Draw(_spriteBatch);
|
GameManager.Draw(_spriteBatch);
|
||||||
_spriteBatch.End();
|
_spriteBatch.End();
|
||||||
|
HUD.Draw(_spriteBatch);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -204,12 +208,8 @@ namespace DangerousD.GameCore
|
||||||
case GameState.Lobby:
|
case GameState.Lobby:
|
||||||
break;
|
break;
|
||||||
case GameState.Game:
|
case GameState.Game:
|
||||||
|
GameManager.mapManager.LoadLevel("lvl");
|
||||||
GameManager.mapManager.LoadLevel("map");
|
|
||||||
|
|
||||||
|
|
||||||
GameManager.FindBorders();
|
GameManager.FindBorders();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GameState.Death:
|
case GameState.Death:
|
||||||
break;
|
break;
|
||||||
|
@ -224,7 +224,12 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
switch (networkTask.operation)
|
switch (networkTask.operation)
|
||||||
{
|
{
|
||||||
case NetworkTaskOperationEnum.TakeDamage:
|
case NetworkTaskOperationEnum.DeleteObject:
|
||||||
|
GameObject gameObject = GameManager.GetAllGameObjects.Find(x => x.id == networkTask.objId);
|
||||||
|
if (gameObject != null)
|
||||||
|
{
|
||||||
|
GameManager.Remove(gameObject);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NetworkTaskOperationEnum.SendSound:
|
case NetworkTaskOperationEnum.SendSound:
|
||||||
SoundManager.StartSound(networkTask.name, networkTask.position, GameManager.GetPlayer1.Pos);
|
SoundManager.StartSound(networkTask.name, networkTask.position, GameManager.GetPlayer1.Pos);
|
||||||
|
@ -285,6 +290,12 @@ namespace DangerousD.GameCore
|
||||||
remoteConnectedPlayer.id = networkTask.objId;
|
remoteConnectedPlayer.id = networkTask.objId;
|
||||||
remoteConnectedPlayer.GetGraphicsComponent().parentId = networkTask.objId;
|
remoteConnectedPlayer.GetGraphicsComponent().parentId = networkTask.objId;
|
||||||
break;
|
break;
|
||||||
|
case NetworkTaskOperationEnum.KillPlayer:
|
||||||
|
Player player1 = GameManager.players.Find(x => x.id==networkTask.objId);
|
||||||
|
player1.Death(networkTask.name);
|
||||||
|
NetworkTask task1 = new NetworkTask();
|
||||||
|
NetworkTasks.Add(task1.DeleteObject(player1.id));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -294,5 +305,28 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
this.multiPlayerStatus = multiPlayerStatus;
|
this.multiPlayerStatus = multiPlayerStatus;
|
||||||
}
|
}
|
||||||
|
public void SetIsFullScreen(bool fullscrin)
|
||||||
|
{
|
||||||
|
DebugHUD?.Set("resX:", SettingsManager.Resolution.X.ToString());
|
||||||
|
DebugHUD?.Set("resY:", SettingsManager.Resolution.Y.ToString());
|
||||||
|
DebugHUD?.Set("FullScreen:", _graphics.IsFullScreen.ToString());
|
||||||
|
if (fullscrin)
|
||||||
|
{
|
||||||
|
_graphics.PreferredBackBufferWidth = 1920;
|
||||||
|
_graphics.PreferredBackBufferHeight = 1080;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_graphics.PreferredBackBufferWidth = SettingsManager.Resolution.X;
|
||||||
|
_graphics.PreferredBackBufferHeight = SettingsManager.Resolution.Y;
|
||||||
|
}
|
||||||
|
UIManager.resolution = new Point(_graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight);
|
||||||
|
_graphics.IsFullScreen = fullscrin;
|
||||||
|
_graphics.ApplyChanges();
|
||||||
|
}
|
||||||
|
public void Restart(string map)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,6 @@ namespace DangerousD.GameCore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < livingEntitiesWithoutPlayers.Count; i++)
|
for (int i = 0; i < livingEntitiesWithoutPlayers.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,22 +27,26 @@ namespace DangerousD.GameCore.Managers
|
||||||
public void SetMainVolume(float volume)
|
public void SetMainVolume(float volume)
|
||||||
{
|
{
|
||||||
settingsContainer.MainVolume = MainVolume;
|
settingsContainer.MainVolume = MainVolume;
|
||||||
///AppManager.Instance.SoundManager.
|
//AppManager.Instance.SoundManager.
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SetMusicVolume(float volume)
|
public void SetMusicVolume(float volume)
|
||||||
{
|
{
|
||||||
settingsContainer.MusicVolume = MainVolume;
|
settingsContainer.MusicVolume = MainVolume;
|
||||||
|
SaveSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SetSoundEffectsVolume(float volume)
|
public void SetSoundEffectsVolume(float volume)
|
||||||
{
|
{
|
||||||
settingsContainer.SoundEffectsVolume = MainVolume;
|
settingsContainer.SoundEffectsVolume = MainVolume;
|
||||||
|
SaveSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SetIsFullScreen(bool isFullScreen)
|
public void SetIsFullScreen(bool isFullScreen)
|
||||||
{
|
{
|
||||||
settingsContainer.IsFullScreen = isFullScreen;
|
settingsContainer.IsFullScreen = isFullScreen;
|
||||||
|
AppManager.Instance.SetIsFullScreen(isFullScreen);
|
||||||
|
SaveSettings();
|
||||||
}
|
}
|
||||||
public void LoadSettings()
|
public void LoadSettings()
|
||||||
{
|
{
|
||||||
|
@ -83,6 +87,6 @@ namespace DangerousD.GameCore.Managers
|
||||||
[JsonProperty("SoundEffectsVolume")]
|
[JsonProperty("SoundEffectsVolume")]
|
||||||
public float SoundEffectsVolume { get; set; } = 1;
|
public float SoundEffectsVolume { get; set; } = 1;
|
||||||
[JsonProperty("Resolution")]
|
[JsonProperty("Resolution")]
|
||||||
public Point Resolution { get; set; } = new Point(1920,1080);
|
public Point Resolution { get; set; } = new Point(1366,768);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,18 +20,6 @@ namespace DangerousD.GameCore.Network
|
||||||
public Type type { get; set; }
|
public Type type { get; set; }
|
||||||
|
|
||||||
public NetworkTask() { }
|
public NetworkTask() { }
|
||||||
/// <summary>
|
|
||||||
/// Нанести урон сущности
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="LivingEntityId"></param>
|
|
||||||
/// <param name="Damage"></param>
|
|
||||||
public NetworkTask(int LivingEntityId, int Damage)
|
|
||||||
{
|
|
||||||
operation = NetworkTaskOperationEnum.TakeDamage;
|
|
||||||
objId = LivingEntityId;
|
|
||||||
value = Damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Проиграть звук на позиции
|
/// Проиграть звук на позиции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -49,14 +37,12 @@ namespace DangerousD.GameCore.Network
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="EntityType"></param>
|
/// <param name="EntityType"></param>
|
||||||
/// <param name="EntityPosition"></param>
|
/// <param name="EntityPosition"></param>
|
||||||
/// <param name="EntityVelocity"></param>
|
|
||||||
/// <param name="ParentId"></param>
|
/// <param name="ParentId"></param>
|
||||||
public NetworkTask(Type EntityType, Vector2 EntityPosition, Vector2 EntityVelocity, int ParentId)
|
public NetworkTask(Type EntityType, Vector2 EntityPosition, int ParentId)
|
||||||
{
|
{
|
||||||
operation = NetworkTaskOperationEnum.CreateEntity;
|
operation = NetworkTaskOperationEnum.CreateEntity;
|
||||||
type = EntityType;
|
type = EntityType;
|
||||||
position = EntityPosition;
|
position = EntityPosition;
|
||||||
velocity = EntityVelocity;
|
|
||||||
objId = ParentId;
|
objId = ParentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,5 +120,18 @@ namespace DangerousD.GameCore.Network
|
||||||
position = playerPosition;
|
position = playerPosition;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public NetworkTask DeleteObject(int objectId)
|
||||||
|
{
|
||||||
|
operation = NetworkTaskOperationEnum.DeleteObject;
|
||||||
|
objId = objectId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public NetworkTask KillPlayer(int playerId, string mosterName)
|
||||||
|
{
|
||||||
|
operation = NetworkTaskOperationEnum.KillPlayer;
|
||||||
|
name = mosterName;
|
||||||
|
objId = playerId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,6 @@ namespace DangerousD.GameCore.Network
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public enum NetworkTaskOperationEnum
|
public enum NetworkTaskOperationEnum
|
||||||
{
|
{
|
||||||
TakeDamage, SendSound, CreateEntity, SendPosition, ChangeState, ConnectToHost, GetClientPlayerId, AddConnectedPlayer
|
DeleteObject, SendSound, CreateEntity, SendPosition, ChangeState, ConnectToHost, GetClientPlayerId, AddConnectedPlayer, KillPlayer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MonogameLibrary.UI.Elements
|
||||||
public delegate void OnButtonPressed();
|
public delegate void OnButtonPressed();
|
||||||
public event OnButtonPressed? RightButtonPressed;
|
public event OnButtonPressed? RightButtonPressed;
|
||||||
public event OnButtonPressed? LeftButtonPressed;
|
public event OnButtonPressed? LeftButtonPressed;
|
||||||
protected HoverState hoverState = HoverState.None;
|
public HoverState hoverState = HoverState.None;
|
||||||
|
|
||||||
public Button(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
|
public Button(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ namespace MonogameLibrary.UI.Elements
|
||||||
if (mouseState.LeftButton != prevmouseState.LeftButton)
|
if (mouseState.LeftButton != prevmouseState.LeftButton)
|
||||||
{
|
{
|
||||||
hoverState = HoverState.Pressing;
|
hoverState = HoverState.Pressing;
|
||||||
LeftButtonPressed?.Invoke();
|
CallLeftBtnEvent();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,5 +77,9 @@ namespace MonogameLibrary.UI.Elements
|
||||||
|
|
||||||
DrawText(_spriteBatch);
|
DrawText(_spriteBatch);
|
||||||
}
|
}
|
||||||
|
public void CallLeftBtnEvent()
|
||||||
|
{
|
||||||
|
LeftButtonPressed?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,13 @@ namespace MonogameLibrary.UI.Elements
|
||||||
public event OnTextChange? StopChanging;
|
public event OnTextChange? StopChanging;
|
||||||
public event OnTextChange? OnEnter;
|
public event OnTextChange? OnEnter;
|
||||||
|
|
||||||
protected HoverState hoverState = HoverState.None;
|
public HoverState hoverState = HoverState.None;
|
||||||
protected IsSelected isSelected = IsSelected.NotSelected;
|
protected IsSelected isSelected = IsSelected.NotSelected;
|
||||||
public bool shouldEndOnEnter;
|
public bool shouldEndOnEnter;
|
||||||
|
public void SelectIt()
|
||||||
|
{
|
||||||
|
isSelected = IsSelected.Selected;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue