public void ClickButton_IfSpreadOrSideMenu() { DAKGOGI.MainDish maindish = DAKGOGI.DishesManager.Instance.GetDishInformationByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex()); if (maindish.getCategory() != -1 && maindish.getSubCategory() != "") { DAKGOGI.NDakgogiManager.Instance.SetSubCurrentCategory(maindish.getSubCategory()); Application.LoadLevel("Menulist"); // var slices = new VerticalSlicesTransition() // { // nextScene = 1, // Menulist // divisions = 1, // dirOffset = 1, // }; // TransitionKit.instance.transitionWithDelegate( slices ); } else { DAKGOGI.NDakgogiManager.Instance.SetShortCut(70); if (DAKGOGI.DishesManager.Instance.IfOptionsAreExistByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex())) { Application.LoadLevel("Detail"); // var slices = new VerticalSlicesTransition() // { // nextScene = 5, // Detail // divisions = 1, // dirOffset = 1, // }; // TransitionKit.instance.transitionWithDelegate( slices ); } else { DAKGOGI.MainDish choiced_dish = lstDishes.Find(x => x.getIndex() == DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex()); if (true == choiced_dish.getSpread()) { choiced_dish.SetSpread(false); } else { choiced_dish.SetSpread(!choiced_dish.getSpread()); nSelectedQTY = 0; dTotalPrice = 0.0; } foreach (DAKGOGI.MainDish dish in lstDishes) { if (true == dish.getSpread() && (dish.getIndex() != DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex())) { dish.SetSpread(false); } } SetAllItemsInScrollView(); } } }
// Use this for initialization void Start() { // for an animation Time.timeScale = 1; animation = pnCart.GetComponent <Animator>(); animation.enabled = false; DAKGOGI.NDakgogiManager.Instance.CheckTheCart(imgCartPlus, lbItemCount); // Change to Previous Page UIButton btnBack = GameObject.Find("BackTitle").GetComponent <UIButton>(); btnBack.onClick.Add(new EventDelegate(ClickButton_MenuList)); // Place to order button btnPlaceAnOrder.onClick.Add(new EventDelegate(ClickButton_PlaceAnOrder)); // Cart button UIButton btnCart = pnCart.GetComponent <UIButton> (); btnCart.onClick.Add(new EventDelegate(ClickButton_CheckOut)); if (DAKGOGI.NDakgogiManager.Instance.GetCurrentOrderIndex() > 0) { DAKGOGI.MainDish dish = DAKGOGI.DishesManager.Instance.GetDishInformationByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex()); lbMenuName.text = DAKGOGI.DishesManager.Instance.GetMainCategory(dish.getCategory()); if (lbMenuName.text.Length <= 0) { lbMenuName.text = dish.getSubCategory(); } lbPlaceToOrder.text = "CHANGE YOUR OPTION"; } int nOptionCNT = 0; dishInformation = DAKGOGI.DishesManager.Instance.GetDishInformationByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex()); // to set Option panels string strCurrentOption = DAKGOGI.DishesManager.Instance.GetOptionCategoryByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex(), DAKGOGI.NDakgogiManager.Instance.GetOptionPageIndex(), out nOptionCNT); if (null == strCurrentOption) { Debug.Log("Current DishIndex is " + DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex()); return; } if (DAKGOGI.NDakgogiManager.Instance.GetOptionPageIndex() >= 1) { lbMenuName.text = "Previous Option"; } else { lbMenuName.trueTypeFont = DAKGOGI.NDakgogiManager.Instance.GetCurrentFont(); DAKGOGI.NDakgogiManager.Instance.PrePlaceAnOrder(null); if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "Korean") { lbMenuName.text = dishInformation.getKorName(); } else if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "English") { lbMenuName.text = dishInformation.getEngName(); } else { lbMenuName.text = dishInformation.getChnName(); } } // to set Option Labels by OptionPageIndex if (nOptionCNT > 1) { UILabel label = GameObject.Find("LabelChoiceStep").GetComponent <UILabel>(); label.text = aryOptionPage[DAKGOGI.NDakgogiManager.Instance.GetOptionPageIndex(), 0]; lbPlaceToOrder.text = aryOptionPage[DAKGOGI.NDakgogiManager.Instance.GetOptionPageIndex(), 1]; } lstOption = DAKGOGI.DishesManager.Instance.GetOptionInformations(strCurrentOption); foreach (DAKGOGI.Option info in lstOption) { if (DAKGOGI.NDakgogiManager.Instance.ComparePreOption(info)) { continue; } GameObject op = Resources.Load("Prefabs/SubMenuItem") as GameObject; GameObject newOption = NGUITools.AddChild(grid, op); newOption.name = info.getIndex().ToString(); newOption.GetComponentInChildren <UIToggle>().name = info.getIndex().ToString(); UILabel[] lables = newOption.GetComponentsInChildren <UILabel>(); foreach (UILabel label in lables) { if (label.name == "price") { if (info.getPrice() > 0) { if (info.getOptionType() != "SUB") { label.text += "+ "; } label.text += "$ " + String.Format("{0,3:0.00}", Math.Round(info.getPrice(), 2)); } else if (info.getPrice() < 0) { label.text = "$ " + String.Format("{0,3:0.00}", Math.Round(info.getPrice(), 2)); } } else if (label.name == "option_name") { label.trueTypeFont = DAKGOGI.NDakgogiManager.Instance.GetCurrentFont(); if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "Korean") { label.text = info.getKorName(); } else if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "English") { label.text = info.getEngName(); } else if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "Chinese") { label.text = info.getChnName(); } } } } DAKGOGI.Option currentOption = DAKGOGI.NDakgogiManager.Instance.GetCurrentOption(); int nCount = currentOption.getIndex(); toggles = grid.GetComponentsInChildren <UIToggle> (); foreach (UIToggle toggle in toggles) { if (toggle.name == currentOption.getIndex().ToString()) { toggle.value = true; } else if (nCount == 0) { toggle.value = true; } else { nCount++; } } grid.GetComponent <UIGrid> ().Reposition(); }