protected override OptionResult Run(GameHitParameters <GameObject> parameters) { RecipeSelection recipeSelection = RecipeSelection.Create(new List <string>(Cupcake.Settings.mRandomRestockSettings.Keys)); OptionResult recipeResult = recipeSelection.Perform(); if (recipeResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } QualitySelection qualitySelection = QualitySelection.Create(new List <Quality>(Cupcake.Settings.RandomRestockQualitiesAsList())); OptionResult qualityResult = qualitySelection.Perform(); if (qualityResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } foreach (Recipe recipe in recipeSelection.selectedItems) { Cupcake.Settings.AddRandomRestockRecipe(recipe.Key, qualitySelection.selectedItems); } Common.Notify(Common.Localize("General:Success")); return(OptionResult.SuccessClose); }
private static void CreateSimulation(ProjectDto project) { // Get project var proj = project; //Recipe var recipeApi = new RecipesApi(); // why Recipe returns repository RepositoryAbridgedDto recipe = recipeApi.ListRecipes(owner: new[] { "ladybug-tools" }.ToList(), _public: true).Resources.First(_ => _.Name == "daylight-factor"); // create a recipeSelection var rec = new RecipeSelection(recipe.Owner.Name, recipe.Name); // Upload artifacts var dir = @"C:\Users\mingo\Downloads\Compressed\project_folder\project_folder"; //UploadDirectory(proj, dir); // create a recipe argument var arg = new Arguments() { Parameters = new List <ArgumentParameter>() { new ArgumentParameter("radiance-parameters", "-I -ab 1 -h"), new ArgumentParameter("sensor-grid-count", "10") }, Artifacts = new List <ArgumentArtifact>() { new ArgumentArtifact("input-grid", new ArtifaceSourcePath("model/grid/room.pts")), new ArgumentArtifact("model", new ArtifaceSourcePath("model/")) } }; Console.WriteLine("-------------------Arguments:-------------------------"); Console.WriteLine(arg.ToJson()); // create a new Simulation var api = new SimulationsApi(); var simu = new SubmitSimulationDto(rec, arg); var ret = api.CreateSimulation(proj.Owner.Name, proj.Name, simu); Console.WriteLine(ret.Id); Console.WriteLine(ret.Message); // check simulation status var done = CheckSimulationStatus(proj, ret.Id.ToString()).Result; var outputs = api.GetSimulationLogs(proj.Owner.Name, proj.Name, ret.Id.ToString()); //return recipes; }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { SlotSelection slotSelection = SlotSelection.Create(mTarget as CraftersConsignmentDisplay); OptionResult result = slotSelection.Perform(); if (result != OptionResult.SuccessClose) { return(OptionResult.Failure); } RecipeSelection recipeSelection = RecipeSelection.Create(Cupcake.Settings.BuildSlotsWithRecipes(Cupcake.Settings.GetDisplaySettings(mTarget.ObjectId))); OptionResult recipeResult = recipeSelection.Perform(); if (recipeResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } QualitySelection qualitySelection = QualitySelection.Create(Cupcake.Settings.BuildSlotsWithQualities(Cupcake.Settings.GetDisplaySettings(mTarget.ObjectId))); OptionResult qualityResult = qualitySelection.Perform(); if (qualityResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } foreach (Recipe recipe in recipeSelection.selectedItems) { Cupcake.Settings.AddDisplayRecipe(mTarget.ObjectId, slotSelection.selectedItems, recipe.Key, false); } foreach (Quality quality in qualitySelection.selectedItems) { Cupcake.Settings.SetRecipeQuality(mTarget.ObjectId, slotSelection.selectedItems, quality, false); } Common.Notify(Common.Localize("General:Success")); return(OptionResult.SuccessClose); }