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() { float alpha = _GetAlpha(); float sw = Screen.width; float sh = Screen.height; Rect rc = new Rect(); rc.x = m_xScale * sw + m_xOffset; rc.y = m_yScale * sh + m_yOffset; rc.width = m_wScale * sw + m_wOffset; rc.height = m_hScale * sh + m_hOffset; Color c = new Color(1, 1, 1, alpha); GUIUtil.PushGUIColor(c); //GUIUtil.PushDepth(m_GUIDepth); GUI.depth = m_GUIDepth; GUI.DrawTexture(rc, m_Tex); //GUIUtil.PopDepth(); GUIUtil.PopGUIColor(); }