コード例 #1
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 10, 100, 30), "Start"))
     {
         SceneManager.LoadScene("Main");
     }
 }
コード例 #2
0
        /// <summary>
        /// Closes the Navigation Field. (Optional) Draws additional controls on top of the content.
        /// </summary>
        public static void EndNavigationField(bool showNativeControls = true)
        {
            Gl.EndArea();             //end offset area
            if (lastDrawnNavField != null)
            {
                if (showNativeControls)
                {
                    if (G.Button(new U.Rect(lastDrawnNavField.backupRect.width - lastDrawnNavField.border - 23, 5, 20, 20), new U.GUIContent("+", "Center View")))
                    {
                        lastDrawnNavField.CenterView();
                    }
                }

#if UNITY_EDITOR
                G.Button(new U.Rect(0, 0, lastDrawnNavField.backupRect.width, lastDrawnNavField.backupRect.height), "", "Label");                 //force hot control
#endif
            }

            Gl.EndArea();             //end field viewport area

            if (lastDrawnNavField != null)
            {
                lastDrawnNavField.DragUpdate();
            }

            lastDrawnNavField = null;
        }
コード例 #3
0
ファイル: GUI.cs プロジェクト: kmlkmljkl2/Anarchy
 public static void ToggleButton(Rect position, Setting <bool> val, string label)
 {
     UGUI.Label(position, label, Style.Label);
     if (UGUI.Button(position, val.Value ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         val.Value = !val.Value;
     }
 }
コード例 #4
0
ファイル: GUI.cs プロジェクト: kmlkmljkl2/Anarchy
 public static bool ToggleButton(Rect position, bool val, string label)
 {
     UGUI.Label(position, label, Style.Label);
     if (UGUI.Button(position, val ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         return(!val);
     }
     return(val);
 }
コード例 #5
0
ファイル: GUI.cs プロジェクト: Lineyka/Anarchy
        public static bool Button(SmartRect position, string text, bool move = true)
        {
            bool value = UGUI.Button(position.ToRect(), text, Style.Button);

            if (move)
            {
                position.MoveY();
            }
            return(value);
        }
コード例 #6
0
ファイル: GUI.cs プロジェクト: kmlkmljkl2/Anarchy
 public static void ToggleButton(SmartRect position, Setting <bool> val, string label, bool move = false)
 {
     UGUI.Label(position.ToRect(), label, Style.Label);
     if (UGUI.Button(position.ToRect(), val.Value ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         val.Value = !val.Value;
     }
     if (move)
     {
         position.MoveY();
     }
 }
コード例 #7
0
ファイル: GUI.cs プロジェクト: Lineyka/Anarchy
 public static bool ToggleButton(SmartRect position, bool val, string label, bool move = false)
 {
     UGUI.Label(position.ToRect(), label, Style.Label);
     if (UGUI.Button(position.ToRect(), val ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         val = !val;
     }
     if (move)
     {
         position.MoveY();
     }
     return(val);
 }
コード例 #8
0
		//METHODS:
#if UNITY_EDITOR
		public override void Draw(E.SceneView sceneView)
		{
			base.Draw(sceneView);
			EditorUtil.BeginColorPocket(m_color);
			if (G.Button(GetPositionedRect(sceneView), m_text, guiStyle))
				if (onClick != null) {
					onClick();
					onClick = null;
					EditorUtil.UnsubGUIDelegate();
				}

			EditorUtil.EndColorPocket();
		}
コード例 #9
0
        private void WindowFunc(int windowID)
        {
            const int border  = 10;
            const int width   = 50;
            const int height  = 25;
            const int spacing = 10;

            Rect l = new Rect(
                border, border + spacing,
                this.windowRect.width - border * 2, this.windowRect.height - border * 2 - height - spacing
                );

            if (this.text_style is null)
            {
                UGUI.Label(l, this.msg);
            }
            else
            {
                UGUI.Label(l, this.msg, this.text_style);
            }

            Rect b = new Rect(
                this.windowRect.width - width - border,
                this.windowRect.height - height - border,
                width,
                height);

            if (this.action is null)
            {
                if (UGUI.Button(b, "OK"))
                {
                    Destroy(this.gameObject);
                }
            }
            else
            {
                if (UGUI.Button(b, "OK"))
                {
                    this.action(); Destroy(this.gameObject);
                }

                Rect b1 = new Rect(b);
                b1.x -= b.width + spacing;
                if (UGUI.Button(b1, "Cancel"))
                {
                    Destroy(this.gameObject);
                }
            }
        }
コード例 #10
0
        private void WindowFunc(int windowID)
        {
            const int border  = 10;
            const int width   = 50;
            const int height  = 25;
            const int spacing = 10;

            Rect l = new Rect(
                border, border + spacing,
                this.windowRect.width - border * 2, this.windowRect.height - border * 2 - height - spacing
                );

            if (this.text_style is null)
            {
                UGUI.Label(l, this.msg);
            }
            else
            {
                UGUI.Label(l, this.msg, this.text_style);
            }

            Rect b = new Rect(
                this.windowRect.width - width - border,
                this.windowRect.height - height - border,
                width,
                height);

            if ((0 == Event.current.button) && (EventType.MouseUp == Event.current.type))
            {
                this.isTicking = false;
            }

            string label = this.isTicking ? string.Format("{0}", (int)(this.seconds_to_show - this.timer)) : "OK";

            if (UGUI.Button(b, label))
            {
                Destroy(this.gameObject);
            }

            GUI.DragWindow();
        }
コード例 #11
0
ファイル: GUI.cs プロジェクト: kmlkmljkl2/Anarchy
 public static bool Button(Rect position, string text)
 {
     return(UGUI.Button(position, text, Style.Button));
 }