コード例 #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>
        /// Active all the button animation under this panel.
        /// </summary>
        private void ActiveAnim()
        {
            if (mBtnCounter == mSlideButtons.Length)
            {
                return;
            }

            if (mBtnCounter != 0)
            {
                mSoundPlayer.PlayOneShot(mActiveClip);

                mSpaceTimer += Time.deltaTime;

                if (mSpaceTime < mSpaceTimer)
                {
                    mSpaceTimer = 0;
                }
                else
                {
                    return;
                }
            }

            JCS_SlideEffect se = mSlideButtons[mBtnCounter];

            // stop checking if exits
            se.AutoAddEvent = false;

            se.Active();

            ++mBtnCounter;

            mSoundPlayer.PlayOneShot(mInsideActiveClip);
        }
コード例 #3
0
        /// <summary>
        /// Initialize all the button under this panel.
        /// </summary>
        private void InitSequenceButtons()
        {
            JCS_SlideEffect se = null;

            for (int index = 0; index < mSlideButtons.Length; ++index)
            {
                se = mSlideButtons[index];

                if (se == null)
                {
                    JCS_Debug.LogError("Missing jcs_button assign in the inspector");
                    continue;
                }

                //
                se.transform.SetParent(this.transform);

                se.AutoAddEvent = false;
            }

            for (int index = 0; index < mAreaEffects.Length; ++index)
            {
                se = mAreaEffects[index];

                if (se == null)
                {
                    JCS_Debug.LogError("Missing jcs_button assign in the inspector");
                    continue;
                }

                //
                se.transform.SetParent(this.transform);
            }
        }
コード例 #4
0
        //========================================
        //      Unity's function
        //------------------------------
        private void Awake()
        {
            mText = this.GetComponent <Text>();

            mFadeObject        = this.GetComponent <JCS_FadeObject>();
            mSimpleTrackAction = this.GetComponent <JCS_SimpleTrackAction>();
            mSlideEffect       = this.GetComponent <JCS_SlideEffect>();

            // set the fade out call back,
            // so we active from pool,
            // and check to see if the object is fade out complete.
            // if is complete set the active to false (return
            // to pool).
            mFadeObject.fadeOutCallback = FadeOutCompleteCallback;
        }
コード例 #5
0
        /// <summary>
        /// Deactive all the button animation under this panel.
        /// </summary>
        private void DeactiveAnim()
        {
            JCS_SlideEffect se = null;

            for (int index = 0; index < mSlideButtons.Length; ++index)
            {
                se = mSlideButtons[index];

                se.Deactive();
            }

            mSpaceTimer = 0;
            mBtnCounter = 0;

            mSoundPlayer.PlayOneShot(mDeactiveClip);
            mSoundPlayer.PlayOneShot(mInsideDeactiveClip);
        }