private void Window_Loaded(object sender, RoutedEventArgs e) { Overlay = new BotOverlay(); Overlay.Show(); GameBot.Start(Overlay, BotConfigurations.darkestdungeon.ConvertToString()); }
private void initBot() { gameBot = new GameBot(); gameBot.onStateChange += (e) => { iC_BotStatus.Invoke(new Action(() => { iC_BotStatus.Status = (int)e; if (gameBot.BMode == GameBot.Mode.Default) { logLabel1.Text = iC_BotStatus.StateTitle; } else { if (gameBot.Status == GameBot.State.Active) { logLabel1.Text = "Начало записи"; wasRecoding = true; } if (gameBot.Status == GameBot.State.Ready && wasRecoding) { logLabel1.Text = "Остановка записи и сохранение"; wasRecoding = false; } } })); }; gameBot.onDataReport += (e) => { Invoke(new Action(() => { labelObjPoint.Text = "Obj: " + e.pt.ToString(); labelDist.Text = "Distance: " + e.dist.ToString(); labelNoFiltDist.Text = e.noFiltDist; labelCommand.Text = "Command: " + e.command; labelfps.Text = "fps " + e.fps.ToString(); if (e.speed > 0) { labelSpeed.Text = "Speed " + e.speed + "%"; } string situation = "Ситуация: "; if (e.situation == 1) { situation += "На встречу"; } if (e.situation == 2) { situation += "Догоняет"; } if (e.situation == 3) { situation += "Разлетелись"; } labelSituation.Text = situation; })); }; }
void Start() { bot = GetComponent <GameBot>(); VucNotePath = Application.dataPath + @"/DotaVocabulary.txt"; KeshNotePath = Application.dataPath + @"/DotaKeshPastWords.txt"; menegrerScr = GetComponent <GameMenegrerScr>(); CreateFirstLetter(); wordsWasWritten.Add("***"); fm = GetComponent <FailMeneger>(); }
private void GameOverHandler(object sender, GameBot.GameOverEventArgs e) { var gameOverXml = new GameOverMessage { GameId = e.GameInfo.GameId, Winner = e.GameInfo.GameWinner }.ToXml(); Connection.Send(new Message(e.GameInfo.Player1, gameOverXml)); Connection.Send(new Message(e.GameInfo.Player2, gameOverXml)); }
public GameBot AddBot(int gameId, int botId) { var gameBot = new GameBot { BotId = botId, GameId = gameId }; Db.GameBots.Add(gameBot); Db.SaveChanges(); return(gameBot); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); GameBot.Stop(); Overlay.Close(); /*e.Cancel = true; * * GameBot.Stop(()=> { * this.UI(()=> { * Overlay.Close(); * Close(); * }); * });*/ }
static void Main(string[] args) { var botOnly = args.FirstOrDefault() == "bot"; gameClient = new HttpClient.GameHttpClient(new System.Net.Http.HttpClient()); if (!botOnly) { Console.WriteLine("Human player mode"); var gameBoards = gameClient.GetGameBoards(); if (!gameBoards.Any(gb => gb.GameId == gameId)) { Console.WriteLine("Creating game"); gameClient.CreateGame(gameId); } gameClient.JoinGame(gameId, playerId, "Niklas"); Console.WriteLine("Waiting for bot..."); Thread.Sleep(10000); Console.WriteLine("Starting game"); gameClient.StartGame(gameId); } else { var bot = GameBot.Create(gameId); bot.OnException += (e) => throw e; bot.Start(); } if (!botOnly) { RunHumanPlayer(); } else { while (true) { Thread.Sleep(5000); } } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { bot.StopWorkAsync(); bot = null; GC.Collect(); }
public MainWindow() { InitializeComponent(); bot = new GameBot(); }
public OnePlayerVM() : base() { GameBot = new GameBot(GameBoard, botCharacter); }