コード例 #1
0
        public Task <Result> StartScenario(string scenarioName)
        {
            string connectionId = Context.ConnectionId;

            if (Context.Items.TryGetValue(connectionId, out object serverId))
            {
                string name = Context.User.Identity.Name;
                string id   = (string)serverId;
                return(_factorioServerManager.StartScenario(id, scenarioName, name));
            }

            var error = Result.Failure(Constants.ServerIdErrorKey, $"The server id for the connection is invalid.");

            return(Task.FromResult(error));
        }