Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 2
0
        //========================================
        //      Unity's function
        //------------------------------
        protected override void Awake()
        {
            base.Awake();

            // JCS_SoundPlayer will be optional.
            mSoundPlayer = this.GetComponent <JCS_SoundPlayer>();

            // set the call back function if there is button assigned.
            if (mActiveButton != null)
            {
                mActiveButton.SetSystemCallback(JCS_OnMouseOver);
            }
        }
        //========================================
        //      Unity's function
        //------------------------------
        protected override void Awake()
        {
            base.Awake();

            // JCS_SoundPlayer will be optional.
            mSoundPlayer = this.GetComponent <JCS_SoundPlayer>();

            // set the call back function if there is button assigned.
            if (mActiveButton != null)
            {
                mActiveButton.SetSystemCallback(JCS_OnMouseOver);
            }


            Vector3 newPos = this.transform.localPosition;

            // record the original position
            this.mRecordPosition = newPos;
            this.mTargetPosition = newPos;

            switch (mAxis)
            {
            case JCS_Axis.AXIS_X:
                newPos.x += mDistance;
                break;

            case JCS_Axis.AXIS_Y:
                newPos.y += mDistance;
                break;

            case JCS_Axis.AXIS_Z:
                newPos.z += mDistance;
                break;
            }

            this.mTowardPosition = newPos;
        }
Exemplo n.º 4
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);
                    }
                }
            }
        }