コード例 #1
0
ファイル: CManagerSound.cs プロジェクト: strix13/UnityLibrary
    public CSoundSlot DoPlaySoundEffect_OrNull(string strSound, float fVolume = 1f)
    {
        if (_bIsMute)
        {
            return(null);
        }

        CSoundSlot pSoundSlot = FindDisableSlot_OrMakeSlot();

        if (pSoundSlot == null)
        {
            return(null);
        }

        if (_mapSoundVolume.ContainsKey(strSound))
        {
            pSoundSlot.DoPlaySound(GetAudioClip(strSound), _mapSoundVolume[strSound] * fVolume * _fVolumeEffect);
        }
        else
        {
            pSoundSlot.DoPlaySound(GetAudioClip(strSound), fVolume * _fVolumeEffect);
        }


        return(pSoundSlot);
    }
コード例 #2
0
    public void DoPlayBGM(ENUM_SOUND_NAME eSound, System.Action CallBackOnFinishBGM = null)
    {
        float fVolume = 0f;

        if (_mapSoundVolume.ContainsKey(eSound))
        {
            fVolume = _mapSoundVolume[eSound] * _fVolumeBGM;
        }
        else
        {
            fVolume = _fVolumeBGM;
        }

        //Debug.Log( eSound + "Volume : " + fVolume );

        if (_pSlotBGM.CheckIsPlaying())
        {
            _pSlotBGM.DoSetFadeOut(DoGetResource_Origin(eSound), fVolume);
        }
        else
        {
            _pSlotBGM.DoPlaySound(DoGetResource_Origin(eSound), fVolume);
        }

        _CallBackOnFinishBGM = CallBackOnFinishBGM;
    }
コード例 #3
0
ファイル: CManagerSound.cs プロジェクト: strix13/UnityLibrary
    public void DoPlayBGM(string strSound, System.Action CallBackOnFinishBGM = null)
    {
        float fVolume = 0f;

        if (_mapSoundVolume.ContainsKey(strSound))
        {
            fVolume = _mapSoundVolume[strSound] * _fVolumeBGM;
        }
        else
        {
            fVolume = _fVolumeBGM;
        }

        //Debug.Log( eSound + "Volume : " + fVolume );

        if (_pSlotBGM.CheckIsPlaying())
        {
            _pSlotBGM.DoSetFadeOut(GetAudioClip(strSound), fVolume);
        }
        else
        {
            _pSlotBGM.DoPlaySound(GetAudioClip(strSound), fVolume);
        }

        _CallBackOnFinishBGM = CallBackOnFinishBGM;
    }
コード例 #4
0
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출                         */

    public void DoPlayAnimation(string strLabelContent, float fDurationSec, CSoundSlot pSoundSlot_OnChangeText = null)
    {
        if (_bIsExcuteAwake == false)
        {
            OnAwake();
        }

        if (strLabelContent == null || strLabelContent.Length == 0)
        {
            Debug.LogWarning("라벨의 길이가 0입니다.");
            return;
        }

        if (pSoundSlot_OnChangeText != null)
        {
            _pSoundSlot_OnChangeText = pSoundSlot_OnChangeText;
            pSoundSlot_OnChangeText.DoPlaySound();
        }

        _strLabelContent = strLabelContent;
        _fCharPerSec     = fDurationSec / _strLabelContent.Length;
        ProcEditText("");
        _iCharLengthIndex = 0;
        _fPrevTime        = _bIgnoreTimeScale ? RealTime.time : Time.time;

        StartCoroutine(CoPlayUILabelAnimation());
    }
コード例 #5
0
    public CSoundSlot DoPlaySoundEffect(ENUM_SOUND_NAME eSound, float fVolume = 1f)
    {
        string strSoundName = eSound.ToString();

        if (_mapCurrentPlayingSound.ContainsKey(strSoundName))
        {
            CSoundSlot pSlotCurrentPlaying = _mapCurrentPlayingSound[strSoundName];
            //pSlotCurrentPlaying.DoStopSound();
            pSlotCurrentPlaying.DoPlaySound();

            return(pSlotCurrentPlaying);
        }

        //Debug.Log("Play Sound : " + eSound);
        CSoundSlot pSoundSlot = FindDisableSlot_OrNull();

        if (pSoundSlot == null)
        {
            return(null);
        }
        //{
        //    MakeSoundSlot();
        //    pSoundSlot = FindDisableSlot();
        //}

        if (pSoundSlot != null)
        {
            if (_mapSoundVolume.ContainsKey(eSound))
            {
                pSoundSlot.DoPlaySound(DoGetResource_Origin(eSound), _mapSoundVolume[eSound] * fVolume * _fVolumeEffect);
            }
            else
            {
                pSoundSlot.DoPlaySound(DoGetResource_Origin(eSound), fVolume * _fVolumeEffect);
            }

            _mapCurrentPlayingSound.Add(strSoundName, pSoundSlot);
        }

        return(pSoundSlot);
    }
