コード例 #1
0
        // Function call pattern
        //
        // 1) OnSetup
        // 2) OnConnecting
        // 3) OnConnected
        // 3.1) OnRemoteBotGameConfigure - Only for non hosted bots
        // 4) OnGameJoined
        // 5) Loop
        //    5.1) OnGameUpdate
        //    5.2) OnGameActionRequested
        // 6) OnDisconnected
        // Anytime) OnUnhandledException

        public override Task <OnSetupResponse> OnSetup(OnSetupOptions options)
        {
            // OnSetup is called first when the BotHost is figuring out how to run.
            //
            // If `options.IsHosted` is set to true, this bot is running on the server and won't
            // take any configurations. This is because the game is already setup for it to run.
            //
            // If `options.IsHosted` is false, the bot is ruining as a remote player. This can either
            // against the public service or a local server. To connect to a local server, the bot should
            // set the `LocalServerPort` port in `OnSetupResponse`.
            Logger.Log(Log.Info, $"OnSetup called; Is running hosted? {options.IsHosted}");

            return(Task.FromResult(new OnSetupResponse()
            {
                // Set this if you want to connect to a local server.
                // (only respected if the bot isn't running in hosted mode).
                // LocalServerPort = 64005,
                // If this bot is running remotely, you must supply a user name.
                // (only respected if the bot isn't running in hosted mode).
                UserName = m_botName,
                // If this bot is running remotely, you must supply a passcode.
                // (only respected if the bot isn't running in hosted mode).
                Passcode = "RandomBotWins"
            }));
        }
コード例 #2
0
        //
        //  Public Overwrite Functions.
        //

        // Called initial to figure out how the bot is being ran.
        // There are two configurations
        //    Hosted Bot - Running on the server, the bot has little control. (the game is already setup for it)
        //    Remote Player - The bot is either playing on the service or a local server, it's responsible for setting up the game.
        public abstract Task <OnSetupResponse> OnSetup(OnSetupOptions options);