/* Play the left sound. */
        private void PlayLeftSound()
        {
            if (mLeftSound == null)
            {
                return;
            }
            JCS_SoundPlayer sp = JCS_SoundManager.instance.GetGlobalSoundPlayer();

            sp.PlayOneShotByMethod(mLeftSound, mLeftSoundMethod);
        }
        public static void PlayByAttachment(JCS_SoundPlayer player, AudioClip clip, JCS_SoundMethod method = JCS_SoundMethod.PLAY_SOUND, float volume = 1.0f)
        {
            JCS_SoundPlayer useSp = player;

            if (useSp == null)
            {
                useSp = JCS_SoundManager.instance.GetGlobalSoundPlayer();
            }
            useSp.PlayOneShotByMethod(clip, method, volume);
        }
Пример #3
0
        /// <summary>
        /// Play the button click sound.
        /// </summary>
        private void PlayButtonClickSound()
        {
            if (mButtonClickSound == null)
            {
                return;
            }

            JCS_SoundPlayer soundPlayer = mSoundPlayer;

            /* Get sound plaeyr according to the chosen choice. */
            if (mPlayWithGlobalSoundPlayer)
            {
                soundPlayer = JCS_SoundManager.instance.GetGlobalSoundPlayer();
            }

            soundPlayer.PlayOneShotByMethod(mButtonClickSound, mSoundMethod);
        }
Пример #4
0
        private void Update()
        {
            // IMPORTANT(JenChieh): only double click need update
            if (mIsOver)
            {
                if (JCS_Input.OnMouseDoubleClick(0))
                {
                    // either time is out or double click,
                    // both are all over the "double click event".
                    mIsOver = false;

                    if (mJCSButton != null)
                    {
                        if (!mJCSButton.Interactable)
                        {
                            // play not ineractable sound
                            mSoundPlayer.PlayOneShotByMethod(
                                mOnMouseDoubleClickRefuseSound,
                                mOnMouseDoubleClickRefuseSoundMethod);
                            return;
                        }
                        else
                        {
                            // play normal double click sound
                            mSoundPlayer.PlayOneShotByMethod(
                                mOnMouseDoubleClickSound,
                                mOnMouseDoubleClickSoundMethod);
                        }
                    }
                }

                // check if the mouse still over or not
                if (!JCS_Utility.MouseOverGUI(this.mRectTransform))
                {
                    mIsOver = false;
                }
            }
        }