コード例 #6
0
ファイル: CManagerSound.cs プロジェクト: strix13/UnityLibrary
    public CSoundSlot DoPlaySoundEffect_OnlySinglePlay_OrNull(string strSound, float fVolume = 1f)
    {
        if (_bIsMute)
        {
            return(null);
        }

        string strSoundName = strSound;

        if (_mapCurrentPlayingSound.ContainsKey(strSoundName))
        {
            CSoundSlot pSlotCurrentPlaying = _mapCurrentPlayingSound[strSoundName];
            pSlotCurrentPlaying.DoPlaySound();

            return(pSlotCurrentPlaying);
        }

        CSoundSlot pSoundSlot = FindDisableSlot_OrMakeSlot();

        if (pSoundSlot == null)
        {
            return(null);
        }

        if (_mapSoundVolume.ContainsKey(strSound))
        {
            pSoundSlot.DoPlaySound(GetAudioClip(strSound), _mapSoundVolume[strSound] * fVolume * _fVolumeEffect);
        }
        else
        {
            pSoundSlot.DoPlaySound(GetAudioClip(strSound), fVolume * _fVolumeEffect);
        }

        _mapCurrentPlayingSound.Add(strSoundName, pSoundSlot);

        return(pSoundSlot);
    }
コード例 #7
0
    private IEnumerator CoPlayUILabelAnimation()
    {
        while (true)
        {
            yield return(null);

            float fTime    = _bIgnoreTimeScale ? RealTime.time : Time.time;
            float fTimeSec = fTime - _fPrevTime;

            if (fTimeSec > _fCharPerSec)
            {
                ProcEditText(_strLabelContent.Substring(0, _iCharLengthIndex));
                _fPrevTime = fTime;

                if (_pSoundSlot_OnChangeText != null)
                {
                    _pSoundSlot_OnChangeText.DoPlaySound();
                }

                if (_iCharLengthIndex++ == _strLabelContent.Length)
                {
                    if (_pSoundSlot_OnChangeText != null)
                    {
                        _pSoundSlot_OnChangeText.DoStopSound();
                    }

                    ProcEditText(_strLabelContent);
                    if (p_EVENT_OnAnimationFinish != null)
                    {
                        p_EVENT_OnAnimationFinish();
                    }

                    break;
                }
            }
        }
    }
コード例 #8
0
ファイル: CManagerSound.cs プロジェクト: strix13/UnityLibrary
    public CSoundSlot DoPlaySoundEffect_OrNull(AudioClip pClip, float fVolume = 1f)
    {
        if (_bIsMute)
        {
            return(null);
        }

        //Debug.Log("Play Sound : " + eSound);
        CSoundSlot pSoundSlot = FindDisableSlot_OrMakeSlot();

        if (pSoundSlot == null)
        {
            return(null);
        }

        if (pSoundSlot != null)
        {
            pSoundSlot.DoPlaySound(pClip, fVolume * _fVolumeEffect);
        }

        return(pSoundSlot);
    }
コード例 #9
0
    public void DoPlayAnimation_Number(int iStartNubmer, int iDestNumber, string strNumberFormat, float fDurationSec, CSoundSlot pSoundSlot_OnChangeText = null, float fStartDelaySec = 0f)
    {
        if (_bIsExcuteAwake == false)
        {
            OnAwake();
        }

        if (pSoundSlot_OnChangeText != null)
        {
            _pSoundSlot_OnChangeText = pSoundSlot_OnChangeText;
            pSoundSlot_OnChangeText.DoPlaySound();
        }

        _strLabelContent  = strNumberFormat;
        _iCharLengthIndex = iStartNubmer;
        ProcEditText(string.Format(strNumberFormat, iStartNubmer));
        _iStartNumber = iStartNubmer;
        _iDestNumber  = iDestNumber;
        _fCharPerSec  = fDurationSec;

        StartCoroutine(CoPlayUILabelAnimation_Number(fStartDelaySec));
    }