Example #1
0
    void OnGUI()
    {
        #region Buttons
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Previous"))
        {
            Debug.Log("Previous Text");
            selectedDialog = ((selectedDialog - 1) + totalDialog - 2) % (totalDialog - 2);
            Debug.Log(selectedDialog);
        }
        if (GUILayout.Button("Next"))
        {
            Debug.Log("Next Text");
            selectedDialog = (selectedDialog + 1) % (totalDialog - 2);
        }
        if (GUILayout.Button("Add Lang"))
        {
            Debug.Log("Added Language");
            wizard = AddLanguageWizard.CreateInstance <AddLanguageWizard>();
            wizard.Show();
        }

        EditorGUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Load Text"))
        {
            Debug.Log("Loading All Text...");
        }
        if (GUILayout.Button("Save Changes"))
        {
            Debug.Log("Saving Changes");
            SaveTextDebug(translatedText);
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region Popup
        Rect popup = new Rect(new Vector2(0, 2 * EditorGUIUtility.singleLineHeight), new Vector2(this.position.width, EditorGUIUtility.singleLineHeight));

        if (localizedLanguages.Count > 0)
        {
            selectedLanguage = EditorGUI.Popup(popup, selectedLanguage, options.ToArray());
        }
        #endregion

        #region OriginalText
        GUILayout.BeginArea(new Rect(0, 3 * EditorGUIUtility.singleLineHeight, this.position.width, EditorGUIUtility.singleLineHeight * 6));
        EditorGUILayout.BeginHorizontal();
        GUILayout.TextArea(GetTextDebug(0, selectedDialog), GUILayout.Height(position.height - 30));
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
        #endregion

        #region LocalizedText
        GUILayout.BeginArea(new Rect(0, 10 * EditorGUIUtility.singleLineHeight, this.position.width, EditorGUIUtility.singleLineHeight * 6));
        EditorGUILayout.BeginHorizontal();
        translatedText = GUILayout.TextArea(translatedText, GUILayout.Height(position.height - 30));
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
        #endregion
    }
Example #2
0
    void OnGUI()
    {
        //#region ObjectField
        //Object dataObj = null;
        //dataObj = EditorGUILayout.ObjectField(dataObj, typeof(DataManager), false);
        //data = dataObj as DataManager;
        //#endregion

        #region Buttons
        EditorGUILayout.BeginHorizontal();
        Dictionary <string, string> outLang;
        List <string> popDialog = null;
        if (selectedLanguage != null && data.languages.TryGetValue(selectedLanguage, out outLang))
        {
            //selectedDialog = outLang.Keys.FirstOrDefault();
            popDialog = outLang.Keys.ToList();
        }
        //List<string> popLang = data.languages.Keys.ToList();
        if (GUILayout.Button("Previous"))
        {
            Debug.Log("Previous Text");
            selectedDialog = popDialog[(selectPopDialog - 1 + totalDialog - 2) % (totalDialog - 2)];
            Debug.Log(selectedDialog);
        }
        if (GUILayout.Button("Next"))
        {
            Debug.Log("Next Text");
            selectedDialog = popDialog[(selectPopDialog + 1) % (totalDialog - 2)];
        }
        if (GUILayout.Button("Add Lang"))
        {
            Debug.Log("Added Language");
            wizard = AddLanguageWizard.CreateInstance <AddLanguageWizard>();
            wizard.Show();
        }

        EditorGUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Load Text"))
        {
            Debug.Log("Loading All Text...");
        }
        if (GUILayout.Button("Save Changes"))
        {
            Debug.Log("Saving Changes");
            //SaveTextDebug(translatedText);
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region Popup
        Rect popup = new Rect(new Vector2(0, 2 * EditorGUIUtility.singleLineHeight), new Vector2(this.position.width, EditorGUIUtility.singleLineHeight));

        if (localizedLanguages.Count > 0)
        {
            List <string> popLang = data.languages.Keys.ToList();
            selectedLanguage = popLang[EditorGUI.Popup(popup, selectPopLanguage, options.ToArray())];
        }
        #endregion

        #region OriginalText
        GUILayout.BeginArea(new Rect(0, 3 * EditorGUIUtility.singleLineHeight, this.position.width, EditorGUIUtility.singleLineHeight * 6));
        EditorGUILayout.BeginHorizontal();
        GUILayout.TextArea(GetTextDebug(data.languages.Keys.FirstOrDefault(), selectedDialog), GUILayout.Height(position.height - 30));
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
        #endregion

        #region LocalizedText
        GUILayout.BeginArea(new Rect(0, 10 * EditorGUIUtility.singleLineHeight, this.position.width, EditorGUIUtility.singleLineHeight * 6));
        EditorGUILayout.BeginHorizontal();
        translatedText = GUILayout.TextArea(translatedText, GUILayout.Height(position.height - 30));
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
        #endregion
    }