예제 #1
0
        void OnChoiceClick(ModalChoiceItem item)
        {
            //update selection
            var prevChoiceItem = mCurChoiceItem;

            mCurChoiceItem = item;

            if (prevChoiceItem)
            {
                prevChoiceItem.selected = false;
            }

            if (mCurChoiceItem)
            {
                mCurChoiceItem.selected = true;
            }

            if (confirmButton)
            {
                confirmButton.interactable = true;
            }

            //update confirm
            if (confirmReadyGO)
            {
                confirmReadyGO.SetActive(true);
            }

            if (!confirmButton) //call next if no confirm
            {
                OnConfirmClick();
            }
        }
예제 #2
0
        private void GenerateChoices(ModalChoiceItemInfo[] infos, int startIndex, bool shuffle)
        {
            if (choiceTemplate)
            {
                var choiceRoot = choiceTemplate.transform.parent;

                for (int i = 0; i < infos.Length; i++)
                {
                    ModalChoiceItem itm;

                    if (mItemCache.Count > 0)
                    {
                        itm = mItemCache.RemoveLast();
                    }
                    else   //add new
                    {
                        itm = Instantiate(choiceTemplate);
                        itm.transform.SetParent(choiceRoot, false);

                        itm.clickCallback += OnChoiceClick;
                    }

                    itm.Setup(i, infos[i]);
                    itm.selected     = false;
                    itm.interactable = false;
                    itm.gameObject.SetActive(true);

                    mItemActives.Add(itm);
                }

                if (shuffle)
                {
                    mItemActives.Shuffle();

                    for (int i = 0; i < mItemActives.Count; i++)
                    {
                        var itm = mItemActives[i];
                        itm.transform.SetAsLastSibling();
                    }
                }

                if (startIndex != -1 && startIndex < mItemActives.Count)
                {
                    mCurChoiceItem = mItemActives[startIndex];
                }
            }
        }
예제 #3
0
 void M8.IModalPop.Pop()
 {
     mCurChoiceItem = null;
     mNextCallback  = null;
 }