Update for new MyMonoGame
This commit is contained in:
parent
492c058e9b
commit
7b247a2e72
|
@ -1,10 +1,10 @@
|
|||
using Galactic_Colors_Control;
|
||||
using Galactic_Colors_Control_Common;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using MyMonoGame;
|
||||
using MyMonoGame.GUI;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
@ -23,14 +23,6 @@ namespace Galactic_Colors_Control_GUI
|
|||
private SpriteBatch spriteBatch;
|
||||
private ContentManager content;
|
||||
|
||||
private SoundEffect[] effects = new SoundEffect[4]; //click, hover, explosion,...
|
||||
|
||||
public Fonts fonts;
|
||||
|
||||
internal static Texture2D nullSprite;
|
||||
|
||||
private Texture2D[] pointerSprites = new Texture2D[1];
|
||||
public boxSprites[] buttonsSprites = new boxSprites[1];
|
||||
public Background background;
|
||||
|
||||
public MultiLang multilang = new MultiLang();
|
||||
|
@ -80,8 +72,6 @@ namespace Galactic_Colors_Control_GUI
|
|||
multilang.Load();
|
||||
if (Program._debug) { logger.Write("CLIENT IS IN DEBUG MODE !", Logger.logType.error, Logger.logConsole.show); }
|
||||
if (Program._dev) { logger.Write("CLIENT IS IN DEV MODE !", Logger.logType.error, Logger.logConsole.show); }
|
||||
nullSprite = new Texture2D(GraphicsDevice, 1, 1);
|
||||
nullSprite.SetData(new Color[1 * 1] { Color.White });
|
||||
|
||||
GUI.Initialise();
|
||||
base.Initialize();
|
||||
|
@ -96,82 +86,55 @@ namespace Galactic_Colors_Control_GUI
|
|||
// Create a new SpriteBatch, which can be used to draw textures.
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
|
||||
GUI.content.Initialise(content, GraphicsDevice);
|
||||
|
||||
//Need OpenAL Update for Windows 10 at least
|
||||
effects[0] = content.Load<SoundEffect>("Sounds/alert");
|
||||
effects[1] = content.Load<SoundEffect>("Sounds/bip");
|
||||
effects[2] = content.Load<SoundEffect>("Sounds/change");
|
||||
effects[3] = content.Load<SoundEffect>("Sounds/valid");
|
||||
GUI.content.AddSound("alert");
|
||||
GUI.content.AddSound("bip");
|
||||
GUI.content.AddSound("change");
|
||||
GUI.content.AddSound("valid");
|
||||
|
||||
fonts.small = content.Load<SpriteFont>("Fonts/small");
|
||||
fonts.basic = content.Load<SpriteFont>("Fonts/basic");
|
||||
fonts.title = content.Load<SpriteFont>("Fonts/title");
|
||||
GUI.content.AddFont("small");
|
||||
GUI.content.AddFont("basic");
|
||||
GUI.content.AddFont("title");
|
||||
|
||||
for (int i = 0; i < pointerSprites.Length; i++)
|
||||
{
|
||||
pointerSprites[i] = content.Load<Texture2D>("Textures/Hub/pointer" + i);
|
||||
}
|
||||
GUI.content.AddTexture("pointer", "Hub/pointer0");
|
||||
|
||||
Texture2D[] backSprites = new Texture2D[2];
|
||||
backSprites[0] = content.Load<Texture2D>("Textures/background0");
|
||||
backSprites[1] = content.Load<Texture2D>("Textures/background1");
|
||||
GUI.content.AddTexture("background0");
|
||||
GUI.content.AddTexture("background1");
|
||||
|
||||
States.MainMenuState.logoSprite = content.Load<Texture2D>("Textures/LogoSmall");
|
||||
GUI.content.AddTexture("logoSmall", "LogoSmall");
|
||||
|
||||
for (int i = 0; i < buttonsSprites.Length; i++)
|
||||
{
|
||||
buttonsSprites[i].topLeft = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/topLeft");
|
||||
buttonsSprites[i].topCenter = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/topCenter");
|
||||
buttonsSprites[i].topRight = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/topRight");
|
||||
buttonsSprites[i].centerLeft = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/centerLeft");
|
||||
buttonsSprites[i].centerCenter = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/centerCenter");
|
||||
buttonsSprites[i].centerRight = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/centerRight");
|
||||
buttonsSprites[i].bottomLeft = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/bottomLeft");
|
||||
buttonsSprites[i].bottomCenter = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/bottomCenter");
|
||||
buttonsSprites[i].bottomRight = content.Load<Texture2D>("Textures/Hub/Buttons/" + i + "/bottomRight");
|
||||
}
|
||||
GUI.content.AddBox("Default", "Hub/Buttons/0");
|
||||
|
||||
//Load from files
|
||||
if (Directory.Exists("Skin/" + config.skin))
|
||||
{
|
||||
if (Directory.Exists("Skin/" + config.skin + "/Sounds"))
|
||||
{
|
||||
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/alert.mp3", ref effects[0]);
|
||||
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/bip.mp3", ref effects[1]);
|
||||
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/change.mp3", ref effects[2]);
|
||||
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/valid.mp3", ref effects[3]);
|
||||
GUI.content.EditSound("alert", MyMonoGame.Utilities.FromFile.SoundFromMp3("Skin/" + config.skin + "/Sounds/alert.mp3"));
|
||||
GUI.content.EditSound("bip", MyMonoGame.Utilities.FromFile.SoundFromMp3("Skin/" + config.skin + "/Sounds/bip.mp3"));
|
||||
GUI.content.EditSound("change", MyMonoGame.Utilities.FromFile.SoundFromMp3("Skin/" + config.skin + "/Sounds/change.mp3"));
|
||||
GUI.content.EditSound("valid", MyMonoGame.Utilities.FromFile.SoundFromMp3("Skin/" + config.skin + "/Sounds/valid.mp3"));
|
||||
}
|
||||
|
||||
if (Directory.Exists("Skin/" + config.skin + "/Textures"))
|
||||
{
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/background0.png", ref backSprites[0], GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/background1.png", ref backSprites[1], GraphicsDevice);
|
||||
GUI.content.EditTexture("background0", MyMonoGame.Utilities.FromFile.SpriteFromPng("Skin/" + config.skin + "Textures/background0.png", GraphicsDevice));
|
||||
GUI.content.EditTexture("background1", MyMonoGame.Utilities.FromFile.SpriteFromPng("Skin/" + config.skin + "Textures/background1.png", GraphicsDevice));
|
||||
if (Directory.Exists("Skin/" + config.skin + "/Textures/Hub/"))
|
||||
{
|
||||
if (Directory.Exists("Skin/" + config.skin + "/Textures/Hub/Buttons"))
|
||||
{
|
||||
for (int i = 0; i < buttonsSprites.Length; i++)
|
||||
{
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/topLeft.png", ref buttonsSprites[i].topLeft, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/topCenter.png", ref buttonsSprites[i].topCenter, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/topRight.png", ref buttonsSprites[i].topRight, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/centerLeft.png", ref buttonsSprites[i].centerLeft, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/centerCenter.png", ref buttonsSprites[i].centerCenter, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/centerRight.png", ref buttonsSprites[i].centerRight, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/bottomLeft.png", ref buttonsSprites[i].bottomLeft, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/bottomCenter.png", ref buttonsSprites[i].bottomCenter, GraphicsDevice);
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/bottomRight.png", ref buttonsSprites[i].bottomRight, GraphicsDevice);
|
||||
}
|
||||
GUI.content.EditBox("Default", MyMonoGame.Utilities.FromFile.BoxFormFolder("Skin/" + config.skin + "Textures/Hub/Buttons/0", GraphicsDevice));
|
||||
}
|
||||
|
||||
for (int i = 0; i < pointerSprites.Length; i++)
|
||||
{
|
||||
Utilities.SpriteFromPng("Skin/" + config.skin + "/Textures/Hub/pointer" + i + ".png", ref pointerSprites[i], GraphicsDevice);
|
||||
}
|
||||
GUI.content.EditTexture("pointer", MyMonoGame.Utilities.FromFile.SpriteFromPng("Skin/" + config.skin + "/Textures/Hub/pointer0.png", GraphicsDevice));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background = new Background(backSprites, new double[2] { 1, 2 }); //Background initialisation
|
||||
background = new Background(new Texture2D[2] { GUI.content.GetTexture("background0"), GUI.content.GetTexture("background1") }, new double[2] { 1, 2 }); //Background initialisation
|
||||
background.speedX = 1;
|
||||
}
|
||||
|
||||
|
@ -191,8 +154,8 @@ namespace Galactic_Colors_Control_GUI
|
|||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
protected override void Update(GameTime gameTime)
|
||||
{
|
||||
gameState.Update();
|
||||
GUI.Update();
|
||||
gameState.Update();
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
@ -210,9 +173,12 @@ namespace Galactic_Colors_Control_GUI
|
|||
GUI.Draw(spriteBatch);
|
||||
gameState.Draw(spriteBatch);
|
||||
|
||||
#if DEBUG
|
||||
Color ActiveColor = IsActive ? Color.Green : Color.Red;
|
||||
GUI.Label(new MyMonoGame.Vector(10, ScreenHeight - 20), (1 / (float)gameTime.ElapsedGameTime.TotalSeconds).ToString(), fonts.small, new MyMonoGame.Colors(ActiveColor));
|
||||
spriteBatch.Draw(pointerSprites[0], new Rectangle(Mouse.GetState().X - 10, Mouse.GetState().Y - 10, 20, 20), Color.Red);
|
||||
GUI.Label(new Vector(10, ScreenHeight - 20), (1 / (float)gameTime.ElapsedGameTime.TotalSeconds).ToString(), GUI.content.GetFont("small"), new MyMonoGame.Colors(ActiveColor));
|
||||
#endif
|
||||
|
||||
spriteBatch.Draw(GUI.content.GetTexture("pointer"), new Rectangle(Mouse.GetState().X - 10, Mouse.GetState().Y - 10, 20, 20), Color.Red);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
|
|
|
@ -31,28 +31,28 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (showLoading)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.fonts.basic);
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showOKMessage)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.fonts.basic, null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.fonts.small, null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.fonts.basic)) { locked = false; Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.GUI.content.GetFont("small"), null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { locked = false; Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showYNMessage)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 100), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.fonts.basic, null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 100, 135, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Yes", Game.singleton.config.lang), Game.singleton.fonts.basic))
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 100), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 100, 135, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Yes", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic")))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
new Thread(ConnectHost).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 + 5, Game.singleton.ScreenHeight / 4 + 100, 135, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("No", Game.singleton.config.lang), Game.singleton.fonts.basic))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 + 5, Game.singleton.ScreenHeight / 4 + 100, 135, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("No", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic")))
|
||||
{
|
||||
showYNMessage = false;
|
||||
Game.singleton.client.ResetHost();
|
||||
|
@ -71,7 +71,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 - 30, 150, 40), ref adress, Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White), Manager.textAlign.centerCenter, Game.singleton.multilang.Get("EnterHostname", Game.singleton.config.lang)))
|
||||
if (Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 - 30, 150, 40), ref adress, Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White), Manager.textAlign.centerCenter, Game.singleton.multilang.Get("EnterHostname", Game.singleton.config.lang)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
new Thread(ValidateHost).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Connect", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Connect", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
new Thread(ValidateHost).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
|
|
@ -27,29 +27,29 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Texture(new Rectangle(0, 0, Game.singleton.ScreenWidth, 30), Game.nullSprite, new MyMonoGame.Colors(new Color(0.1f, 0.1f, 0.1f)));
|
||||
if (Game.singleton.GUI.Button(new Rectangle(5, 5, 50, 20), (showChat ? Game.singleton.multilang.Get("Hide", Game.singleton.config.lang) : Game.singleton.multilang.Get("Show", Game.singleton.config.lang)) + " " + Game.singleton.multilang.Get("Chat", Game.singleton.config.lang), Game.singleton.fonts.small, new MyMonoGame.Colors(Color.White, Color.LightGray, Color.Gray))) { Game.singleton.GUI.ResetFocus(); showChat = !showChat; }
|
||||
Game.singleton.GUI.Texture(new Rectangle(0, 0, Game.singleton.ScreenWidth, 30), MyMonoGame.Utilities.Content.nullSprite, new MyMonoGame.Colors(new Color(0.1f, 0.1f, 0.1f)));
|
||||
if (Game.singleton.GUI.Button(new Rectangle(5, 5, 50, 20), (showChat ? Game.singleton.multilang.Get("Hide", Game.singleton.config.lang) : Game.singleton.multilang.Get("Show", Game.singleton.config.lang)) + " " + Game.singleton.multilang.Get("Chat", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("small"), new MyMonoGame.Colors(Color.White, Color.LightGray, Color.Gray))) { Game.singleton.GUI.ResetFocus(); showChat = !showChat; }
|
||||
|
||||
if (showChat)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(0, 30, 310, 310), Game.singleton.buttonsSprites[0]);
|
||||
if (Game.singleton.GUI.TextField(new Rectangle(5, 35, 305, 20), ref chatInput, Game.singleton.fonts.basic, null, Manager.textAlign.centerLeft, Game.singleton.multilang.Get("EnterMessage", Game.singleton.config.lang))) { if (chatInput != null) { new Thread(ChatEnter).Start(); } }
|
||||
Game.singleton.GUI.Label(new Rectangle(5, 60, 305, 245), chatText, Game.singleton.fonts.small, null, Manager.textAlign.topLeft, true);
|
||||
Game.singleton.GUI.Box(new Rectangle(0, 30, 310, 310), Game.singleton.GUI.content.GetBox("Default"));
|
||||
if (Game.singleton.GUI.TextField(new Rectangle(5, 35, 305, 20), ref chatInput, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.centerLeft, Game.singleton.multilang.Get("EnterMessage", Game.singleton.config.lang))) { if (chatInput != null) { new Thread(ChatEnter).Start(); } }
|
||||
Game.singleton.GUI.Label(new Rectangle(5, 60, 305, 245), chatText, Game.singleton.GUI.content.GetFont("small"), null, Manager.textAlign.topLeft, true);
|
||||
}
|
||||
|
||||
if (showLoading)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.fonts.basic);
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showOKMessage)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.fonts.basic, null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.fonts.small, null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.fonts.basic)) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; Game.singleton.client.ExitHost(); }
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.GUI.content.GetFont("small"), null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; Game.singleton.client.ExitHost(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,24 +19,24 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (showLoading)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.fonts.basic);
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showOKMessage)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.fonts.basic, null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.fonts.small, null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.fonts.basic)) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.GUI.content.GetFont("small"), null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 - 30, 150, 40), ref username, Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White), Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Username", Game.singleton.config.lang)))
|
||||
if (Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 - 30, 150, 40), ref username, Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White), Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Username", Game.singleton.config.lang)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
new Thread(IdentifiacateHost).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Validate", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Validate", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
new Thread(IdentifiacateHost).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
|
|
@ -10,16 +10,15 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
{
|
||||
public class MainMenuState : State
|
||||
{
|
||||
public static Texture2D logoSprite;
|
||||
private bool locked = false;
|
||||
|
||||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 40), Game.singleton.multilang.Get("GUI", Game.singleton.config.lang) + " " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth - 64, Game.singleton.ScreenHeight - 74, 64, 64), logoSprite)) { System.Diagnostics.Process.Start("https://sheychen.shost.ca/"); }
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 - 30, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Play", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White, Color.Green)))
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 40), Game.singleton.multilang.Get("GUI", Game.singleton.config.lang) + " " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth - 64, Game.singleton.ScreenHeight - 74, 64, 64), Game.singleton.GUI.content.GetTexture("logoSmall"))) { System.Diagnostics.Process.Start("https://sheychen.shost.ca/"); }
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 - 30, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Play", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.White, Color.Green)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -33,12 +32,12 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
}).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Options", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White, Color.Blue)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Options", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.White, Color.Blue)))
|
||||
{
|
||||
Game.singleton.GUI.ResetFocus();
|
||||
Game.singleton.gameState = new OptionsState();
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Exit", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White, Color.Red)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Exit", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.White, Color.Red)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
|
|
@ -12,13 +12,13 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Langs[Game.singleton.config.lang], Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Langs[Game.singleton.config.lang],Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
Game.singleton.GUI.ResetFocus();
|
||||
ChangeLang();
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 70, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Back", Game.singleton.config.lang),Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
|
|
@ -20,27 +20,27 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (showLoading)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.fonts.basic);
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showOKMessage)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.fonts.basic, null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.fonts.small, null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.fonts.basic)) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.GUI.content.GetFont("small"), null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 60, Game.singleton.ScreenHeight / 2 - 100, 120, 210), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 - 90, 100, 40), ref name, Game.singleton.fonts.basic, null, Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Name", Game.singleton.config.lang));
|
||||
Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 - 40, 100, 40), ref size, Game.singleton.fonts.basic, null, Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Size", Game.singleton.config.lang));
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 + 10, 100, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Create", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 60, Game.singleton.ScreenHeight / 2 - 100, 120, 210), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 - 90, 100, 40), ref name, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Name", Game.singleton.config.lang));
|
||||
Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 - 40, 100, 40), ref size, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Size", Game.singleton.config.lang));
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 + 10, 100, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Create", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
}
|
||||
}
|
||||
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 + 60, 100, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 50, Game.singleton.ScreenHeight / 2 + 60, 100, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
|
|
@ -40,25 +40,25 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
if (showLoading)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.fonts.basic);
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.Get("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showOKMessage)
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.buttonsSprites[0]);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.fonts.basic, null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.fonts.small, null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.fonts.basic)) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 150), Game.singleton.GUI.content.GetBox("Default"));
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 60), message.title, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.bottomCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4 + 100), message.text, Game.singleton.GUI.content.GetFont("small"), null, Manager.textAlign.bottomCenter);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 4 + 150, 280, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 2 - 300, 300, 600), Game.singleton.buttonsSprites[0]);
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 2 - 290, 100, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Update", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
Game.singleton.GUI.Box(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 2 - 300, 300, 600), Game.singleton.GUI.content.GetBox("Default"));
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 140, Game.singleton.ScreenHeight / 2 - 290, 100, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Update", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
new Thread(UpdateParty).Start();
|
||||
}
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 + 40, Game.singleton.ScreenHeight / 2 - 290, 100, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Create", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 + 40, Game.singleton.ScreenHeight / 2 - 290, 100, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Create", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
}
|
||||
}
|
||||
|
||||
//TODO Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 + 40, Game.singleton.ScreenHeight / 2 - 290, 100, 40), ref password, Game.singleton.fonts.basic, null, Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Password", Game.singleton.config.lang));
|
||||
//TODO Game.singleton.GUI.TextField(new Rectangle(Game.singleton.ScreenWidth / 2 + 40, Game.singleton.ScreenHeight / 2 - 290, 100, 40), ref password, Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.centerCenter, Game.singleton.multilang.Get("Password", Game.singleton.config.lang));
|
||||
if (parties.Count > 0)
|
||||
{
|
||||
if (parties.Count > 10)
|
||||
|
@ -84,7 +84,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
}
|
||||
for (int i = (page - 1) * 10; i < page * 10 && i < parties.Count; i++)
|
||||
{
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 100, Game.singleton.ScreenHeight / 2 - 240 + i * 50, 200, 40), Game.singleton.buttonsSprites[0], parties[i].text, Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 100, Game.singleton.ScreenHeight / 2 - 240 + i * 50, 200, 40), Game.singleton.GUI.content.GetBox("Default"), parties[i].text, Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
locked = true;
|
||||
id = parties[i].id;
|
||||
|
@ -94,9 +94,9 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
}
|
||||
else
|
||||
{
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 2 - 240), Game.singleton.multilang.Get("AnyParty", Game.singleton.config.lang), Game.singleton.fonts.basic, null, Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 2 - 240), Game.singleton.multilang.Get("AnyParty", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), null, Manager.textAlign.centerCenter);
|
||||
}
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 240, 150, 40), Game.singleton.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 240, 150, 40), Game.singleton.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||
{
|
||||
if (!locked)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Galactic_Colors_Control_GUI.States
|
|||
public override void Draw(SpriteBatch spritebatch)
|
||||
{
|
||||
Game.singleton.background.Draw(spritebatch);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 2), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 2), Game.singleton.multilang.Get("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
|
|
|
@ -1,51 +1,9 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace Galactic_Colors_Control_GUI
|
||||
{
|
||||
public struct Fonts
|
||||
{
|
||||
public SpriteFont small; //Text fonts
|
||||
public SpriteFont basic;
|
||||
public SpriteFont title;
|
||||
}
|
||||
|
||||
internal static class Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Load Texture2D from files
|
||||
/// </summary>
|
||||
/// <param name="path">File .png path</param>
|
||||
/// <param name="sprite">Result sprite</param>
|
||||
static public void SpriteFromPng(string path, ref Texture2D sprite, GraphicsDevice graphics)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
sprite = Texture2D.FromStream(graphics, fileStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load SoundEffect from files
|
||||
/// </summary>
|
||||
/// <param name="path">File .mp3 path</param>
|
||||
/// <param name="sound">Result sound</param>
|
||||
static public void SoundFromMp3(string path, ref SoundEffect sound)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
sound = SoundEffect.FromStream(fileStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DoubleTo(ref double value, double target, double speed)
|
||||
{
|
||||
speed = Math.Abs(speed);
|
||||
|
|
Reference in New Issue