1
0
Fork 0

Update for MyCommon

This commit is contained in:
sheychen 2016-12-10 16:52:28 +01:00
parent eced8cbf04
commit 5bb7a987fd
19 changed files with 127 additions and 158 deletions

View File

@ -5,6 +5,8 @@ namespace Galactic_Colors_Control_Common
{
public static class Common
{
public static string dictionary = Properties.Resources.Lang;
/// <summary>
/// Simpler string array creation
/// </summary>

View File

@ -34,6 +34,9 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="MyCommon">
<HintPath>..\..\MyCommon\MyCommon\bin\Release\MyCommon.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -51,7 +54,6 @@
<Compile Include="Common.cs" />
<Compile Include="Console.cs" />
<Compile Include="Logger.cs" />
<Compile Include="MultiLang.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
@ -61,6 +63,7 @@
<Compile Include="Protocol\Data.cs" />
<Compile Include="Protocol\EventData.cs" />
<Compile Include="Protocol\EventDataArgs.cs" />
<Compile Include="Protocol\Parser.cs" />
<Compile Include="Protocol\Protocol.cs" />
<Compile Include="Protocol\RequestData.cs" />
<Compile Include="Protocol\RequestResult.cs" />

View File

@ -1,82 +0,0 @@
using Galactic_Colors_Control_Common.Protocol;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Galactic_Colors_Control_Common
{
public class MultiLang
{
private Dictionary<string, List<string>> _multiDictionary = new Dictionary<string, List<string>>(); //List of phrases by key
private List<string> _Langs = new List<string>(); //Readable langs list
public Dictionary<string, List<string>> multiDictionary { get { return _multiDictionary; } }
public List<string> Langs { get { return _Langs; } }
public void Load()
{
_multiDictionary.Clear();
_Langs.Clear();
string[] lines = Properties.Resources.Lang.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); //Load from .cvs ressources. //TODO add more langs
_Langs = lines[0].Split(';').OfType<string>().ToList();
_Langs.RemoveAt(0);
foreach (string line in lines)
{
List<string> items = line.Split(';').OfType<string>().ToList();
string key = items[0];
items.RemoveAt(0);
_multiDictionary.Add(key, items);
}
}
public string GetEventText(EventData eve, int lang)
{
string data = Common.ArrayToString(eve.data);
switch (eve.type)
{
case EventTypes.ChatMessage:
return data;
case EventTypes.PartyJoin:
case EventTypes.PartyLeave:
case EventTypes.ServerJoin:
case EventTypes.ServerLeave:
return data + " " + Get(eve.type.ToString(), lang);
default:
return eve.ToSmallString();
}
}
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)
{
string text = "";
if (_multiDictionary.ContainsKey(Key))
{
if (_multiDictionary[Key].Count >= Lang)
{
text = _multiDictionary[Key][Lang];
}
else
{
text = "!!!UNKNOW LANG KEY!!!";
}
}
else
{
text = "!!!UNKNOW WORD KEY!!!";
}
return text;
}
}
}

View File

@ -0,0 +1,34 @@
using MyCommon;
namespace Galactic_Colors_Control_Common.Protocol
{
public static class Parser
{
public static string GetEventText(EventData eve, int lang, MultiLang dico)
{
string data = Common.ArrayToString(eve.data);
switch (eve.type)
{
case EventTypes.ChatMessage:
return data;
case EventTypes.PartyJoin:
case EventTypes.PartyLeave:
case EventTypes.ServerJoin:
case EventTypes.ServerLeave:
return data + " " + dico.GetWord(eve.type.ToString(), lang);
default:
return eve.ToSmallString();
}
}
public static string GetResultText(ResultData res, int lang, MultiLang dico)
{
string data = Common.ArrayToString(res.result);
if (res.type == ResultTypes.Error)
data = dico.GetWord("Error", lang) + ": " + data;
return data;
}
}
}

View File

@ -34,6 +34,9 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="MyCommon">
<HintPath>..\..\MyCommon\MyCommon\bin\Release\MyCommon.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />

View File

