Ejemplo n.º 1
0
        protected override void Update(float dt)
        {
            if (_selected)
            {
                char c;
                while (KeyboardAPI.IsKeyAvalible)
                {
                    c = KeyboardAPI.ReadKey();
                    if (c == '\b')
                    {
                        if (Text.Length > 0)
                        {
                            Text = Text.Substring(0, Text.Length - 1);
                        }
                        continue;
                    }
                    if (c != '#')                    // detect when we need to do more work with the key press
                    {
                        if (c == '\n' && !MultiLine) //if we are not multiline make the return key exit the textbox
                        {
                            _selected = false;
                        }
                        else
                        {
                            Text += c;
                        }
                    }
                    else
                    {
                        if (KeyboardAPI.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back)) //if back key is press then
                        {
                            if (Text.Length > 0)
                            {
                                Text = Text.Substring(0, Text.Length - 1);
                            }
                        }

                        if (KeyboardAPI.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) //if back key is press then
                        {
                            _selected = false;
                        }
                    }
                    if (OnKeyPressed != null)
                    {
                        OnKeyPressed(this);
                    }
                }
                _flasher += dt * 4;
                if (_flasher > 1)
                {
                    _flasher -= 2;
                }


                KeyboardAPI.DisableXnaInputThisUpdate(); //disable xna style input
            }
        }
Ejemplo n.º 2
0
        protected virtual void Update(float dt)
        {
            if (_useTimeOut)
            {
                _timeOut -= dt;
            }

            if (KeyboardAPI.IsKeyPressed(Keys.Escape) || _useTimeOut && _timeOut <= 0)
            {
                DeActivate();
            }
        }
Ejemplo n.º 3
0
        private void UpdateAllItems()
        {
            if (_isScrolable)
            {
                if (KeyboardAPI.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up))
                {
                    _scrollAmount += _spacing;
                }

                if (KeyboardAPI.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down))
                {
                    _scrollAmount -= _spacing;
                }

                _scrollAmount -= MouseTouch.ScrollAmount * 40;
                if (_scrollAmount < 0)
                {
                    _scrollAmount = 0;
                }

                if (_scrollAmount + _areaCurrent.Height > Items.Count * _spacing)
                {
                    _scrollAmount = Items.Count * _spacing - _areaCurrent.Height;
                }
            }

            _hilightedItem = -1;
            HilightedItem.Clear();

            int   starti = (int)(_scrollAmount / 40);
            Point p      = new Point((int)MouseTouch.Position.X, (int)MouseTouch.Position.Y);

            if (_areaCurrent.Contains(p))
            {
                GetClickedItem(p);
            }

            if (_selectedItem != -1 && _hilightedItem == -1) //if there is an item select and currently no item hilighted
            {
                if (Items.Count == 0)
                {
                    return;
                }
                for (int c = 0; c < _items[_selectedItem].Contents.Count; c++) //retun the selected item
                {
                    HilightedItem.Add(_items[_selectedItem].Contents[c].Text);
                }
            }
        }
Ejemplo n.º 4
0
        protected virtual void Update(float dt)
        {
            if (_useTimeOut)
            {
                _timeOut -= dt;
            }

            if (KeyboardAPI.IsKeyPressed(Keys.Escape) || _useTimeOut && _timeOut <= 0)
            {
                DeActivate();
                if (_responce != null)
                {
                    _responce(null, Point.Zero);
                }
            }
        }
