Merge remote-tracking branch 'origin/main' into MapManager

# Conflicts:
#	DangerousD/Content/Content.mgcb
#	DangerousD/GameCore/Levels/Level1.cs
#	DangerousD/GameCore/Managers/AppManager.cs
#	DangerousD/GameCore/Managers/GameManager.cs
This commit is contained in:
Mootfrost777 2023-08-17 12:29:46 +03:00
commit bb86eee1b2
53 changed files with 632 additions and 142 deletions

View file

@ -62,7 +62,7 @@ namespace AnimationsFileCreator
container.TextureFrameInterval = 1;
container.Id = id;
string json = JsonConvert.SerializeObject(container);
StreamWriter writer = new StreamWriter(id);
StreamWriter writer = new StreamWriter("../../../../DangerousD/Content/animations/" + id);
writer.WriteLine(json);
writer.Close();
}

View file

@ -14,7 +14,7 @@
#---------------------------------- Content ---------------------------------#
#begin animation1.png
#begin MonstersAnimations.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -24,7 +24,19 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:animation1.png
/build:MonstersAnimations.png
#begin deathAnimation.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:deathAnimation.png
#begin ButtonFont.spritefont
/importer:FontDescriptionImporter
@ -33,6 +45,12 @@
/processorParam:TextureFormat=Compressed
/build:ButtonFont.spritefont
#begin DoomTestSong.mp3
/importer:Mp3Importer
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:DoomTestSong.mp3
#begin Font_25.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
@ -67,6 +85,7 @@
/build:menuFon.jpg
#begin MonstersAnimations.png
#begin menuFon.jpg
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -76,9 +95,9 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:MonstersAnimations.png
/build:menuFon.jpg
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
#begin MenuFon2.jpg
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -88,7 +107,19 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
/build:MenuFon2.jpg
#begin menuFon3.jpg
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:menuFon3.jpg
#begin tiles.png
/importer:TextureImporter

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View file

@ -0,0 +1 @@
{"id":"BallMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":229,"Y":332,"Width":16,"Height":16},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"DeathFromZombie","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":99,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"FlameSkullMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":593,"Width":24,"Height":16},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"FlameSkullMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":576,"Width":24,"Height":16},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"GhostAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":503,"Width":24,"Height":31},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"GhostMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":536,"Width":24,"Height":26},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"GhostMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":503,"Width":24,"Height":26},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"GhostSpawn","textureName":"MonstersAnimations","startSpriteRectangle":{"X":26,"Y":503,"Width":24,"Height":30},"frameSecond":[{"Item1":0,"Item2":20}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"HunchmanDaggerLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":224,"Y":129,"Width":9,"Height":6},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"HunchmanDaggerRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":224,"Y":116,"Width":9,"Height":6},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"SpiderMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":225,"Width":34,"Height":8},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"SpiderMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":199,"Width":34,"Height":8},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"SpiderOnWeb","textureName":"MonstersAnimations","startSpriteRectangle":{"X":80,"Y":199,"Width":16,"Height":24},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"SpiderWeb","textureName":"MonstersAnimations","startSpriteRectangle":{"X":108,"Y":199,"Width":4,"Height":8},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"WolfJumpLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":133,"Y":290,"Width":40,"Height":33},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"WolfJumpRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":133,"Y":258,"Width":40,"Height":33},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"WolfMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":292,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"WolfMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":258,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}

View file

@ -1 +1 @@
{"id":"ZombieLeftAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":50,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}
{"id":"ZombieLeftAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":50,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}

View file

