Esempio n. 1
0
        static protected string GetText(LangDataInstance langData, int id)
        {
            string text = TEXT_NOT_FOUND;

            text = langData.texts.Find(x => x.id == id)?.textValue;
            return(text);
        }
Esempio n. 2
0
        static protected void LoadLangDataInstance(string resourcePath, bool additive = false, int index = 0)
        {
            string filePath = resourcePath.Replace(".json", "");

            try
            {
                TextAsset        targetFile = Resources.Load <TextAsset>(filePath);
                LangDataInstance langData   = JsonUtility.FromJson <LangDataInstance>(targetFile.text);

                if (additive)
                {
                    GetInstance().currentLangDataInstance[index] = langData;
                }
                else
                {
                    GetInstance().currentLangDataInstance[0] = langData;
                }

                print("Loaded: " + filePath);
            }
            catch (System.Exception exc)
            {
                print("Error! While loading currentLangDataInstance from path: " + filePath);
                print("and error msg is: " + exc);
            }
        }
Esempio n. 3
0
        static public string GetText(int id, int specificFileIndex)
        {
            if (GetInstance().currentLangDataInstance.Length <= specificFileIndex)
            {
                return(TEXT_NOT_FOUND);
            }
            LangDataInstance langData = GetInstance().currentLangDataInstance[specificFileIndex];

            if (langData == null)
            {
                Debug.LogWarning("Lang File index: " + specificFileIndex + " does not exits. There is " + GetInstance().currentLangDataInstance.Length + " files loaded."); return(TEXT_NOT_FOUND);
            }
            return(GetText(langData, id));
        }