public override void OnStartServer() { api = new HttpApiLogic(HttpRequestSender.GetInstance()); roads = RoadController.GetInstance(); roads.OnCustomStartServer(); var randomPositions = AchievementController.GetRandomPositions(COINS_COUNT, roads); foreach (Vector2 position in randomPositions) { NetworkServer.Spawn( Instantiate( achievementPrefab, new Vector3(position.x, 1.5f, position.y), Quaternion.AngleAxis(45, Vector3.up) * Quaternion.AngleAxis(90, Vector3.forward) ) ); } var superPosition = AchievementController.GetPoint(roads); NetworkServer.Spawn( Instantiate( superAchievementPrefab, new Vector3(superPosition.x, 1.5f, superPosition.y), Quaternion.AngleAxis(45, Vector3.up) * Quaternion.AngleAxis(90, Vector3.forward) ) ); }
public static PromptValidator <FoundChoice> Create(IApiInterface api) { return(async(promptContext, cancellationToken) => { if (!promptContext.Recognized.Succeeded) { return await Task.FromResult(false); } if (promptContext.Recognized.Value.Value == Phrases.None) { return await Task.FromResult(true); } var user = await api.GetUser(promptContext.Context); var resources = await api.GetResourcesForUser(user); // Make sure the index and name still match up in case the schema changed. var selectedChoice = promptContext.Recognized.Value; var selectedIndex = selectedChoice.Index; if (selectedIndex >= resources.Count) { return await Task.FromResult(false); } return await Task.FromResult(resources[selectedIndex].Name == selectedChoice.Value); }); }
public DialogBase(StateAccessors state, DialogSet dialogs, IApiInterface api, IConfiguration configuration) { this.state = state; this.dialogs = dialogs; this.api = api; this.configuration = configuration; }
public static async Task <User> CreateUser(IApiInterface api) { var user = new User() { PhoneNumber = Guid.NewGuid().ToString() }; await api.Create(user); return(user); }
public TheBot(IConfiguration configuration, StateAccessors state, CosmosInterface api) { this.configuration = configuration; this.state = state ?? throw new ArgumentNullException(nameof(state)); this.dialogs = new DialogSet(state.DialogContextAccessor); this.api = api ?? throw new ArgumentNullException(nameof(api)); // Register prompts. Prompt.Register(this.dialogs, this.configuration, this.api); }
/// <summary> /// Adds each prompt to the master dialog set /// </summary> public static void Register(DialogSet dialogs, IConfiguration configuration, IApiInterface api) { dialogs.Add(new CustomChoicePrompt(ChoicePrompt)); dialogs.Add(new CustomConfirmPrompt(ConfirmPrompt)); dialogs.Add(new NumberPrompt <int>(IntPrompt, NotNegativeIntPromptValidator.Create())); dialogs.Add(new TextPrompt(TextPrompt)); dialogs.Add(new TextPrompt(LocationTextPrompt, LocationPromptValidator.Create(configuration))); dialogs.Add(new TextPrompt(HourPrompt, HourPromptValidator.Create())); dialogs.Add(new TextPrompt(HourMinutePrompt, HourMinutePromptValidator.Create())); dialogs.Add(new TextPrompt(DaysPrompt, DaysPromptValidator.Create())); dialogs.Add(new CustomChoicePrompt(CategoryPrompt, CategoryPromptValidator.Create())); dialogs.Add(new CustomChoicePrompt(ResourcePrompt, ResourcePromptValidator.Create())); }
/* Uncomment the line to use Approov SDK */ //private static ApproovHttpClient httpClient; public GetShapePlatform() { /* Comment out the line to use Approov SDK */ httpClient = new HttpClient(); /* Uncomment the lines bellow to use Approov SDK */ //var factory = new ApproovHttpClientFactory(); //httpClient = factory.GetApproovHttpClient("<enter-your-config-string-here>"); httpClient.BaseAddress = new Uri("https://shapes.approov.io"); try { apiClient = RestService.For <IApiInterface>(httpClient); } catch (Exception ex) { Console.WriteLine("Exception during RestService: " + ex.Message); } }
public UpdateDialog(StateAccessors state, DialogSet dialogs, IApiInterface api, IConfiguration configuration) : base(state, dialogs, api, configuration) { }
public RequestDialog(StateAccessors state, DialogSet dialogs, IApiInterface api, IConfiguration configuration) : base(state, dialogs, api, configuration) { this.translator = new Translator(configuration); }
public InitApiMiddleware(IApiInterface api) { this.api = api ?? throw new ArgumentNullException(nameof(api)); }
/// <summary> /// Initializes a new instance of the <see cref="TranslationMiddleware"/> class. /// </summary> public TranslationMiddleware(IApiInterface api, StateAccessors state, Translator translator) { this.api = api ?? throw new ArgumentNullException(nameof(api)); this.state = state ?? throw new ArgumentNullException(nameof(state)); this.translator = translator ?? throw new ArgumentNullException(nameof(translator)); }
public InteropInterface(IApiInterface value) { this._object = value; }
public RecipeSearchService(IApiInterface apiInterface) { this.apiInterface = apiInterface; }
public static StackItem FromInterface(IApiInterface value) { return(new InteropInterface(value)); }