Ejemplo n.º 1
0
        /// <summary>
        /// 查找指定色牌
        /// </summary>
        /// <param name="targetCardArgb"></param>
        /// <returns></returns>
        private bool LookUpCardColor(int targetCardArgb)
        {
            Stopwatch sw    = Stopwatch.StartNew();
            int       count = 0;

            while (cardTaskFlag)
            {
                var changeColor = ColorRec.GetPixelColor(config.CardPositionX, config.CardPositionY);

                if (changeColor.ToArgb().Equals(targetCardArgb))
                {
                    sw.Stop();
                    Console.WriteLine(sw.ElapsedMilliseconds);
                    W_Press();
                    return(true);
                }

                Thread.Sleep(1);
                if (sw.ElapsedMilliseconds > config.TimeOut)
                {
                    sw.Stop();
                    Console.WriteLine(sw.ElapsedMilliseconds);
                    break;
                }

                count++;
            }

            return(false);
        }
Ejemplo n.º 2
0
        private void SelectCard()
        {
            while (cardTaskFlag)
            {
                //黄牌
                if (KeyPressState(config.KeyYellow) && !KeyPressState(17))
                {
                    if (config.KeyYellow != 87)
                    {
                        W_Press();
                    }

                    LookUpCardColor(config.ArgbYellowCard);
                    continue;
                }

                //蓝牌
                if (KeyPressState(config.KeyBlue) && !KeyPressState(17))
                {
                    W_Press();
                    LookUpCardColor(config.ArgbBlueCard);
                    continue;
                }

                //红牌
                if (KeyPressState(config.KeyRed) && !KeyPressState(17))
                {
                    W_Press();
                    LookUpCardColor(config.ArgbRedCard);
                    continue;
                }

                //大招自动黄牌
                if (KeyPressState(82) && !KeyPressState(17) && config.RAutoYellowCard)
                {
                    W_Press();
                    LookUpCardColor(config.ArgbYellowCard);
                    continue;
                }

                //黄牌ARGB
                if (KeyPressState(49) && KeyPressState(18))
                {
                    var tempColor = ColorRec.GetPixelColor(config.CardPositionX, config.CardPositionY);
                    WriteIni("CardColorArgb", "Yellow", tempColor.ToArgb().ToString());
                }

                //蓝牌ARGB
                if (KeyPressState(50) && KeyPressState(18))
                {
                    var tempColor = ColorRec.GetPixelColor(config.CardPositionX, config.CardPositionY);
                    WriteIni("CardColorArgb", "Blue", tempColor.ToArgb().ToString());
                }

                //红牌ARGB
                if (KeyPressState(51) && KeyPressState(18))
                {
                    var tempColor = ColorRec.GetPixelColor(config.CardPositionX, config.CardPositionY);
                    WriteIni("CardColorArgb", "Red", tempColor.ToArgb().ToString());
                }

                //W键位坐标
                if (KeyPressState(36))
                {
                    WriteIni("CardPosition", "X", MousePosition.X.ToString());
                    WriteIni("CardPosition", "Y", MousePosition.Y.ToString());
                }

                Thread.Sleep(1);
            }
        }