protected override void OnEnable()
 {
     base.OnEnable();
     m_target = target as UIT_TextExtend;
     TLocalization.SetRegion(enum_Option_LanguageRegion.CN);
     targetLocalize = m_target.m_LocalizeKey;
 }
Esempio n. 2
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();
    }
        public static void CreateTextExtend()
        {
            GameObject go         = Selection.activeGameObject;
            GameObject textExtend = new GameObject("Text_Extended");

            if (go != null)
            {
                textExtend.transform.SetParent(go.transform);
            }
            UIT_TextExtend extend = textExtend.AddComponent <UIT_TextExtend>();

            extend.text  = "New Text Extend";
            extend.color = Color.black;
            extend.rectTransform.anchoredPosition = Vector2.zero;
        }
Esempio n. 4
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";
    }