@ -4,6 +4,7 @@ using Galactic_Colors_Control_Common.Protocol;
using System.Reflection;
using System.Threading;
using Consol = Galactic_Colors_Control_Common.Console;
using MyCommon;
namespace Galactic_Colors_Control_Console
{
@ -29,7 +30,7 @@ namespace Galactic_Colors_Control_Console
logger.Write("Console " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Logger.logType.error);
config = config.Load();
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, _debug, _dev);
multilang.Load();
multilang.Initialise(Common.dictionary);
client.OnEvent += new System.EventHandler(OnEvent); //Set OnEvent function
if (args.Length > 0)
{
@ -54,7 +55,7 @@ namespace Galactic_Colors_Control_Console
while (!hostSet) //Request hostname
{
Thread.Sleep(100);
Consol.Write(new ColorStrings(multilang.Get("EnterHostname", config.lang) + ":"));
Consol.Write(new ColorStrings(multilang.GetWord("EnterHostname", config.lang) + ":"));
string host = client.ValidateHost(System.Console.ReadLine());
if (host[0] == '*')
{
@ -66,7 +67,7 @@ namespace Galactic_Colors_Control_Console
else
{
logger.Write("Validate " + host, Logger.logType.info);
Consol.Write(new ColorStrings(new ColorString(multilang.Get("Use", config.lang) + " "), new ColorString(host, System.ConsoleColor.Blue), new ColorString("? "), new ColorString("y", System.ConsoleColor.Green), new ColorString("/"), new ColorString("n", System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(multilang.GetWord("Use", config.lang) + " "), new ColorString(host, System.ConsoleColor.Blue), new ColorString("? "), new ColorString("y", System.ConsoleColor.Green), new ColorString("/"), new ColorString("n", System.ConsoleColor.Red)));
System.ConsoleKeyInfo c = new System.ConsoleKeyInfo();
while (c.Key != System.ConsoleKey.Y && c.Key != System.ConsoleKey.N)
{
@ -82,7 +83,7 @@ namespace Galactic_Colors_Control_Console
}
}
}
Consol.Write(new ColorStrings(multilang.Get("Loading", config.lang)));
Consol.Write(new ColorStrings(multilang.GetWord("Loading", config.lang)));
if (client.ConnectHost()) //Try connection
{
logger.Write("Connected", Logger.logType.warm);
@ -91,7 +92,7 @@ namespace Galactic_Colors_Control_Console
//Identifaction
while (!connected)
{
Consol.Write(new ColorStrings(multilang.Get("Username", config.lang) + ":"));
Consol.Write(new ColorStrings(multilang.GetWord("Username", config.lang) + ":"));
string username = System.Console.ReadLine();
if (username.Length > 3)
{
@ -100,20 +101,20 @@ namespace Galactic_Colors_Control_Console
else
{
logger.Write("Identification error " + res.result, Logger.logType.info);
Consol.Write(new ColorStrings(new ColorString(multilang.GetResultText(res, config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(Parser.GetResultText(res, config.lang, multilang), System.ConsoleColor.Red)));
}
}
else
{
Consol.Write(new ColorStrings(new ColorString(multilang.Get("TooShort", config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(multilang.GetWord("TooShort", config.lang), System.ConsoleColor.Red)));
}
}
bool inparty = false;
while (!inparty)
{
System.Console.Clear();
Consol.Write(new ColorStrings(multilang.GetResultText(client.Request(new string[2] { "party", "list" }), config.lang)));
Consol.Write(new ColorStrings(multilang.Get("Party", config.lang) + ":" + System.Environment.NewLine + " (<id> [password] or 'c' for create)"));
Consol.Write(new ColorStrings(Parser.GetResultText(client.Request(new string[2] { "party", "list" }), config.lang, multilang)));
Consol.Write(new ColorStrings(multilang.GetWord("Party", config.lang) + ":" + System.Environment.NewLine + " (<id> [password] or 'c' for create)"));
string[] data = Common.SplitArgs(System.Console.ReadLine());
if (data.Length > 0)
{
@ -127,13 +128,13 @@ namespace Galactic_Colors_Control_Console
if (createRes.type == ResultTypes.OK) { inparty = true; }
else
{
Consol.Write(new ColorStrings(new ColorString(multilang.GetResultText(createRes, config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(Parser.GetResultText(createRes, config.lang, multilang), System.ConsoleColor.Red)));
System.Console.Read();
}
}
else
{
Consol.Write(new ColorStrings(new ColorString(multilang.Get("Format", config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(multilang.GetWord("Format", config.lang), System.ConsoleColor.Red)));
}
}
else
@ -146,12 +147,12 @@ namespace Galactic_Colors_Control_Console
if (res.type == ResultTypes.OK) { inparty = true; }
else
{
Consol.Write(new ColorStrings(new ColorString(multilang.GetResultText(res, config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(Parser.GetResultText(res, config.lang, multilang), System.ConsoleColor.Red)));
}
}
else
{
Consol.Write(new ColorStrings(new ColorString(multilang.Get("Format", config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(multilang.GetWord("Format", config.lang), System.ConsoleColor.Red)));
}
}
}
@ -168,7 +169,7 @@ namespace Galactic_Colors_Control_Console
else
{
logger.Write("Connection error", Logger.logType.error);
Consol.Write(new ColorStrings(new ColorString(multilang.Get("CantConnect", config.lang), System.ConsoleColor.Red)));
Consol.Write(new ColorStrings(new ColorString(multilang.GetWord("CantConnect", config.lang), System.ConsoleColor.Red)));
}
run = false;
logger.Join();
@ -193,14 +194,14 @@ namespace Galactic_Colors_Control_Console
{
req = Common.Strings("say", input);
}
Consol.Write(new ColorStrings(multilang.GetResultText(client.Request(req), config.lang)));
Consol.Write(new ColorStrings(Parser.GetResultText(client.Request(req), config.lang, multilang)));
}
private static void OnEvent(object sender, System.EventArgs e)
{
//TODO add PartyKick
EventData eve = ((EventDataArgs)e).Data;
Consol.Write(new ColorStrings(multilang.GetEventText(eve, config.lang)));
Consol.Write(new ColorStrings(Parser.GetEventText(eve, config.lang, multilang)));
}
}
}

View File

@ -61,6 +61,9 @@
<Compile Include="Utilities.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MyCommon">
<HintPath>..\..\MyCommon\MyCommon\bin\Release\MyCommon.dll</HintPath>
</Reference>
<Reference Include="MyMonoGame">
<HintPath>..\..\MonoGame\MyMonoGameGUI\MyMonoGameGUI\bin\Release\MyMonoGame.dll</HintPath>
</Reference>

View File

@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MyCommon;
using MyMonoGame;
using MyMonoGame.GUI;
using System;
@ -69,7 +70,7 @@ namespace Galactic_Colors_Control_GUI
config = config.Load();
logger.Write("Galactic Colors Control GUI " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Logger.logType.fatal);
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, Program._debug, Program._dev, false);
multilang.Load();
multilang.Initialise(Common.dictionary);
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); }

View File

@ -31,11 +31,11 @@ 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.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), Game.singleton.multilang.GetWord("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.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"));
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.GetWord("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
}
else
{
@ -44,7 +44,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.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; }
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.GetWord("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { locked = false; Game.singleton.GUI.ResetFocus(); showOKMessage = false; }
}
else
{
@ -52,7 +52,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.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 (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.GetWord("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.GUI.content.GetBox("Default"), Game.singleton.multilang.Get("No", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("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.GetWord("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.GUI.content.GetFont("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.GetWord("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.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 (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.GetWord("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.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 (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.GetWord("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
{
if (!locked)
{
@ -118,7 +118,7 @@ namespace Galactic_Colors_Control_GUI.States
if (Host[0] == '*')
{
Host = Host.Substring(1);
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.title = Game.singleton.multilang.GetWord("Error", Game.singleton.config.lang);
message.text = Host;
showOKMessage = true;
Game.singleton.client.ResetHost();
@ -126,7 +126,7 @@ namespace Galactic_Colors_Control_GUI.States
}
else
{
message.title = Game.singleton.multilang.Get("Use", Game.singleton.config.lang) + " " + Host + "?";
message.title = Game.singleton.multilang.GetWord("Use", Game.singleton.config.lang) + " " + Host + "?";
showYNMessage = true;
}
showLoading = false;
@ -144,7 +144,7 @@ namespace Galactic_Colors_Control_GUI.States
else
{
Game.singleton.logger.Write("Connect error", Logger.logType.error);
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.title = Game.singleton.multilang.GetWord("Error", Game.singleton.config.lang);
message.text = string.Empty;
showOKMessage = true;
Game.singleton.client.ResetHost();

View File

@ -28,19 +28,19 @@ namespace Galactic_Colors_Control_GUI.States
{
Game.singleton.background.Draw(spritebatch);
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 (Game.singleton.GUI.Button(new Rectangle(5, 5, 50, 20), (showChat ? Game.singleton.multilang.GetWord("Hide", Game.singleton.config.lang) : Game.singleton.multilang.GetWord("Show", Game.singleton.config.lang)) + " " + Game.singleton.multilang.GetWord("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.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(); } }
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.GetWord("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.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"));
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.GetWord("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
}
else
{
@ -49,7 +49,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.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(); }
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.GetWord("OK", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"))) { Game.singleton.GUI.ResetFocus(); showOKMessage = false; Game.singleton.client.ExitHost(); }
}
}
}
@ -79,14 +79,14 @@ namespace Galactic_Colors_Control_GUI.States
{
request = request.Substring(1);
res = Game.singleton.client.Request(Common.SplitArgs(request));
ChatText(Game.singleton.multilang.GetResultText(res, Game.singleton.config.lang));
ChatText(Parser.GetResultText(res, Game.singleton.config.lang, Game.singleton.multilang));
}
else
{
res = Game.singleton.client.Request(Common.Strings("say", request));
if (res.type != ResultTypes.OK)
{
ChatText(Game.singleton.multilang.GetResultText(res, Game.singleton.config.lang));
ChatText(Parser.GetResultText(res, Game.singleton.config.lang, Game.singleton.multilang));
}
}
}
@ -97,13 +97,13 @@ namespace Galactic_Colors_Control_GUI.States
if (eve.type == EventTypes.ServerKick)
{
Game.singleton.logger.Write("Server kick" + eve.data, Logger.logType.warm);
message.title = Game.singleton.multilang.Get("ServerKick", Game.singleton.config.lang);
message.title = Game.singleton.multilang.GetWord("ServerKick", Game.singleton.config.lang);
message.text = Common.ArrayToString(eve.data);
showOKMessage = true;
}
else
{
ChatText(Game.singleton.multilang.GetEventText(eve, Game.singleton.config.lang));
ChatText(Parser.GetEventText(eve, Game.singleton.config.lang, Game.singleton.multilang));
}
}

View File

@ -19,11 +19,11 @@ 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.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), Game.singleton.multilang.GetWord("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.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"));
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.GetWord("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
}
else
{
@ -32,11 +32,11 @@ 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.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; }
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.GetWord("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.GUI.content.GetFont("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.GetWord("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.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 (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.GetWord("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.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 (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.GetWord("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
{
if (!locked)
{
@ -84,7 +84,7 @@ namespace Galactic_Colors_Control_GUI.States
}
else
{
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.title = Game.singleton.multilang.GetWord("Error", Game.singleton.config.lang);
message.text = Common.ArrayToString(res.result);
showOKMessage = true;
}

View File

@ -15,10 +15,10 @@ 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.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);
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.GetWord("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.GetWord("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 (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.GetWord("Play", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.White, Color.Green)))
{
if (!locked)
{
@ -32,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.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)))
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.GetWord("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.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 (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.GetWord("Exit", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.White, Color.Red)))
{
if (!locked)
{

View File

@ -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.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.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 4), Game.singleton.multilang.GetWord("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.IDToLang(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.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 (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.GetWord("Back", Game.singleton.config.lang),Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
{
if (!locked)
{
@ -41,7 +41,7 @@ namespace Galactic_Colors_Control_GUI.States
private void ChangeLang()
{
if (Game.singleton.config.lang < Game.singleton.multilang.Langs.Count - 1)
if (Game.singleton.config.lang < Game.singleton.multilang.langsCount - 1)
{
Game.singleton.config.lang++;
}

View File

@ -20,11 +20,11 @@ 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.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), Game.singleton.multilang.GetWord("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.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"));
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.GetWord("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
}
else
{
@ -33,14 +33,14 @@ 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.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; }
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.GetWord("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.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)))
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.GetWord("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.GetWord("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.GetWord("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.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 (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.GetWord("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
{
if (!locked)
{
@ -83,7 +83,7 @@ namespace Galactic_Colors_Control_GUI.States
else
{
Game.singleton.logger.Write("Create error " + Common.ArrayToString(res.result), Logger.logType.error);
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.title = Game.singleton.multilang.GetWord("Error", Game.singleton.config.lang);
message.text = Common.ArrayToString(res.result);
showOKMessage = true;
}

View File

@ -40,11 +40,11 @@ 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.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), Game.singleton.multilang.GetWord("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.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"));
Game.singleton.GUI.Label(new Rectangle(Game.singleton.ScreenWidth / 2 - 150, Game.singleton.ScreenHeight / 4 + 50, 300, 50), Game.singleton.multilang.GetWord("Loading", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"));
}
else
{
@ -53,12 +53,12 @@ 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.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; }
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.GetWord("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.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 (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.GetWord("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.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 (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.GetWord("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.GUI.content.GetFont("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.GetWord("Password", Game.singleton.config.lang));
if (parties.Count > 0)
{
if (parties.Count > 10)
@ -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.GUI.content.GetFont("basic"), null, Manager.textAlign.centerCenter);
Game.singleton.GUI.Label(new MyMonoGame.Vector(Game.singleton.ScreenWidth / 2, Game.singleton.ScreenHeight / 2 - 240), Game.singleton.multilang.GetWord("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.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 (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.GetWord("Back", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("basic"), new MyMonoGame.Colors(Color.LightGray, Color.White)))
{
if (!locked)
{
@ -155,7 +155,7 @@ namespace Galactic_Colors_Control_GUI.States
else
{
Game.singleton.logger.Write("Join error " + Common.ArrayToString(res.result), Logger.logType.error);
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.title = Game.singleton.multilang.GetWord("Error", Game.singleton.config.lang);
message.text = Common.ArrayToString(res.result);
showOKMessage = true;
}

View File

@ -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.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 / 2), Game.singleton.multilang.GetWord("GCC", Game.singleton.config.lang), Game.singleton.GUI.content.GetFont("title"), new MyMonoGame.Colors(Color.White), Manager.textAlign.centerCenter);
}
public override void Update()

View File

@ -49,6 +49,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MyCommon">
<HintPath>..\..\MyCommon\MyCommon\bin\Release\MyCommon.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.XML" />
</ItemGroup>

View File

@ -7,6 +7,7 @@ using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Threading;
using MyCommon;
using Console = Galactic_Colors_Control_Common.Console;
//TODO gui parties pages
@ -50,7 +51,7 @@ namespace Galactic_Colors_Control_Server
logger.Write(Console.Title + " " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Logger.logType.fatal);
config = config.Load();
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, _debug, _dev);
multilang.Load();
multilang.Initialise(Common.dictionary);
if (args.Length > 0)
{
switch (args[0])
@ -101,7 +102,7 @@ namespace Galactic_Colors_Control_Server
{
string ConsoleInput = Console.Read();
string[] args = Common.SplitArgs(ConsoleInput);
Console.Write(new ColorStrings(multilang.GetResultText(new ResultData(-1, Commands.Manager.Execute(args, null, true)), config.lang)));
Console.Write(new ColorStrings(Parser.GetResultText(new ResultData(-1, Commands.Manager.Execute(args, null, true)), config.lang, multilang)));
ConsoleInput = null;
}
}

View File

@ -33,7 +33,7 @@ namespace Galactic_Colors_Control_Server
public static string GetName(Socket soc)
{
if (soc == null)
return Server.multilang.Get("Server", Server.config.lang);
return Server.multilang.GetWord("Server", Server.config.lang);
if (!Server.clients.ContainsKey(soc))
return "?";
@ -90,7 +90,7 @@ namespace Galactic_Colors_Control_Server
switch (packet.GetType().Name)
{
case "EventData":
Console.Write(new ColorStrings(Server.multilang.GetEventText((EventData)packet, Server.config.lang)));
Console.Write(new ColorStrings(Parser.GetEventText((EventData)packet, Server.config.lang, Server.multilang)));
break;
default:
@ -120,7 +120,7 @@ namespace Galactic_Colors_Control_Server
switch (data.GetType().Name)
{
case "EventData":
Console.Write(new ColorStrings(Server.multilang.GetEventText((EventData)data, Server.config.lang)));
Console.Write(new ColorStrings(Parser.GetEventText((EventData)data, Server.config.lang, Server.multilang)));
break;
default: