// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, SeedDatas seddDatas, ILoggerFactory loggerFactory) { //app.UseRequestLocalization(localizationOptions); if (env.IsDevelopment()) { seddDatas.seed(); app.UseDeveloperExceptionPage(); app.UseGlobalExceptionHandler(loggerFactory); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ApiBooks v1")); } app.UseStatusCodePages(); app.UseHttpsRedirection(); app.UseRouting(); app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
//fonction to create a seed plant, soon to be sucker void CreateSeedHere(Soils mySoil, GameObject myBabySucker, PlantData myplantData) { if (myInventory) { if (!mySoil.mySoilsData.has_babyplant) { //Debug.Log("we are creating a baby sucker on "+ mySoil+ " : " + myplantData); temporarySucker = Instantiate(myBabySucker, mySoil.transform.position, mySoil.transform.rotation); temporarySucker.transform.SetParent(mySoil.transform); //add the new seed to the sucker list SeedDatas mySeed = temporarySucker.AddComponent <SeedDatas>(); if (mySeed) { //Debug.Log("seed ok, add to list"); float timeBeforeSeedReplant = myplantData.lifetime - myplantData.timeBeforeFruit; mySeed.SeedsConstructor(temporarySucker, mySoil, myplantData.plantPrefabName, timeBeforeSeedReplant); myInventory.SuckersList.Add(mySeed); mySoil.mySoilsData.has_babyplant = true; } } } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app) { if (Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseWebAssemblyDebugging(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseBlazorFrameworkFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseIdentityServer(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers(); endpoints.MapFallbackToFile("index.html"); }); if (Environment.IsDevelopment()) { await SeedDatas.Seed(app); } }