Exemple #1
0
        /// <summary>
        /// Espera hasta que llega a la ventana inicial
        /// </summary>
        public void WaitForCastle()
        {
            WriteHelper.Write($"Esperando por la localización: {Places.Castle} ");
            ConsoleSpiner spin = new ConsoleSpiner();

            while (true)
            {
                if (ActualLocation != Places.Castle)
                {
                    spin.Turn();
                    KeyScap();
                    Thread.Sleep(1000);
                }
                else
                {
                    break;
                }
            }

            spin.FinishTurn();
        }
Exemple #2
0
        /// <summary>
        /// Espera hasta que se obtiene la ubicación seleccionada
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public bool WaitForLocation(Places location)
        {
            bool result   = false;
            int  tryCount = 50;

            if (location == Places.Battle)
            {
                tryCount = 1000;
            }
            if (location == Places.BattleFinish)
            {
                tryCount = 5000;
            }
            if (location == Places.DustMap)
            {
                tryCount = 15000;
            }
            if (location == Places.DustFinished)
            {
                tryCount = 600000;
            }

            ConsoleSpiner spin = new ConsoleSpiner();

            WriteHelper.Write($"Esperando por la localización: {location} ");

            for (int i = 0; i < tryCount; i++)
            {
                var _actualLocation = ActualLocation;
                if (_actualLocation == location)
                {
                    result = true;
                    break;
                }

                if (location == Places.Battle)
                {
                    if (_actualLocation == Places.ApplePopUp)
                    {
                        break;
                    }

                    if (_actualLocation == Places.SpellPopUp)
                    {
                        TapContinueInSpellPopUp();
                    }

                    if (_actualLocation == Places.LifePopUp)
                    {
                        TapNoInLifePopUp();
                        Thread.Sleep(4000);
                        TapInGoFight();
                    }
                }

                spin.Turn();
            }

            spin.FinishTurn();

            if (result)
            {
                WriteHelper.WriteSuccessfully($"Navegación completada: {location}");
            }
            else
            {
                WriteHelper.WriteError($"No se ha conseguido completar la navegación: {location}");
            }

            return(result);
        }