public void RegisterMinigame(IMinigame minigame)
 {
     _typeToMinigame.Add(minigame.GetType(), minigame);
 }
Exemplo n.º 2
0
        public void GameTickLoop_GameFinished(object sender, GameFinishedEventArgs e)
        {
            StopGame();
            CurrentGame.Gain_Power();
            GainPowerResult result = GainPowerResult.Unknown;

            while (result == GainPowerResult.Unknown || result == GainPowerResult.Pending)
            {
                result = Get_GainPowerResult();
                Thread.Sleep(1000);
            }
            BotGameLog gameLog = new BotGameLog(DateTime.Now, CurrentGame.GameResult, CurrentGame.GetType().Name, result);

            GameLogs.Add(gameLog);
            if (!DatabaseInterface.Write(gameLog))
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("[BotInstance] WARNING: Failed to save the game result log. It will show up in the process memory but will not be stored permanently.");
                Console.ResetColor();
            }
            Console.WriteLine($"[BotInstance] Finished game\nGameResult => {CurrentGame.GameResult}\nGainPowerResult => {result}");
            Thread th = new Thread(new ThreadStart(() =>
            {
                Console.WriteLine("[BotInstance] Queue game start...");
                WebBrowser.Load(@"https://rollercoin.com/game/choose_game");
                Thread.Sleep(TimeSpan.FromMinutes(5));
                Console.WriteLine("[BotInstance] Queue game end...");
                Run();
            }));

            th.IsBackground = true;
            th.Start();
            DestroyGame();
        }