コード例 #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;

            EventManager = new EventManager();
            TickThread   = new CTick();
            InputThread  = new VInput();

            //Starts the input manager thread
            InputThread.Start();

            //Start the ticks trigger thread
            TickThread.Start();


            //Starts a new game
            CGame.NewGame();

            string[] soundFile          = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), "*.wav");
            System.Media.SoundPlayer sp = new System.Media.SoundPlayer();

            //Infinite loop for the game
            while (true)
            {
                foreach (string music in soundFile)
                {
                    sp.SoundLocation = music;
                    sp.PlaySync();
                }
            }
        }
コード例 #2
0
 private void HorizontalCalc()
 {
     // Get button input from controller (name 'buttonLeft')
     if (VInput.GetButton(player1, "buttonLeft"))
     {
         print("Player: " + player1 + " pressed Left");
         // Turn car left
         horizontal += -horizontalAdd;
         horizontal  = Mathf.Clamp(horizontal - horizontalAdd, -1f, 0);
     }
     // Get button input from controller (name 'buttonRight')
     else if (VInput.GetButton(player1, "buttonRight"))
     {
         print("Player: " + player1 + " pressed Right");
         // Turn car right
         horizontal = Mathf.Clamp(horizontal + horizontalAdd, 0, 1f);
     }
     else if (horizontal > 0)
     {
         horizontal = Mathf.Clamp(horizontal - horizontalAdd, -1f, 0);
     }
     else if (horizontal < 0)
     {
         horizontal = Mathf.Clamp(horizontal + horizontalSlow, horizontal, 0);
     }
 }
コード例 #3
0
ファイル: PlayerControl.cs プロジェクト: toyboot4e/Rot
        /// <summary> Maps key input to events </summary>
        RlEvent handleVKey(VKey key, VInput input)
        {
            var entity = this.controller.actor;
            var dir    = entity.get <Body>().facing;

            switch (key)
            {
            case VKey.Select:
                return(PlayerCommands.onSelectKeyPressed(entity, this.gameCtx));

            case VKey.Cancel:
                // this.cradle.push(new MenuControl(this.god, new InvMenu(this.god, this.context.controlled.get<Inventory>())));
                break;

            case VKey.Ground:
                break;

            case VKey.RestATurn:
                break;

            default:
                break;
            }

            return(null);
        }
コード例 #4
0
    private void Update()
    {
        if (isStarting)
        {
            StartCoroutine(UIWait());
        }
        else
        {
            //if(Input.GetMouseButtonDown(0)) rhythm.CheckRhythm();
            VInput.Update(Time.unscaledDeltaTime);
            StateAndUI();
        }

        //if(Input.GetMouseButtonDown(0))
        //{
        //	Debug.Log("a1");
        //	if (uIState != UIState.credit_m)
        //	{
        //		Debug.Log("a2");
        //		Debug.Log(credit.name);
        //		CreditOn();
        //		uIState = UIState.credit_m;
        //		StartCoroutine("CreditChecker");
        //	}
        //	else{
        //		StopCoroutine("CreditChecker");
        //		CreditOff();
        //		//credit_Ani.Rebind();                            // 애니메이터 초기화
        //		uIState = UIState.menu;
        //	}
        //}
    }
コード例 #5
0
        public void Set(int w, int h)
        {
            GL.ClearColor(System.Drawing.Color.AliceBlue);
            GL.Enable(EnableCap.DepthTest);
            AppInfo.W    = w;
            AppInfo.H    = h;
            AppInfo.RW   = w;
            AppInfo.RH   = h;
            AppInfo.Full = false;
            AppInfo.App  = "GLApp";
            VImport.RegDefaults();
            for (int i = 0; i < 32; i++)
            {
                VInput.MB[i] = false;
            }
            VPen.InitDraw();
            VInput.InitInput();
            Vivid.Sound.VSoundSys.Init();
            GL.Viewport(0, 0, w, h);
            GL.Scissor(0, 0, w, h);
            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.Disable(EnableCap.StencilTest);
            GL.Disable(EnableCap.ScissorTest);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthRange(0, 1);

            GL.ClearDepth(1.0f);
            GL.DepthFunc(DepthFunction.Less);
            // UI.UISys.ActiveUI.OnResize(Width, Height);
            VPen.SetProj(0, 0, w, h);
        }
