menu background
This commit is contained in:
parent
52743c1f89
commit
5d1800c90e
8 changed files with 88 additions and 30 deletions
|
@ -41,6 +41,41 @@
|
||||||
/processorParam:TextureFormat=Compressed
|
/processorParam:TextureFormat=Compressed
|
||||||
/build:Font2.spritefont
|
/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
|
#begin MonstersAnimations.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
|
@ -54,18 +89,6 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:MonstersAnimations.png
|
/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
|
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
|
BIN
DangerousD/Content/MenuFon2.jpg
Normal file
BIN
DangerousD/Content/MenuFon2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 464 KiB |
BIN
DangerousD/Content/menuFon3.jpg
Normal file
BIN
DangerousD/Content/menuFon3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 KiB |
|
@ -7,6 +7,10 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using DangerousD.GameCore.Managers;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GUI
|
namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
class LobbyGUI : AbstractGui
|
class LobbyGUI : AbstractGui
|
||||||
|
@ -17,8 +21,12 @@ namespace DangerousD.GameCore.GUI
|
||||||
}
|
}
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int screenWidth = AppManager.Instance.resolution.X;
|
int screenWidth = AppManager.Instance.inGameResolution.X;
|
||||||
int screenHeight = AppManager.Instance.resolution.Y;
|
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
|
// CheckBoxs
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(screenWidth / 30 * 2, screenHeight / 30 * 5,
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle(screenWidth / 30 * 2, screenHeight / 30 * 5,
|
||||||
|
@ -26,7 +34,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
{
|
{
|
||||||
Button backButton = new Button(Manager)
|
Button backButton = new ButtonText(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30, screenHeight / 30, 60, 50),
|
rectangle = new Rectangle(screenWidth / 30, screenHeight / 30, 60, 50),
|
||||||
text = "<-",
|
text = "<-",
|
||||||
|
@ -38,7 +46,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
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),
|
rectangle = new Rectangle(screenWidth / 30, screenHeight / 15 * 13, 120, 50),
|
||||||
text = "Host",
|
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),
|
rectangle = new Rectangle(screenWidth / 30 * 6, screenHeight / 15 * 13, 120, 50),
|
||||||
text = "Refresh",
|
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),
|
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 15 * 13, 120, 50),
|
||||||
text = "Join",
|
text = "Join",
|
||||||
|
@ -73,7 +81,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
joinSelectedButton.LeftButtonPressed += () => {
|
joinSelectedButton.LeftButtonPressed += () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
Button joinByIpButton = new Button(Manager)
|
Button joinByIpButton = new ButtonText(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 30, 120, 50),
|
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 30, 120, 50),
|
||||||
text = "JoinByIp",
|
text = "JoinByIp",
|
||||||
|
|
|
@ -5,6 +5,10 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
using DangerousD.GameCore.Managers;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
using MonogameLibrary.UI.Elements;
|
using MonogameLibrary.UI.Elements;
|
||||||
using MonogameLibrary.UI.Enums;
|
using MonogameLibrary.UI.Enums;
|
||||||
|
|
||||||
|
@ -20,8 +24,12 @@ namespace DangerousD.GameCore.GUI
|
||||||
|
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int screenWidth = AppManager.Instance.resolution.X;
|
int screenWidth = AppManager.Instance.inGameResolution.X;
|
||||||
int screenHeight = AppManager.Instance.resolution.Y;
|
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) {
|
Elements.Add(new Label(Manager) {
|
||||||
rectangle = new Rectangle(screenWidth / 2 - 250, screenHeight / 6 - 50, 500, 100),
|
rectangle = new Rectangle(screenWidth / 2 - 250, screenHeight / 6 - 50, 500, 100),
|
||||||
|
@ -29,7 +37,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
scale = 0.8f,
|
scale = 0.8f,
|
||||||
fontColor = Color.White,
|
fontColor = Color.White,
|
||||||
mainColor = Color.Transparent,
|
mainColor = Color.Transparent,
|
||||||
fontName = "font2"
|
fontName = "ButtonFont"
|
||||||
});
|
});
|
||||||
|
|
||||||
// TextBox-ы
|
// 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),
|
rectangle = new Rectangle(screenWidth / 4 + 50, screenHeight / 6 * 4, 100, 50),
|
||||||
text = "LogIn",
|
text = "LogIn",
|
||||||
scale = 0.2f,
|
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),
|
rectangle = new Rectangle(screenWidth / 4 * 2 + 50, screenHeight / 6 * 4, 100, 50),
|
||||||
text = "Reg",
|
text = "Reg",
|
||||||
|
@ -107,7 +115,7 @@ namespace DangerousD.GameCore.GUI
|
||||||
};
|
};
|
||||||
regButton.LeftButtonPressed += GoToRegWebServer;
|
regButton.LeftButtonPressed += GoToRegWebServer;
|
||||||
|
|
||||||
Button backButton = new Button(Manager)
|
Button backButton = new ButtonText(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, 50, 50),
|
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, 50, 50),
|
||||||
text = "<-",
|
text = "<-",
|
||||||
|
|
|
@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
using MonogameLibrary.UI.Elements;
|
using MonogameLibrary.UI.Elements;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GUI;
|
namespace DangerousD.GameCore.GUI;
|
||||||
|
|
||||||
|
@ -10,6 +11,8 @@ internal class MenuGUI : AbstractGui
|
||||||
{
|
{
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int wigth = AppManager.Instance.Window.ClientBounds.Width;
|
int wigth = AppManager.Instance.Window.ClientBounds.Width;
|
||||||
int height = AppManager.Instance.Window.ClientBounds.Height;
|
int height = AppManager.Instance.Window.ClientBounds.Height;
|
||||||
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" };
|
||||||
|
|
|
@ -8,6 +8,7 @@ using DangerousD.GameCore.GUI;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using DangerousD.GameCore.Graphics;
|
using DangerousD.GameCore.Graphics;
|
||||||
using DangerousD.GameCore.Network;
|
using DangerousD.GameCore.Network;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
|
||||||
namespace DangerousD.GameCore
|
namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
|
@ -17,7 +18,8 @@ namespace DangerousD.GameCore
|
||||||
public static AppManager Instance { get; private set; }
|
public static AppManager Instance { get; private set; }
|
||||||
private GraphicsDeviceManager _graphics;
|
private GraphicsDeviceManager _graphics;
|
||||||
private SpriteBatch _spriteBatch;
|
private SpriteBatch _spriteBatch;
|
||||||
public Point resolution;
|
public Point resolution = new Point(1920, 1080);
|
||||||
|
public Point inGameResolution = new Point(800, 480);
|
||||||
GameState gameState;
|
GameState gameState;
|
||||||
IDrawableObject MenuGUI;
|
IDrawableObject MenuGUI;
|
||||||
IDrawableObject OptionsGUI;
|
IDrawableObject OptionsGUI;
|
||||||
|
@ -27,6 +29,7 @@ namespace DangerousD.GameCore
|
||||||
public GameManager GameManager { get; private set; } = new GameManager();
|
public GameManager GameManager { get; private set; } = new GameManager();
|
||||||
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();
|
||||||
|
private RenderTarget2D renderTarget;
|
||||||
public AppManager()
|
public AppManager()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
@ -34,12 +37,16 @@ namespace DangerousD.GameCore
|
||||||
Content.RootDirectory = "Content";
|
Content.RootDirectory = "Content";
|
||||||
IsMouseVisible = true;
|
IsMouseVisible = true;
|
||||||
TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30);
|
TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30);
|
||||||
|
|
||||||
resolution = new Point(_graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight);
|
_graphics.PreferredBackBufferWidth = resolution.X;
|
||||||
|
_graphics.PreferredBackBufferHeight = resolution.Y;
|
||||||
|
_graphics.IsFullScreen = true;
|
||||||
gameState = GameState.Menu;
|
gameState = GameState.Menu;
|
||||||
MenuGUI = new MenuGUI();
|
MenuGUI = new MenuGUI();
|
||||||
LoginGUI = new LoginGUI();
|
LoginGUI = new LoginGUI();
|
||||||
LobbyGUI = new LobbyGUI();
|
LobbyGUI = new LobbyGUI();
|
||||||
|
UIManager.resolution = resolution;
|
||||||
|
UIManager.resolutionInGame = inGameResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
|
@ -59,6 +66,7 @@ namespace DangerousD.GameCore
|
||||||
LobbyGUI.LoadContent();
|
LobbyGUI.LoadContent();
|
||||||
GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1);
|
GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1);
|
||||||
GameObject.debugTexture.SetData<Color>(new Color[] { new Color(1, 0,0,0.25f) });
|
GameObject.debugTexture.SetData<Color>(new Color[] { new Color(1, 0,0,0.25f) });
|
||||||
|
renderTarget = new RenderTarget2D(GraphicsDevice, inGameResolution.X, inGameResolution.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
|
@ -94,6 +102,7 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||||
|
|
||||||
|
GraphicsDevice.SetRenderTarget(renderTarget);
|
||||||
switch (gameState)
|
switch (gameState)
|
||||||
{
|
{
|
||||||
case GameState.Menu:
|
case GameState.Menu:
|
||||||
|
@ -116,6 +125,10 @@ namespace DangerousD.GameCore
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GraphicsDevice.SetRenderTarget(null);
|
||||||
|
_spriteBatch.Begin();
|
||||||
|
_spriteBatch.Draw(renderTarget, new Rectangle(0,0, _graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight), Color.White);
|
||||||
|
_spriteBatch.End();
|
||||||
|
|
||||||
base.Draw(gameTime);
|
base.Draw(gameTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ using MonogameLibrary.UI.Interfaces;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
namespace MonogameLibrary.UI.Base
|
namespace MonogameLibrary.UI.Base
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ namespace MonogameLibrary.UI.Base
|
||||||
public KeyboardState GetKeyboardState { get { return keyboardState; } }
|
public KeyboardState GetKeyboardState { get { return keyboardState; } }
|
||||||
static MouseState mouseState, prevmouseState;
|
static MouseState mouseState, prevmouseState;
|
||||||
static KeyboardState keyboardState;
|
static KeyboardState keyboardState;
|
||||||
|
public static Point resolutionInGame, resolution;
|
||||||
|
|
||||||
public void LoadContent(ContentManager content, string font)
|
public void LoadContent(ContentManager content, string font)
|
||||||
{
|
{
|
||||||
|
@ -48,11 +49,13 @@ namespace MonogameLibrary.UI.Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
keyboardState = Keyboard.GetState();
|
keyboardState = Keyboard.GetState();
|
||||||
mouseState = Mouse.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
|
catch
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue