コード例 #1
0
        //----------------------
        // Protected Variables

        //========================================
        //      setter / getter
        //------------------------------

        //========================================
        //      Unity's function
        //------------------------------
        private void Awake()
        {
            mRectTransform = this.GetComponent <RectTransform>();
            mSlideEffect   = this.GetComponent <JCS_SlideEffect>();
            mSoundPlayer   = this.GetComponent <JCS_SoundPlayer>();

            InitSequenceButtons();

            // do not auto check this exit,
            // so it wont exit itself.
            mSlideEffect.AutoAddEvent = false;

            // if button not equals to null,
            // then we can do the button to close the panel instead of
            // on mouse stay. (Area Detection)
            if (mToggleOrExitButton != null)
            {
                JCS_ToggleButton tb = mToggleOrExitButton.GetComponent <JCS_ToggleButton>();
                if (tb != null)
                {
                    tb.SetActiveFunc(mSlideEffect.Active);
                    tb.SetDeactiveFunc(ClosePanel);
                }
                else
                {
                    mToggleOrExitButton.SetSystemCallback(ClosePanel);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initalize all the button.
        /// </summary>
        private void InitBtnsSet()
        {
            if (mOkBtn != null)
            {
                mOkBtn.SetSystemCallback(OkBtnCallback);
            }

            if (mNoBtn != null)
            {
                mNoBtn.SetSystemCallback(NoBtnCallback);
            }

            if (mYesBtn != null)
            {
                mYesBtn.SetSystemCallback(YesBtnCallback);
            }

            if (mNextBtn != null)
            {
                mNextBtn.SetSystemCallback(NextBtnCallback);
            }

            if (mPreviousBtn != null)
            {
                mPreviousBtn.SetSystemCallback(PreviousBtnCallback);
            }

            if (mExitBtn != null)
            {
                mExitBtn.SetSystemCallback(ExitBtnCallback);
            }

            if (mAcceptBtn != null)
            {
                mAcceptBtn.SetSystemCallback(AcceptBtnCallback);
            }

            if (mDeclineBtn != null)
            {
                mDeclineBtn.SetSystemCallback(DeclineBtnCallback);
            }

            for (int index = 0;
                 index < mSelectBtn.Length;
                 ++index)
            {
                JCS_Button btn = mSelectBtn[index];

                if (btn == null)
                {
                    continue;
                }

                btn.SetSystemCallback(SelectionInt, index);

                if (mMakeHoverSelect)
                {
                    if (btn.ButtonSelection == null)
                    {
                        JCS_Debug.LogWarning(@"Cannot make hover select 
because button selection is not attach to all selections in the list...");
                    }
                    else
                    {
                        EventTrigger eventTrigger = btn.GetComponent <EventTrigger>();
                        if (eventTrigger == null)
                        {
                            eventTrigger = btn.gameObject.AddComponent <EventTrigger>();
                        }

                        JCS_Utility.AddEventTriggerEvent(
                            eventTrigger,
                            EventTriggerType.PointerEnter,
                            mButtonSelectionGroup.SelectSelection,
                            btn.ButtonSelection);
                    }
                }
            }
        }