@ -1 +1 @@
{"id":"ZombieRightAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":9,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}
{"id":"ZombieRightAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":9,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

View file

@ -7,6 +7,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DangerousD.GameCore.Managers;
using MonogameLibrary.UI.Base;
using System.Diagnostics;
namespace DangerousD.GameCore.GUI
{
class LobbyGUI : AbstractGui
@ -17,8 +21,12 @@ namespace DangerousD.GameCore.GUI
}
protected override void CreateUI()
{
int screenWidth = AppManager.Instance.resolution.X;
int screenHeight = AppManager.Instance.resolution.Y;
int screenWidth = AppManager.Instance.inGameResolution.X;
int screenHeight = AppManager.Instance.inGameResolution.Y;
var lobbyBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, screenWidth, screenHeight), textureName = "menuFon3" };
Elements.Add(lobbyBackground);
lobbyBackground.LoadTexture(AppManager.Instance.Content);
// CheckBoxs
Elements.Add(new Label(Manager) { rectangle = new Rectangle(screenWidth / 30 * 2, screenHeight / 30 * 5,
@ -26,7 +34,7 @@ namespace DangerousD.GameCore.GUI
// Buttons
{
Button backButton = new Button(Manager)
Button backButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 30, screenHeight / 30, 60, 50),
text = "<-",
@ -38,7 +46,7 @@ namespace DangerousD.GameCore.GUI
AppManager.Instance.ChangeGameState(GameState.Menu);
};
Button hostButton = new Button(Manager)
Button hostButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 30, screenHeight / 15 * 13, 120, 50),
text = "Host",
@ -50,7 +58,7 @@ namespace DangerousD.GameCore.GUI
};
Button refreshButton = new Button(Manager)
Button refreshButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 30 * 6, screenHeight / 15 * 13, 120, 50),
text = "Refresh",
@ -62,7 +70,7 @@ namespace DangerousD.GameCore.GUI
};
Button joinSelectedButton = new Button(Manager)
Button joinSelectedButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 15 * 13, 120, 50),
text = "Join",
@ -73,7 +81,7 @@ namespace DangerousD.GameCore.GUI
joinSelectedButton.LeftButtonPressed += () => {
};
Button joinByIpButton = new Button(Manager)
Button joinByIpButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 30, 120, 50),
text = "JoinByIp",

View file

@ -5,6 +5,10 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using DangerousD.GameCore.Managers;
using MonogameLibrary.UI.Base;
using System.Diagnostics;
using MonogameLibrary.UI.Elements;
using MonogameLibrary.UI.Enums;
@ -20,8 +24,12 @@ namespace DangerousD.GameCore.GUI
protected override void CreateUI()
{
int screenWidth = AppManager.Instance.resolution.X;
int screenHeight = AppManager.Instance.resolution.Y;
int screenWidth = AppManager.Instance.inGameResolution.X;
int screenHeight = AppManager.Instance.inGameResolution.Y;
var loginBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, screenWidth, screenHeight), textureName = "menuFon2" };
Elements.Add(loginBackground);
loginBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) {
rectangle = new Rectangle(screenWidth / 2 - 250, screenHeight / 6 - 50, 500, 100),
@ -29,7 +37,7 @@ namespace DangerousD.GameCore.GUI
scale = 0.8f,
fontColor = Color.White,
mainColor = Color.Transparent,
fontName = "font2"
fontName = "ButtonFont"
});
// TextBox-ы
@ -83,7 +91,7 @@ namespace DangerousD.GameCore.GUI
// Кнопки
{
Button logButton = new Button(Manager) {
Button logButton = new ButtonText(Manager) {
rectangle = new Rectangle(screenWidth / 4 + 50, screenHeight / 6 * 4, 100, 50),
text = "LogIn",
scale = 0.2f,
@ -97,7 +105,7 @@ namespace DangerousD.GameCore.GUI
}
};
Button regButton = new Button(Manager)
Button regButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 4 * 2 + 50, screenHeight / 6 * 4, 100, 50),
text = "Reg",
@ -107,7 +115,7 @@ namespace DangerousD.GameCore.GUI
};
regButton.LeftButtonPressed += GoToRegWebServer;
Button backButton = new Button(Manager)
Button backButton = new ButtonText(Manager)
{
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, 50, 50),
text = "<-",

View file

