Exemplo n.º 1
0
 public void ShowMessage(string msg)
 {
     Console.WriteLine(msg);
     realtimeSinceStartup = Time.realtimeSinceStartup;
     tmpMessage           = new ModMenu.TmpMessage {
         msg   = msg,
         epoch = realtimeSinceStartup
     };
 }
Exemplo n.º 2
0
        private void OnGUI()
        {
            if (this.tmpMessage != null)
            {
                this.realtimeSinceStartup = Time.realtimeSinceStartup;
                GUI.color = Color.white;
                GUI.Label(new Rect(20f, (float)(Screen.height - 50), 600f, 100f), this.tmpMessage.msg, fontLarge);
                if (this.realtimeSinceStartup - this.tmpMessage.epoch > 1f)
                {
                    this.tmpMessage = null;
                }
            }

            if (shouldShowCursorFuncs.Any())
            {
                shouldShowCursor = Enumerable.Max <Func <int> >(shouldShowCursorFuncs.Values, (f) => f.Invoke()) != 0;
            }
            else
            {
                shouldShowCursor = false;
            }

            if (!this.showMenu && !(UnityModManager.UI.Instance != null && UnityModManager.UI.Instance.Opened) && !shouldShowCursor)
            {
                Cursor.visible = false;
                return;
            }

            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;

            if (tempHideFuncs.Any())
            {
                tempHideMenu = Enumerable.Max <Func <int> >(tempHideFuncs.Values, (f) => f.Invoke()) != 0;
            }
            else
            {
                tempHideMenu = false;
            }

            if (this.showMenu && !tempHideMenu)
            {
                windowRect.height = 0;
                windowRect        = GUILayout.Window(1, windowRect, renderWindow, "Skater XL Shred Menu", GUILayout.Width(600));
            }
        }
Exemplo n.º 3
0
        private void OnGUI()
        {
            GUI.backgroundColor = windowColor;

            if (!generatedStyle)
            {
                windowStyle = new GUIStyle(GUI.skin.window)
                {
                    padding       = new RectOffset(10, 10, 25, 10),
                    contentOffset = new Vector2(0, -23.0f)
                };

                boxStyle = new GUIStyle(GUI.skin.box)
                {
                    padding       = new RectOffset(14, 14, 24, 9),
                    contentOffset = new Vector2(0, -20f)
                };

                columnLeftStyle.margin.right = spacing;

                toggleStyle = new GUIStyle(GUI.skin.toggle)
                {
                    fontSize      = smallFontSize,
                    margin        = new RectOffset(0, 0, 0, 0),
                    padding       = new RectOffset(20, 0, 2, 0),
                    contentOffset = new Vector2(0, 0)
                };
                toggleStyle.normal.textColor   = toggleStyle.active.textColor = toggleStyle.hover.textColor = largeFontColor;
                toggleStyle.onNormal.textColor = toggleStyle.onActive.textColor = toggleStyle.onHover.textColor = smallFontColor;


                toggleStyle.padding.left  = 20;
                toggleStyle.imagePosition = ImagePosition.TextOnly;

                generatedStyle = true;
            }


            if (this.tmpMessage != null)
            {
                this.realtimeSinceStartup = Time.realtimeSinceStartup;
                GUI.color = Color.white;
                GUI.Label(new Rect(20f, (float)(Screen.height - 50), 600f, 100f), this.tmpMessage.Msg, fontLarge);
                if (this.realtimeSinceStartup - this.tmpMessage.Epoch > 1f)
                {
                    this.tmpMessage = null;
                }
            }

            shouldShowCursor = cursorVisibilityRegistry.Any();

            if (shouldShowCursorFuncs.Any())
            {
                shouldShowCursor = shouldShowCursor || Enumerable.Max <Func <int> >(shouldShowCursorFuncs.Values, (f) => f.Invoke()) != 0;
            }

            if (!this.showMenu && !(UnityModManager.UI.Instance != null && UnityModManager.UI.Instance.Opened) && !shouldShowCursor)
            {
                Cursor.visible = false;
                return;
            }

            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;

            tempHideMenu = hideMenuRegistry.Any();

            if (tempHideFuncs.Any())
            {
                tempHideMenu = tempHideMenu || Enumerable.Max <Func <int> >(tempHideFuncs.Values, (f) => f.Invoke()) != 0;
            }

            if (this.showMenu && !tempHideMenu)
            {
                windowRect = GUILayout.Window(GUIUtility.GetControlID(FocusType.Passive), windowRect, RenderWindow, "Skater XL Shred Menu", windowStyle, GUILayout.Width(600));
            }
        }