Merge remote-tracking branch 'origin/ui'

# Conflicts:
#	DangerousD/GameCore/Managers/AppManager.cs
This commit is contained in:
SergoDobro 2023-08-16 23:07:19 +03:00
commit e3c9630c83
7 changed files with 72 additions and 27 deletions

View file

@ -54,6 +54,41 @@
/processorParam:TextureFormat=Compressed
/build:Font2.spritefont
#begin menuFon.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:menuFon.jpg
#begin MenuFon2.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: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 MonstersAnimations.png
/importer:TextureImporter
@ -67,18 +102,6 @@
/processorParam:TextureFormat=Color
/build:MonstersAnimations.png
#begin menuFon.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:menuFon.jpg
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 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,6 +11,8 @@ 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" };

View file

@ -7,7 +7,7 @@ using MonogameLibrary.UI.Interfaces;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using static System.Net.Mime.MediaTypeNames;
using static System.Net.Mime.MediaTypeNames;
namespace MonogameLibrary.UI.Base
{
@ -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)
{
@ -48,11 +49,13 @@ namespace MonogameLibrary.UI.Base
}
}
public void Update()
{
{
try
{
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
{