@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
using MonogameLibrary.UI.Base;
using MonogameLibrary.UI.Elements;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace DangerousD.GameCore.GUI;
@ -10,13 +11,25 @@ internal class MenuGUI : AbstractGui
{
protected override void CreateUI()
{
int wigth = AppManager.Instance.Window.ClientBounds.Width;
int height = AppManager.Instance.Window.ClientBounds.Height;
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "menuFon" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 60, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 0.7f, fontName = "Font2", fontColor = Color.White });
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 250, 90, 50, 50), text = "D", mainColor = Color.Transparent, scale = 1.2f, fontName = "Font2", fontColor = Color.White });
int TopMenu = 0;
Color[] colors = new Color[] { new Color(64, 53, 51), new Color(84, 58, 52),
new Color(170, 101, 63), new Color(254, 208, 116), new Color(252, 231, 124) };
for (int i = 0; i < colors.Length; i++)
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 60, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 1-0.05f*i*i/10, fontName = "Font2", fontColor = colors[i] });
int dx = 100;
Color[] colors2 = new Color[] { new Color(64, 53, 51), new Color(84, 58, 52),
new Color(170, 101, 63), new Color(254, 208, 116), new Color(252, 231, 124) };
for (int i = 0; i < colors2.Length; i++)
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 250 + dx-i*i, 90 - i * i/5, 50, 50), text = "D", mainColor = Color.Transparent, scale = 1.3f - 0.05f * i * i / 5, fontName = "Font2", fontColor = colors2[i] });
var butSingle = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "ButtonFont" };
Elements.Add(butSingle);
butSingle.LeftButtonPressed += () =>

View file

@ -14,8 +14,8 @@ namespace DangerousD.GameCore
{
protected Vector2 _pos;
public Vector2 Pos => _pos;
public int Width { get; protected set; }
public int Height { get; protected set; }
public int Width { get; set; }
public int Height { get; set; }
public Rectangle Rectangle => new Rectangle((int)Pos.X, (int)Pos.Y, Width, Height);
public Vector2 velocity;
public Vector2 acceleration;

View file

@ -24,11 +24,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
public override void Update(GameTime gameTime)
{
if (monster_health <= 0)
{
Death();
isAlive = false;
}
base.Update(gameTime);
}
public abstract void Death();
@ -36,5 +31,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
public abstract void Attack();
public abstract void Move(GameTime gameTime);
public void TakeDamage(int damage)
{
monster_health -= damage;
if (monster_health <= 0)
{
Death();
isAlive = false;
}
}
}
}

View file

@ -14,10 +14,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public FlameSkull(Vector2 position) : base(position)
{
Width = 62;
Height = 40;
monster_speed = 3;
name = "Skull";
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveLeft", "FlameSkullMoveRight" }, "FlameSkullMoveRight");
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveRight" , "FlameSkullMoveLeft"}, "FlameSkullMoveRight");
public override void Attack()
{

View file

@ -19,7 +19,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
Height = 160;
GraphicsComponent.StartAnimation("FrankMoveLeft");
monster_speed = 1;
name = "Фрэнк";
name = "Frank";
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FrankMoveRight", "FrankMoveLeft" }, "FrankMoveRight");
@ -35,35 +35,27 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public override void Move(GameTime gameTime)
{
/* if (player.Pos.X - _pos.X <= 20 || player.Pos.X - _pos.X <= -20)
var player = AppManager.Instance.GameManager.players[0];
if (player.Pos.X - _pos.X <= 20 || player.Pos.X - _pos.X <= -20)
{
player.Death(name);
} */
}
if (isGoRight)
{
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight")
{
GraphicsComponent.StartAnimation("FrankMoveRight");
velocity = new Vector2(monster_speed, 0);
}
velocity.X = monster_speed;
}
else if (!isGoRight)
else
{
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveLeft")
{
GraphicsComponent.StartAnimation("FrankMoveLeft");
velocity = new Vector2(-monster_speed, 0);
}
}
if (_pos.X <= 1)
{
isGoRight = true;
}
else if (_pos.X >= 500)
{
isGoRight = false;
velocity.X = -monster_speed;
}
}
}

View file

@ -0,0 +1,41 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public class FrankBalls : CoreEnemy
{
public FrankBalls(Vector2 position) : base(position)
{
name = "FrankBalls";
Width = 40;
Height = 40;
monster_speed = 1;
acceleration = Vector2.Zero;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "BallMoveRight" }, "BallMoveRight");
public override void Attack()
{
}
public override void Death()
{
}
public override void Move(GameTime gameTime)
{
}
}
}

View file