コード例 #6
0
 private void VerticalCalc()
 {
     // Get button input from controller (name 'buttonUp')
     if (VInput.GetButton(player0, "buttonUp"))
     {
         print("Player: " + player0 + " pressed Up");
         // Move car up
         rb.AddForce(transform.up * speedForce);
     }
     // Get button input from controller (name 'buttonDown')
     else if (VInput.GetButton(player0, "buttonDown"))
     {
         print("Player: " + player0 + " pressed Down");
         // Move car down
         if (rb.velocity.y > -4f)
         {
             rb.AddForce(transform.up * -speedForce);
         }
     }
     else if (vertical > 0)
     {
         vertical += speedForce;
     }
     else if (vertical < 0)
     {
         vertical = Mathf.Clamp(vertical + rb.drag, vertical, 0);
     }
 }
コード例 #7
0
        public void GetCommand()
        {
            var input = VInput.GetArgs();

            if (input.Length == 0)
            {
                return;                    //Don't process 0 args
            }
            var commandName = input[0];
            var args        = ArraysUtility.SubArray(input, 1);
            //FIND ALIASES
            var command = CurrentCommands.FirstOrDefault(command => command.Aliases.Any(alias => alias == commandName.ToLower()));

            if (command != null)
            {
                Attempt(command, args);
                return;
            }
            //FIND NAME
            var commandList = StringsUtility.Match(commandName, CurrentCommands);

            if (commandList.Count == 0)
            {
                new GameError($"No commands starting with \"{commandName}\" found!").Write();
            }
            else if (commandList.Count > 1)
            {
                VConsole.WriteLine($"Commands starting with \"{commandName}\":");
                new TextList <Command>(commandList).Write();
            }
            else
            {
                Attempt(commandList[0], args);
            }
        }
コード例 #8
0
        public override void Render()
        {
            pa = pa + 3;
            px = (float)Math.Cos((double)MathHelper.DegreesToRadians(pa)) * 250;
            pz = (float)Math.Sin((double)MathHelper.DegreesToRadians(pa)) * 250;
            if (VInput.KeyIn(OpenTK.Input.Key.W))
            {
                c1.Move(new Vector3(0, 0, -1), Space.Local);
            }
            if (VInput.KeyIn(OpenTK.Input.Key.A))
            {
                c1.Move(new Vector3(-1, 0, 0), Space.Local);
            }
            if (VInput.KeyIn(OpenTK.Input.Key.D))
            {
                c1.Move(new Vector3(1, 0, 0), Space.Local);
            }
            if (VInput.KeyIn(OpenTK.Input.Key.S))
            {
                c1.Move(new Vector3(0, 0, 1), Space.Local);
            }
            if (first)
            {
                lx    = VInput.MX;
                ly    = VInput.MY;
                first = false;
            }
            x  = VInput.MX - lx;
            y  = VInput.MY - ly;
            lx = VInput.MX;
            ly = VInput.MY;
            if (Math.Abs(x) > 15)
            {
                x = 0;
            }
            if (Math.Abs(y) > 15)
            {
                y = 0;
            }
            //if (VInput.KeyIn(OpenTK.Input.Key.Space))
            // {

            //  c1.LookAt(Vector3.Zero);
            l1.Diff = new Vector3(5, 5, 5);
            e1.Turn(new Vector3(y * 0.6f, x * 0.6f, 0), Space.Local);
            // }
            //c1.Turn(new Vector3(y, x, 0), Space.Local);
            //1.Rot(new Vector3(x,y,z), Space.Local);
            l1.Pos(new Vector3(px, 80, pz), Space.Local);
            //Console.WriteLine("Render!");
            // VPen.Rect(20, 20, 200, 200);
            // sg.Render();
            //  ER.Render();

            PR.Render();
        }