Ejemplo n.º 5
0
        public override void Update(GameTime gameTime)
        {
            if (Pause)
            {
                return;
            }

            float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (State == ConversationState.None)
            {
                if (fade > 0)
                {
                    fade -= dt * fadeSpd;
                }
                return;
            }

            if (fade < 1)
            {
                fade += dt * fadeSpd;
                return;
            }

            if (_activeConversation.TypeOfConversation == ConversationType.Active)
            {
                if (GamePadApi.IsButtonClick(Buttons.A) || KeyboardAPI.IsKeyPressed(Keys.Enter))
                {
                    _activeConversation.Confirm();
                    return;
                }

                if (GamePadApi.IsButtonClick(Buttons.B) || KeyboardAPI.IsKeyPressed(Keys.Escape))
                {
                    _activeConversation.JumpToEnd();
                }
            }
            //fade = 0;
            _activeConversation.Update(dt);
            base.Update(gameTime);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Converts a WPF <see href="Key"/> to a <see href="char"/>.
        /// </summary>
        /// <param name="key">
        ///     A WPF <c>Key</c> value.
        /// </param>
        /// <returns>
        ///     The <c>char</c> value of <paramref name="key"/>.
        /// </returns>
        /// <seealso href="http://stackoverflow.com/a/5826175/467582"/>
        public static char GetCharFromKey(Key key)
        {
            char ch = ' ';

            int virtualKey = KeyInterop.VirtualKeyFromKey(key);

            byte[] keyboardState = new byte[256];
            KeyboardAPI.GetKeyboardState(keyboardState);

            uint          scanCode      = KeyboardAPI.MapVirtualKey((uint)virtualKey, KeyboardAPI.MapType.MAPVK_VK_TO_VSC);
            StringBuilder stringBuilder = new StringBuilder(2);

            int result = KeyboardAPI.ToUnicode((uint)virtualKey, scanCode, keyboardState, stringBuilder, stringBuilder.Capacity, 0);

            switch (result)
            {
            case -1:
                break;

            case 0:
                break;

            case 1:
            {
                ch = stringBuilder[0];
                break;
            }

            default:
            {
                ch = stringBuilder[0];
                break;
            }
            }
            return(ch);
        }
Ejemplo n.º 7
0
        private void buttonStart_Click_1(object sender, EventArgs e)
        {
            buttonStart.Text    = "Running ...";
            buttonStart.Enabled = false;

            new Thread(() =>
            {
                while (FormAlive)
                {
                    new System.Threading.ManualResetEvent(false).WaitOne(200);
                    if (checkBoxAutoReady.Checked == true)
                    {
                        Rectangle readyBtn = OptImageSearch.FindCoods("Ready_Button.png", new Rectangle(0, 0, 1279, 800));
                        if (readyBtn.Width > 0 || readyBtn.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(new Point(515, 180), 55); // Joining BlackList
                            InputSimulator.MouseAPI.Main.LeftClick(readyBtn.Center(), 55);   // Going Ready
                        }
                        Rectangle okBtn = OptImageSearch.FindCoods("OK_Button.png", new Rectangle(0, 0, 1279, 800));
                        if (okBtn.Width > 0 || okBtn.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn.Center(), 55);
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn.Center(), 55);
                        }
                        Rectangle okBtn2 = OptImageSearch.FindCoods("OK_Button_2.png", new Rectangle(0, 0, 1279, 800));
                        if (okBtn2.Width > 0 || okBtn2.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn2.Center(), 55);
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn2.Center(), 55);
                        }
                        Rectangle archievBtn = OptImageSearch.FindCoods("Achievement_Button.png", new Rectangle(0, 0, 1279, 800));
                        if (archievBtn.Width > 0 || archievBtn.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn.Center(), 55);
                        }
                    }

                    if (checkBoxStart.Checked == true)
                    {
                        Rectangle okBtn = OptImageSearch.FindCoods("OK_Button.png", new Rectangle(0, 0, 1279, 800));
                        if (okBtn.Width > 0 || okBtn.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn.Center(), 55);
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn.Center(), 55);
                        }
                        Rectangle okBtn2 = OptImageSearch.FindCoods("OK_Button_2.png", new Rectangle(0, 0, 1279, 800));
                        if (okBtn2.Width > 0 || okBtn2.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn2.Center(), 55);
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn2.Center(), 55);
                        }
                        Rectangle archievBtn = OptImageSearch.FindCoods("Achievement_Button.png", new Rectangle(0, 0, 1279, 800));
                        if (archievBtn.Width > 0 || archievBtn.Height > 0)
                        {
                            InputSimulator.MouseAPI.Main.LeftClick(okBtn.Center(), 55);
                        }
                        Rectangle startBtn = OptImageSearch.FindCoods("Start_Button.png", new Rectangle(0, 0, 1279, 800));
                        if (startBtn.Width > 0 || startBtn.Height > 0)
                        {
                            WalkedToBot    = false;
                            int startDelay = int.TryParse(comboBoxStartDelay.Text, out startDelay) ? startDelay : 10000;
                            KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.RETURN);
                            KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.RETURN);
                            new System.Threading.ManualResetEvent(false).WaitOne(startDelay);
                            InputSimulator.MouseAPI.Main.LeftClick(new Point(870, 195), 55);
                            InputSimulator.MouseAPI.Main.LeftClick(startBtn.Center(), 55);
                            InputSimulator.MouseAPI.Main.LeftClick(startBtn.Center(), 55);
                        }
                    }

                    if (checkBoxFarm.Checked == true)
                    {
                        Rectangle ingame = OptImageSearch.FindCoods("Ingame_GR.png", new Rectangle(0, 0, 1279, 800));
                        if (ingame.Width > 0 || ingame.Height > 0)
                        {
                            if (WalkedToBot == false)
                            {
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_3);           // Change to Knife
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_A, 6666);  // Base Wall Left
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_D, 1999);  // Base Middle -> LOS Doors
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_W, 5555);  // Walking to Doors
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_A, 500);   // Make Sure to hit Hole
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_W, 15555); // Walking trough Doors
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_D, 6666);  // Walking to Red-White
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_A, 1000);  // Walking to Base Entry Middle
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_W, 2222);  // Walking to First Corner
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_D, 1111);  // Walking to Right Wall
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_W, 2222);  // Walking to Bots Face
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.KEY_S, 199);   // Stepping a little back
                                switch (comboBoxWeapon.Text)
                                {
                                case "Primary":
                                    KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_1);
                                    break;

                                case "Secondary":
                                    KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_2);
                                    break;

                                case "Knife":
                                    KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_3);
                                    break;
                                }
                                if (textBoxHeadPos.Text.Contains(","))
                                {
                                    String[] coords = textBoxHeadPos.Text.Split(',');
                                    int[] coordsInt = Array.ConvertAll(coords, s => int.Parse(s));
                                    if (coordsInt.Length >= 2)
                                    {
                                        MouseAPI.Only.OMouseDrag(coordsInt[0], coordsInt[1]);
                                    }
                                }

                                if (checkBoxSniper.Checked == true)
                                {
                                    MouseAPIEX.RightClick();
                                    new System.Threading.ManualResetEvent(false).WaitOne(1000);
                                    MouseAPIEX.RightClick();
                                }
                                WalkedToBot = true;
                            }
                            else if (WalkedToBot == true)
                            {
                                Int32 shootDelay = 2500;
                                Int32.TryParse(textBoxShootDelay.Text, out shootDelay);
                                new System.Threading.ManualResetEvent(false).WaitOne(shootDelay);
                                switch (comboBoxWeapon.Text)
                                {
                                case "Primary":
                                    MouseAPIEX.OLeftClick();
                                    break;

                                case "Secondary":
                                    MouseAPIEX.OLeftClick();
                                    break;

                                case "Knife":
                                    MouseAPIEX.RightClick();
                                    break;
                                }
                                KeyboardAPI.HoldKey(KeyboardAPI.ScanCodeShort.F5, 55);          // Spam Chat
                            }
                        }
                    }

                    if (checkBoxAntiAFK.Checked == true || checkBoxDeathRun.Checked == true)
                    {
                        Rectangle ingame = OptImageSearch.FindCoods("Ingame_BL.png", new Rectangle(0, 0, 1279, 800));
                        if (ingame.Width > 0 || ingame.Height > 0)
                        {
                            if (checkBoxDeathRun.Checked == true)
                            {
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_3);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_A);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_3);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_S);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_3);
                            }
                            else if (checkBoxAntiAFK.Checked == true)
                            {
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_3);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.F5);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_F);
                                KeyboardAPI.Send(KeyboardAPI.ScanCodeShort.KEY_2);
                            }
                        }
                    }
                }
            }).Start();
        }