@ -12,11 +12,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public Ghost(Vector2 position) : base(position)
{
monster_speed = 1;
name = "Ghost";
Width = 48;
Height = 62;
GraphicsComponent.StartAnimation("GhostSpawn");
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "");
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
public override void Attack()
{

View file

@ -0,0 +1,40 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public class HunchmanDagger : CoreEnemy
{
public HunchmanDagger(Vector2 position) : base(position)
{
name = "Hunchman";
monster_speed = 1;
Width = 9;
Height = 6;
}
protected override GraphicsComponent GraphicsComponent { get; } = new (new List<string> { "HunchmanDaggerRight", "HunchmanDaggerLeft" }, "HunchmanDaggerLeft");
public override void Attack()
{
}
public override void Death()
{
}
public override void Move(GameTime gameTime)
{
}
}
}

View file

@ -12,15 +12,85 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public class Spider : CoreEnemy
{
protected SpiderWeb web;
protected float delay;
protected int webLength;
protected bool isDown;
protected bool isDownUp;
public Spider(Vector2 position) : base(position)
{
isDownUp = true;
isDown = true;
web = new SpiderWeb(Pos);
name = "Spider";
Width = 112;
Height = 24;
delay = 0;
webLength = 0;
monster_speed = 1;
acceleration = Vector2.Zero;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "SpiderMoveRight", "SpiderMoveLeft", "SpiderDown", "SpiderUp" }, "");
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "SpiderMoveRight", "SpiderMoveLeft", "SpiderOnWeb" }, "SpiderMoveRight");
public override void Attack()
public override void Update(GameTime gameTime)
{
if (isDownUp)
{
Width = 48;
Height = 72;
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
if (delay > 0.5 && webLength <= 4 && isDown)
{
StartCicycleAnimation("SpiderOnWeb");
webLength++;
_pos.Y += 25;
web.Height = webLength * 25;
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2, Pos.Y - 25 * webLength));
delay = 0;
if (webLength == 4)
{
isDown = false;
}
}
else if (delay > 0.5 && webLength != 0 && !isDown)
{
StartCicycleAnimation("SpiderOnWeb");
webLength--;
_pos.Y -= 25;
web.Height = webLength * 25;
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2, Pos.Y - 25 * webLength));
delay = 0;
if (webLength == 0)
{
isDown = true;
}
}
else
{
Width = 112;
Height = 24;
}
}
base.Update(gameTime);
}
public override void Attack()
{ //48 72
}
public override void Draw(SpriteBatch spriteBatch)
{
if (GraphicsComponent.GetCurrentAnimation == "SpiderOnWeb")
{
GraphicsComponent.DrawAnimation(new Rectangle((int)Pos.X, (int)Pos.Y, 48, 72), spriteBatch);
}
else
{
base.Draw(spriteBatch);
}
}
public override void Death()

View file

@ -0,0 +1,41 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public class SpiderWeb : CoreEnemy
{
public SpiderWeb(Vector2 position) : base(position)
{
name = "Web";
monster_speed = 1;
Width = 16;
Height = 0;
acceleration = Vector2.Zero;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "SpiderWeb" }, "SpiderWeb");
public override void Attack()
{
}
public override void Death()
{
}
public override void Move(GameTime gameTime)
{
}
}
}

View file