コード例 #9
0
        public override void DrawState()
        {
            int move = 8;

            if (VInput.KeyIn(OpenTK.Input.Key.ShiftLeft))
            {
                move = 12;
            }
            if (VInput.KeyIn(OpenTK.Input.Key.W))
            {
                cam1.Move(new OpenTK.Vector3(0, 0, -move), Space.Local);
            }
            if (VInput.KeyIn(OpenTK.Input.Key.A))
            {
                cam1.Move(new OpenTK.Vector3(-move, 0, 0), Space.Local);
            }

            if (VInput.KeyIn(OpenTK.Input.Key.D))
            {
                cam1.Move(new OpenTK.Vector3(move, 0, 0), Space.Local);
            }

            if (VInput.KeyIn(OpenTK.Input.Key.S))
            {
                cam1.Move(new OpenTK.Vector3(0, 0, move), Space.Local);
            }
            if (VInput.MB[0])
            {
                light1.LocalPos = cam1.LocalPos;
            }
            int xd, yd;

            if (firstd)
            {
                lx     = VInput.MX;
                ly     = VInput.MY;
                firstd = false;
            }
            xd = VInput.MX - lx;
            yd = VInput.MY - ly;
            lx = VInput.MX;
            ly = VInput.MY;
            cam1.Turn(new OpenTK.Vector3(yd, xd, 0), Space.Local);

            scene3d.Render();

            UI.Render();
        }
コード例 #10
0
ファイル: PlayerControl.cs プロジェクト: toyboot4e/Rot
        public Switch update(VInput input)
        {
            bool isDown = input.isKeyDown(this.key);

            if (isDown && this.isOff)
            {
                this.isOn = true;
                return(Switch.TurnOn);
            }

            if (!isDown && this.isOn)
            {
                this.isOn = false;
                return(Switch.TurnOff);
            }

            return(Switch.NoChange);
        }
コード例 #11
0
ファイル: PlayerControl.cs プロジェクト: toyboot4e/Rot
        /// <summary> Maybe dispatches a sub routine to the input </summary>
        RlEvent handleInput(VInput input)
        {
            var top = input.consumeTopPressedIgnoring(VKey.Dia, VKey.Dir, VKey.AxisKey);

            if (top.isKey)
            {
                return(this.handleVKey(top.asKey, input));
            }
            else if (input.isDirDown)
            {
                // XXX: HACK to avoid walking to block at the same frame again
                input.vDir.clearBuf();
                return(this.handleDir(input.dirDown));
            }
            else
            {
                return(null);
            }
        }
コード例 #12
0
        public VApp(string app, int width, int height, bool full) : base(width, height, OpenTK.Graphics.GraphicsMode.Default, app, full ? GameWindowFlags.Fullscreen : GameWindowFlags.Default, DisplayDevice.Default, 4, 5, OpenTK.Graphics.GraphicsContextFlags.ForwardCompatible)

        {
            Link         = this;
            _Title       = app;
            AppInfo.W    = width;
            AppInfo.H    = height;
            AppInfo.RW   = width;
            AppInfo.RH   = height;
            AppInfo.Full = full;
            AppInfo.App  = app;
            VImport.RegDefaults();
            for (int i = 0; i < 32; i++)
            {
                VInput.MB[i] = false;
            }
            VPen.InitDraw();
            VInput.InitInput();
            Vivid.Sound.VSoundSys.Init();
        }
コード例 #13
0
ファイル: Racket.cs プロジェクト: JwolffTeach/Volplane_New
        /// <summary>
        /// 'MonoBehaviour.Update()' method from Unity
        /// Update is called every frame, if the MonoBehaviour is enabled.
        /// </summary>
        private void Update()
        {
            // Get button input from controller (name 'buttonUp')
            if (VInput.GetButton(playerNumber, "buttonUp"))
            {
                // Move racket up
                if (transform.position.y < 4f)
                {
                    transform.Translate(0f, 0.1f * speed, 0f);
                }
            }

            // Get button input from controller (name 'buttonDown')
            if (VInput.GetButton(playerNumber, "buttonDown"))
            {
                // Move racket down
                if (transform.position.y > -4f)
                {
                    transform.Translate(0f, -0.1f * speed, 0f);
                }
            }
        }
