public override void OnGUI(RigelGUIEvent e) { if (m_drawFunction != null) { m_drawFunction.Invoke(e, View); } }
internal bool CheckFocused(RigelGUIEvent e, GUIFrame lastframe) { GUIView lastFocus = null; if (m_focusedView != null) { var curfocus = m_focusedView; var focused = m_focusedView.CheckFocused(e); if (focused) { if (curfocus == m_focusedView) { return(true); } } lastFocus = m_focusedView; m_focusedView = null; m_syncAll = true; } if (!m_rootView.CheckFocused(e)) { if (lastFocus != null && lastframe != null && lastframe.OnDragDrop) { m_focusedView = lastFocus; } return(false); } m_focusedView.SetOrderFocused(); m_rootView.SyncOrder(0); m_syncAll = true; return(true); }
//private IGUIContent m_sampleWindow = null; private void SampleWindow(RigelGUIEvent e) { //bool hasWindow = m_sampleWindow != null; //if (GUILayout.Button(hasWindow ? "Remove Window":"New window")) //{ // if (hasWindow) // { // GUI.Form.RemoveRegion(m_sampleWindow); // m_sampleWindow = null; // hasWindow = false; // } // else // { // m_sampleWindow = new IGUIContent(GUI.Form, 0); // m_sampleWindow.Caption = "Dynamic Window"; // GUI.Form.AddRegion(m_sampleWindow, GUILayerType.Window); // } //} //if (!hasWindow) return; //if (GUILayout.Button("Window Move : " + m_sampleWindow.Moveable)) //{ // m_sampleWindow.Moveable = !m_sampleWindow.Moveable; //} }
internal void InternalUpdate(RigelGUIEvent e, GUIView exclude = null, bool onlyself = false) { if (exclude != this) { GUI.StartGUIView(this); Update(e); GUI.EndGUIView(this); } if (onlyself) { return; } if (m_childrens != null) { for (var i = 0; i < m_childrens.Count; i++) { var cview = m_childrens[i]; if (cview.Layer == null) { cview.Layer = Layer; } cview.InternalUpdate(e, exclude); } } }
public void Update(RigelGUIEvent e) { GUI.StartGUILayer(this); { actionBeforeUpdate.Invoke(); if (m_syncAll) { if (m_focusedView == null) { //No focused view GUI.SetDrawBuffer(m_bufferRect, m_bufferText); m_bufferRect.Clear(); m_bufferText.Clear(); m_rootView.InternalUpdate(e); m_bufferRect.IsBufferChanged = true; m_bufferText.IsBufferChanged = true; } else { //has focused view //dynamic set buffer GUI.SetDrawBuffer(m_bufferRectDynamic, m_bufferTextDynamic); BufferRectDynamic.Clear(); BufferTextDynamic.Clear(); m_focusedView.InternalUpdate(e, null, true); BufferRectDynamic.IsBufferChanged = true; BufferTextDynamic.IsBufferChanged = true; //normal set buffer GUI.SetDrawBuffer(m_bufferRect, m_bufferText); m_bufferRect.Clear(); m_bufferText.Clear(); m_rootView.InternalUpdate(e, m_focusedView); m_bufferRect.IsBufferChanged = true; m_bufferText.IsBufferChanged = true; } m_syncAll = false; } else { //Update Dynamic if (m_focusedView != null) { GUI.SetDrawBuffer(m_bufferRectDynamic, m_bufferTextDynamic); BufferRectDynamic.Clear(); BufferTextDynamic.Clear(); m_focusedView.InternalUpdate(e, null, true); BufferRectDynamic.IsBufferChanged = true; BufferTextDynamic.IsBufferChanged = true; } } } GUI.EndGUILayer(this); }
private void SampleButton(RigelGUIEvent e) { //Button Align if (GUI.Button(new Vector4(0, 0, 100, 23), "BtnC")) { Console.WriteLine("GUI.Button Center Click"); } if (GUI.Button(new Vector4(100, 0, 100, 38), "BtnL", GUIOption.AlignLeft)) { Console.WriteLine("GUI.Button Left Click"); } if (GUI.Button(new Vector4(200, 0, 100, 43), "BtnR", GUIOption.AlignRight)) { Console.WriteLine("GUI.Button Right Click"); } GUILayout.Space(45); GUILayout.BeginHorizontal(); { GUILayout.Button("None", GUIOption.Grid(0.25f)); GUILayout.Button("Left", GUIOption.Grid(0.25f), GUIOption.AlignLeft); GUILayout.Button("Center", GUIOption.Grid(0.25f), GUIOption.AlignCenter); GUILayout.Button("Right", GUIOption.Grid(0.25f), GUIOption.AlignRight); } GUILayout.EndHorizontal(); }
public void RemoveFocus(RigelGUIEvent e) { if (m_focusedView != null) { m_focusedView.RemoveFocused(); m_focusedView = null; m_syncAll = true; } }
private void SampleTabView(RigelGUIEvent e) { m_sampleTabViewIndex = GUILayout.TabView(m_sampleTabViewIndex, m_sampleTabViewList, (i) => { GUILayout.Button("Btn in tabview : " + i); }, GUIOption.Height(100)); m_sampleTabViewIndex = GUILayout.TabViewVertical(m_sampleTabViewIndex, m_sampleTabViewList, (i) => { GUILayout.Label("label in vertical tabview : " + i, Vector4.one); }, 50); }
private void SampleScrollView(RigelGUIEvent e) { GUILayout.BeginScrollView(m_sampleScrollPos, GUIScrollType.All); { GUILayout.Label("Clip:" + GUI.CurArea.Clip); GUILayout.Button("Button", GUIOption.Width(100)); GUILayout.Indent(300); for (int i = 0; i < 20; i++) { GUILayout.Indent(5); GUILayout.Label("Text" + i, Vector4.one); } } m_sampleScrollPos = GUILayout.EndScrollView(); }
public virtual void Update(RigelGUIEvent e) { if (Content == null) { if (m_debug) { m_color = RigelColor.Random(); GUI.RectAbsolute(Rect, m_color); } } else { Content.OnGUI(e); } }
public override void Update(RigelGUIEvent e) { if (SplitMode == GUISplitViewContentMode.Content) { GUI.DrawContentDocker(m_mainDocker, new Vector4(1, 0, GUI.CurAreaRect.z, GUI.CurAreaRect.w)); } else { //DrawSplitBar m_splitRect.w = GUI.CurAreaRect.w; m_splitRect.x = GUI.CurAreaRect.z * 0.5f; GUI.Rect(m_splitRect, GUIStyle.Current.ColorBackgroundL2); } DrawDockerMask(); }
public bool EmitGUIEvent(RigelGUIEvent e) { m_rect.z = e.RenderWidth; m_rect.w = e.RenderHeight; if (e.EventType == RigelGUIEventType.MouseMove) { if (FastMode) { return(false); } if (m_focusedLayer == null || m_focusedLayer.m_focusedView == null) { return(false); } else { if (!GUIUtility.RectContainsCheck(m_focusedLayer.m_focusedView.Rect, e.Pointer)) { return(false); } } } m_rect.z = e.RenderWidth; m_rect.w = e.RenderHeight; CheckFocused(e); GUI.StartFrame(this, e); startFrameAction.Invoke(); foreach (var layer in m_layers) { layer.Update(e); } endFrameAction.Invoke(); GUI.EndFrame(this); //m_forceUpdate = false; return(true); }
public void Reset(GUIForm form, RigelGUIEvent e) { AreaStack.Clear(); LayoutStack.Clear(); RootRect = form.Rect; if (e.EventType == RigelGUIEventType.MouseDragLeave) { OnDragDrop = false; } else if (e.EventType == RigelGUIEventType.MouseDragUpdate) { if (OnDragDrop) { OnDragDrop = true; } } }
internal static void StartFrame(GUIForm form, RigelGUIEvent e) { if (m_form != null) { throw new Exception(); } m_form = form; Event = e; m_frame = m_form.Frame; m_frame.Reset(m_form, e); Font = m_form.GraphicsBind.FontInfo; s_poolTabView.OnFrame(); s_poolScrollView.OnFrame(); s_poolMenuDraw.OnFrame(); s_poolDragRect.OnFrame(); s_poolDropRect.OnFrame(); s_poolDragState.OnFrame(); }
public override void OnGUI(RigelGUIEvent e) { GUILayout.BeginHorizontal(); if (GUILayout.Button("<", GUIOption.Grid(0.1f))) { m_sampleIndex += m_sampleFunctions.Count - 1; m_sampleIndex = m_sampleIndex % m_sampleFunctions.Count; } GUILayout.Button(m_sampleFunctions[m_sampleIndex].Method.Name, GUIOption.Grid(0.8f)); if (GUILayout.Button(">", GUIOption.Grid(0.1f))) { m_sampleIndex++; m_sampleIndex = m_sampleIndex % m_sampleFunctions.Count; } GUILayout.EndHorizontal(); GUI.BeginArea(new Vector4(GUI.CurLayout.Offset, GUI.CurLayout.RemainSize), true); m_sampleFunctions[m_sampleIndex](e); GUI.EndArea(); }
private void SampleText(RigelGUIEvent e) { //Draw Text GUI.Char(new Vector4(0, 0, 20, 20), 'R', RigelColor.Red, Vector2.Zero, false); GUI.Text(new Vector4(0, 20, 100, 20), "Hello World", RigelColor.White, Vector2.zero, false); GUILayout.Space(40); //Layout text GUILayout.Label("This is a label.", RigelColor.White); GUILayout.BeginHorizontal(); { GUILayout.Button("TestBtn", GUIOption.Grid(0.5f)); GUILayout.Label("HorizontalLabel", RigelColor.Green); GUILayout.Button("TestBtn", GUIOption.Width(30)); } GUILayout.EndHorizontal(); GUILayout.Rect(new Vector2(30, 10), RigelColor.Green); GUILayout.Label(">> Label <<", RigelColor.White); }
private void SampleDragDrop(RigelGUIEvent e) { //DragRect/DropRect { GUILayout.DragRect("contract1", new Vector2(50, 20), "AAA"); GUILayout.DragRect("contract2", new Vector2(50, 20), "BBB"); //GUILayout.DropRect(new Vector2(100, 50), "contract1", (o) => //{ // Console.WriteLine("OnDrop " + o); //}, () => //{ // GUILayout.Label("contract1:OnHover"); //}); //GUILayout.DropRect(new Vector2(100, 50), "contract2", (o) => //{ // Console.WriteLine("OnDrop " + o); //}, () => //{ // GUILayout.Label("contract2:OnHover"); //}); } { GUILayout.Space(5); var offset = GUI.CurLayout.Offset; var rect = new Vector4(offset, 300, 23); } { var rect = new Vector4(GUI.CurLayout.Offset, 200, 25); var rectab = GUI.GetAbsoluteRect(rect); GUI.ReorderedListAbsolute(sortedList, rectab); rectab.y += 30; rectab.z = 120; rectab.w = 100; GUI.ReorderedListVerticalAbsolute(sortedList, rectab); } }
public bool CheckFocused(RigelGUIEvent e) { if (Layer == null) { throw new Exception(); } if (HasChild) { for (var i = m_childrens.Count - 1; i >= 0; i--) { //fix layer if (m_childrens[i].Layer == null) { m_childrens[i].Layer = Layer; } if (m_childrens[i].CheckFocused(e)) { return(true); } } if (GUIUtility.RectContainsCheck(Rect, e.Pointer)) { Layer.m_focusedView = this; return(true); } } else { if (GUIUtility.RectContainsCheck(Rect, e.Pointer)) { Layer.m_focusedView = this; return(true); } } return(false); }
private void CheckFocused(RigelGUIEvent e) { if ((!e.IsMouseDragEvent() || !Frame.OnDragDrop) && !e.IsMouseActiveEvent()) { return; } GUILayer lastFocusedLayer = m_focusedLayer; m_focusedLayer = null; foreach (var layer in m_layers) { if (layer.CheckFocused(e, Frame)) { m_focusedLayer = layer; if (!Frame.OnDragDrop) { break; } } else { if (lastFocusedLayer == layer) { lastFocusedLayer = null; } } } if (lastFocusedLayer != null && lastFocusedLayer != m_focusedLayer) { lastFocusedLayer.RemoveFocus(e); Console.WriteLine("remove focus"); return; } }
public virtual void OnDynamicDraw(RigelGUIEvent e) { }
private void SampleLayout(RigelGUIEvent e) { //Absolute and relative { GUI.Rect(new Vector4(0, 0, 20, 20), RigelColor.Red); Vector4 rectab = new Vector4(View.Rect.x + 21, View.Rect.y + 25, 20, 20); GUI.RectAbsolute(rectab, RigelColor.Red); } //Nested area { GUI.BeginArea(new Vector4(0, 25, 40, 40)); { GUI.Rect(new Vector4(0, 20, 20, 20), RigelColor.Blue); GUI.Rect(new Vector4(20, 0, 20, 20), RigelColor.Green); } GUI.EndArea(); } //Layout { var viewRect = View.Rect; GUI.BeginArea(new Vector4(viewRect.z / 2, 0, viewRect.z / 2, viewRect.w - 25)); { GUILayout.Button("Button1"); GUILayout.Button("Button2"); GUILayout.BeginHorizontal(); { //Option Grid GUILayout.Button("Btn3", GUIOption.Grid(0.5f)); //Indent GUILayout.Indent(10); //Line extrude GUILayout.Button("Btnh", GUIOption.Width(20), GUIOption.Height(50)); //Option Width GUILayout.Button("Btn4", GUIOption.Width(10)); } GUILayout.EndHorizontal(); GUILayout.Button("Btn5", GUIOption.Width(20)); GUILayout.BeginHorizontal(); { //OptionGrid base on LayoutInfo GUILayout.Button("H1", GUIOption.Grid(0.5f)); GUILayout.Button("H2", GUIOption.Grid(0.5f)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Button("H1", GUIOption.Width(30)); GUILayout.BeginVertical(); { GUILayout.Button("Test", GUIOption.Width(15)); //GUILayout.Indent(10); GUILayout.Button("Text", GUIOption.Width(60)); } GUILayout.EndVertical(); GUILayout.Button("H3", GUIOption.Width(30)); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.Label("Current Pointer " + e.Pointer); GUI.Rect(new Vector4(0, 0, 5, 5), RigelColor.Red); } GUI.EndArea(); } }
private void SampleMenuList(RigelGUIEvent e) { GUILayout.Indent(250); GUILayout.DrawMenu(m_sampleMenuList, GUIOption.Width(150)); GUILayout.Button("Button on nextline"); }
public override void OnGUI(RigelGUIEvent e) { GUI.DrawDebugInfo(); }
public abstract void OnGUI(RigelGUIEvent e);
public override void OnGUI(RigelGUIEvent e) { GUI.RectAbsolute(View.Rect, GUIStyle.Current.ColorBackground); }