Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        DAKGOGI.NDakgogiManager.Instance.CheckTheCart(imgCartPlus, lbItemCount);

        string strMenuName = "";

        if (DAKGOGI.NDakgogiManager.Instance.GetSubCurrentCategory() != "")
        {
            lbMenuName.trueTypeFont = DAKGOGI.NDakgogiManager.Instance.GetCurrentFont();
            strMenuName             = DAKGOGI.NDakgogiManager.Instance.GetSubCurrentCategory();

            DAKGOGI.MainDish dish = DAKGOGI.DishesManager.Instance.GetDishInformationByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex());

            if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "Korean")
            {
                lbMenuName.text = dish.getKorName();
            }
            else if (DAKGOGI.NDakgogiManager.Instance.GetCurrentLanguage() == "English")
            {
                lbMenuName.text = dish.getEngName();
            }
            else
            {
                lbMenuName.text = dish.getChnName();
            }
        }
        else
        {
            strMenuName     = DAKGOGI.NDakgogiManager.Instance.GetCurrentCategory();
            lbMenuName.text = DAKGOGI.NDakgogiManager.Instance.GetCurrentCategory();
        }

        DAKGOGI.DishesManager.Instance.GetMainDishesByCategory(strMenuName, out lstDishes);

        // Change to Previous Page
        UIButton btnBack = GameObject.Find("BackTitle").GetComponent <UIButton>();

        btnBack.onClick.Add(new EventDelegate(ClickButton_Main));

        //
        btnPlaceAnOrder.onClick.Add(new EventDelegate(ClickButton_PlaceAnOrder));

        //
        UIButton btnCart = pnCart.GetComponent <UIButton> ();

        btnCart.onClick.Add(new EventDelegate(ClickButton_CheckOut));

        SetAllItemsInScrollView();

        // for an animation
        Time.timeScale    = 1;
        animation         = pnCart.GetComponent <Animator>();
        animation.enabled = false;

        // for springpanel
//		GameObject springPanel = sv_menulist.GetComponent<SpringPanel>().gameObject;
//		Vector3 pos = new Vector3(0, DAKGOGI.NDakgogiManager.Instance.GetShortCut());
//
//		if (DAKGOGI.NDakgogiManager.Instance.GetShortCut () > 70) {
//			ClickButton_IfSpreadOrSideMenu ();
//		}
//
//		SpringPanel.Begin (springPanel, pos, 10.0f);
    }
Esempio n. 2
0
    // 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();
    }