void InitRecipes() { RecipeManager.AddShapelessRecipe(new int[] { 2 }, ItemLoader.CreateItem(5), 4); //Log to planks RecipeManager.AddShapelessRecipe(new int[] { 5 }, ItemLoader.CreateItem(6), 4); //Plank to stick RecipeManager.AddShapelessRecipe(new int[] { 3, 3 }, ItemLoader.CreateItem(6), 1); //Twig to stick // RecipeManager.AddShapedRecipe(new int[] {0, -1, 0, 0}, ItemLoader.GetItemData(1)); //Dirt to rock }
public IActionResult Recipe(string id) { long idAsLong = 0; if (!long.TryParse(id, out idAsLong)) { throw new Exception("Invalid id"); } Recipe.Monolith.Models.Recipe recipe = RecipeManager.GetRecipeById(idAsLong); if (recipe == null) { throw new Exception($"Recipe not found for id {id}"); } // increase hit count for selected recipe if (recipe.Hits == null) { recipe.Hits = 1; } else { recipe.Hits++; } RecipeManager.UpdateRecipe(idAsLong, recipe); return(View(recipe)); }
public void repopulateSource(BasketMealsRecord[] items) { m_mealDict = new Dictionary <int, BasketTableItem>(); m_selectedItems = new List <NSIndexPath>(); foreach (BasketMealsRecord bmr in items) { //create new table item //BasketTableItem bti = new BasketTableItem(); // get recipe record for meal RecipeMealsRecord rmr = RecipeManager.GetRecipeMealRecord(bmr.RecipeMealsID); // record fo each meal id BasketTableItem bti; string unit = ""; m_mealDict.TryGetValue(rmr.MealID, out bti); if (bti == null) { bti = new BasketTableItem(); MealRecord mr = MealManager.GetMeal(rmr.MealID); bti.m_meal_name = mr.Name; //save units first bti.m_unit = mr.MealDesc; } bti.m_weight += rmr.Qty; bti.m_bmIDs.Add(bmr.ID); m_mealDict[rmr.MealID] = bti; } m_tableItems = new BasketTableItem[m_mealDict.Count]; m_mealDict.Values.CopyTo(m_tableItems, 0); }
void Awake() { _recipeManager = FindObjectOfType<RecipeManager>(); _musicManager = FindObjectOfType<MusicManager>(); _rigidbody = GetComponent<Rigidbody2D>(); _collider = GetComponent<Collider2D>(); _animator = GetComponent<Animator> (); _initPos = transform.position; if(GameManager.Instance.playerDevices.Count > playerNum - 1) { //Take the controller assigned on the menu _playerInput = new PlayerInput(true); _playerInput.Device = InputManager.Devices[GameManager.Instance.playerDevices[playerNum - 1]]; Debug.Log(playerNum + " " + _playerInput.Device.Name); } else { //Test only Debug.Log("Controllers " + InputManager.Devices.Count); if(InputManager.Devices.Count > playerNum - 1) { _playerInput = new PlayerInput(true); _playerInput.Device = InputManager.Devices[playerNum - 1]; } else if(playerNum == 4) _playerInput = new PlayerInput(false); Debug.LogWarning("No input for player " + playerNum); } FindObjectOfType<GameOverManager>().OnGameOver += HandleGameOver; }
/// <summary> /// Invoke /// </summary> public async Task InvokeAsync(BuildOptions options) { var recipePath = Directory.GetCurrentDirectory(); var recipe = await RecipeManager.LoadFromFileAsync(recipePath); if (recipe == null) { Log.Error("Could not find the recipe file."); return; } // Ensure the library directory exists var libraryPath = PackageManager.BuildKitchenLibraryPath(_config); if (!Directory.Exists(libraryPath)) { Directory.CreateDirectory(libraryPath); } // Now build the current project Log.Info(string.Empty); Log.Info("Building Project"); var buildPath = Path.Combine(Constants.ProjectGenerateFolderName, Constants.StoreBuildFolderName); var buildEngine = new BuildEngine(_config, _compiler); await buildEngine.ExecuteAsync(recipePath, recipe, options.Force); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { //[Take Row] RecipeTWCell cell = tableView.CellAt(indexPath) as RecipeTWCell; if (cell != null) { if (cell.m_bWasChanged) { RecipeRecord rec = RecipeManager.GetRecipeRecord(m_tableItems[indexPath.Row].ID); rec.isFavourite = cell.m_bChecked ? 1 : 0; RecipeManager.SaveRecipeRecord(rec); cell.m_bWasChanged = false; } else { // add pages DukappPagedDataSource qsrc = new DukappPagedDataSource(2); DukappPagedVC mp = new DukappPagedVC(qsrc); MealsVC rec_meals = new MealsVC(m_tableItems[indexPath.Row], m_parent_vc); HowToCookVC cook_vc = new HowToCookVC(m_tableItems[indexPath.Row]); mp.m_pages.Add(rec_meals); mp.m_pages.Add(cook_vc); mp.SetViewControllers(new UIViewController[] { rec_meals }, UIPageViewControllerNavigationDirection.Forward, true, null); m_parent_vc.NavigationController.PushViewController(mp, true); } } }
public static void Main(string[] args) { AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); var logRepository = LogManager.GetRepository(System.Reflection.Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); log.Info("Starting ACEmulator..."); Console.Title = @"ACEmulator"; ConfigManager.Initialize(); ServerManager.Initialize(); DatabaseManager.Initialize(); AssetManager.Initialize(); InboundMessageManager.Initialize(); DatabaseManager.Start(); DatManager.Initialize(); GuidManager.Initialize(); SocketManager.Initialize(); WorldManager.Initialize(); CommandManager.Initialize(); RecipeManager.Initialize(); DatabaseManager.Start(); }
public async Task SetRecipe(RecipeDetailsEntry recipe) { ItemDetailsEntry item = null; Bitmap image = null; string details = await Task.Run <string>(async() => { try { var itemTask = ItemManager.Instance.GetItem(recipe.OutputItemId).ConfigureAwait(false); var detailTask = RecipeManager.GetRecipeString(recipe); var imageTask = RecipeManager.GetRecipeImage(recipe); item = await itemTask; image = await imageTask; return(await detailTask); } catch (Exception e) { Console.WriteLine(e); } return("Error occured\n"); }); labelRecipeDetails.Text = details; labelRecipeName.Text = item != null ? item.Name : "Error Getting Item Details"; pictureBox1.Image = image; }
public IActionResult Recipe(string id) { long idAsLong = 0; if (!long.TryParse(id, out idAsLong)) { throw new Exception("Invalid id"); } Models.Recipe recipe = RecipeManager.GetRecipeById(idAsLong); if (recipe == null) { throw new Exception($"Recipe not found for id {id}"); } // Demo: Data breakpoints if (recipe.Hits == null) { recipe.Hits = 1; } else { recipe.Hits++; } RecipeManager.UpdateRecipe(idAsLong, recipe); return(View(recipe)); }
public Recipe SetFabricators(string[] fabricators, float fabricationTime) { this.fabricators = fabricators; FabricationTime = fabricationTime; RecipeManager.Get().Add(this); return(this); }
public void TestWizardValues() { var extensionManager = new MockExtensionManager(); extensionManager.AddGuidancePackage(@"Services\DictionaryServiceTest.xml"); IRecipeManagerService manager = new RecipeManager(); ((IServiceContainer)manager).AddService(typeof(IPersistenceService), new MockServices.MockPersistenceService()); ((IServiceContainer)manager).AddService(typeof(IUIService), new MockServices.MockUIService()); manager.AddService(typeof(SVsExtensionManager), extensionManager); // Load the package from the config. GuidancePackage package = new GuidancePackage(new XmlTextReader(Utils.MakeTestRelativePath(@"Services\DictionaryServiceTest.xml"))); manager.EnablePackage(package); // Add dependant mock services. package.AddService(typeof(EnvDTE._DTE), new MockServices.MockDte()); package.AddService(typeof(IValueGatheringService), new WizardFramework.WizardGatheringService()); package.AddService(typeof(SVsExtensionManager), extensionManager); // DictionaryTestStep class is the one that performs the actual checks on the values. package.Execute(new MockObjects.MockReference("TestDictionary", "/Services")); }
public void AddCraftingRecipes() { RecipeManager.AddRecipe("blacksmithing", new List <InventoryItem> { RecipeManager.Item("planks", 1), RecipeManager.Item("ironingot", 1), RecipeManager.Item("feather", 1) }, new List <InventoryItem> { RecipeManager.Item("arrow", 12) }, true); RecipeManager.AddRecipe("masonry", new List <InventoryItem> { RecipeManager.Item("stoneblock", 1) }, new List <InventoryItem> { RecipeManager.Item("stonebricks", 1) }, true, true); RecipeManager.AddFueledRecipe("baking", new List <InventoryItem> { RecipeManager.Item("flour", 5), RecipeManager.Item("waterbottle", 1) }, new List <InventoryItem> { RecipeManager.Item("bread", 2), RecipeManager.Item("bottle", 1) }, 0.26f); }
public static void Main(string[] args) { //Setup Database var mj = new MakeJsonFiles(new FileClient()); mj.CreateAllTables(); //Poor Man DI var ingredientRepository = new IngredientRepository(new FileClient()); var recipeRepository = new RecipeRepository(new FileClient()); var recipeIngredientRespository = new RecipeIngredientRepository(new FileClient()); var recipeManager = new RecipeManager( ingredientRepository, recipeRepository, recipeIngredientRespository ); //Start Program var recipes = recipeManager.GetAll(); foreach (var recipe in recipes) { var receipt = new RecipeReceipt(recipe); Console.WriteLine(receipt.ToString()); } }
// Use this for initialization private void Awake() { _instance = this; recipes = new MaterialRecipe[2][]; recipes[0] = aRecipes; recipes[1] = bRecipes; }
public MainViewModel() { _businessLayer = new RecipeManager(); RecipeBook = new MyRecipeBook(_businessLayer); SelectedRecipe = RecipeBook.Recipes[1]; NewRecipe = new Recipe(); }
public RecipTableSrc(DietPhaseId phase, UIViewController parent) { m_parent_vc = parent; List <RecipeRecord> recipesList = RecipeManager.GetRecipesForPhase(new DietPhase(phase)); m_tableItems = recipesList.ToArray(); }
private bool ShouldBeDiscovered(Tag food_id) { if (WorldInventory.Instance.IsDiscovered(food_id)) { return(true); } foreach (Recipe recipe in RecipeManager.Get().recipes) { if (recipe.Result == food_id) { string[] fabricators = recipe.fabricators; foreach (string id in fabricators) { if (Db.Get().TechItems.IsTechItemComplete(id)) { return(true); } } } } foreach (Crop item in Components.Crops.Items) { if (Grid.IsVisible(Grid.PosToCell(item.gameObject)) && item.cropId == food_id.Name) { return(true); } } return(false); }
public void After_Edit_ValidObject_Get_Should_Changed() { // Arrange DbContextOptions <RepositoryContext> options = new MockDBHandler().CategoryWithThreeMember().CountryWithThreeMember().UnitWithThreeMember().IngredientWithThreeMember().ReciptWithThreeMember().build(); using (var context = new RepositoryContext(options)) { ICustomMapper _customMapper = new CustomMapper(context); IDataRepository <Recipe> mockRepository = new RecipeManager(context); RecipeController recipecontroller = new RecipeController(mockRepository, _mapper, _customMapper, _usermanager); //Act var forEdit = new MockDBHandler().buildMockRecipeView(); forEdit.ID = 1; // Because In mock it is something else and in equalation assert result to false OkObjectResult okresult = recipecontroller.Get(1) as OkObjectResult; RecipeViewModel origin = okresult.Value as RecipeViewModel; recipecontroller.Put(origin.ID, forEdit); OkObjectResult okresultAfterEdit = recipecontroller.Get(1) as OkObjectResult; RecipeViewModel afterEdit = okresultAfterEdit.Value as RecipeViewModel; // Assert Assert.True(forEdit.Equals(afterEdit)); Assert.False(origin.Equals(afterEdit)); } }
/// <summary> /// Invoke /// </summary> public async Task InvokeAsync(PublishOptions options) { var projectDirectory = Directory.GetCurrentDirectory(); var recipe = await RecipeManager.LoadFromFileAsync(projectDirectory); Log.Info($"Publish Project: {recipe.Name}@{recipe.Version}"); var result = await _soupIdentity.AuthenticateUserAsync(); using (var stream = new MemoryStream()) { // Pack the project into a memory stream await PackageManager.PackAsync(recipe, projectDirectory, stream); // Reset the stream so we can read from it stream.Seek(0, SeekOrigin.Begin); // Publish the package to the service try { bool created = await _soupApi.PublishPackageAsync(recipe.Name, stream); if (!created) { Log.Warning("The package version already existed! No change was made."); } } catch (HttpRequestException ex) { Log.Error($"Failed request: {ex.ToString()}"); } } }
public frmSelectItem(RecipeManager recipeManager, ItemManager itemManager) { InitializeComponent(); _recipeManager = recipeManager; _itemManager = itemManager; SetupSelectItem(); }
// Smelting Recipes public void AddSmeltingRecipes() { RecipeManager.AddRecipe("smelting", new List <InventoryItem> { RecipeManager.Item("ironore", 3) }, new List <InventoryItem> { RecipeManager.Item("ironingot", 1) }, 0.2f); RecipeManager.AddRecipe("smelting", new List <InventoryItem> { RecipeManager.Item("goldore", 3) }, new List <InventoryItem> { RecipeManager.Item("goldingot", 1) }, 0.2f); RecipeManager.AddRecipe("pottery", new List <InventoryItem> { RecipeManager.Item("clay", 3) }, new List <InventoryItem> { RecipeManager.Item("bricks", 3) }, 0.2f); }
// Techhnologist Recipes public void AddTechnologistRecipes() { RecipeManager.AddRecipe("technologist", new List <InventoryItem> { RecipeManager.Item("bread", 1), RecipeManager.Item("berry", 5), RecipeManager.Item("clothing", 1), RecipeManager.Item("linenbag", 1), }, new List <InventoryItem> { RecipeManager.Item("sciencebaglife", 2) }, 0.0f); RecipeManager.AddRecipe("technologist", new List <InventoryItem> { RecipeManager.Item("ironingot", 1), RecipeManager.Item("bricks", 3), RecipeManager.Item("goldcoin", 1), RecipeManager.Item("linenbag", 1), }, new List <InventoryItem> { RecipeManager.Item("sciencebagbasic", 2) }, 0.0f); }
void Initialize() { DifficultySettings = GameDifficultySettings.GetPresetDifficultySettings(GameDifficultySettings.GameDifficultyType.GameDifficulty_Easy); if (m_CustomerManager == null) { m_CustomerManager = new CustomerManager(); m_CustomerManager.Initialize(this); } if (m_InnManager == null) { m_InnManager = new InnManager(); m_InnManager.Initialize(this); } if (m_UIManager == null) { m_UIManager = new UIManager(); m_UIManager.Initialize(this); } if (m_RecipeManager == null) { m_RecipeManager = new RecipeManager(); m_RecipeManager.Initialize(this); } }
private async Task <Recipe> UnpackArchiveAsync(string tempPath, Stream packageFile) { // Unpack the zip file into the package directory var tempPackagePath = Path.Combine(tempPath, Constants.StorePackageFolderName); Directory.CreateDirectory(tempPackagePath); await PackageManager.ExtractAsync(packageFile, tempPackagePath); // Load the packages recipe file var recipe = await RecipeManager.LoadFromFileAsync(tempPackagePath); var packagePath = PackageManager.BuildKitchenPackagePath(_config, recipe); // TODO : Perform some verification that the package is valid // TODO : Should not hit this when, verify the package exists before download // For now delete and recreate it if (Directory.Exists(packagePath)) { Directory.Delete(packagePath, true); } // Ensure the parent directory exists var packageParentDirectory = Directory.GetParent(packagePath); if (!packageParentDirectory.Exists) { packageParentDirectory.Create(); } // Move the results out of the staging directory Directory.Move(tempPackagePath, packagePath); return(recipe); }
public RecipTableSrc(RecipeSrcType type, UIViewController parent) { m_parent_vc = parent; List <RecipeRecord> recipesList = RecipeManager.GetRecipeRecords(type); m_tableItems = recipesList.ToArray(); }
private void CreateOrder_OnClick(object sender, RoutedEventArgs e) { if (Recipe.Medicines == null || Recipe.Patient == null) { return; } var doctor = new Doctor() { LastName = doctorLastName.Text, FirstName = doctorFirstName.Text, SecondaryName = doctorFathersName.Text }; try { var doctorId = DoctorManager.Insert(doctor); Recipe.Doctor = new Doctor(doctorId); } catch (SqlException ex) { MessageBox.Show("Doctor information is empty"); return; } Guid recipeId; try { Recipe.Diagnoz = diagnoz.Text; recipeId = RecipeManager.Insert(Recipe); } catch (SqlException ex) { MessageBox.Show("Recipe information is empty"); return; } var order = new Order { Recipe = new Recipe(recipeId), TotalPrice = Recipe.Medicines.Sum(m => m.Price), PhoneNumber = Recipe.Patient.PhoneNumber, OrderDate = DateTime.Now, AvailabilityOfComponents = new Random().Next(100), MakeState = OrderState.Open, ReadyTime = DateTime.Now.AddDays(new Random().Next(1, 10)) }; try { OrderManager.Insert(order); } catch (SqlException ex) { MessageBox.Show("order information is empty"); return; } this.Close(); }
public override void ProcessConfirmation(bool response, bool timeout = false) { var player = Player; if (player == null) { return; } if (!response) { player.SendWeenieError(WeenieError.YouChickenOut); return; } // inventory only? var source = player.FindObject(SourceGuid.Full, Player.SearchLocations.LocationsICanMove); var target = player.FindObject(TargetGuid.Full, Player.SearchLocations.LocationsICanMove); if (source == null || target == null) { return; } RecipeManager.UseObjectOnTarget(player, source, target, true); }
private void Awake() { _instance = this; _recipeCode1 = GenerateRecipeCode(Recipe1); _recipeTable[_recipeCode1] = true; RecipeImageHash[_recipeCode1] = recipe1Image; _recipeCode2 = GenerateRecipeCode(Recipe2); _recipeTable[_recipeCode2] = true; RecipeImageHash[_recipeCode2] = recipe2Image; _recipeCode3 = GenerateRecipeCode(Recipe3); _recipeTable[_recipeCode3] = true; RecipeImageHash[_recipeCode3] = recipe3Image; _recipeCode4 = GenerateRecipeCode(Recipe4); _recipeTable[_recipeCode4] = true; RecipeImageHash[_recipeCode4] = recipe4Image; _recipeCode5 = GenerateRecipeCode(Recipe5); _recipeTable[_recipeCode5] = true; RecipeImageHash[_recipeCode5] = recipe5Image; _recipeCode6 = GenerateRecipeCode(Recipe6); _recipeTable[_recipeCode6] = true; RecipeImageHash[_recipeCode6] = recipe6Image; }
/// <summary> /// Recursively iterates the recipe list looking for foods that can be made with this /// item. /// </summary> /// <param name="item">The item to search.</param> /// <param name="found">The foods found so far.</param> /// <param name="seen">The items already seen, to prevent recipe loops from crashing.</param> /// <param name="quantity">The quantity of the base item.</param> private void SearchForRecipe(Tag item, IList <FoodResult> found, ICollection <Tag> seen, float quantity) { var prefab = Assets.GetPrefab(item); if (prefab != null && quantity > 0.0f && !seen.Contains(item)) { var edible = prefab.GetComponent <Edible>(); float kcal; seen.Add(item); // Item itself is usable as food if (edible != null && (kcal = edible.FoodInfo.CaloriesPerUnit) > 0.0f) { found.Add(new FoodResult(kcal, quantity, item)); } // Search for recipes using this item foreach (var recipe in RecipeManager.Get().recipes) { float amount = 0.0f; foreach (var ingredient in recipe.Ingredients) { // Search for this item in the recipe if (ingredient.tag == item) { amount = ingredient.amount; break; } } if (amount > 0.0f) { SearchForRecipe(recipe.Result, found, seen, recipe.OutputUnits * quantity / amount); } } // And complex ones too foreach (var recipe in ComplexRecipeManager.Get().recipes) { float amount = 0.0f; foreach (var ingredient in recipe.ingredients) { // Search for this item in the recipe if (ingredient.material == item) { amount = ingredient.amount; break; } } if (amount > 0.0f) { // Check all results of the recipe foreach (var result in recipe.results) { SearchForRecipe(result.material, found, seen, result.amount * quantity / amount); } } } } }
public static RecipeManager Get() { if (_Instance == null) { _Instance = new RecipeManager(); } return(_Instance); }
/// <summary> /// Invoke /// </summary> public async Task InvokeAsync(PackOptions options) { var recipe = await RecipeManager.LoadFromFileAsync(@"./"); Log.Info($"Packaging Project: {recipe.Name}@{recipe.Version}"); await PackageManager.PackAsync(recipe, Directory.GetCurrentDirectory()); }
private AnimalManager manager = null; // MainGUI "har en" AnimalManager /// <summary> /// Default konstruktor som instansierar ett objekt av AnimalManager samt fyller i alla nödvändiga värden /// </summary> public MainGUI() { InitializeComponent(); manager = new AnimalManager(); // Instansiera AnimalManagern InitializeGUI(); // Börjar med att fylla i alla nödvändiga värden foodManager = new RecipeManager(); }
public RecipeForm() { InitializeComponent(); if (m_recipe == null) { m_recipe = new Recipe(); } rcpMngr = new RecipeManager(); //Instantiate som test value textBoxNameFood.Text = "Pankaka"; textBoxNameIngred.Text = "2 Ägg"; }
private void Start() { _musicManager = GameObject.FindObjectOfType<MusicManager> (); _recipeManager = GameObject.FindObjectOfType<RecipeManager>(); _ambientManager = GameObject.FindObjectOfType<AmbientManager>(); _gameOverManager = GameObject.FindObjectOfType<GameOverManager>(); //_gameOverManager.OnGameStart += Init; _shaker = Camera.main.GetComponent<ProCamera2DShake> (); if(_recipeManager == null) Debug.LogError("Recipe Manager is Missing!"); Init (); }
public void Setup() { repository = new RecipeRepository(); manager = new RecipeManager(repository); }