Multilang and working config
This commit is contained in:
parent
5add5b8f28
commit
5dcd7c328e
|
@ -34,20 +34,24 @@ namespace Galactic_Colors_Control_Common
|
||||||
private ConsoleColor[] logBackColor;
|
private ConsoleColor[] logBackColor;
|
||||||
private ConsoleColor[] logForeColor;
|
private ConsoleColor[] logForeColor;
|
||||||
private Thread Updater;
|
private Thread Updater;
|
||||||
private logType logLevel;
|
private logType logLevel = logType.info;
|
||||||
private bool _run = true;
|
private bool _run = true;
|
||||||
public bool run { get { return _run; } }
|
public bool run { get { return _run; } }
|
||||||
|
private static bool _debug = false;
|
||||||
|
private static bool _dev = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create log file and start logger thread
|
/// Create log file and start logger thread
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="LogPath">Absolute path to logs directory</param>
|
/// <param name="LogPath">Absolute path to logs directory</param>
|
||||||
public void Initialise(string LogPath, ConsoleColor[] backColor, ConsoleColor[] foreColor, logType LogLevel)
|
public void Initialise(string LogPath, ConsoleColor[] backColor, ConsoleColor[] foreColor, logType LogLevel, bool debug, bool dev)
|
||||||
{
|
{
|
||||||
logPath = LogPath;
|
logPath = LogPath;
|
||||||
logBackColor = backColor;
|
logBackColor = backColor;
|
||||||
logForeColor = foreColor;
|
logForeColor = foreColor;
|
||||||
logLevel = LogLevel;
|
logLevel = LogLevel;
|
||||||
|
_debug = debug;
|
||||||
|
_dev = dev;
|
||||||
if (!Directory.Exists(logPath))
|
if (!Directory.Exists(logPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(logPath);
|
Directory.CreateDirectory(logPath);
|
||||||
|
@ -120,7 +124,7 @@ namespace Galactic_Colors_Control_Common
|
||||||
/// <param name="log">Log struct</param>
|
/// <param name="log">Log struct</param>
|
||||||
private void Write(Log log)
|
private void Write(Log log)
|
||||||
{
|
{
|
||||||
if (logLevel == logType.debug || logLevel == logType.dev)
|
if (_debug || _dev)
|
||||||
{
|
{
|
||||||
//Add Source Method
|
//Add Source Method
|
||||||
log.text = "[" + new StackTrace().GetFrame(2).GetMethod().Name + "]: " + log.text;
|
log.text = "[" + new StackTrace().GetFrame(2).GetMethod().Name + "]: " + log.text;
|
||||||
|
|
|
@ -48,6 +48,14 @@ namespace Galactic_Colors_Control_Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetResultText(ResultData res, int lang)
|
||||||
|
{
|
||||||
|
string data = Common.ArrayToString(res.result);
|
||||||
|
if (res.type == ResultTypes.Error)
|
||||||
|
data = Get("Error", lang) + ": " + data;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public string Get(string Key, int Lang)
|
public string Get(string Key, int Lang)
|
||||||
{
|
{
|
||||||
string text = "";
|
string text = "";
|
||||||
|
|
|
@ -1,5 +1,30 @@
|
||||||
Key;Français;English
|
Key;Français;English
|
||||||
|
GCC;Galactic Colors Control;Galactic Colors Control
|
||||||
|
Client;Client;Client
|
||||||
|
Server;Serveur;Server
|
||||||
|
Console;Console;Console
|
||||||
|
Loading;Chargement;Loading
|
||||||
|
OK;OK;OK
|
||||||
|
Yes;Oui;Yes
|
||||||
|
No;Non;No
|
||||||
|
EnterHostname;Saisir l'addresse;Enter hostname
|
||||||
|
EnterMessage;Saisir un message;Enter message
|
||||||
|
Connect;Connexion;Connect
|
||||||
|
Back;Retour;Back
|
||||||
|
Username;Pseudo;Username
|
||||||
|
Validate;Valider;Validate
|
||||||
|
GUI;GUI;GUI
|
||||||
|
Play;Jouer;Play
|
||||||
|
Options;Options;Options
|
||||||
|
Exit;Quitter;Exit
|
||||||
|
Error;Erreur;Error
|
||||||
|
Hide;Cacher;Hide
|
||||||
|
Show;Afficher;Show
|
||||||
|
Chat;Chat;Chat
|
||||||
|
Use;Utiliser;Use
|
||||||
|
CantConnect;Connexion impossible. Au revoir;Can't connect sorry. Bye
|
||||||
ServerJoin;rejoint le server;join the server
|
ServerJoin;rejoint le server;join the server
|
||||||
PartyJoin;rejoint la partie;join the party
|
PartyJoin;rejoint la partie;join the party
|
||||||
ServerLeave;quitte le server;leave the server
|
ServerLeave;quitte le server;leave the server
|
||||||
PartyLeave;quitte la partie;leave the party
|
PartyLeave;quitte la partie;leave the party
|
||||||
|
ServerKick;Exclus du serveur;Kick from server
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
|
||||||
|
<xsd:element name="config">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="logPath" type="xsd:string" />
|
||||||
|
<xsd:element name="logLevel" type="xsd:string" />
|
||||||
|
<xsd:element name="commandChar" type="xsd:unsignedByte" />
|
||||||
|
<xsd:element name="logForeColor">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element maxOccurs="unbounded" name="ConsoleColor" type="xsd:string" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="logBackColor">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element maxOccurs="unbounded" name="ConsoleColor" type="xsd:string" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="lang" type="xsd:unsignedByte" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xs:schema>
|
|
@ -61,6 +61,12 @@
|
||||||
<Name>Galactic Colors Control</Name>
|
<Name>Galactic Colors Control</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="ConfigSchema.xsd">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Galactic_Colors_Control_Console
|
||||||
public static bool _dev = false;
|
public static bool _dev = false;
|
||||||
|
|
||||||
private static Client client = new Client();
|
private static Client client = new Client();
|
||||||
private static MultiLang multilang = new MultiLang(); //TODO use multilang
|
private static MultiLang multilang = new MultiLang();
|
||||||
public static Config config = new Config();
|
public static Config config = new Config();
|
||||||
public static Logger logger = new Logger();
|
public static Logger logger = new Logger();
|
||||||
private static bool run = true;
|
private static bool run = true;
|
||||||
|
@ -23,13 +23,13 @@ namespace Galactic_Colors_Control_Console
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
config = config.Load();
|
config = config.Load();
|
||||||
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel);
|
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, _debug, _dev);
|
||||||
multilang.Load();
|
multilang.Load();
|
||||||
client.OnEvent += new EventHandler(OnEvent); //Set OnEvent function
|
client.OnEvent += new EventHandler(OnEvent); //Set OnEvent function
|
||||||
Console.Title = "Galactic Colors Control Client"; //Start display
|
Console.Title ="Galactic Colors Control Client"; //Start display
|
||||||
Console.Write(">");
|
Console.Write(">");
|
||||||
Common.ConsoleWrite("Galactic Colors Control Client", ConsoleColor.Red);
|
Common.ConsoleWrite(Console.Title, ConsoleColor.Red);
|
||||||
Common.ConsoleWrite("Console " + Assembly.GetEntryAssembly().GetName().Version.ToString(), ConsoleColor.Yellow);
|
Common.ConsoleWrite(multilang.Get("Console", config.lang) + " " + Assembly.GetEntryAssembly().GetName().Version.ToString(), ConsoleColor.Yellow);
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
switch (args[0])
|
switch (args[0])
|
||||||
|
@ -52,7 +52,7 @@ namespace Galactic_Colors_Control_Console
|
||||||
bool hostSet = false;
|
bool hostSet = false;
|
||||||
while (!hostSet) //Request hostname
|
while (!hostSet) //Request hostname
|
||||||
{
|
{
|
||||||
Common.ConsoleWrite("Enter server host:");
|
Common.ConsoleWrite(multilang.Get("EnterHostname", config.lang) +":");
|
||||||
string host = client.ValidateHost(Console.ReadLine());
|
string host = client.ValidateHost(Console.ReadLine());
|
||||||
if (host[0] == '*')
|
if (host[0] == '*')
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ namespace Galactic_Colors_Control_Console
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Common.ConsoleWrite("Use " + host + "? y/n");
|
Common.ConsoleWrite(multilang.Get("Use", config.lang) + " " + host + "? y/n");
|
||||||
ConsoleKeyInfo c = new ConsoleKeyInfo();
|
ConsoleKeyInfo c = new ConsoleKeyInfo();
|
||||||
while (c.Key != ConsoleKey.Y && c.Key != ConsoleKey.N)
|
while (c.Key != ConsoleKey.Y && c.Key != ConsoleKey.N)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ namespace Galactic_Colors_Control_Console
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Common.ConsoleWrite("Can't connect sorry. Bye", ConsoleColor.Red);
|
Common.ConsoleWrite(multilang.Get("CantConnect", config.lang), ConsoleColor.Red);
|
||||||
Console.Read();
|
Console.Read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,11 +113,12 @@ namespace Galactic_Colors_Control_Console
|
||||||
{
|
{
|
||||||
req = Common.Strings("say", input);
|
req = Common.Strings("say", input);
|
||||||
}
|
}
|
||||||
Common.ConsoleWrite(client.Request(req).ToSmallString()); //Add processing (common)
|
Common.ConsoleWrite(multilang.GetResultText(client.Request(req),config.lang));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnEvent(object sender, EventArgs e)
|
private static void OnEvent(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
//TODO add PartyKick
|
||||||
EventData eve = ((EventDataArgs)e).Data;
|
EventData eve = ((EventDataArgs)e).Data;
|
||||||
Common.ConsoleWrite(multilang.GetEventText(eve, config.lang));
|
Common.ConsoleWrite(multilang.GetEventText(eve, config.lang));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace Galactic_Colors_Control_GUI
|
||||||
public ConsoleColor[] logForeColor = new ConsoleColor[6] { ConsoleColor.DarkGray, ConsoleColor.Gray, ConsoleColor.White, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.White };
|
public ConsoleColor[] logForeColor = new ConsoleColor[6] { ConsoleColor.DarkGray, ConsoleColor.Gray, ConsoleColor.White, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.White };
|
||||||
public ConsoleColor[] logBackColor = new ConsoleColor[6] { ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Red };
|
public ConsoleColor[] logBackColor = new ConsoleColor[6] { ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Red };
|
||||||
public int lang = 0;
|
public int lang = 0;
|
||||||
|
public string skin = "default";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load config from xml file
|
/// Load config from xml file
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
|
||||||
|
<xsd:element name="config">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="logPath" type="xsd:string" />
|
||||||
|
<xsd:element name="logLevel" type="xsd:string" />
|
||||||
|
<xsd:element name="commandChar" type="xsd:unsignedByte" />
|
||||||
|
<xsd:element name="logForeColor">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element maxOccurs="unbounded" name="ConsoleColor" type="xsd:string" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="logBackColor">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element maxOccurs="unbounded" name="ConsoleColor" type="xsd:string" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="lang" type="xsd:unsignedByte" />
|
||||||
|
<xsd:element name="skin" type="xsd:string" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xs:schema>
|
|
@ -132,6 +132,12 @@
|
||||||
<Name>Galactic Colors Control</Name>
|
<Name>Galactic Colors Control</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="ConfigSchema.xsd">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -38,7 +38,6 @@ namespace Galactic_Colors_Control_GUI
|
||||||
public Client client; //Client Core
|
public Client client; //Client Core
|
||||||
public Manager GUI = new Manager(); //MyMonogameGUI
|
public Manager GUI = new Manager(); //MyMonogameGUI
|
||||||
|
|
||||||
private string skinName;
|
|
||||||
private bool isFullScreen = false;
|
private bool isFullScreen = false;
|
||||||
|
|
||||||
public States.State gameState = new States.TitleState(new States.MainMenuState(), new TimeSpan(0,0,5));
|
public States.State gameState = new States.TitleState(new States.MainMenuState(), new TimeSpan(0,0,5));
|
||||||
|
@ -75,7 +74,7 @@ namespace Galactic_Colors_Control_GUI
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
config = config.Load();
|
config = config.Load();
|
||||||
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel);
|
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, Program._debug, Program._dev);
|
||||||
multilang.Load();
|
multilang.Load();
|
||||||
if (Program._debug) { logger.Write("CLIENT IS IN DEBUG MODE !", Logger.logType.error, Logger.logConsole.show); }
|
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); }
|
if (Program._dev) { logger.Write("CLIENT IS IN DEV MODE !", Logger.logType.error, Logger.logConsole.show); }
|
||||||
|
@ -130,41 +129,41 @@ namespace Galactic_Colors_Control_GUI
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load from files
|
//Load from files
|
||||||
if (Directory.Exists("Skin/" + skinName))
|
if (Directory.Exists("Skin/" + config.skin))
|
||||||
{
|
{
|
||||||
if (Directory.Exists("Skin/" + skinName + "/Sounds"))
|
if (Directory.Exists("Skin/" + config.skin + "/Sounds"))
|
||||||
{
|
{
|
||||||
Utilities.SoundFromMp3("Skin/" + skinName + "/Sounds/alert.mp3", ref effects[0]);
|
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/alert.mp3", ref effects[0]);
|
||||||
Utilities.SoundFromMp3("Skin/" + skinName + "/Sounds/bip.mp3", ref effects[1]);
|
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/bip.mp3", ref effects[1]);
|
||||||
Utilities.SoundFromMp3("Skin/" + skinName + "/Sounds/change.mp3", ref effects[2]);
|
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/change.mp3", ref effects[2]);
|
||||||
Utilities.SoundFromMp3("Skin/" + skinName + "/Sounds/valid.mp3", ref effects[3]);
|
Utilities.SoundFromMp3("Skin/" + config.skin + "/Sounds/valid.mp3", ref effects[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Directory.Exists("Skin/" + skinName + "/Textures"))
|
if (Directory.Exists("Skin/" + config.skin + "/Textures"))
|
||||||
{
|
{
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/background0.png", ref backSprites[0], GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/background0.png", ref backSprites[0], GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/background1.png", ref backSprites[1], GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/background1.png", ref backSprites[1], GraphicsDevice);
|
||||||
if (Directory.Exists("Skin/" + skinName + "/Textures/Hub/"))
|
if (Directory.Exists("Skin/" + config.skin + "/Textures/Hub/"))
|
||||||
{
|
{
|
||||||
if (Directory.Exists("Skin/" + skinName + "/Textures/Hub/Buttons"))
|
if (Directory.Exists("Skin/" + config.skin + "/Textures/Hub/Buttons"))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buttonsSprites.Length; i++)
|
for (int i = 0; i < buttonsSprites.Length; i++)
|
||||||
{
|
{
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/topLeft.png", ref buttonsSprites[i].topLeft, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/topLeft.png", ref buttonsSprites[i].topLeft, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/topCenter.png", ref buttonsSprites[i].topCenter, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/topCenter.png", ref buttonsSprites[i].topCenter, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/topRight.png", ref buttonsSprites[i].topRight, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/topRight.png", ref buttonsSprites[i].topRight, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/centerLeft.png", ref buttonsSprites[i].centerLeft, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/centerLeft.png", ref buttonsSprites[i].centerLeft, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/centerCenter.png", ref buttonsSprites[i].centerCenter, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/centerCenter.png", ref buttonsSprites[i].centerCenter, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/centerRight.png", ref buttonsSprites[i].centerRight, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/centerRight.png", ref buttonsSprites[i].centerRight, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/bottomLeft.png", ref buttonsSprites[i].bottomLeft, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/bottomLeft.png", ref buttonsSprites[i].bottomLeft, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/bottomCenter.png", ref buttonsSprites[i].bottomCenter, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/bottomCenter.png", ref buttonsSprites[i].bottomCenter, GraphicsDevice);
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "Textures/Hub/Buttons/" + i + "/bottomRight.png", ref buttonsSprites[i].bottomRight, GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "Textures/Hub/Buttons/" + i + "/bottomRight.png", ref buttonsSprites[i].bottomRight, GraphicsDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pointerSprites.Length; i++)
|
for (int i = 0; i < pointerSprites.Length; i++)
|
||||||
{
|
{
|
||||||
Utilities.SpriteFromPng("Skin/" + skinName + "/Textures/Hub/pointer" + i + ".png", ref pointerSprites[i], GraphicsDevice);
|
Utilities.SpriteFromPng("Skin/" + config.skin + "/Textures/Hub/pointer" + i + ".png", ref pointerSprites[i], GraphicsDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
public override void Draw(SpriteBatch spritebatch)
|
public override void Draw(SpriteBatch spritebatch)
|
||||||
{
|
{
|
||||||
Game.singleton.background.Draw(spritebatch);
|
Game.singleton.background.Draw(spritebatch);
|
||||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), "Galactic Colors Control", 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.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||||
if (showLoading)
|
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.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), "Loading", Game.singleton.fonts.basic);
|
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);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
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.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 + 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);
|
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], "Ok", Game.singleton.fonts.basic)) { locked = false; Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
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; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
{
|
{
|
||||||
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.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);
|
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], "Yes", Game.singleton.fonts.basic))
|
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))
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
new Thread(ConnectHost).Start();
|
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], "No", 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.buttonsSprites[0], Game.singleton.multilang.Get("No", Game.singleton.config.lang), Game.singleton.fonts.basic))
|
||||||
{
|
{
|
||||||
showYNMessage = false;
|
showYNMessage = false;
|
||||||
Game.singleton.client.ResetHost();
|
Game.singleton.client.ResetHost();
|
||||||
|
@ -70,14 +70,14 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
}
|
}
|
||||||
else
|
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, "Server address")) {
|
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 (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
locked = true;
|
locked = true;
|
||||||
new Thread(ValidateHost).Start();
|
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], "Connect", 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.buttonsSprites[0], Game.singleton.multilang.Get("Connect", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
new Thread(ValidateHost).Start();
|
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], "Back", 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.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
|
@ -116,14 +116,14 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
if (Host[0] == '*')
|
if (Host[0] == '*')
|
||||||
{
|
{
|
||||||
Host = Host.Substring(1);
|
Host = Host.Substring(1);
|
||||||
message.title = "Error";
|
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
|
||||||
message.text = Host;
|
message.text = Host;
|
||||||
showOKMessage = true;
|
showOKMessage = true;
|
||||||
Game.singleton.client.ResetHost(); ;
|
Game.singleton.client.ResetHost(); ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message.title = "Use " + Host + "?";
|
message.title = Game.singleton.multilang.Get("Use", Game.singleton.config.lang) + " " + Host + "?";
|
||||||
showYNMessage = true;
|
showYNMessage = true;
|
||||||
}
|
}
|
||||||
showLoading = false;
|
showLoading = false;
|
||||||
|
@ -139,7 +139,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message.title = "Error";
|
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
|
||||||
message.text = string.Empty;
|
message.text = string.Empty;
|
||||||
showOKMessage = true;
|
showOKMessage = true;
|
||||||
Game.singleton.client.ResetHost();
|
Game.singleton.client.ResetHost();
|
||||||
|
|
|
@ -31,20 +31,20 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
{
|
{
|
||||||
Game.singleton.background.Draw(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)));
|
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 ? "Hide" : "Show") + " chat", Game.singleton.fonts.small, new MyMonoGame.Colors(Color.White, Color.LightGray, Color.Gray))) { Game.singleton.GUI.ResetFocus(); showChat = !showChat; }
|
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; }
|
||||||
//if (Game.singleton.GUI.Button(new Rectangle(65, 5, 50, 20), (showParty ? "Leave" : "Join") + " party", smallFont, new MyMonoGame.Colors(Color.White, Color.LightGray, Color.Gray))) { new Thread(PartyClick).Start(); }
|
//if (Game.singleton.GUI.Button(new Rectangle(65, 5, 50, 20), (showParty ? "Leave" : "Join") + " party", smallFont, new MyMonoGame.Colors(Color.White, Color.LightGray, Color.Gray))) { new Thread(PartyClick).Start(); }
|
||||||
|
|
||||||
if (showChat)
|
if (showChat)
|
||||||
{
|
{
|
||||||
Game.singleton.GUI.Box(new Rectangle(0, 30, 310, 310), Game.singleton.buttonsSprites[0]);
|
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, "Enter message")) { if (chatInput != null) { new Thread(ChatEnter).Start(); } }
|
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.Label(new Rectangle(5, 60, 305, 245), chatText, Game.singleton.fonts.small, null, Manager.textAlign.topLeft, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showLoading)
|
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.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), "Loading", Game.singleton.fonts.basic);
|
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);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
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.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 + 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);
|
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], "Ok", Game.singleton.fonts.basic)) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; Game.singleton.client.ExitHost(); }
|
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(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,15 +79,14 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
{
|
{
|
||||||
request = request.Substring(1);
|
request = request.Substring(1);
|
||||||
res = Game.singleton.client.Request(Common.SplitArgs(request));
|
res = Game.singleton.client.Request(Common.SplitArgs(request));
|
||||||
ChatText(res.ToSmallString()); //TODO multilang
|
ChatText(Game.singleton.multilang.GetResultText(res, Game.singleton.config.lang));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = Game.singleton.client.Request(Common.Strings("say", request));
|
res = Game.singleton.client.Request(Common.Strings("say", request));
|
||||||
if (res.type != ResultTypes.OK)
|
if (res.type != ResultTypes.OK)
|
||||||
{
|
{
|
||||||
//TODO Mutlilang
|
ChatText(Game.singleton.multilang.GetResultText(res, Game.singleton.config.lang));
|
||||||
ChatText("Error :" + Common.ArrayToString(res.result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +97,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
EventData eve = ((EventDataArgs)e).Data;
|
EventData eve = ((EventDataArgs)e).Data;
|
||||||
if (eve.type == EventTypes.ServerKick)
|
if (eve.type == EventTypes.ServerKick)
|
||||||
{
|
{
|
||||||
message.title = "Kick from server";
|
message.title = Game.singleton.multilang.Get("ServerKick", Game.singleton.config.lang);
|
||||||
message.text = Common.ArrayToString(eve.data);
|
message.text = Common.ArrayToString(eve.data);
|
||||||
showOKMessage = true;
|
showOKMessage = true;
|
||||||
}else
|
}else
|
||||||
|
|
|
@ -20,11 +20,11 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
public override void Draw(SpriteBatch spritebatch)
|
public override void Draw(SpriteBatch spritebatch)
|
||||||
{
|
{
|
||||||
Game.singleton.background.Draw(spritebatch);
|
Game.singleton.background.Draw(spritebatch);
|
||||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), "Galactic Colors Control", 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.fonts.title , new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||||
if (showLoading)
|
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.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), "Loading", Game.singleton.fonts.basic);
|
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);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -33,25 +33,25 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
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.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 + 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);
|
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], "Ok", Game.singleton.fonts.basic)){ Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
|
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; }
|
||||||
}
|
}
|
||||||
else
|
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, "Username")) {
|
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 (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
locked = true;
|
locked = true;
|
||||||
new Thread(IdentifiacateHost).Start();
|
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], "Validate", 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.buttonsSprites[0], Game.singleton.multilang.Get("Validate", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White))) {
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
locked = true;
|
locked = true;
|
||||||
new Thread(IdentifiacateHost).Start();
|
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], "Back", 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.buttonsSprites[0], Game.singleton.multilang.Get("Back", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.LightGray, Color.White)))
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message.title = "Error";
|
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
|
||||||
message.text = Common.ArrayToString(res.result);
|
message.text = Common.ArrayToString(res.result);
|
||||||
showOKMessage = true;
|
showOKMessage = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
public override void Draw(SpriteBatch spritebatch)
|
public override void Draw(SpriteBatch spritebatch)
|
||||||
{
|
{
|
||||||
Game.singleton.background.Draw(spritebatch);
|
Game.singleton.background.Draw(spritebatch);
|
||||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), "Galactic Colors Control", 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.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), "GUI " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Game.singleton.fonts.basic, 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 - 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], "Play", Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White, Color.Green)))
|
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)))
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
|
@ -33,11 +33,11 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
}).Start();
|
}).Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Game.singleton.GUI.Button(new Rectangle(Game.singleton.ScreenWidth / 2 - 75, Game.singleton.ScreenHeight / 2 + 20, 150, 40), Game.singleton.buttonsSprites[0], "Options", 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.buttonsSprites[0], Game.singleton.multilang.Get("Options", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White, Color.Blue))) {
|
||||||
Game.singleton.GUI.ResetFocus();
|
Game.singleton.GUI.ResetFocus();
|
||||||
Game.singleton.gameState = new OptionsState();
|
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], "Exit", 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.buttonsSprites[0], Game.singleton.multilang.Get("Exit", Game.singleton.config.lang), Game.singleton.fonts.basic, new MyMonoGame.Colors(Color.White, Color.Red)))
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
while (!Utilities.DoubleTo(ref Game.singleton.background.speedX, 0, 0.1)) { Thread.Sleep(50); }
|
while (!Utilities.DoubleTo(ref Game.singleton.background.speedX, 0, 0.1)) { Thread.Sleep(50); }
|
||||||
|
Game.singleton.logger.Join();
|
||||||
Game.singleton.Exit();
|
Game.singleton.Exit();
|
||||||
}).Start();
|
}).Start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Galactic_Colors_Control_GUI.States
|
||||||
public override void Draw(SpriteBatch spritebatch)
|
public override void Draw(SpriteBatch spritebatch)
|
||||||
{
|
{
|
||||||
Game.singleton.background.Draw(spritebatch);
|
Game.singleton.background.Draw(spritebatch);
|
||||||
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 2), "Galactic Colors Control", 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.fonts.title, new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Xml.Serialization;
|
||||||
|
|
||||||
namespace Galactic_Colors_Control_Server
|
namespace Galactic_Colors_Control_Server
|
||||||
{
|
{
|
||||||
|
//TODO Common config
|
||||||
[XmlRoot("config")]
|
[XmlRoot("config")]
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
<xsd:element name="lang" type="xsd:unsignedInt" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
|
@ -29,9 +29,9 @@ namespace Galactic_Colors_Control_Server
|
||||||
public static Dictionary<int, Party> parties { get; private set; } = new Dictionary<int, Party>();
|
public static Dictionary<int, Party> parties { get; private set; } = new Dictionary<int, Party>();
|
||||||
public static int selectedParty = -1;
|
public static int selectedParty = -1;
|
||||||
|
|
||||||
//TODO add multilang
|
|
||||||
public static Config config = new Config();
|
public static Config config = new Config();
|
||||||
public static Logger logger = new Logger();
|
public static Logger logger = new Logger();
|
||||||
|
public static MultiLang multilang = new MultiLang();
|
||||||
public static Thread CheckConnected = new Thread(CheckConnectedLoop);
|
public static Thread CheckConnected = new Thread(CheckConnectedLoop);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,8 +39,11 @@ namespace Galactic_Colors_Control_Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.Title = "Galactic Colors Control Server";
|
config = config.Load();
|
||||||
logger.Write("Galactic Colors Control Server " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Logger.logType.fatal);
|
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, _debug, _dev);
|
||||||
|
multilang.Load();
|
||||||
|
Console.Title = multilang.Get("Galactic Colors Control Server", config.lang);
|
||||||
|
logger.Write(Console.Title + " " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Logger.logType.fatal);
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
switch (args[0])
|
switch (args[0])
|
||||||
|
@ -72,8 +75,6 @@ namespace Galactic_Colors_Control_Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void SetupServer()
|
private static void SetupServer()
|
||||||
{
|
{
|
||||||
config = config.Load();
|
|
||||||
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel);
|
|
||||||
Commands.Manager.Load();
|
Commands.Manager.Load();
|
||||||
logger.Write("Setting up server on *:" + config.port, Logger.logType.warm);
|
logger.Write("Setting up server on *:" + config.port, Logger.logType.warm);
|
||||||
logger.Write("Size:" + config.size, Logger.logType.debug);
|
logger.Write("Size:" + config.size, Logger.logType.debug);
|
||||||
|
@ -94,7 +95,7 @@ namespace Galactic_Colors_Control_Server
|
||||||
string ConsoleInput = Console.ReadLine();
|
string ConsoleInput = Console.ReadLine();
|
||||||
Console.Write(">");
|
Console.Write(">");
|
||||||
string[] args = Common.SplitArgs(ConsoleInput);
|
string[] args = Common.SplitArgs(ConsoleInput);
|
||||||
Common.ConsoleWrite(new ResultData(-1, Commands.Manager.Execute(args, null, true)).ToSmallString());
|
Common.ConsoleWrite(multilang.GetResultText(new ResultData(-1, Commands.Manager.Execute(args, null, true)), config.lang));
|
||||||
ConsoleInput = null;
|
ConsoleInput = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Galactic_Colors_Control_Server
|
||||||
public static string GetName(Socket soc)
|
public static string GetName(Socket soc)
|
||||||
{
|
{
|
||||||
if (soc == null)
|
if (soc == null)
|
||||||
return "Server";
|
return Program.multilang.Get("Server",Program.config.lang);
|
||||||
|
|
||||||
if (!Program.clients.ContainsKey(soc))
|
if (!Program.clients.ContainsKey(soc))
|
||||||
return "?";
|
return "?";
|
||||||
|
|
Reference in New Issue