public void Add(Ingredient ingredient) { if (Expected?.IsInstanceOfType(ingredient) ?? false) { AddIngredient[Expected](ingredient); Expected = NextExpected[Expected]; } }
public override void OnEvent(AddIngredient evnt) { if (evnt.Construction) { evnt.Construction.GetComponentInChildren <Craft_Structure>().AddIngrendient_Actual(evnt.IngredientNum, false); } }
protected override void AddIngredient(int ingredientNum) { if (CheatMenuPlusCtrl.Options.Player.InstantBuild) { BuildIngredients ingredients = _requiredIngredients[ingredientNum]; if (BoltNetwork.isRunning) { AddIngredient ingredient = new AddIngredient(); typeof(Bolt.Event).GetField("Targets", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(ingredient, (byte)Bolt.GlobalTargets.OnlyServer); typeof(Bolt.Event).GetField("TargetConnection", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(ingredient, null); typeof(Bolt.Event).GetField("Reliability", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(ingredient, Bolt.ReliabilityModes.ReliableOrdered); ingredient.IngredientNum = ingredientNum; ingredient.Construction = base.GetComponentInParent <BoltEntity>(); ingredient.Send(); } else { base.AddIngrendient_Actual(ingredientNum, true); } } else { base.AddIngredient(ingredientNum); } }
private void SaveIngredient() { //??? Wat nu? //Ingredienten.Add(SelectedIngredient); //context.Ingredienten.Add(SelectedIngredient.ToIngredient()); //context.SaveChanges(); AddIngredient window = new AddIngredient(); window.Show(); }
/// <summary> /// Executes the add ingredient command /// </summary> private void AddItemExecute() { try { AddIngredient addIngredient = new AddIngredient(); addIngredient.ShowDialog(); IngredientList = ingrediantsData.GetAllIngredients(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void MakeComplete(Craft_Structure structure) { try { if (structure._requiredIngredients.Count <= 0) { return; } for (int i = 0; i < structure._requiredIngredients.Count; ++i) { Craft_Structure.BuildIngredients buildIngredients = structure._requiredIngredients[i]; if (structure.GetPresentIngredients().Length <= i) { continue; } ReceipeIngredient receipeIngredient = structure.GetPresentIngredients()[i]; if (receipeIngredient._amount >= buildIngredients._amount) { continue; } for (int j = 0; j < buildIngredients._amount - receipeIngredient._amount; j++) { if (BoltNetwork.isRunning) { AddIngredient ingredient = AddIngredient.Create(GlobalTargets.OnlyServer); ingredient.IngredientNum = i; ingredient.ItemId = buildIngredients._itemID; ingredient.Construction = structure.entity; ingredient.Send(); } else { structure.AddIngrendient_Actual(i, true); } SleepFor(0.300f); } SleepFor(0.300f); } } catch { } }
public IHttpActionResult PostIngredient(AddIngredient ingredient) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var newIngredient = new Ingredient { IngredientDescription = ingredient.IngredientDescription, OnShoppingList = ingredient.OnShoppingList, Recipe = db.Recipe.Find(ingredient.RecipeId) }; db.Ingredient.Add(newIngredient); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = ingredient.IngredientId }, ingredient)); }
public static void InstantlyFinishBlueprint(Craft_Structure structure) { try { if (structure._requiredIngredients.Count > 0) { for (var itemNumber = 0; itemNumber < structure._requiredIngredients.Count; itemNumber++) { var requiredItems = structure._requiredIngredients[itemNumber]; if (structure.GetPresentIngredients().Length > itemNumber) { var presentItems = structure.GetPresentIngredients()[itemNumber]; if (presentItems._amount >= requiredItems._amount) { continue; } for (var i = 0; i < requiredItems._amount - presentItems._amount; i++) { if (BoltNetwork.isRunning) { var addIngredient = AddIngredient.Create(GlobalTargets.OnlyServer); addIngredient.IngredientNum = itemNumber; addIngredient.ItemId = requiredItems._itemID; addIngredient.Construction = structure.entity; PacketQueue.Add(addIngredient); } else { structure.AddIngrendient_Actual(itemNumber, true); } } } } } } catch (Exception) { // ignored } }
public IActionResult Post([FromBody, Required] AddIngredient command) { // This works and give me a reason to write an extension method // (something I don't do very often); however, it's clunky at best // and forces me to inject the IoC container unless I inject every // command / query this controller might handle. if (command == null) { return(BadRequest()); } ValidationResult result = _container.TryGetValidatorInstance <AddIngredient>()?.Validate(command); if (result?.IsValid == false) { return(BadRequest(result)); } return(CreatedAtRoute("GetIngredient", new { id = Guid.NewGuid() }, null)); }
protected override void AddIngredient(int ingredientNum) { if (!CheatMenuComponent.InstantBuild) { base.AddIngredient(ingredientNum); return; } Craft_Structure.BuildIngredients buildIngredients = this._requiredIngredients[ingredientNum]; LocalPlayer.Sfx.PlayHammer(); if (BoltNetwork.isRunning) { AddIngredient addIngredient = global::AddIngredient.Create(GlobalTargets.OnlyServer); addIngredient.IngredientNum = ingredientNum; addIngredient.ItemId = buildIngredients._itemID; addIngredient.Construction = base.GetComponentInParent <BoltEntity>(); addIngredient.Send(); return; } base.AddIngrendient_Actual(ingredientNum, true, null); }
private void AddIngredient(int ingredientNum) { Craft_Structure.BuildIngredients buildIngredients = this._requiredIngredients[ingredientNum]; if (LocalPlayer.Inventory.RemoveItem(buildIngredients._itemID, 1, false) || Cheats.Creative) { LocalPlayer.Sfx.PlayHammer(); Scene.HudGui.AddIcon.SetActive(false); if (BoltNetwork.isRunning) { AddIngredient addIngredient = global::AddIngredient.Raise(GlobalTargets.OnlyServer); addIngredient.IngredientNum = ingredientNum; addIngredient.Construction = base.GetComponentInParent <BoltEntity>(); addIngredient.Send(); } else { this.AddIngrendient_Actual(ingredientNum, true); } } }
private void AddIngredient(int ingredientNum) { Craft_Structure.BuildIngredients buildIngredients = this._requiredIngredients[ingredientNum]; if (LocalPlayer.Inventory.RemoveItem(buildIngredients._itemID, 1, false, true) || Cheats.Creative) { LocalPlayer.Sfx.PlayHammer(); if (!Cheats.Creative || Time.frameCount % 3 == 0) { Scene.HudGui.AddBuildingIngredientIcon.SetActive(false); } if (BoltNetwork.isRunning) { if (BoltNetwork.isClient) { bool flag = true; for (int i = 0; i < this._requiredIngredients.Count; i++) { if (this._presentIngredients[i]._amount < this._requiredIngredients[i]._amount && (i != ingredientNum || this._presentIngredients[i]._amount + 1 < this._requiredIngredients[i]._amount)) { flag = false; break; } } if (flag) { this.Build(); } } AddIngredient addIngredient = global::AddIngredient.Create(GlobalTargets.OnlyServer); addIngredient.IngredientNum = ingredientNum; addIngredient.ItemId = buildIngredients._itemID; addIngredient.Construction = base.GetComponentInParent <BoltEntity>(); addIngredient.Send(); } else { this.AddIngrendient_Actual(ingredientNum, true, null); } } }
public static void InstantBuilder(Craft_Structure structure) { try { if (structure._requiredIngredients.Count > 0) { for (int i = 0; i < structure._requiredIngredients.Count; i++) { Craft_Structure.BuildIngredients buildIngredients = structure._requiredIngredients[i]; if (structure.GetPresentIngredients().Length > i) { ReceipeIngredient receipeIngredient = structure.GetPresentIngredients()[i]; if (receipeIngredient._amount < buildIngredients._amount) { for (int j = 0; j < buildIngredients._amount - receipeIngredient._amount; j++) { if (BoltNetwork.isRunning) { AddIngredient ingredient = AddIngredient.Create(GlobalTargets.OnlyServer); ingredient.IngredientNum = i; ingredient.ItemId = buildIngredients._itemID; ingredient.Construction = structure.entity; ingredient.Send(); } else { structure.AddIngrendient_Actual(i, true, null); } } } } } } } catch (System.Exception) { } }
private void AddIngredientClick(object sender, RoutedEventArgs e) { AddIngredient popup = new AddIngredient(PM); popup.ShowDialog(); }
/// <summary> /// Opens the Add ingredient window /// </summary> /// <param name="addIngredientOpen">Window that we open</param> /// <param name="recipeID">recipe id</param> public AddIngredientViewModel(AddIngredient addIngredientOpen) { ingredient = new tblIngredient(); addIngredient = addIngredientOpen; }
public override void OnEvent(AddIngredient evnt) { if (evnt.Construction) { evnt.Construction.GetComponentInChildren<Craft_Structure>().AddIngrendient_Actual(evnt.IngredientNum, false); } }