@ -14,9 +14,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public Werewolf(Vector2 position) : base(position)
{
name = "Wolf";
monster_speed = 1;
Width = 78;
Height = 96;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "");
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "WolfMoveRight");
public override void Attack()
{

View file

@ -15,30 +15,23 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
private bool isGoRight = true;
int leftBorder;
int rightBorder;
bool isAttaking = false;
public Zombie(Vector2 position) : base(position)
{
Width = 72;
Height = 120;
monster_speed = 10;
GraphicsComponent.StartAnimation("ZombieLeftAttack");
monster_speed = 3;
name = "Zombie";
leftBorder = (int)position.X;
rightBorder = (int)position.X + 200;
leftBorder = (int)position.X - 60;
rightBorder = (int)position.X + 120;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft");
public override void Update(GameTime gameTime)
{
if (AppManager.Instance.GameManager.GetPlayer1.Pos.X>Pos.X)
isGoRight = true;
else
isGoRight = false;
Move(gameTime);
if(Pos.X + 20 <= AppManager.Instance.GameManager.GetPlayer1.Pos.X || Pos.X - 20 >= AppManager.Instance.GameManager.GetPlayer1.Pos.X)
if (!isAttaking)
{
Attack();
AppManager.Instance.GameManager.GetPlayer1.Death(name);
Move(gameTime);
}
base.Update(gameTime);
@ -46,16 +39,22 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public override void Attack()
{
velocity.X = 0;
isAttaking = true;
if (isGoRight)
{
if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack")
GraphicsComponent.StartAnimation("ZombieRightAttack");
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
{
GraphicsComponent.StartAnimation("ZombieAttackRight");
}
AppManager.Instance.GameManager.players[0].Death(name);
}
else if (!isGoRight)
{
if (GraphicsComponent.GetCurrentAnimation != "ZombieLeftAttack")
{
GraphicsComponent.StartAnimation("ZombieLeftAttack");
}
AppManager.Instance.GameManager.players[0].Death(name);
}
}
@ -67,26 +66,45 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public override void Move(GameTime gameTime)
{
double delta = gameTime.ElapsedGameTime.TotalSeconds;
float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;
if (isGoRight)
{
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
{
GraphicsComponent.StartAnimation("ZombieMoveRight");
}
velocity.X = monster_speed;
}
else if (!isGoRight)
{
if(GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
{
GraphicsComponent.StartAnimation("ZombieMoveLeft");
}
velocity.X = -monster_speed;
}
}
public void TakeDamage(int damage)
if(Pos.X >= rightBorder)
{
isGoRight = false;
}
else if(Pos.X <= leftBorder)
{
isGoRight = true;
}
}
public override void OnCollision(GameObject gameObject)
{
monster_health -= damage;
//play take damage animation
if(gameObject is Player)
{
if (AppManager.Instance.GameManager.players[0].IsAlive)
{
Attack();
}
}
base.OnCollision(gameObject);
}
}
}

View file

@ -1,31 +0,0 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DangerousD.GameCore.GameObjects.LivingEntities
{
public class Player : LivingEntity
{
public Player(Vector2 position) : base(position)
{
Width = 32;
Height = 64;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft");//TODO: Change to player
public void Kill()
{
}
public void Death(string monsterName)
{
//анимация по имени монстра
}
}
}

View file

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DangerousD.GameCore.GameObjects;
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
namespace DangerousD.GameCore.GameObjects.PlayerDeath
{
public class DeathRectangle : GameObject
{
public DeathRectangle(Vector2 pos, string DeathType) : base(pos)
{
Height = 128;
Width = 128;
PlayDeath(DeathType);
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> {"DeathFromZombie"},
"DeathFromZombie");
public GraphicsComponent Gr => GraphicsComponent;
private void PlayDeath(string deathName)
{
if (GraphicsComponent.GetCurrentAnimation != "DeathFromZombie")
{
GraphicsComponent.StartAnimation("DeathFromZombie");
}
}
}
}

View file

@ -0,0 +1,45 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DangerousD.GameCore.GameObjects.PlayerDeath;
namespace DangerousD.GameCore.GameObjects.LivingEntities
{
public class Player : LivingEntity
{
bool isAlive = true;
public Player(Vector2 position) : base(position)
{
Width = 32;
Height = 64;
}
public bool IsAlive { get { return isAlive; } }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack", "DeathFromZombie" }, "ZombieMoveLeft");//TODO: Change to player
public void Kill()
{
}
public void Death(string monsterName)
{
if(monsterName == "Zombie")
{
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
{
if (a == "DeathFrom" + monsterName)
{
AppManager.Instance.ChangeGameState(GameState.GameOver);
}
};
}
isAlive = false;
}
}
}

View file

@ -23,4 +23,12 @@ public abstract class LivingEntity : Entity
}
base.Update(gameTime);
}
public virtual void StartCicycleAnimation(string animationName)
{
if (GraphicsComponent.GetCurrentAnimation != animationName)
{
GraphicsComponent.StartAnimation(animationName);
}
}
}

View file

