Esempio n. 1
0
        private void Fix()
        {
            UILocalization local = target as UILocalization;
            Text           txt   = local.gameObject.GetComponent <Text>();
            Image          img   = local.gameObject.GetComponent <Image>();

            int id;

            if (string.IsNullOrEmpty(local.key) || int.TryParse(local.key.Substring(1), out id))
            {
                local.key = LanguageManager.GetAvalibleKey();
            }

            if (txt != null)
            {
                string key = local.key;

                if (LanguageManager.TryGetKey(txt.text, out key))
                {
                    local.key = key;
                    return;
                }
                else
                {
                    LanguageManager.Refresh();
                    if (!LanguageManager.ContainKey(local.key))
                    {
                        LanguageManager.AddNewWord(local.key, txt.text);
                        AssetDatabase.Refresh();
                    }
                    else
                    {
                        local.key = "_" + local.key;
                        Fix();
                    }
                    LanguageManager.Refresh();
                }
            }
            else
            {
                Debug.logger.LogError("DataGener", "不存在Text");
            }
        }