コード例 #14
0
ファイル: PlayerControl.cs プロジェクト: toyboot4e/Rot
        /// <summary> Updates input mode and maybe creates directional modification for the player controllerd </summary>
        RlEvent updateModes(VInput input)
        {
            this.diaMode.update(input);

            var result = this.dirMode.update(input);

            if (result != KeyMode.Switch.TurnOn)
            {
                return(null);
            }

            if (PlayerControl.findOnlyNeighbor(this.controller.actor, this.gameCtx) is Entity neighbor)
            {
                var entity = this.controller.actor;
                var dir    = Dir9.fromVec2i(neighbor.get <Body>().pos - entity.get <Body>().pos);
                return(RlEv.DirChange.smooth(entity, dir).noConsumeTurn());
            }
            else
            {
                return(null);
            }
        }
コード例 #15
0
        public override void KeyAdd(Key k, bool shift)
        {
            if (k == Key.Minus)
            {
                if (shift)
                {
                    Add("_");
                }
                else
                {
                    Add("-");
                }
            }
            if (k == Key.Plus)
            {
                if (shift)
                {
                    Add("+");
                }
                else
                {
                    Add("=");
                }
            }
            if (k == Key.Comma)
            {
                if (shift)
                {
                    Add("<");
                }
                else
                {
                    Add(",");
                }
            }
            if (k == Key.Period)
            {
                if (shift)
                {
                    Add(">");
                }
                else
                {
                    Add(".");
                }
            }

            if (k == Key.Space)
            {
                Add(" ");
                return;
            }
            if (k == Key.Tab)
            {
                Add(" ");
                return;
            }
            if (VInput.TextKey(k))
            {
                string cs = k.ToString();
                if (cs.Contains("Number"))
                {
                    string ac = cs.Substring(6, 1);

                    if (shift)
                    {
                        switch (int.Parse(ac))
                        {
                        case 1:
                            ac = "!";
                            break;

                        case 2:
                            ac = "@";
                            break;

                        case 3:
                            ac = "#";
                            break;

                        case 4:
                            ac = "$";
                            break;

                        case 5:
                            ac = "%";
                            break;

                        case 6:
                            ac = "^";
                            break;

                        case 7:
                            ac = "&";
                            break;

                        case 8:
                            ac = "*";
                            break;

                        case 9:
                            ac = "(";
                            break;

                        case 0:
                            ac = ")";
                            break;
                        }
                        Add(ac);
                        return;
                    }
                    else
                    {
                        Add(ac);
                    }
                    return;
                }
                if (shift)
                {
                    Add(k.ToString().ToUpper());
                }
                else
                {
                    Add(k.ToString().ToLower());
                }
            }
        }
コード例 #16
0
        public override void DrawState()
        {
            bool RenderDarkLogo()
            {
                VPen.Rect(0, 0, StarApp.W, StarApp.H, LogoTex, new OpenTK.Vector4(LogoAlpha, LogoAlpha, LogoAlpha, LogoAlpha));
                return(PresentLogo);
            }

            bool RenderPresLogo()
            {
                VPen.Rect(0, 0, StarApp.W, StarApp.H, this.PresTex, new OpenTK.Vector4(LogoAlpha, LogoAlpha, LogoAlpha, LogoAlpha));
                return(GameLogo);
            }

            bool RenderGameLogo()
            {
                //Console.WriteLine("Rendering!");

                VPen.Rect(0, 0, StarApp.W, StarApp.H, GameTex, new OpenTK.Vector4(LogoAlpha, LogoAlpha, LogoAlpha, LogoAlpha));
                return(ToMenu);
            }

            void DoMenu()
            {
                LogoAlpha = 0.0f;
                ms.Stop();

                StarApp.PushState(new MainMenuState());
            }

            bool CheckInput()
            {
                if (ToMenu)
                {
                    return(true);
                }
                if (VInput.MB[0])
                {
                    return(true);
                }
                if (VInput.KeyIn(OpenTK.Input.Key.Enter) || VInput.KeyIn(OpenTK.Input.Key.Space))
                {
                    return(true);
                }
                return(false);
            }

            //Logics.Do(TestDo);

            Graphics.When(CheckInput, DoMenu, null);

            Graphics.Flow(null, RenderDarkLogo);
            Graphics.Flow(null, RenderPresLogo);
            Graphics.Flow(null, RenderGameLogo);

            Graphics.SmartUpdate();

            return;

            void DarkLogo()
            {
                VPen.Rect(0, 0, StarApp.W, StarApp.H, LogoTex, new OpenTK.Vector4(LogoAlpha, LogoAlpha, LogoAlpha, LogoAlpha));
            }

            bool DarkLogoUntil()
            {
                return(PresentLogo);
            }

            void PresLogo()
            {
                VPen.Rect(0, 0, StarApp.W, StarApp.H, LogoTex, new OpenTK.Vector4(LogoAlpha, LogoAlpha, LogoAlpha, LogoAlpha));
            }

            bool PresentLogoUntil()
            {
                return(ReboundLogo);
            }

            void DoPresent()
            {
                Graphics.Do(PresLogo, PresentLogoUntil);
            }

            Graphics.Do(DarkLogo, DarkLogoUntil, DoPresent);

            Graphics.InternalUpdate();
        }
