From 93b5f588e3cb644f61e002932d61f2c6cdab87ab Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 11 Oct 2019 18:16:34 -0400 Subject: We finally got rid of GPL --- Assets/Scripts/Localisation/CSVLoader.cs | 68 ---------------------- Assets/Scripts/Localisation/CSVLoader.cs.meta | 11 ---- Assets/Scripts/Localisation/LocalisationSystem.cs | 54 ----------------- .../Localisation/LocalisationSystem.cs.meta | 11 ---- Assets/Scripts/Localisation/TextLocaliserUI.cs | 21 ------- .../Scripts/Localisation/TextLocaliserUI.cs.meta | 11 ---- 6 files changed, 176 deletions(-) delete mode 100644 Assets/Scripts/Localisation/CSVLoader.cs delete mode 100644 Assets/Scripts/Localisation/CSVLoader.cs.meta delete mode 100644 Assets/Scripts/Localisation/LocalisationSystem.cs delete mode 100644 Assets/Scripts/Localisation/LocalisationSystem.cs.meta delete mode 100644 Assets/Scripts/Localisation/TextLocaliserUI.cs delete mode 100644 Assets/Scripts/Localisation/TextLocaliserUI.cs.meta (limited to 'Assets/Scripts/Localisation') diff --git a/Assets/Scripts/Localisation/CSVLoader.cs b/Assets/Scripts/Localisation/CSVLoader.cs deleted file mode 100644 index 6805761..0000000 --- a/Assets/Scripts/Localisation/CSVLoader.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using UnityEngine; - -public class CSVLoader -{ - //Reference file; - private TextAsset csvFile; - private char lineSeperator = '\n'; - private char surrond = '"'; - private string[] fieldSeperator = { "\", \"" }; - - public void LoadCSV() - { - csvFile = Resources.Load("localisation"); - } - - public Dictionary GetDictionaryValues(string attributeID) - { - Dictionary dictionary = new Dictionary(); - - string[] lines = csvFile.text.Split(lineSeperator); - - int attributeIndex = -1; - - string[] headers = lines[0].Split(fieldSeperator, StringSplitOptions.None); - - for(int i=0; i attributeIndex) - { - var key = fields[0]; - - if (dictionary.ContainsKey(key)) { continue; } - - var value = fields[attributeIndex]; - - dictionary.Add(key, value); - } - } - - return dictionary; - } - -} diff --git a/Assets/Scripts/Localisation/CSVLoader.cs.meta b/Assets/Scripts/Localisation/CSVLoader.cs.meta deleted file mode 100644 index f8da045..0000000 --- a/Assets/Scripts/Localisation/CSVLoader.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 61806182744136d43ac66686d8fd4a8c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Localisation/LocalisationSystem.cs b/Assets/Scripts/Localisation/LocalisationSystem.cs deleted file mode 100644 index 3d48244..0000000 --- a/Assets/Scripts/Localisation/LocalisationSystem.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class LocalisationSystem -{ - public enum Language - { - English, - French - } - - public static Language language = Language.English; - - private static Dictionary localisedEN; - private static Dictionary localisedFR; - - public static bool isInit; - - public static void Init() - { - Debug.Log("Initalizing the localisation system..."); - CSVLoader csvLoader = new CSVLoader(); - csvLoader.LoadCSV(); - - localisedEN = csvLoader.GetDictionaryValues("en"); - localisedFR = csvLoader.GetDictionaryValues("fr"); - - isInit = true; - Debug.Log("Loaded the values for the localisation system."); - } - - public static string GetLocalisedValue(string key) - { - if (!isInit) { Init(); } - - string value = key; - - switch (language) - { - case Language.English: - localisedEN.TryGetValue(key, out value); - break; - case Language.French: - localisedFR.TryGetValue(key, out value); - break; - - } - - return value; - } - -} diff --git a/Assets/Scripts/Localisation/LocalisationSystem.cs.meta b/Assets/Scripts/Localisation/LocalisationSystem.cs.meta deleted file mode 100644 index 59e4525..0000000 --- a/Assets/Scripts/Localisation/LocalisationSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a3891ee2e9bce604eb56fc66b0ee96ac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Localisation/TextLocaliserUI.cs b/Assets/Scripts/Localisation/TextLocaliserUI.cs deleted file mode 100644 index a56afb0..0000000 --- a/Assets/Scripts/Localisation/TextLocaliserUI.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using TMPro; -using UnityEngine; - -[RequireComponent(typeof(TextMeshProUGUI))] -public class TextLocaliserUI : MonoBehaviour -{ - TextMeshProUGUI textField; - - public string key; - - // Start is called before the first frame update - void Start() - { - textField = GetComponent(); - string value = LocalisationSystem.GetLocalisedValue(key); - textField.text = value; - } - -} diff --git a/Assets/Scripts/Localisation/TextLocaliserUI.cs.meta b/Assets/Scripts/Localisation/TextLocaliserUI.cs.meta deleted file mode 100644 index 93e3094..0000000 --- a/Assets/Scripts/Localisation/TextLocaliserUI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7c6a2fc696577634c999293f25c45550 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: -- cgit v1.2.3