/// <summary> /// /// </summary> /// <param name="pos"></param> /// <param name="scrolltype"></param> /// <param name="options"></param> public static void BeginScrollView(Vector2 pos, GUIScrollType scrolltype = GUIScrollType.Vertical, params GUIOption[] options) { { var sizeremian = GUI.CurLayout.RemainSize; if (options != null) { GUIOptionHeight optHeight; options.GetOption(out optHeight); } var rect = new Vector4(GUI.CurLayout.Offset, sizeremian); var rectab = GUI.GetAbsoluteRect(rect); var scrollview = GUI.GetObjScrollView(rectab); scrollview.Draw(rect, rectab, pos, scrolltype); } }
public Vector2 Draw(Vector4 rectab, Vector2 pos, GUIScrollType scrolltype = GUIScrollType.Vertical) { RectAB = rectab; if (!ScrollInit) { ScrollPos = pos; ScrollType = scrolltype; ScrollInit = true; } if ((ScrollType & GUIScrollType.Vertical) > 0) { GUILayout.Space(ScrollPos.Y); } if ((ScrollType & GUIScrollType.Horizontal) > 0) { GUILayout.Indent(ScrollPos.X); } return(ScrollPos); }
/// <summary> /// /// </summary> /// <param name="pos"></param> /// <param name="scrolltype"></param> /// <param name="options">GUIOption.With GUIOption.Height</param> /// <returns></returns> public static Vector2 BeginScrollView(Vector2 pos, GUIScrollType scrolltype = GUIScrollType.Vertical, params GUIOption[] options) { GUIOption optWidth = null; GUIOption optHeight = null; if (options != null) { foreach (var opt in options) { if (opt.type == GUIOption.GUIOptionType.width) { optWidth = opt; continue; } if (opt.type == GUIOption.GUIOptionType.height) { optHeight = opt; continue; } } } var sizeremain = SizeRemain; if (optWidth != null) { sizeremain.X = optWidth.IntValue; } if (optHeight != null) { sizeremain.Y = optHeight.IntValue; } var rect = new Vector4(s_ctx.currentLayout.Offset, sizeremain.X, sizeremain.Y); var rectab = GetRectAbsolute(rect); var scrollView = GUI.GetScrollView(rectab); BeginContainer(rectab, null, GUIOption.Border(GUIStyle.Current.BackgroundColorS)); return(scrollView.Draw(rectab, pos, scrolltype)); }
public void Draw(Vector4 rect, Vector4 rectab, Vector2 pos, GUIScrollType scrolltype) { GUI.BeginArea(rect, true); m_rectAbsolute = rectab; if (!m_scrollInit) { m_scrollPos = pos; m_scrollType = scrolltype; m_scrollInit = true; } if ((m_scrollType & GUIScrollType.Vertical) > 0) { GUILayout.Space(m_scrollPos.y); m_scrollV = true; } if ((m_scrollType & GUIScrollType.Horizontal) > 0) { GUILayout.Indent(m_scrollPos.x); m_scrollH = true; } }