コード例 #17
0
        /// <summary>
        /// 'MonoBehaviour.Update()' method from Unity
        /// Update is called every frame, if the MonoBehaviour is enabled.
        /// </summary>
        private void Update()
        {
            // Switch through the possible player colors (left)
            if (VInput.GetButtonDown(playerId, "colorChangeLeft"))
            {
                if (currentColor == PlayerColors.Red)
                {
                    currentColor = PlayerColors.Black;
                }
                else
                {
                    currentColor--;
                }

                ApplyColor(currentColor);
            }

            // Switch through the possible player colors (right)
            if (VInput.GetButtonDown(playerId, "colorChangeRight"))
            {
                if (currentColor == PlayerColors.Black)
                {
                    currentColor = PlayerColors.Red;
                }
                else
                {
                    currentColor++;
                }

                ApplyColor(currentColor);
            }

            // Toggle this players ready state
            if (VInput.GetButtonDown(playerId, "submitButton"))
            {
                // Get the Volplane player object from this player
                VPlayer thisDevice = GetPlayer(playerId);

                if (!IsReady)
                {
                    // This player is ready!

                    // Hide elements for choosing colors and indicate that the player is ready
                    thisDevice.HideElement("colorChangeLeft");
                    thisDevice.HideElement("colorChangeRight");
                    thisDevice.HideElement("colorText");
                    thisDevice.ChangeElementText("infoText", "Waiting for game to start...");
                    thisDevice.ChangeElementText("submitButton", "Cancel");

                    if (playerText != null)
                    {
                        playerText.text = GetPlayer(playerId).Nickname + "\n(Ready)";
                    }

                    IsReady = true;

                    // Try to start the game by calling the lobbys 'StartGame()' method
                    GameObject.FindWithTag("Lobby").GetComponent <Lobby>().StartGame();
                }
                else
                {
                    // This player is still not ready after all...

                    // Give the player ability to choose its color again
                    thisDevice.ShowElement("colorChangeLeft");
                    thisDevice.ShowElement("colorChangeRight");
                    thisDevice.ShowElement("colorText");
                    thisDevice.ChangeElementText("infoText", "Choose your color!");
                    thisDevice.ChangeElementText("submitButton", "Ready");

                    if (playerText != null)
                    {
                        playerText.text = GetPlayer(playerId).Nickname + "\n(Waiting)";
                    }

                    IsReady = false;
                }
            }

            // Players can move when game starts
            // -> the element 'joystick' lies on the game view
            transform.Translate(new Vector3(
                                    VInput.GetAxis(playerId, "joystick", VInput.Axis.Horizontal),
                                    0f,
                                    VInput.GetAxis(playerId, "joystick", VInput.Axis.Vertical)
                                    ).normalized * 0.1f);
        }
コード例 #18
0
 protected override void OnKeyUp(KeyboardKeyEventArgs e)
 {
     VInput.SetKey(e.Key, false);
 }
