void OnGUI() { GUIUtil.PushSkin(m_Skin); Rect wndRect = new Rect(0, Screen.height - WND_HEIGHT, Screen.width, WND_HEIGHT); Rect imgRect = new Rect(); NormalParagraph p = m_Paragraphs[m_ParagraphIdx]; if (p.m_SpeakerAvatarImg != null) { imgRect.xMin = 0; imgRect.yMin = wndRect.yMin; imgRect.width = p.m_SpeakerAvatarImg.width; imgRect.height = p.m_SpeakerAvatarImg.height; if (imgRect.height > WND_HEIGHT) { imgRect.y = Screen.height - imgRect.height; } } GUI.Box(wndRect, ""); if (p.m_SpeakerAvatarImg != null) { GUIUtil.PushGUIColor(Color.white); GUI.DrawTexture(imgRect, p.m_SpeakerAvatarImg); GUIUtil.PopGUIColor(); } Rect textRect = new Rect(wndRect); textRect.xMin = imgRect.width + 20f; textRect.xMax -= 20f; GUILayout.BeginArea(textRect); { GUILayout.Label(p.m_SpeakerName); GUIUtil.PushGUIEnable(false); GUILayout.TextArea(p.m_Text); GUIUtil.PopGUIEnable(); } GUILayout.EndArea(); GUIUtil.PopSkin(); }
void OnGUI() { m_SMR = EditorGUILayout.ObjectField(m_SMR, typeof(SkinnedMeshRenderer), true) as SkinnedMeshRenderer; bool bValid = (m_SMR != null); GUIUtil.PushGUIEnable(bValid); if (EUtil.Button(m_bShowing ? "Stop!" : "Run!", Color.white)) { m_bShowing = !m_bShowing; if (m_bShowing) { SceneView.onSceneGUIDelegate += this.OnSceneGUI; } else { SceneView.onSceneGUIDelegate -= this.OnSceneGUI; } SceneView.lastActiveSceneView.Repaint(); } GUIUtil.PopGUIEnable(); }