From 5dcd7c328e785347dbc59b28d2b09362cd7f1ee6 Mon Sep 17 00:00:00 2001 From: sheychen Date: Wed, 16 Nov 2016 15:20:55 +0100 Subject: [PATCH] Multilang and working config --- Galactic Colors Control Common/Logger.cs | 12 +++-- Galactic Colors Control Common/MultiLang.cs | 8 ++++ .../Resources/Lang.csv | 27 ++++++++++- .../ConfigSchema.xsd | 27 +++++++++++ .../Galactic Colors Control Console.csproj | 6 +++ Galactic Colors Control Console/Program.cs | 19 ++++---- Galactic Colors Control GUI/Config.cs | 1 + Galactic Colors Control GUI/ConfigSchema.xsd | 28 ++++++++++++ .../Galactic Colors Control GUI.csproj | 6 +++ Galactic Colors Control GUI/Game.cs | 45 +++++++++---------- .../States/ConnectState.cs | 22 ++++----- .../States/GameState.cs | 15 +++---- .../States/IndentificationState.cs | 14 +++--- .../States/MainMenuState.cs | 11 ++--- .../States/TitleState.cs | 2 +- Galactic Colors Control Server/Config.cs | 1 + .../ConfigSchema.xsd | 1 + Galactic Colors Control Server/Program.cs | 13 +++--- Galactic Colors Control Server/Utilities.cs | 2 +- 19 files changed, 184 insertions(+), 76 deletions(-) create mode 100644 Galactic Colors Control Console/ConfigSchema.xsd create mode 100644 Galactic Colors Control GUI/ConfigSchema.xsd diff --git a/Galactic Colors Control Common/Logger.cs b/Galactic Colors Control Common/Logger.cs index 6e55bf7..a78c31a 100644 --- a/Galactic Colors Control Common/Logger.cs +++ b/Galactic Colors Control Common/Logger.cs @@ -34,20 +34,24 @@ namespace Galactic_Colors_Control_Common private ConsoleColor[] logBackColor; private ConsoleColor[] logForeColor; private Thread Updater; - private logType logLevel; + private logType logLevel = logType.info; 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; /// /// Create log file and start logger thread /// /// Absolute path to logs directory - 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; logBackColor = backColor; logForeColor = foreColor; logLevel = LogLevel; + _debug = debug; + _dev = dev; if (!Directory.Exists(logPath)) { Directory.CreateDirectory(logPath); @@ -120,7 +124,7 @@ namespace Galactic_Colors_Control_Common /// Log struct private void Write(Log log) { - if (logLevel == logType.debug || logLevel == logType.dev) + if (_debug || _dev) { //Add Source Method log.text = "[" + new StackTrace().GetFrame(2).GetMethod().Name + "]: " + log.text; diff --git a/Galactic Colors Control Common/MultiLang.cs b/Galactic Colors Control Common/MultiLang.cs index 0a413a3..f2bcd4a 100644 --- a/Galactic Colors Control Common/MultiLang.cs +++ b/Galactic Colors Control Common/MultiLang.cs @@ -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) { string text = ""; diff --git a/Galactic Colors Control Common/Resources/Lang.csv b/Galactic Colors Control Common/Resources/Lang.csv index 44fada4..380b9cf 100644 --- a/Galactic Colors Control Common/Resources/Lang.csv +++ b/Galactic Colors Control Common/Resources/Lang.csv @@ -1,5 +1,30 @@ 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 PartyJoin;rejoint la partie;join the party ServerLeave;quitte le server;leave the server -PartyLeave;quitte la partie;leave the party \ No newline at end of file +PartyLeave;quitte la partie;leave the party +ServerKick;Exclus du serveur;Kick from server \ No newline at end of file diff --git a/Galactic Colors Control Console/ConfigSchema.xsd b/Galactic Colors Control Console/ConfigSchema.xsd new file mode 100644 index 0000000..cf91447 --- /dev/null +++ b/Galactic Colors Control Console/ConfigSchema.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Galactic Colors Control Console/Galactic Colors Control Console.csproj b/Galactic Colors Control Console/Galactic Colors Control Console.csproj index f82f6ef..30710b6 100644 --- a/Galactic Colors Control Console/Galactic Colors Control Console.csproj +++ b/Galactic Colors Control Console/Galactic Colors Control Console.csproj @@ -61,6 +61,12 @@ Galactic Colors Control + + + Designer + PreserveNewest + +