Ejemplo n.º 8
0
 private void OnGUI()
 {
     if (windows == true)
     {
         GUI.Window(0, new Rect(3f, 18f, 100f, 140f), new GUI.WindowFunction(DoMyWindow), " 帮助菜单");
     }
     if ((DateTime.Now - cd).TotalSeconds > 1f)
     {
         if (Input.GetKeyUp(KeyCode.F6) && !ChatUI.singleton.textInput.IsVisible)
         {
             if (this.ShowAim)
             {
                 this.ShowAim = false;
                 PopupUI.singleton.CreateNotice(5f, "☣", "准心关闭");
             }
             else
             {
                 this.ShowAim = true;
                 PopupUI.singleton.CreateNotice(5f, "☣", "准心打开");
             }
             cd = DateTime.Now;
         }
         else if (Input.GetKeyUp(KeyCode.Q) && !ChatUI.singleton.textInput.IsVisible)
         {
             ConsoleNetworker.SendCommandToServer("chat.say /bb");
             cd = DateTime.Now;
         }
         else if (Input.GetKeyUp(KeyCode.F3) && !ChatUI.singleton.textInput.IsVisible)
         {
             ConsoleWindow consoleWindow = new ConsoleWindow();
             if (zoom)
             {
                 zoom    = false;
                 Zoom.On = false;
                 PopupUI.singleton.CreateNotice(5f, "剑", "超视距已关闭");
             }
             else
             {
                 zoom    = true;
                 Zoom.On = true;
                 PopupUI.singleton.CreateNotice(5f, "剑", "超视距已开启");
             }
             cd = DateTime.Now;
         }
         else if (Input.GetKeyUp(KeyCode.F4) && !ChatUI.singleton.textInput.IsVisible)
         {
             ConsoleNetworker.SendCommandToServer("chat.say /who");
             cd = DateTime.Now;
         }
         else if (Input.GetKeyUp(KeyCode.F5) && !ChatUI.singleton.textInput.IsVisible)
         {
             if (windows == true)
             {
                 windows = false;
             }
             else
             {
                 windows = true;
             }
             cd = DateTime.Now;
         }
         else if (Input.GetKeyUp(KeyCode.Return) && !ChatUI.singleton.textInput.IsVisible)
         {
             KeyboardAPI.SendKey(KeyboardAPI.DirectXKeyStrokes.DIK_T, false, KeyboardAPI.InputType.Keyboard);
         }
         else if (this.ShowAim)
         {
             Rect rect = new Rect(Screen.width / 2 - (this.Taskelis.width >> 1) + 2, Screen.height / 2 - (this.Taskelis.height >> 1) - 1, this.Taskelis.width, this.Taskelis.height);
             GUI.DrawTexture(rect, this.Taskelis);
         }
     }
 }
