Esempio n. 1
0
 public OrderedDish(int nOrderIndex, MainDish dish, List <Option> options, string optionType, int nAmount)
 {
     nOrderIndex_   = nOrderIndex;
     mainDish_      = dish;
     lstOptions_    = options;
     strOptionType_ = optionType;
     nOrderAmount_  = nAmount;
 }
Esempio n. 2
0
    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();
            }
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        //충돌이 감지된 영역
        RaycastHit hit;

        GameObject target = null;

        if (true == Input.GetMouseButtonDown(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100))
            {
                Debug.Log("name : " + hit.collider.name);

                target = hit.collider.gameObject;
                UIPanel panel = target.GetComponentInParent <UIPanel> ();

                int nChoicedIndex = -1;
                if (panel.name == "Header" || panel.name == "Btn" || panel.name == "Cart" || panel.name == "BTN_ADDTOORDER")
                {
                    return;
                }

                if (!System.Int32.TryParse(panel.name, out nChoicedIndex))
                {
                    Debug.Log("Failed convert to int!!!! from string : " + panel.name);
                    return;
                }

                if (dishInformation == null || DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex() != nChoicedIndex)
                {
                    if (nSelectedQTY > 0)
                    {
                        InitOrderedMenu();
                    }

                    DAKGOGI.NDakgogiManager.Instance.SetCurrentDishIndex(nChoicedIndex);
                    dishInformation = DAKGOGI.DishesManager.Instance.GetDishInformationByIndex(nChoicedIndex);
                }
            }
        }
    }
Esempio n. 4
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. 5
0
        public void PlaceAnOrder(MainDish dish, Option newOption, int nAmount)
        {
            string        optionType = null;
            List <Option> lstOption  = new List <Option> ();

            if (newOption != null)
            {
                if (option_ != null)
                {
                    lstOption.Add(option_);
                }
                lstOption.Add(newOption);
                optionType = newOption.getOptionType();
            }

            List <OrderedDish> lstTemp;

            if (true == dicOrder_.TryGetValue(dish.getIndex(), out lstTemp))
            {
                if (DAKGOGI.DishesManager.Instance.IfOptionsAreExistByIndex(DAKGOGI.NDakgogiManager.Instance.GetCurrentDishIndex()))
                {
                    if (nSelectedOrderIndex_ > 0)
                    {
                        foreach (OrderedDish op in lstTemp)
                        {
                            if (op.getOrderIndex() == nSelectedOrderIndex_)
                            {
                                op.RemoveAllOptions();

                                foreach (Option newop in lstOption)
                                {
                                    op.AddOption(newop);
                                }
                            }
                        }
                    }
                    else
                    {
                        lstTemp.Add(new DAKGOGI.OrderedDish(++nOrderIndex_, dish, lstOption, optionType, nAmount));
                    }

                    dicOrder_[dish.getIndex()] = lstTemp;
                }
                else
                {
                    foreach (OrderedDish order in lstTemp)
                    {
                        order.AddUpAmount(nAmount);
                    }
                }
            }
            else
            {
                List <OrderedDish> newList = new List <OrderedDish>();
                newList.Add(new DAKGOGI.OrderedDish(++nOrderIndex_, dish, lstOption, optionType, nAmount));
                dicOrder_.Add(dish.getIndex(), newList);
            }

            option_ = null;

            /*Debug.Log ("........... For Debugging start................");
             *
             * // for debugging
             * foreach (KeyValuePair<int, List<OrderedDish>> order in dicOrder_)
             * {
             *      Debug.Log ("DishIndex : " + order.Key);
             *
             *      foreach(DAKGOGI.OrderedDish orderedDish in order.Value)
             *              orderedDish.Output();
             * }*/
        }
