コード例 #1
0
        void DoMessageArea()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                DrawDialogIcon.ForMessage(mAlertType);

                using (new EditorGUILayout.VerticalScope())
                {
                    GUILayout.Label(mTitle, UnityStyles.Dialog.MessageTitle);
                    GUILayout.Label(mMessage, UnityStyles.Dialog.MessageText);
                }
            }
        }
コード例 #2
0
ファイル: PlasticAlert.cs プロジェクト: shuwithu/Faces
        void DoMessageArea()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                DrawDialogIcon.ForMessage(mAlertType);

                using (new EditorGUILayout.VerticalScope())
                {
                    GUILayout.Label(mTitle, UnityStyles.Dialog.MessageTitle);

                    GUIContent message = new GUIContent(mMessage);

                    Rect     lastRect          = GUILayoutUtility.GetLastRect();
                    GUIStyle scrollPlaceholder = new GUIStyle(UnityStyles.Dialog.MessageText);
                    scrollPlaceholder.normal.textColor = Color.clear;
                    scrollPlaceholder.clipping         = TextClipping.Clip;

                    if (Event.current.type == EventType.Repaint)
                    {
                        mMessageDesiredHeight = ((GUIStyle)UnityStyles.Dialog.MessageText)
                                                .CalcHeight(message, lastRect.width - 20) + 20;
                        mMessageViewHeight = Mathf.Min(mMessageDesiredHeight, 500);
                    }

                    GUILayout.Space(mMessageViewHeight);

                    Rect scrollPanelRect = new Rect(
                        lastRect.xMin, lastRect.yMax,
                        lastRect.width + 20, mMessageViewHeight);

                    Rect contentRect = new Rect(
                        scrollPanelRect.xMin,
                        scrollPanelRect.yMin,
                        scrollPanelRect.width - 20,
                        mMessageDesiredHeight);

                    mScroll = GUI.BeginScrollView(scrollPanelRect, mScroll, contentRect);

                    GUI.Label(contentRect, mMessage, UnityStyles.Dialog.MessageText);

                    GUI.EndScrollView();
                };
            }
        }