Merge branch 'ui'
This commit is contained in:
commit
463db1b00a
15 changed files with 437 additions and 25 deletions
BIN
DangerousD/Content/Caveat-Bold.ttf
Normal file
BIN
DangerousD/Content/Caveat-Bold.ttf
Normal file
Binary file not shown.
|
@ -13,6 +13,27 @@
|
|||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin File.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:File.spritefont
|
||||
|
||||
#begin Font_25.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font_25.spritefont
|
||||
|
||||
#begin Font2.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font2.spritefont
|
||||
|
||||
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
|
60
DangerousD/Content/File.spritefont
Normal file
60
DangerousD/Content/File.spritefont
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?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>Handjet-ExtraLight.ttf</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>70</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>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
60
DangerousD/Content/Font2.spritefont
Normal file
60
DangerousD/Content/Font2.spritefont
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?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>JosefinSans-Bold.ttf</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>100</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>Bold</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>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
64
DangerousD/Content/Font_25.spritefont
Normal file
64
DangerousD/Content/Font_25.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>Arial</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>25</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>
|
64
DangerousD/Content/Font_30.spritefont
Normal file
64
DangerousD/Content/Font_30.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>Arial</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>30</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/Handjet-ExtraLight.ttf
Normal file
BIN
DangerousD/Content/Handjet-ExtraLight.ttf
Normal file
Binary file not shown.
BIN
DangerousD/Content/JosefinSans-Bold.ttf
Normal file
BIN
DangerousD/Content/JosefinSans-Bold.ttf
Normal file
Binary file not shown.
|
@ -10,22 +10,23 @@ public abstract class AbstractGui : IDrawableObject
|
|||
{
|
||||
protected UIManager Manager = new();
|
||||
protected List<DrawableUIElement> Elements = new();
|
||||
protected string font;
|
||||
|
||||
public AbstractGui()
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract void CreateUI();
|
||||
|
||||
private GraphicsDevice graphicsDevice;
|
||||
public virtual void Initialize(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
Manager.Initialize(font, graphicsDevice);
|
||||
Manager.Initialize(graphicsDevice);
|
||||
this.graphicsDevice = graphicsDevice;
|
||||
CreateUI();
|
||||
}
|
||||
|
||||
public virtual void LoadContent()
|
||||
{
|
||||
Manager.LoadContent(AppManager.Instance.Content);
|
||||
Manager.LoadContent(AppManager.Instance.Content, "Font");
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime gameTime)
|
||||
|
|
106
DangerousD/GameCore/GUI/LoginGUI.cs
Normal file
106
DangerousD/GameCore/GUI/LoginGUI.cs
Normal file
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
using MonogameLibrary.UI.Elements;
|
||||
using MonogameLibrary.UI.Enums;
|
||||
|
||||
namespace DangerousD.GameCore.GUI
|
||||
{
|
||||
class LoginGUI : AbstractGui
|
||||
{
|
||||
protected override void CreateUI()
|
||||
{
|
||||
int screenWidth = AppManager.Instance.resolution.X;
|
||||
int screenHeight = AppManager.Instance.resolution.Y;
|
||||
|
||||
Elements.Add(new Label(Manager) {
|
||||
rectangle = new Rectangle(screenWidth / 2 - 250, screenHeight / 6 - 50, 500, 100),
|
||||
text = "Login",
|
||||
scale = 0.8f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Transparent,
|
||||
fontName = "font2"
|
||||
});
|
||||
|
||||
// TextBox-ы
|
||||
{
|
||||
TextBox loginTextBox = new TextBox(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(screenWidth / 2 - 125, screenHeight / 6 * 2 - 20, 250, 40),
|
||||
text = "NickName",
|
||||
scale = 0.16f,
|
||||
fontColor = Color.Gray,
|
||||
fontName = "font2",
|
||||
textAligment = TextAligment.Left
|
||||
};
|
||||
loginTextBox.TextChanged += input => {
|
||||
if (loginTextBox.fontColor == Color.Gray)
|
||||
{
|
||||
loginTextBox.text = ""; loginTextBox.fontColor = Color.Black;
|
||||
}
|
||||
};
|
||||
|
||||
TextBox passwordTextBox = new TextBox(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(screenWidth / 2 - 125, screenHeight / 6 * 3 - 40, 250, 40),
|
||||
text = "Password",
|
||||
scale = 0.16f,
|
||||
fontColor = Color.Gray,
|
||||
fontName = "font2",
|
||||
textAligment = TextAligment.Left
|
||||
};
|
||||
passwordTextBox.TextChanged += input => {
|
||||
if (passwordTextBox.fontColor == Color.Gray)
|
||||
{
|
||||
passwordTextBox.text = ""; passwordTextBox.fontColor = Color.Black;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Кнопки
|
||||
{
|
||||
Button logButton = new Button(Manager) {
|
||||
rectangle = new Rectangle(screenWidth / 4 + 50, screenHeight / 6 * 4, 100, 50),
|
||||
text = "LogIn",
|
||||
scale = 0.2f,
|
||||
fontColor = Color.Black,
|
||||
fontName = "font2"
|
||||
};
|
||||
logButton.LeftButtonPressed += () => {
|
||||
AppManager.Instance.ChangeGameState(GameState.Lobby);
|
||||
};
|
||||
|
||||
Button regButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(screenWidth / 4 * 2 + 50, screenHeight / 6 * 4, 100, 50),
|
||||
text = "Reg",
|
||||
scale = 0.2f,
|
||||
fontColor = Color.Black,
|
||||
fontName = "font2"
|
||||
};
|
||||
regButton.LeftButtonPressed += GoToRegWebServer;
|
||||
|
||||
Button backButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, 50, 50),
|
||||
text = "<-",
|
||||
scale = 0.3f,
|
||||
fontColor = Color.Black,
|
||||
fontName = "font2"
|
||||
};
|
||||
backButton.LeftButtonPressed += () => {
|
||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void GoToRegWebServer()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,12 +8,31 @@ internal class MenuGUI : AbstractGui
|
|||
{
|
||||
protected override void CreateUI()
|
||||
{
|
||||
Elements.Add(new CheckBox(Manager) { rectangle = new Rectangle(10, 10, 50, 50) });
|
||||
var but = new Button(Manager) { rectangle = new Rectangle(100, 10, 80, 50) };
|
||||
Elements.Add(but);
|
||||
but.LeftButtonPressed += () =>
|
||||
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" };
|
||||
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" };
|
||||
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" };
|
||||
Elements.Add(butOption);
|
||||
butOption.LeftButtonPressed += () =>
|
||||
{
|
||||
// открытие настроек
|
||||
};
|
||||
var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" };
|
||||
Elements.Add(butExit);
|
||||
butExit.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.Exit();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,16 +10,19 @@ using DangerousD.GameCore.Graphics;
|
|||
|
||||
namespace DangerousD.GameCore
|
||||
{
|
||||
public enum GameState { Menu, Options, Lobby, Game }
|
||||
public enum GameState { Menu, Options, Lobby, Game, Login }
|
||||
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 GameManager GameManager { get; private set; }
|
||||
public AnimationBuilder AnimationBuilder { get; private set; } = new AnimationBuilder();
|
||||
public AppManager()
|
||||
|
@ -30,22 +33,26 @@ namespace DangerousD.GameCore
|
|||
IsMouseVisible = true;
|
||||
TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30);
|
||||
|
||||
resolution = new Point(_graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight);
|
||||
GameManager = new GameManager();
|
||||
gameState = GameState.Menu;
|
||||
MenuGUI = new MenuGUI();
|
||||
LoginGUI = new LoginGUI();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
MenuGUI.Initialize(GraphicsDevice);
|
||||
AnimationBuilder.LoadAnimations();
|
||||
MenuGUI.Initialize(GraphicsDevice);
|
||||
LoginGUI.Initialize(GraphicsDevice);
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
protected override void LoadContent()
|
||||
protected override void LoadContent()
|
||||
{
|
||||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
MenuGUI.LoadContent();
|
||||
LoginGUI.LoadContent();
|
||||
}
|
||||
|
||||
protected override void Update(GameTime gameTime)
|
||||
|
@ -61,6 +68,9 @@ namespace DangerousD.GameCore
|
|||
case GameState.Options:
|
||||
OptionsGUI.Update(gameTime);
|
||||
break;
|
||||
case GameState.Login:
|
||||
LoginGUI.Update(gameTime);
|
||||
break;
|
||||
case GameState.Lobby:
|
||||
LobbyGUI.Update(gameTime);
|
||||
break;
|
||||
|
@ -86,6 +96,9 @@ namespace DangerousD.GameCore
|
|||
case GameState.Options:
|
||||
OptionsGUI.Draw(_spriteBatch);
|
||||
break;
|
||||
case GameState.Login:
|
||||
LoginGUI.Draw(_spriteBatch);
|
||||
break;
|
||||
case GameState.Lobby:
|
||||
LobbyGUI.Draw(_spriteBatch);
|
||||
break;
|
||||
|
@ -110,6 +123,8 @@ namespace DangerousD.GameCore
|
|||
break;
|
||||
case GameState.Options:
|
||||
break;
|
||||
case GameState.Login:
|
||||
break;
|
||||
case GameState.Lobby:
|
||||
break;
|
||||
case GameState.Game:
|
||||
|
|
|
@ -57,11 +57,11 @@ namespace MonogameLibrary.UI.Base
|
|||
spriteBatch.DrawString(spriteFont, text, pos, fontColor, 0, Vector2.Zero, scale,
|
||||
SpriteEffects.None, 0);
|
||||
}
|
||||
else if (textAligment == TextAligment.Center)
|
||||
else if (textAligment == TextAligment.Left)
|
||||
{
|
||||
Vector2 pos = rectangle.Location.ToVector2();
|
||||
pos.Y += (int)((rectangle.Height - measured.Y) / 2);
|
||||
pos.X += (int)(2 * scale);
|
||||
pos.X += (int)(2 * scale + rectangle.Width / 20);
|
||||
spriteBatch.DrawString(spriteFont, text, pos, fontColor, 0, Vector2.Zero, scale,
|
||||
SpriteEffects.None, 0);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace MonogameLibrary.UI.Base
|
|||
if (textureName == "")
|
||||
{
|
||||
texture = new Texture2D(Manager.GraphicsDevice, 1, 1);
|
||||
texture.SetData<Color>(new Color[] { Color.White });
|
||||
texture.SetData<Color>(new Color[] { mainColor });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace MonogameLibrary.UI.Base
|
|||
catch
|
||||
{
|
||||
texture = new Texture2D(Manager.GraphicsDevice, 1, 1);
|
||||
texture.SetData<Color>(new Color[] { Color.White });
|
||||
texture.SetData<Color>(new Color[] { mainColor });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,16 +16,10 @@ namespace MonogameLibrary.UI.Base
|
|||
Dictionary<int, List<DrawableUIElement>> layerCollection = new();
|
||||
public GraphicsDevice GraphicsDevice { get; private set; }
|
||||
public SpriteFont BaseFont { get; private set; }
|
||||
public void Initialize(string font, GraphicsDevice graphicsDevice)
|
||||
public void Initialize(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
GraphicsDevice = graphicsDevice;
|
||||
try
|
||||
{
|
||||
//BaseFont = _content.Load<SpriteFont>(font);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
for (int i = -10; i < 11; i++)
|
||||
{
|
||||
layerCollection.Add(i, new List<DrawableUIElement>());
|
||||
|
@ -35,8 +29,16 @@ namespace MonogameLibrary.UI.Base
|
|||
static MouseState mouseState, prevmouseState;
|
||||
static KeyboardState keyboardState;
|
||||
|
||||
public void LoadContent(ContentManager content)
|
||||
public void LoadContent(ContentManager content, string font)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
BaseFont = content.Load<SpriteFont>(font);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
foreach (var collection in layerCollection)
|
||||
{
|
||||
foreach (var item in collection.Value)
|
||||
|
|
Loading…
Add table
Reference in a new issue