Esempio n. 6
0
        public bool SerializeFromData()
        {
            if (dicDishesByCategory_ != null)
            {
                return(true);
            }

            // Dishes
            dicDishesByCategory_ = new SortedDictionary <string, List <MainDish> > ();
            dicDishesByIndex_    = new SortedDictionary <int, MainDish> ();

            if (null == dicDishesByCategory_ || null == dicDishesByIndex_)
            {
                return(false);
            }

            for (int i = 0; i < nProductCount; i++)
            {
                MainDish newDish = new MainDish();
                {
                    int    index;
                    double price;
                    System.Int32.TryParse(aryDishData[i, 0], out index);
                    System.Double.TryParse(aryDishData[i, 8], out price);

                    newDish.OnInit(index, aryDishData[i, 1], aryDishData[i, 2], aryDishData[i, 3], aryDishData[i, 4], aryDishData[i, 5], aryDishData[i, 6], aryDishData[i, 7], price);
                }

                List <MainDish> lstTemp;
                if (true == dicDishesByCategory_.TryGetValue(aryDishData[i, 6], out lstTemp))
                {
                    lstTemp.Add(newDish);
                }
                else
                {
                    List <MainDish> newList = new List <MainDish>();
                    newList.Add(newDish);
                    dicDishesByCategory_.Add(aryDishData[i, 6], newList);
                }

                dicDishesByIndex_.Add(newDish.getIndex(), newDish);
            }

            // Option Information
            dicOptionInformation_ = new SortedDictionary <string, List <Option> > ();
            for (int i = 0; i < nCountOptionInformation; i++)
            {
                Option newFood = new Option();
                {
                    int    index = 0;
                    double price;
                    System.Int32.TryParse(aryOptionInformation [i, 0], out index);
                    System.Double.TryParse(aryOptionInformation[i, 6], out price);
                    newFood.OnInit(index, aryOptionInformation [i, 3], aryOptionInformation [i, 4], aryOptionInformation [i, 5], price);
                    newFood.setOptionType(aryOptionInformation[i, 2]);
                }

                List <Option> lstTemp;
                if (true == dicOptionInformation_.TryGetValue(aryOptionInformation [i, 1], out lstTemp))
                {
                    lstTemp.Add((Option)newFood);
                }
                else
                {
                    List <Option> newList = new List <Option>();
                    newList.Add((Option)newFood);
                    dicOptionInformation_.Add(aryOptionInformation [i, 1], newList);
                }
            }

            // Options
            dicOptions_ = new SortedDictionary <int, List <string> > ();

            for (int i = 0; i < nCountMenuOption; i++)
            {
                int j = 0, nIndex = 0;
                System.Int32.TryParse(aryMenuNOption [i, j], out nIndex);

                List <string> lstTemp;
                if (true == dicOptions_.TryGetValue(nIndex, out lstTemp))
                {
                    lstTemp.Add(aryMenuNOption [i, j + 1]);
                }
                else
                {
                    List <string> newList = new List <string>();
                    newList.Add(aryMenuNOption [i, j + 1]);
                    dicOptions_.Add(nIndex, newList);
                }
            }

            // Localization
            string [] languages = new string[4];
            dicLocalization_ = new SortedDictionary <string, SortedDictionary <string, string> >();

            for (int i = 0; i < 3; i++)
            {
                for (int j = 1; j < 4; j++)
                {
                    if ("Language" == aryLocalization[i, 0])
                    {
                        languages[j] = aryLocalization[i, j];                                   // to get language's index
                        SortedDictionary <string, string> newLanguage = new SortedDictionary <string, string>();
                        dicLocalization_.Add(aryLocalization[i, j], newLanguage);
                    }
                    else
                    {
                        SortedDictionary <string, string> dicTemp;
                        if (true == dicLocalization_.TryGetValue(languages[j], out dicTemp))
                        {
                            string key   = aryLocalization[i, 0];
                            string value = aryLocalization[i, j];

                            dicTemp.Add(key, value);
                        }
                    }
                }
            }

            Debug.Log("Loading Data... count :" + dicDishesByCategory_.Count);
            return(true);
        }
Esempio n. 7
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();
    }