コード例 #19
0
 protected override void OnKeyDown(KeyboardKeyEventArgs e)
 {
     VInput.SetKey(e.Key, true);
 }
コード例 #20
0
ファイル: Animation.cs プロジェクト: toyboot4e/Rot
 public WaitForInput(VInput input, VKey[] keys)
 {
     this.input = input;
     this.keys  = keys;
 }
コード例 #21
0
ファイル: UIWidget.cs プロジェクト: VividMaster/Rebound
        public virtual bool OnUpdate()
        {
            if (this.WidOpen == false)
            {
                return(false);
            }
            for (int wi = Sub.Count - 1; wi > -1; wi--)
            {
                UIWidget w = Sub[wi];

                if (w.OnUpdate())
                {
                    return(true);
                }
            }
            if (UISys.Active != null)
            {
                if (UISys.Active is UIWidgets.UIDragZone)
                {
                    UISys.ActiveWindow = UISys.Active.Top as UIWidgets.UIWindow;
                }
            }

            if (UISys.Active == null)
            {
                UISys.IsKeyIn = false;
            }

            if (UISys.Active == this)
            {
                if (VInput.AnyKey())
                {
                    if (UISys.IsKeyIn == false)
                    {
                        UISys.IsKeyIn    = true;
                        UISys.KeyIn      = VInput.KeyIn();
                        UISys.LastStroke = Environment.TickCount;
                        UISys.NextStroke = UISys.LastStroke + UISys.FirstStrokeWait;
                        UISys.Active.KeyIn(UISys.KeyIn, VInput.IsShiftIn());

                        if (UISys.KeyIn == OpenTK.Input.Key.BackSpace)
                        {
                            this.KeyBackSpace();
                        }
                        else if (UISys.KeyIn == OpenTK.Input.Key.Tab)
                        {
                            if (UISys.Active == this)
                            {
                                int ci = 0;
                                foreach (var w in UISys.Active.Top.Sub)
                                {
                                    if (w == UISys.Active)
                                    {
                                        break;
                                    }
                                    ci++;
                                }
                                UISys.Active.OnDeactivate();
                                if (ci < UISys.Active.Top.Sub.Count - 1)
                                {
                                    UISys.Active = UISys.Active.Top.Sub[ci + 1];
                                    UISys.Active.OnActivate();
                                }
                                else
                                {
                                    UISys.Active = UISys.Active.Top.Sub[0];
                                    UISys.Active.OnActivate();
                                }
                            }
                        }
                        else if (UISys.KeyIn == OpenTK.Input.Key.Delete)
                        {
                            this.KeyDel();
                        }
                        else if (UISys.KeyIn == OpenTK.Input.Key.Left)
                        {
                            this.KeyLeft();
                        }
                        else if (UISys.KeyIn == OpenTK.Input.Key.Right)
                        {
                            this.KeyRight();
                        }
                        else
                        {
                            this.KeyAdd(UISys.KeyIn, VInput.IsShiftIn());
                        }
                    }
                    else
                    {
                        if (VInput.KeyIn() == UISys.KeyIn)
                        {
                            if (Environment.TickCount >= (UISys.NextStroke))
                            {
                                UISys.LastStroke = Environment.TickCount;
                                UISys.NextStroke = UISys.LastStroke + UISys.NextStrokeWait;
                                if (UISys.KeyIn == OpenTK.Input.Key.BackSpace)
                                {
                                    KeyBackSpace();
                                }
                                else if (UISys.KeyIn == OpenTK.Input.Key.Delete)
                                {
                                    this.KeyDel();
                                }
                                else if (UISys.KeyIn == OpenTK.Input.Key.Left)
                                {
                                    this.KeyLeft();
                                }
                                else if (UISys.KeyIn == OpenTK.Input.Key.Right)
                                {
                                    this.KeyRight();
                                }
                                else
                                {
                                    if (VInput.IsShiftIn())
                                    {
                                        KeyAdd(UISys.KeyIn, true);
                                    }
                                    else
                                    {
                                        KeyAdd(UISys.KeyIn, false);
                                    }
                                }
                            }
                        }
                        else
                        {
                            this.KeyUp(UISys.KeyIn, VInput.IsShiftIn());
                            UISys.IsKeyIn    = true;
                            UISys.KeyIn      = VInput.KeyIn();
                            UISys.LastStroke = Environment.TickCount;
                            UISys.NextStroke = UISys.LastStroke + UISys.FirstStrokeWait;
                            UISys.Active.KeyIn(UISys.KeyIn, VInput.IsShiftIn());
                            if (UISys.KeyIn == OpenTK.Input.Key.BackSpace)
                            {
                                KeyDel();
                            }
                            else if (UISys.KeyIn == OpenTK.Input.Key.Left)
                            {
                                this.KeyLeft();
                            }
                            else if (UISys.KeyIn == OpenTK.Input.Key.Right)
                            {
                                this.KeyRight();
                            }
                            else
                            {
                                if (VInput.IsShiftIn())
                                {
                                    KeyAdd(UISys.KeyIn, true);
                                }
                                else
                                {
                                    KeyAdd(UISys.KeyIn, false);
                                }
                            }
                        }
                    }
                }
                else
                {
                    UISys.IsKeyIn = false;
                }
            }
            if (InBounds())
            {
                if (UISys.Over == this)
                {
                    this.OnHover();
                }
                if (UISys.Over == null)
                {
                    UISys.Over = this;
                    this.OnEnter();
                }
                if (UISys.Over != null && UISys.Over != this)
                {
                    UISys.Over.OnLeave();
                    UISys.Over = this;
                    UISys.Over.OnEnter();
                }
            }
            else
            {
                if (UISys.Over == this && UISys.Pressed != this)
                {
                    UISys.Over.OnLeave();
                    UISys.Over = null;
                }
            }
            if (VInput.MB[0] == false && UISys.Lock == true)
            {
                UISys.Lock = false;
            }
            if (VInput.MB[0] && UISys.Lock == false)
            {
                if (UISys.Over != null)
                {
                    if (UISys.Over == this)
                    {
                        if (UISys.Active != this)
                        {
                            if (UISys.Active != null)
                            {
                                if (UISys.IsKeyIn)
                                {
                                    UISys.Active.KeyUp(UISys.KeyIn, VInput.IsShiftIn());
                                    UISys.IsKeyIn = false;
                                }
                                UISys.Active.OnDeactivate();
                            }
                            UISys.IsKeyIn = false;

                            UISys.Active = this;
                            this.OnActivate();
                            UISys.Lock = true;
                            foreach (var p in Patches)
                            {
                                if (VInput.MX >= p.X)
                                {
                                    if (VInput.MY >= p.Y)
                                    {
                                        if (VInput.MX <= (p.X + p.W))
                                        {
                                            if (VInput.MY <= (p.Y + p.H))
                                            {
                                                p.Action();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                }
            }
            if (InBounds())
            {
                if (VInput.MB[0])
                {
                    if (UISys.Pressed == null)
                    {
                        OnMouseDown(UIMouseButton.Left);
                        UISys.Pressed = this;
                        foreach (var p in Patches)
                        {
                            if (VInput.MX >= p.X)
                            {
                                if (VInput.MY >= p.Y)
                                {
                                    if (VInput.MX <= (p.X + p.W))
                                    {
                                        if (VInput.MY <= (p.Y + p.H))
                                        {
                                            p.Action();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (UISys.Pressed == this)
                    {
                        OnMouseUp(UIMouseButton.Left);
                        UISys.Pressed = null;
                    }
                }
            }
            else
            {
                if (VInput.MB[0] == false)
                {
                    if (UISys.Pressed == this)
                    {
                        UISys.Pressed.OnMouseUp(UIMouseButton.Left);
                        UISys.Pressed = null;
                    }
                }
                if (UISys.Pressed != null)
                {
                    // UISys.Pressed.OnMouseUp(UIMouseButton.Left);
                    //UISys.Pressed = null;
                }
            }
            //this.Update();
            if (UISys.Over == this || UISys.Pressed == this)
            {
                return(true);
            }
            return(false);
        }