示例#1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.STRING);

            if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70)))
            {
                LocalizedText textObject = ((LocalizedText)target);
                textObject.localizedKey = selectedKey;
            }
        }
示例#2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.AUDIO);

        if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(80)))
        {
            GameObject           targetGameObject = ((AudioSource)target).gameObject;
            LocalizedAudioSource audioObject      = targetGameObject.GetComponent <LocalizedAudioSource>();
            if (audioObject == null)
            {
                audioObject = targetGameObject.AddComponent <LocalizedAudioSource>();
            }

            audioObject.localizedKey = selectedKey;
        }
    }
示例#3
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.STRING);

        if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70)))
        {
            GameObject       targetGameObject = ((GUIText)target).gameObject;
            LocalizedGUIText textObject       = targetGameObject.GetComponent <LocalizedGUIText>();
            if (textObject == null)
            {
                textObject = targetGameObject.AddComponent <LocalizedGUIText>();
            }

            textObject.localizedKey = selectedKey;
        }
    }
示例#4
0
    public override void OnInspectorGUI()
    {
        // base.OnInspectorGUI();
        TextManager textObject = ((TextManager)target);
        int         cpt        = 0;

        selectedKeys.Clear();


        if (textObject != null)
        {
            int value = (int)Mathf.Clamp(EditorGUILayout.IntField("SystemLanguage : ", textObject.systemLanguages.Count), 0, Mathf.Infinity);

            if (value > textObject.systemLanguages.Count)
            {
                for (int i = value; textObject.systemLanguages.Count < value; i++)
                {
                    textObject.systemLanguages.Add(new TextManager.LanguageConversionData());
                }
            }
            else if (value < textObject.systemLanguages.Count)
            {
                for (int i = value; textObject.systemLanguages.Count > value; i--)
                {
                    textObject.systemLanguages.RemoveAt(textObject.systemLanguages.Count - 1);
                }
            }


            foreach (TextManager.LanguageConversionData i in textObject.systemLanguages)
            {
                i.systemLanguage       = (SystemLanguage)EditorGUILayout.EnumPopup("SystemLanguage : ", i.systemLanguage);
                i.smartLocalizationKey = EditorGUILayout.TextField("SmartLocalisaiton Key : ", i.smartLocalizationKey);
                GUILayout.Space(5);
            }


            GUILayout.Space(20);



            value = (int)Mathf.Clamp(EditorGUILayout.IntField("SmartText : ", textObject.smartTextData.Count), 0, Mathf.Infinity);

            if (value > textObject.smartTextData.Count)
            {
                for (int i = value; textObject.smartTextData.Count < value; i++)
                {
                    textObject.smartTextData.Add(new TextManager.SmartTextData());
                }
            }
            else if (value < textObject.smartTextData.Count)
            {
                for (int i = value; textObject.smartTextData.Count > value; i--)
                {
                    textObject.smartTextData.RemoveAt(textObject.smartTextData.Count - 1);
                }
            }


            foreach (TextManager.SmartTextData i in textObject.smartTextData)
            {
                selectedKeys.Add(i.localizedKey);
            }

            foreach (TextManager.SmartTextData i in textObject.smartTextData)
            {
                i.text         = (Text)EditorGUILayout.ObjectField(i.text, typeof(Text), true);
                i.localizedKey = EditorGUILayout.TextField(i.localizedKey);

                selectedKeys[cpt] = LocalizedKeySelector.SelectKeyGUI(selectedKeys[cpt], true, LocalizedObjectType.STRING);

                if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70)))
                {
                    i.localizedKey = selectedKeys[cpt];
                }
                GUILayout.Space(10);
                cpt++;
            }
        }
    }