@ -8,8 +8,10 @@ using System.Text;
namespace DangerousD.GameCore.Graphics
{
public class GraphicsComponent
{
public event Action<string> actionOfAnimationEnd;
private List<AnimationContainer> animations;
private List<Texture2D> textures;
private List<string> texturesNames;
@ -27,13 +29,11 @@ namespace DangerousD.GameCore.Graphics
private int interval;
private int lastInterval;
private Rectangle sourceRectangle;
public GraphicsComponent(List<string> animationsId, string neitralAnimationId)
{
//this._spriteBatch = _spriteBatch;
currentFrame = 0;
lastInterval = 1;
LoadAnimations(animationsId, neitralAnimationId);
currentAnimation = neitralAnimation;
SetInterval();
@ -114,10 +114,16 @@ namespace DangerousD.GameCore.Graphics
{
if (!currentAnimation.IsCycle)
{
if(actionOfAnimationEnd != null)
{
actionOfAnimationEnd(currentAnimation.Id);
}
currentAnimation = neitralAnimation;
}
currentFrame = 0;
}
buildSourceRectangle();

View file

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
namespace DangerousD.GameCore
{
public enum ScopeState { Up, Middle, Down }
class InputManager
public class InputManager
{
public delegate void Delegat();
public event Delegat MovEventJump;

View file

@ -0,0 +1 @@


View file

@ -8,38 +8,53 @@ using DangerousD.GameCore.GUI;
using Microsoft.Xna.Framework.Input;
using DangerousD.GameCore.Graphics;
using DangerousD.GameCore.Network;
using MonogameLibrary.UI.Base;
using DangerousD.GameCore.Managers;
namespace DangerousD.GameCore
{
public enum GameState { Menu, Options, Lobby, Game, Login }
public enum GameState { Menu, Options, Lobby, Game, Login, GameOver }
public class AppManager : Game
{
public static AppManager Instance { get; private set; }
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
public Point resolution;
GameState gameState;
IDrawableObject MenuGUI;
IDrawableObject OptionsGUI;
IDrawableObject LoginGUI;
IDrawableObject LobbyGUI;
public Point resolution = new Point(1920, 1080);
public Point inGameResolution = new Point(800, 480);
private RenderTarget2D renderTarget;
public GameManager GameManager { get; private set; } = new();
public AnimationBuilder AnimationBuilder { get; private set; } = new AnimationBuilder();
public NetworkManager NetworkManager { get; private set; } = new NetworkManager();
public InputManager InputManager { get; private set; } = new InputManager();
public SoundManager SoundManager { get; private set; } = new SoundManager();
public SettingsManager SettingsManager { get; private set; } = new SettingsManager();
public AppManager()
{
Content.RootDirectory = "Content";
Instance = this;
_graphics = new GraphicsDeviceManager(this);
IsMouseVisible = true;
resolution = new Point(_graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight);
TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30);
SettingsManager = new SettingsManager();
SettingsManager.LoadSettings();
resolution = SettingsManager.Resolution;
_graphics.PreferredBackBufferWidth = resolution.X;
_graphics.PreferredBackBufferHeight = resolution.Y;
// _graphics.IsFullScreen = true;
gameState = GameState.Menu;
MenuGUI = new MenuGUI();
LoginGUI = new LoginGUI();
LobbyGUI = new LobbyGUI();
UIManager.resolution = resolution;
UIManager.resolutionInGame = inGameResolution;
}
protected override void Initialize()
@ -60,6 +75,9 @@ namespace DangerousD.GameCore
LobbyGUI.LoadContent();
GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1);
GameObject.debugTexture.SetData<Color>(new Color[] { new Color(1, 0,0,0.25f) });
SoundManager.LoadSounds();
SoundManager.StartAmbientSound("DoomTestSong");
renderTarget = new RenderTarget2D(GraphicsDevice, inGameResolution.X, inGameResolution.Y);
}
protected override void Update(GameTime gameTime)
@ -67,6 +85,8 @@ namespace DangerousD.GameCore
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
InputManager.Update();
SoundManager.Update();
switch (gameState)
{
case GameState.Menu:
@ -95,6 +115,7 @@ namespace DangerousD.GameCore
{
GraphicsDevice.Clear(Color.CornflowerBlue);
GraphicsDevice.SetRenderTarget(renderTarget);
switch (gameState)
{
case GameState.Menu:
@ -110,13 +131,18 @@ namespace DangerousD.GameCore
LobbyGUI.Draw(_spriteBatch);
break;
case GameState.Game:
_spriteBatch.Begin(SpriteSortMode.Deferred,null,SamplerState.PointClamp);
_spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
GameManager.Draw(_spriteBatch);
_spriteBatch.End();
break;
default:
break;
}
GraphicsDevice.SetRenderTarget(null);
_spriteBatch.Begin();
_spriteBatch.Draw(renderTarget, new Rectangle(0, 0, _graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight), Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
@ -137,6 +163,8 @@ namespace DangerousD.GameCore
case GameState.Game:
GameManager.mapManager.LoadLevel("lvl");
break;
case GameState.GameOver:
break;
default:
throw new ArgumentOutOfRangeException();
}

View file

@ -21,6 +21,7 @@ namespace DangerousD.GameCore
public MapManager mapManager;
public PhysicsManager physicsManager;
public List<Player> players;
public List<GameObject> otherObjects = new();
public Player GetPlayer1 { get; private set; }
public GameManager()
{
@ -44,17 +45,28 @@ namespace DangerousD.GameCore
internal void Register(GameObject gameObject)
{
if (gameObject is LivingEntity)
livingEntities.Add(gameObject as LivingEntity);
else if (gameObject is Entity)
entities.Add(gameObject as Entity);
else if (gameObject is MapObject)
mapObjects.Add(gameObject as MapObject);
else if (gameObject is Player)
if (gameObject is Player)
{
livingEntities.Add(gameObject as LivingEntity);
players.Add(gameObject as Player);
GetPlayer1= players[0];
}else others.Add(gameObject);
GetPlayer1 = players[0];
}
else if (gameObject is LivingEntity)
{
livingEntities.Add(gameObject as LivingEntity);
}
else if (gameObject is Entity)
{
entities.Add(gameObject as Entity);
}
else if (gameObject is MapObject)
{
mapObjects.Add(gameObject as MapObject);
}
else
{
otherObjects.Add(gameObject);
}
}
public void Draw(SpriteBatch _spriteBatch)
@ -65,7 +77,7 @@ namespace DangerousD.GameCore
item.Draw(_spriteBatch);
foreach (var item in livingEntities)
item.Draw(_spriteBatch);
foreach (var item in others)
foreach (var item in otherObjects)
item.Draw(_spriteBatch);
}
@ -77,6 +89,8 @@ namespace DangerousD.GameCore
item.Update(gameTime);
foreach (var item in livingEntities)
item.Update(gameTime);
foreach (var item in otherObjects)
item.Update(gameTime);
physicsManager.UpdateCollisions(entities, livingEntities, mapObjects, gameTime);

View file

@ -1,13 +1,88 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Microsoft.Xna;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Newtonsoft.Json.Serialization;
namespace DangerousD.GameCore.Managers
{
internal class SettingsManager
public class SettingsManager
{
private SettingsContainer settingsContainer= new SettingsContainer();
public bool IsFullScreen { get => settingsContainer.IsFullScreen; }
public float MainVolume { get => settingsContainer.MainVolume; }
public float MusicVolume { get => settingsContainer.MusicVolume; }
public float SoundEffectsVolume { get => settingsContainer.SoundEffectsVolume; }
public Point Resolution { get => settingsContainer.Resolution; }
public void SetResolution(Point resolution)
{
settingsContainer.Resolution = resolution;
AppManager.Instance.resolution = resolution;
}
public void SetMainVolume(float volume)
{
settingsContainer.MainVolume = MainVolume;
///AppManager.Instance.SoundManager.
}
public void SetMusicVolume(float volume)
{
settingsContainer.MusicVolume = MainVolume;
}
public void SetSoundEffectsVolume(float volume)
{
settingsContainer.SoundEffectsVolume = MainVolume;
}
public void SetIsFullScreen(bool isFullScreen)
{
settingsContainer.IsFullScreen = isFullScreen;
}
public void LoadSettings()
{
if (!File.Exists("GameSettings.txt"))
{
SaveSettings();
return;
}
settingsContainer = JsonConvert.DeserializeObject<SettingsContainer>(File.ReadAllText("GameSettings.txt"));
SetIsFullScreen(settingsContainer.IsFullScreen);
SetMainVolume(settingsContainer.MainVolume);
SetMusicVolume(settingsContainer.MusicVolume);
SetResolution(settingsContainer.Resolution);
SetSoundEffectsVolume(settingsContainer.SoundEffectsVolume);
}
public void SaveSettings()
{
using (StreamWriter streamWriter = new StreamWriter("GameSettings.txt"))
{
string _str = JsonConvert.SerializeObject(settingsContainer);
streamWriter.Write(_str);
}
}
}
[Serializable]
public class SettingsContainer
{
[JsonProperty("IsFullScreen")]
public bool IsFullScreen { get; set; } = false;
[JsonProperty("MainVolume")]
public float MainVolume { get; set; } = 1;
[JsonProperty("MusicVolume")]
public float MusicVolume { get; set; } = 1;
[JsonProperty("SoundEffectsVolume")]
public float SoundEffectsVolume { get; set; } = 1;
[JsonProperty("Resolution")]
public Point Resolution { get; set; } = new Point(1920,1080);
}
}

View file

@ -5,6 +5,9 @@ using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using System.Linq;
using DangerousD.GameCore.Graphics;
using Newtonsoft.Json;
namespace DangerousD.GameCore
{
@ -12,19 +15,19 @@ namespace DangerousD.GameCore
{
public Dictionary<string, SoundEffectInstance> Sounds = new Dictionary<string, SoundEffectInstance>(); // словарь со звуками где строка - название файла
public List<Sound> PlayingSounds = new List<Sound>(); // список со всеми звуками, которые проигрываются
public string SoundDirectory = "Sounds"; // папка со звуками там где exe
public float MaxSoundDistance = 1500; // максимальная дальность звука
public void LoadSounds(ContentManager content) // метод для загрузки звуков из папки
public void LoadSounds() // метод для загрузки звуков из папки
{
var soundFiles = Directory.GetFiles(SoundDirectory);
string[] soundFiles = Directory.GetFiles("../../../Content").Where(x=>x.EndsWith("mp3")).Select(x=>x.Split("\\").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
foreach (var soundFile in soundFiles)
{
Sounds.Add(soundFile, content.Load<SoundEffectInstance>(soundFile));
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>(soundFile).CreateInstance());
}
}
public void StartSound(string soundName) // запустить звук у которого нет позиции
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
{
var sound = new Sound(Sounds[soundName]);
sound.SoundEffect.IsLooped = false;
@ -39,7 +42,7 @@ namespace DangerousD.GameCore
sound.SoundEffect.Volume = (float)sound.GetDistance(playerPos) / MaxSoundDistance;
sound.SoundEffect.Play();
PlayingSounds.Add(sound);
}//GameManager.SendSound
}
public void StopAllSounds() // остановка всех звуков
{
foreach (var sound in PlayingSounds)
@ -47,14 +50,21 @@ namespace DangerousD.GameCore
PlayingSounds.Clear();
}
public void Update(Vector2 playerPos) // апдейт, тут происходит изменение громкости
public void Update() // апдейт, тут происходит изменение громкости
{
foreach (var sound in PlayingSounds)
var player = AppManager.Instance.GameManager.GetPlayer1;
if (player != null)
{
if (!sound.isAmbient)
sound.SoundEffect.Volume = (float)sound.GetDistance(playerPos) / MaxSoundDistance;
if (sound.SoundEffect.State == SoundState.Stopped)
PlayingSounds.Remove(sound);
for (int i = 0; i < PlayingSounds.Count; i++)
{
if (!PlayingSounds[i].isAmbient)
PlayingSounds[i].SoundEffect.Volume = (float)PlayingSounds[i].GetDistance(player.Pos) / MaxSoundDistance;
if (PlayingSounds[i].SoundEffect.State == SoundState.Stopped)
PlayingSounds.Remove(PlayingSounds[i]);
}
}
}
}

View file

@ -28,6 +28,7 @@ namespace MonogameLibrary.UI.Base
public KeyboardState GetKeyboardState { get { return keyboardState; } }
static MouseState mouseState, prevmouseState;
static KeyboardState keyboardState;
public static Point resolutionInGame, resolution;
public void LoadContent(ContentManager content, string font)
{
@ -53,6 +54,8 @@ namespace MonogameLibrary.UI.Base
{
keyboardState = Keyboard.GetState();
mouseState = Mouse.GetState();
mouseState = new MouseState((int)(mouseState.X*(float)resolutionInGame.X/resolution.X),
(int)(mouseState.Y * (float)resolutionInGame.Y / resolution.Y), mouseState.ScrollWheelValue, mouseState.LeftButton, mouseState.MiddleButton, mouseState.RightButton, mouseState.XButton1, mouseState.XButton2);
}
catch
{