This commit is contained in:
gravity 2023-08-15 17:31:55 +03:00
parent 463db1b00a
commit 14a5b445a1
10 changed files with 61 additions and 12 deletions

View file

@ -11,7 +11,7 @@ with.
<!--
Modify this string to change the font that will be imported.
-->
<FontName>Handjet-ExtraLight.ttf</FontName>
<FontName>RubikWetPaint-Regular.ttf</FontName>
<!--
Size is a float value, measured in points. Modify this value to change

Binary file not shown.

View file

@ -13,12 +13,12 @@
#---------------------------------- Content ---------------------------------#
#begin File.spritefont
#begin ButtonFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:File.spritefont
/build:ButtonFont.spritefont
#begin Font_25.spritefont
/importer:FontDescriptionImporter
@ -27,12 +27,12 @@
/processorParam:TextureFormat=Compressed
/build:Font_25.spritefont
#begin Font2.spritefont
#begin Font_30.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Font2.spritefont
/build:Font_30.spritefont
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
/importer:TextureImporter

Binary file not shown.

View file

@ -10,25 +10,25 @@ internal class MenuGUI : AbstractGui
{
int wigth = AppManager.Instance.Window.ClientBounds.Width;
int height = AppManager.Instance.Window.ClientBounds.Height;
var butSingle = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "File" };
var butSingle = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "ButtonFont" };
Elements.Add(butSingle);
butSingle.LeftButtonPressed += () =>
{
AppManager.Instance.ChangeGameState(GameState.Game);
};
var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" };
var butMulti = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "ButtonFont" };
Elements.Add(butMulti);
butMulti.LeftButtonPressed += () =>
{
AppManager.Instance.ChangeGameState(GameState.Login);
};
var butOption = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 250, 300, 50), text = "Option", fontName = "File" };
var butOption = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 250, 300, 50), text = "Option", fontName = "ButtonFont" };
Elements.Add(butOption);
butOption.LeftButtonPressed += () =>
{
// открытие настроек
};
var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" };
var butExit = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "ButtonFont" };
Elements.Add(butExit);
butExit.LeftButtonPressed += () =>
{

View file

@ -1,4 +1,5 @@
using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
@ -9,6 +10,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
{
public class Player : LivingEntity
{
public Player(Vector2 position) : base(position)
{
}
protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException();
public void Kill()

View file

@ -8,7 +8,6 @@ namespace DangerousD.GameCore.Levels
{
public void InitLevel()
{
new Player();
var Трава = new GrassBlock(new Vector2(0, 128));
var Death = new TestAnimationDeath(new Vector2(128, 128));

View file

@ -22,7 +22,7 @@ namespace MonogameLibrary.UI.Elements
{
}
public bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
{
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
{
@ -61,11 +61,19 @@ namespace MonogameLibrary.UI.Elements
public override void Draw(SpriteBatch _spriteBatch)
{
if (hoverState == HoverState.None)
{
_spriteBatch.Draw(texture, rectangle, Color.White);
}
else if (hoverState == HoverState.Hovering)
_spriteBatch.Draw(texture, rectangle, new Color(211,211,211));
{
_spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211));
}
else
{
_spriteBatch.Draw(texture, rectangle, new Color(112, 128, 144));
}
DrawText(_spriteBatch);
}
}

View file

@ -0,0 +1,37 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonogameLibrary.UI.Base;
using MonogameLibrary.UI.Enums;
using MonogameLibrary.UI.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
using static MonogameLibrary.UI.Elements.Button;
namespace MonogameLibrary.UI.Elements
{
public class ButtonText : Button
{
public ButtonText(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
{
}
public override void Draw(SpriteBatch _spriteBatch)
{
if (hoverState == HoverState.None)
{
fontColor = Color.White;
}
else if (hoverState == HoverState.Hovering)
{
fontColor = new Color(211, 211, 211);
}
else
{
fontColor = new Color(112, 128, 144);
}
DrawText(_spriteBatch);
}
}
}