Esempio n. 1
0
    // -------------------------------------------------------------------------------------------------------------
    void OnGUI()
    {
        GUILayout.BeginVertical(GUI.skin.box);
        {
            EditorGUIControls.Title(mTitle);

            mLogScrollViewPosition = GUILayout.BeginScrollView(mLogScrollViewPosition, false, true);
            GUILayout.TextArea(mLog);
            GUILayout.EndScrollView();
        }
    }
Esempio n. 2
0
    // -------------------------------------------------------------------------------------------------------------
    public void GUILogBox()
    {
        if (mWidthOption == null)
        {
            mWidthOption = GUILayout.Width(mWidth);
        }

        if (mHeightOption == null)
        {
            mHeightOption = GUILayout.Height(mHeight);
        }

        if (mUpdate)
        {
            mStringBuilder.Length = 0;

            foreach (string s in mLines)
            {
                mStringBuilder.Append(s).Append(System.Environment.NewLine);
            }

            mString = mStringBuilder.ToString();

            mUpdate = false;
        }

        if (mWidth != 0 && mHeight != 0)
        {
            GUILayout.BeginVertical(GUI.skin.box, mWidthOption, mHeightOption);
        }
        else if (mWidth != 0)
        {
            GUILayout.BeginVertical(GUI.skin.box, mWidthOption);
        }
        else if (mHeight != 0)
        {
            GUILayout.BeginVertical(GUI.skin.box, mHeightOption);
        }
        else
        {
            GUILayout.BeginVertical(GUI.skin.box);
        }

        {
            EditorGUIControls.Title("Log");

            mScrollView = GUILayout.BeginScrollView(mScrollView, false, true);
            GUILayout.Label(mString);
            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Clear", EditorGUIControls.BUTTON_WIDTH))
                {
                    Clear();
                }
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
    }