private void BtnAdd_Click(object sender, RoutedEventArgs e) { float quantity = 0; if (!float.TryParse(TextBoxQuantity.Text, out quantity) || ComboBoxIngredient.SelectedIndex < 0) { WindownsManager.getInstance().showMessageBoxCheckInfoAgain(); return; } var id = ((ComboData)ComboBoxIngredient.SelectedItem).Id; var name = IngredientManager.getInstance().IngredientList[id].Name; var unitName = UnitManager.getInstance().UnitList[IngredientManager.getInstance().IngredientList[id].UnitId].Name; foreach (IngredientWithFoodTable ingredientWithFoodTable in DataGridIngredient.Items) { if (ingredientWithFoodTable.Id == id) { WindownsManager.getInstance().showMessageBoxCheckInfoAgain(); return; } } _ingredientsWithFood.Add(new IngredientWithFoodTable() { Id = id, Name = name, UnitName = unitName, Quantity = quantity }); }
void FillList() { for (int i = 0; i <= drinkSlotAmount; i++) { if (GameSystem.Instance.recipeList[i].recipeId == -1) { GameObject holder = Instantiate(drinkSlot, grid); int tempId = i; holder.GetComponent <Button>().onClick.AddListener(() => openModal(tempId)); } else { GameObject holder = Instantiate(drinkSlot, grid); Sprite sprite = Resources.Load <Sprite>("Sprites/" + IngredientManager.GetRecipes()[GameSystem.Instance.recipeList[i].recipeId].Image); holder.transform.GetChild(0).GetComponent <Image>().sprite = sprite; holder.transform.GetChild(0).GetComponent <Image>().preserveAspect = true; holder.transform.GetChild(2).GetComponent <Text>().text = IngredientManager.GetRecipes()[GameSystem.Instance.recipeList[i].recipeId].Name; int tempId = i; holder.GetComponent <Button>().onClick.AddListener(() => openModal(tempId)); } //GetComponent<Image>().sprite = sprite; //MachineStatsHolder holderScript = holder.GetComponent<MachineStatsHolder>(); //holderScript.machineStat = machineStats[i]; } }
// Use this for initialization void Start() { ingredientsUI = this; ingredientList = IngredientManager.GetIngredients(); FillList(); Debug.Log("start"); }
private void ComboBoxIngredient_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ComboBoxIngredient.SelectedIndex >= 0) { TextBlockUnit.Text = UnitManager.getInstance().UnitList[IngredientManager.getInstance().IngredientList[((ComboData)ComboBoxIngredient.SelectedItem).Id].UnitId].Name; } }
private void setupUI() { var ingredientId = _ingredientDetailId; var unitNames = new List <ComboData>(); foreach (KeyValuePair <int, Unit> entry in UnitManager.getInstance().UnitList) { if (entry.Value != null) { unitNames.Add(new ComboData() { Id = entry.Key, Value = entry.Value.Name }); } } ComboBoxUnit.ItemsSource = unitNames; ComboBoxUnit.DisplayMemberPath = "Value"; ComboBoxUnit.SelectedValuePath = "Id"; if (ingredientId != Constant.ID_CREATE_NEW) { var ingredientData = IngredientManager.getInstance().IngredientList[ingredientId]; //TextBoxId.Text = ingredientData.IngredientId.ToString(); TextBoxName.Text = ingredientData.Name; ComboBoxUnit.SelectedValue = ingredientData.UnitId; Title = "Chi tiết nguyên liệu"; //TextBlockNameWindow.Text = "Chi tiết nguyên liệu"; BtnConfirm.Content = "Sửa"; } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { if (ComboBoxIngredient.SelectedIndex < 0 || TextBoxTotal.Text == "0" || string.IsNullOrEmpty(TextBoxTotal.Text)) { WindownsManager.getInstance().showMessageBoxSomeThingWrong(); return; } decimal quantity = 0; decimal.TryParse(TextBoxQuantity.Text, out quantity); decimal price = 0; decimal.TryParse(TextBoxPrice.Text, out price); var ingredientId = (int)((ComboBoxItem)ComboBoxIngredient.SelectedItem).Tag; var importIngredientWithBill = new IngredientWithImportBill(); importIngredientWithBill.IngredientId = ingredientId; importIngredientWithBill.Ingredient = IngredientManager.getInstance().IngredientList[ingredientId]; importIngredientWithBill.Quantities = (float)quantity; importIngredientWithBill.SinglePricePerUnit = price; LVIngredient.Items.Add(new ImportIngredientCell(importIngredientWithBill, this)); reloadTotalBill(); }
/// <summary> /// Sell item if there are enough resources (subtract resources and add money to bank account, play subtractResources and addMoney animations). /// If there are not enough money, play NotEnoughResources animation. /// </summary> /// <param name="lime">How many limes to subtract.</param> /// <param name="ice">How many ice cubes to subtract.</param> /// <param name="sugar">How many sugar cubes to subtract.</param> /// <param name="_money">How much money to add to the bank account.</param> /// <param name="animatedMoneyText">UI Text element which is animated when item was sold.</param> /// <param name="animation">Animation which is played when item was sold.</param> private void SellItem(int lime, int ice, int sugar, int _money, Text animatedMoneyText, Animation animation) { // if there are enough resources, sell the lemonade if (ingredientManager.limeCounter - lime >= 0 && ingredientManager.iceCounter - ice >= 0 && ingredientManager.sugarCounter - sugar >= 0) { // subtract resources ingredientManager.limeCounter -= lime; ingredientManager.iceCounter -= ice; ingredientManager.sugarCounter -= sugar; // text for subtract animation limeAnimatedText.text = "-" + lime; iceAnimatedText.text = "-" + ice; sugarAnimatedText.text = "-" + sugar; // play subtract animation IngredientManager.PlayAnimation(limeSubtractAnimation, "SubtractResources"); IngredientManager.PlayAnimation(iceSubtractAnimation, "SubtractResources"); IngredientManager.PlayAnimation(sugarSubtractAnimation, "SubtractResources"); // create and play addMoney animation animatedMoneyText.text = "+$" + _money; IngredientManager.PlayAnimation(animation, "AddMoney"); //add money to the bank account money += _money; } else if (ingredientManager.limeCounter - lime < 0 || ingredientManager.sugarCounter - sugar < 0 || ingredientManager.iceCounter - ice < 0) { // display that there are not enough resources statusText.text = "Not Enough Resources"; IngredientManager.PlayAnimation(statusTextAnimation, "NotEnoughResources"); } }
// Update is called once per frame void Update() { for (int i = 0; i < IngredientManager.GetIngredients().Count; i++) { this.transform.GetChild(i).GetChild(1).GetComponent <Text>().text = "x " + GameSystem.Instance.ingredientAmount[i].ToString(); } }
private void setupUIWithFoodData(Food foodData) { TextBoxId.Text = foodData.FoodId.ToString(); TextBoxName.Text = foodData.Name; TextBoxPrice.Text = foodData.Price.ToString(); _currentImage = null; ComboBoxCategory.SelectedValue = foodData.FoodCategorizeId; if (foodData.IngredientWithFoods == null) { return; } foreach (IngredientWithFood ingredientWithFood in foodData.IngredientWithFoods) { _ingredientsWithFood.Add(new IngredientWithFoodTable() { Id = ingredientWithFood.IngredientId, Name = IngredientManager.getInstance().IngredientList[ingredientWithFood.IngredientId].Name, UnitName = UnitManager.getInstance().UnitList[IngredientManager.getInstance().IngredientList[ingredientWithFood.IngredientId].UnitId].Name, Quantity = ingredientWithFood.Quantities }); } }
private void InsertIngredients() { if (IngredientManager.Get(CurrentContextType).Count() != 0) { throw new Exception("Ingredients already inserted !"); } string filename = System.Configuration.ConfigurationManager.AppSettings["IngredientList"]; string fullFilename = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/" + filename); try { string[] fileLines = System.IO.File.ReadAllLines(fullFilename); foreach (string s in fileLines) { string[] ingredientData = s.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string groupName = ingredientData[0]; int groupCount = int.Parse(ingredientData[1]); while (groupCount > 0) { Ingredient newIngredient = new Ingredient(); newIngredient.Id = System.Guid.NewGuid(); newIngredient.Name = ingredientData[groupCount + 1]; if (newIngredient.Name.EndsWith("[A]")) { newIngredient.Colour = ColorKeys.AMBER; newIngredient.Name = newIngredient.Name.Replace("[A]", ""); } else if (newIngredient.Name.EndsWith("[R]")) { newIngredient.Colour = ColorKeys.RED; newIngredient.Name = newIngredient.Name.Replace("[R]", ""); } else { newIngredient.Colour = ColorKeys.GREEN; } newIngredient.Category = groupName; newIngredient.PackImagePath = ""; newIngredient.CreatedOn = DateTime.UtcNow; groupCount--; IngredientManager.Insert(newIngredient, CurrentContextType); } } } catch (System.IO.FileNotFoundException ioExcp) { throw new Exception("Ingredients file could not be loaded.", ioExcp); } catch (System.IO.IOException ioGeneralExcp) { throw new System.IO.IOException("An IO Exception occurred while reading the ingredients file.", ioGeneralExcp); } catch (Exception excp) { throw new Exception("A general exception occurred while reading the ingredients file.", excp); } }
public void SetDrink(int slotId, int drinkId) { GameSystem.Instance.SetRecipe(slotId, drinkId); Sprite sprite = Resources.Load <Sprite>("Sprites/" + IngredientManager.GetRecipes()[drinkId].Image); grid.GetChild(slotId).transform.GetChild(0).gameObject.GetComponent <Image>().sprite = sprite; grid.GetChild(slotId).transform.GetChild(0).gameObject.GetComponent <Image>().preserveAspect = true; grid.GetChild(slotId).transform.GetChild(2).gameObject.GetComponent <Text>().text = IngredientManager.GetRecipes()[drinkId].Name; }
// Use this for initialization void Start() { for (int i = 0; i < IngredientManager.GetIngredients().Count; i++) { GameObject holder = Instantiate(ingredientHolderPrefab, grid); holder.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/" + IngredientManager.GetIngredients()[i].Image); holder.transform.GetChild(1).GetComponent <Text>().text = "x " + GameSystem.Instance.ingredientAmount[i].ToString(); } }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); fossilSystem = player.GetComponent <FossilSystem>(); playerScript = player.GetComponent <PlayerController>(); ingredientManager = player.GetComponent <IngredientManager>(); // Disable panel HidePanel(); }
private void ComboBoxIngredient_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ComboBoxIngredient.SelectedIndex < 0) { return; } var unitId = IngredientManager.getInstance().IngredientList[(int)((ComboBoxItem)ComboBoxIngredient.SelectedItem).Tag].UnitId; TextBlockUnit.Text = " / 1 " + UnitManager.getInstance().UnitList[unitId].Name; }
private void Awake() { if (Instance != null && Instance != this) { Destroy(this); } Instance = this; DontDestroyOnLoad(gameObject); ingredients = new List <Pickup>(); }
public List <Ingredient> GetAllIngredients() { try { return(IngredientManager.GetAllIngredients()); } catch { return(new List <Ingredient>()); } }
public int InsertNewIngredient(Ingredient ingredient) { try { return(IngredientManager.InsertNewIngredient(ingredient)); } catch { return(0); } }
public Ingredient GetOneIngredient(int id) { try { return(IngredientManager.GetOneIngredient(id)); } catch { return(new Ingredient()); } }
public int UpdateExistingIngredient(Ingredient ingredient) { try { return(IngredientManager.UpdateExistingIngredient(ingredient)); } catch { return(0); } }
public Select_Ingredient_Form() { InitializeComponent(); LoadHeaderName(); igrManager = new IngredientManager(); selectedIngredients = new List <Ingredient>(); dataGridView_SelectedItems.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2; dataGridView_SelectedItems.SelectionMode = DataGridViewSelectionMode.CellSelect; LoadDataToScreen(); }
private void Awake() { if (null == Instance) { Instance = this; } else { Destroy(this); } }
private void Start() { currencyManager = FindObjectOfType <CurrencyManager>(); ingredientManager = FindObjectOfType <IngredientManager>(); // setup initial values on the price tags limePriceTag.text = "$" + limeUpgradeCost; icePriceTag.text = "$" + iceUpgradeCost; sugarPriceTag.text = "$" + sugarUpgradeCost; ultraPriceTag.text = "$" + ultraUpgradeCost; }
public ActionResult Index() { return(View(new HomeStatsViewModel() { Participants = ParticipantManager.Count(CurrentContextType), Entries = EntryManager.Count(CurrentContextType), Ingredients = IngredientManager.Count(CurrentContextType), ExistingBarCombinations = ExistingBarCombinationManager.Count(CurrentContextType), NewProCampaignTransactions = ProCampaignTransactionManager.CountByStatus(ProCampaignTransactionStatusKeys.NEW, CurrentContextType), SentProCampaignTransactions = ProCampaignTransactionManager.CountByStatus(ProCampaignTransactionStatusKeys.SENT, CurrentContextType) })); }
private void BtnConfirm_Click(object sender, RoutedEventArgs e) { if (((ComboData)ComboBoxUnit.SelectedItem) == null || String.IsNullOrEmpty(TextBoxName.Text)) { WindownsManager.getInstance().showMessageBoxCheckInfoAgain(); return; } loadingAnim.Visibility = Visibility.Visible; Action <NetworkResponse> cbSuccessSent = delegate(NetworkResponse networkResponse) { if (!networkResponse.Successful) { WindownsManager.getInstance().showMessageBoxSomeThingWrong(); } else { if (_ingredientTab != null) { _ingredientTab.reloadIngredientTableUI(); } this.Close(); } loadingAnim.Visibility = Visibility.Hidden; }; Action <string> cbError = delegate(string err) { WindownsManager.getInstance().showMessageBoxErrorNetwork(); loadingAnim.Visibility = Visibility.Hidden; }; if (_ingredientDetailId != Constant.ID_CREATE_NEW) { IngredientManager.getInstance().updateIngredientFromServerAndUpdate( _ingredientDetailId, TextBoxName.Text, ((ComboData)ComboBoxUnit.SelectedItem).Id, cbSuccessSent, cbError ); } else { IngredientManager.getInstance().createIngredientFromServerAndUpdate( TextBoxName.Text, ((ComboData)ComboBoxUnit.SelectedItem).Id, cbSuccessSent, cbError ); } }
public void Add(string name) { var random = new Random(); var ingredient = new Ingredient(Guid.NewGuid()) { Name = name, Count = random.Next(0, 100), ReservedCount = random.Next(0, 100) }; IngredientManager.Insert(ingredient); }
void AddDrinkSlot(int i) { GameObject holder = Instantiate(drinkSlot, grid); holder.GetComponent <Button>().onClick.AddListener(() => openModal(i)); if (GameSystem.Instance.recipeList[i].recipeId != -1) { Sprite sprite = Resources.Load <Sprite>("Sprites/" + IngredientManager.GetRecipes()[GameSystem.Instance.recipeList[i].recipeId].Image); holder.transform.GetChild(0).GetComponent <Image>().sprite = sprite; holder.transform.GetChild(0).GetComponent <Image>().preserveAspect = true; holder.transform.GetChild(2).GetComponent <Text>().text = IngredientManager.GetRecipes()[GameSystem.Instance.recipeList[i].recipeId].Name; } }
public ResultDTO Process() { if (String.IsNullOrEmpty(Ingredient1Raw)) { Result.Code = CodeKeys.EMPTY_INGREDIENTS; return(Result); } Ingredient ingredient1 = null; Ingredient ingredient2 = null; Ingredient ingredient3 = null; ingredient1 = IngredientManager.GetIngredientFromName(Ingredient1Raw); if (ingredient1 == null) { Result.Code = CodeKeys.INVALID_INGREDIENT_1; return(Result); } if (!String.IsNullOrEmpty(Ingredient2Raw)) { ingredient2 = IngredientManager.GetIngredientFromName(Ingredient2Raw); if (ingredient2 == null) { Result.Code = CodeKeys.INVALID_INGREDIENT_2; return(Result); } } if (!String.IsNullOrEmpty(Ingredient3Raw)) { ingredient3 = IngredientManager.GetIngredientFromName(Ingredient3Raw); if (ingredient3 == null) { Result.Code = CodeKeys.INVALID_INGREDIENT_3; return(Result); } } Result.HttpStatusCode = HttpStatusCode.OK; Result.Meta = new { Ingredient1 = ingredient1, Ingredient2 = ingredient2, Ingredient3 = ingredient3 }; return(Result); }
private void TabControlMain_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (isReloading) { return; } var tabPrepareFood = ((PrepareFoodTab)TabItemPrepareFood.Content); if (TabItemIngredient.IsSelected && IngredientManager.getInstance().IngredientList.Count <= 0) { ((IngredientTab)(TabItemIngredient.Content)).reloadUnitTableUI(true, delegate() { ((IngredientTab)(TabItemIngredient.Content)).reloadIngredientTableUI(true); }); tabPrepareFood.IsOpeningThisTab = false; } else if (TabItemFood.IsSelected && FoodManager.getInstance().FoodList.Count <= 0) { ((FoodTab)(TabItemFood.Content)).reloadCategoryTableUI(true, delegate() { ((FoodTab)(TabItemFood.Content)).reloadFoodTableUI(true); }); tabPrepareFood.IsOpeningThisTab = false; } else if (TabItemOrder.IsSelected && TableManager.getInstance().TableList.Count <= 0) { ((OrderAndTableTab)(TabItemOrder.Content)).reloadOrderUI(true, delegate() { ((OrderAndTableTab)(TabItemOrder.Content)).reloadTableUI(true); }); tabPrepareFood.IsOpeningThisTab = false; } else if (TabItemRespository.IsSelected) { var tabImportIngredient = ((ImportIngredientTab)TabItemRespository.Content).TabImportIngredient; ((ImportTab)tabImportIngredient.Content).setupComboBoxIngredient(); tabPrepareFood.IsOpeningThisTab = false; } else if (TabItemPrepareFood.IsSelected && !tabPrepareFood.IsOpeningThisTab) { tabPrepareFood.IsOpeningThisTab = true; tabPrepareFood.reloadAndUpdateUI(); } else if (TabItemReport.IsSelected) { tabPrepareFood.IsOpeningThisTab = false; } }
public JsonResult SetIngredients(string[] data) { List <IngredientModel> ingredients = new List <IngredientModel>(); foreach (var str in data) { var id = Guid.Parse(str); ingredients.Add(IngredientManager.GetIngredients().Where(x => x.Id == id).FirstOrDefault()); } var order = TempData["order"] as OrderViewModel; order.ingredients = ingredients; TempData["order"] = order; return(Json(new { redirectTo = Url.Action("AddOrder", "Order", order) })); }
private void Start() { // get a reference to the ingredient manager ingredientManager = FindObjectOfType <IngredientManager>(); // find corresponding animations statusTextAnimation = statusText.GetComponent <Animation>(); sellGlassAnimation = glassMoneyText.GetComponent <Animation>(); sellJugAnimation = jugMoneyText.GetComponent <Animation>(); sellBucketAnimation = bucketMoneyText.GetComponent <Animation>(); limeSubtractAnimation = limeAnimatedText.GetComponent <Animation>(); iceSubtractAnimation = iceAnimatedText.GetComponent <Animation>(); sugarSubtractAnimation = sugarAnimatedText.GetComponent <Animation>(); }