Exemple #1
0
 void OnKeyLocalize()
 {
     if (B_AutoLocalize)
     {
         text = TLocalization.GetLocalizeValue(m_LocalizeKey);
     }
 }
Exemple #2
0
 void OnKeyLocalize()
 {
     if (B_AutoLocalize)
     {
         text = TLocalization.GetKeyLocalized(S_AutoLocalizeKey);
     }
 }
 protected override void OnEnable()
 {
     base.OnEnable();
     m_target = target as UIT_TextExtend;
     TLocalization.SetRegion(enum_Option_LanguageRegion.CN);
     targetLocalize = m_target.m_LocalizeKey;
 }
Exemple #4
0
    public override void OnInspectorGUI()
    {
        m_target = target as UIT_TextExtend;

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Auto Localize:", GUILayout.Width(Screen.width / 3 - 20));
        m_target.B_AutoLocalize = EditorGUILayout.Toggle(m_target.B_AutoLocalize, GUILayout.Width(Screen.width * 2 / 3 - 20));
        EditorGUILayout.EndHorizontal();

        if (m_target.B_AutoLocalize)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Localize Key:", GUILayout.Width(Screen.width / 3 - 20));
            m_target.S_AutoLocalizeKey = GUILayout.TextArea(m_target.S_AutoLocalizeKey, GUILayout.Width(Screen.width * 2 / 3 - 20));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            TLocalization.SetRegion(enum_Option_LanguageRegion.CN);
            GUILayout.Label("Localized Text:", GUILayout.Width(Screen.width / 3 - 20));
            GUILayout.Label(TLocalization.CanLocalize(m_target.S_AutoLocalizeKey) ? TLocalization.GetKeyLocalized(m_target.S_AutoLocalizeKey) : "Unable To Localize", GUILayout.Width(Screen.width * 2 / 3 - 20));
            GUILayout.EndHorizontal();
        }

        EditorGUILayout.BeginHorizontal();
        int spacing = EditorGUILayout.IntField("Character Spacing:", m_target.m_characterSpacing);

        if (spacing != m_target.m_characterSpacing)
        {
            m_target.m_characterSpacing = spacing;
            m_target.SetAllDirty();
        }
        EditorGUILayout.EndHorizontal();

        base.OnInspectorGUI();
    }
Exemple #5
0
    void Awake()
    {
        Properties <STestProperties> .Init();

        for (int i = 0; i < Properties <STestProperties> .PropertiesList.Count; i++)
        {
            Debug.Log(TDataConvert.Convert(Properties <STestProperties> .PropertiesList[i]));
        }

        SheetProperties <STestSheetProperties> .Init();

        for (int i = 0; i < SheetProperties <STestSheetProperties> .GetPropertiesList(1).Count; i++)
        {
            Debug.Log(TDataConvert.Convert(SheetProperties <STestSheetProperties> .GetPropertiesList(1)[i]));
        }

        m_Normal = transform.Find("Normal").GetComponent <UIT_TextExtend>();
        m_Format = transform.Find("Format").GetComponent <UIT_TextExtend>();
        transform.Find("ChangeLanguage").GetComponent <Button>().onClick.AddListener(OnChangeLanguageClick);

        TLocalization.OnLocaleChanged += OnKeyLocalized;
        TLocalization.SetRegion(enum_Option_LanguageRegion.CN);
        m_Normal.localizeKey = "GAME_TEST_NORMAL";
    }
Exemple #6
0
 public string formatText(string formatKey, params object[] subItems) => base.text = string.Format(TLocalization.GetKeyLocalized(formatKey), subItems);
        public override void OnInspectorGUI()
        {
            EditorGUILayout.BeginHorizontal();
            //Will Do Localize?
            GUILayout.Label("Auto Localize:", GUILayout.Width(Screen.width / 3 - 20));
            bool autoLocalize = EditorGUILayout.Toggle(m_target.B_AutoLocalize, GUILayout.Width(Screen.width * 2 / 3 - 20));;

            if (autoLocalize != m_target.B_AutoLocalize)
            {
                Undo.RecordObject(m_target, "Text Extend Undo");
                m_target.B_AutoLocalize = autoLocalize;
            }
            EditorGUILayout.EndHorizontal();

            // Do Localize
            if (m_target.B_AutoLocalize)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Localize Key:", GUILayout.Width(Screen.width / 3 - 20));
                targetLocalize = EditorGUILayout.TextField(targetLocalize, GUILayout.Width(Screen.width * 2 / 3 - 20));

                string localizeKey  = null;
                bool   localized    = true;
                bool   keyLocalized = false;
                if (TLocalization.CheckKeyLocalizable(targetLocalize))
                {
                    localizeKey  = targetLocalize;
                    keyLocalized = true;
                }
                else if (TLocalization.CheckValueLocalized(targetLocalize))
                {
                    localizeKey  = TLocalization.FindLocalizeKey(targetLocalize);
                    keyLocalized = false;
                }
                else
                {
                    localized = false;
                }

                if (localizeKey != m_target.m_LocalizeKey)
                {
                    Undo.RecordObject(m_target, "Text Extend Undo");
                    m_target.m_LocalizeKey = localizeKey;
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (localized)
                {
                    if (keyLocalized)
                    {
                        GUILayout.Label("Localized Value:", GUILayout.Width(Screen.width / 3 - 20));
                        GUILayout.Label(TLocalization.GetLocalizeValue(m_target.m_LocalizeKey), GUILayout.Width(Screen.width * 2 / 3 - 20));
                    }
                    else
                    {
                        GUILayout.Label("Localized Key:", GUILayout.Width(Screen.width / 3 - 20));
                        GUILayout.Label(m_target.m_LocalizeKey);
                    }
                }
                else
                {
                    GUILayout.Label("Unable To Localize");
                }
                GUILayout.EndHorizontal();
            }

            //Character Spacing
            EditorGUILayout.BeginHorizontal();
            int spacing = EditorGUILayout.IntField("Character Spacing:", m_target.m_CharacterSpacing);

            if (spacing != m_target.m_CharacterSpacing)
            {
                Undo.RecordObject(m_target, "Text Extend Undo");
                m_target.m_CharacterSpacing = spacing;
                m_target.SetAllDirty();
            }
            EditorGUILayout.EndHorizontal();

            base.OnInspectorGUI();
        }
Exemple #8
0
 public string formatKey(string formatKey, string subKey) => base.text             = string.Format(TLocalization.GetLocalizeValue(formatKey), TLocalization.GetLocalizeValue(subKey));
Exemple #9
0
 void OnKeyLocalized()
 {
     m_Format.formatText("GAME_TEST_FORMAT", 10, TLocalization.GetKeyLocalized("GAME_TEST_ITEM"));
 }
Exemple #10
0
 void OnChangeLanguageClick()
 {
     TLocalization.SetRegion(TLocalization.e_CurLocation == enum_Option_LanguageRegion.CN? enum_Option_LanguageRegion.EN: enum_Option_LanguageRegion.CN);
 }