Ejemplo n.º 9
0
        public void Update(float dt)
        {
            if (_activeSnippit == -1)
            {
                return;
            }

            if (delay > 0)
            {
                delay -= dt;
                return;
            }

            if (_currentChar != _lastChar)
            {
                if (_chat.OnNextChar != null)
                {
                    _chat.OnNextChar(_currentChar);
                }
                _lastChar = _currentChar;
            }
            float spd = TextSpeed * dt;

            if (SpeedUpText)
            {
                spd *= 4f;
            }

            _textProgress += dt / ((float)_snippits[_activeSnippit].Text.Length / spd);

            if (_responces.Count > 0) //make sure we have responces
            {
                if (TypeOfConversation == ConversationType.Passive)
                {
                    throw new Exception("Cannot have a passive conversation with responces");
                }
                if (KeyboardAPI.IsKeyPressed(Keys.Left) || GamePadApi.DPadDirectionClicked(DPadDirection.Left) ||
                    GamePadApi.LeftThumbStickFlickLeft)
                {
                    if (_responceSelected > 0)
                    {
                        _responceSelected--;
                    }
                }

                if (KeyboardAPI.IsKeyPressed(Keys.Right) || GamePadApi.DPadDirectionClicked(DPadDirection.Right) ||
                    GamePadApi.LeftThumbStickFlickRight)
                {
                    if (_responceSelected < _responces.Count - 1)
                    {
                        _responceSelected++;
                    }
                }
            }

            if (_textProgress >= 1)
            {
                _flasher += dt;
                if (_flasher > 1)
                {
                    _flasher -= 2;
                }
            }

            if (_responces.Count <= 1 && _textProgress > 1)
            {
                if (TypeOfConversation == ConversationType.Passive)
                {
                    if (_snippits[_activeSnippit].Requirment != null)
                    {
                        if (_snippits[_activeSnippit].Requirment()) //check to see if requirment met
                        {
                            if (_snippits[_activeSnippit].Pause)
                            {
                                return;
                            }
                            Confirm();
                            return;
                        }
                    }
                    else
                    {
                        _autoEndTimer += dt;
                        if (_autoEndTimer >= 1)
                        {
                            if (_snippits[_activeSnippit].Pause)
                            {
                                return;
                            }
                            Confirm();
                            return;
                        }
                    }
                }

                if (_snippits[_activeSnippit].AutoEndSnippit) //if we are going to auto end a snippit
                {
                    _autoEndTimer += dt;
                    if (_autoEndTimer >= 1)
                    {
                        Confirm();
                    }
                }
            }
        }