using UnityEngine; using TMPro; public class TRANS : MonoBehaviour { public static string This(string txt) { int ind = 0; if (txt[..2] == "T_") { ind = System.Array.IndexOf(_T.TRANS_T, txt); return Retext(_T.TRANS_T[ind + _G.L]); } ind = System.Array.IndexOf(_T.TRANS, txt); return Retext(_T.TRANS[ind + _G.L]); } public static string CabinetSubCategory(string Category, string txt) { Category += _G.L; return Category switch { "BASE1" => _SC.BASE1[_SC.BASE1.IndexOf(txt)], "BASE2" => _SC.BASE2[_SC.BASE1.IndexOf(txt)], "BASE3" => _SC.BASE3[_SC.BASE1.IndexOf(txt)], "WALL1" => _SC.WALL1[_SC.WALL1.IndexOf(txt)], "WALL2" => _SC.WALL2[_SC.WALL1.IndexOf(txt)], "WALL3" => _SC.WALL3[_SC.WALL1.IndexOf(txt)], "TALL1" => _SC.TALL1[_SC.TALL1.IndexOf(txt)], "TALL2" => _SC.TALL2[_SC.TALL1.IndexOf(txt)], "TALL3" => _SC.TALL3[_SC.TALL1.IndexOf(txt)], "CBASE1" => _SC.CBASE1[_SC.CBASE1.IndexOf(txt)], "CBASE2" => _SC.CBASE2[_SC.CBASE1.IndexOf(txt)], "CBASE3" => _SC.CBASE3[_SC.CBASE1.IndexOf(txt)], "CWALL1" => _SC.CWALL1[_SC.CWALL1.IndexOf(txt)], "CWALL2" => _SC.CWALL2[_SC.CWALL1.IndexOf(txt)], "CWALL3" => _SC.CWALL3[_SC.CWALL1.IndexOf(txt)], _ => "Oups", }; } public static void go() { GameObject[] gos; gos = GameObject.FindGameObjectsWithTag("txt"); int ind = 1; string Texte=""; foreach (GameObject go in gos) { if (go.name != "") { if(go.name[..2] =="T_"){ ind = System.Array.IndexOf(_T.TRANS_T, go.name); Texte=_T.TRANS_T[ind + _G.L]; } else { ind = System.Array.IndexOf(_T.TRANS, go.name); Texte=_T.TRANS[ind + _G.L]; } go.GetComponent().text = Retext(Texte); } } GameObject[] gospro; gospro = GameObject.FindGameObjectsWithTag("txtpro"); ind = 1; foreach (GameObject go in gospro) { if (go.name != "") { ind = System.Array.IndexOf(_T.TRANS, go.name); go.GetComponent().text = Retext(_T.TRANS[ind + _G.L]); } if(go.name[..2] =="T_"){ ind = System.Array.IndexOf(_T.TRANS_T, go.name); Texte=_T.TRANS_T[ind + _G.L]; } else { ind = System.Array.IndexOf(_T.TRANS, go.name); Texte=_T.TRANS[ind + _G.L]; } go.GetComponent().text = Retext(Texte); } } public static string color(string txt) { int ind = System.Array.IndexOf(_C.TRANS, txt); string t = _C.TRANS[ind + _G.L]; return t; } public static string Retext(string T ){ if(_G.Lexique.ContainsKey(T)){return _G.Lexique[T];} return T; } }