예제 #1
0
 public void play(string path, bool loop_ = true)
 {
     if (m_path2SoundDic.ContainsKey(path))
     {
         //m_path2SoundDic[path].m_bLoop = loop_;
         m_path2SoundDic[path].Play();
     }
     else
     {
         SoundParam param = Ctx.m_instance.m_poolSys.newObject <SoundParam>();
         param.m_path  = path;
         param.m_bLoop = loop_;
         play(param);
         Ctx.m_instance.m_poolSys.deleteObj(param);
     }
 }
예제 #2
0
        public void play(SoundParam soundParam)
        {
            if (!soundParam.m_bLoop)
            {
                addTimer();
            }

            soundParam.m_path = Ctx.m_instance.m_pPakSys.getCurResPakPathByResPath(soundParam.m_path, null);

            if (m_path2SoundDic.ContainsKey(soundParam.m_path))      // 如果已经有了直接返回
            {
                if (!m_path2SoundDic[soundParam.m_path].bInCurState(SoundPlayState.eSS_Play))
                {
                    m_path2SoundDic[soundParam.m_path].Play();
                }
            }
            else
            {
                // 创建
                if (isPrefab(soundParam.m_path))
                {
                    m_path2SoundDic[soundParam.m_path] = new SoundPrefabItem();
                    m_path2SoundDic[soundParam.m_path].m_soundResType = SoundResType.eSRT_Prefab;
                }
                else
                {
                    m_path2SoundDic[soundParam.m_path] = new SoundClipItem();
                    m_path2SoundDic[soundParam.m_path].m_soundResType = SoundResType.eSRT_Clip;
                }
                m_audioList.Add(m_path2SoundDic[soundParam.m_path]);
                m_path2SoundDic[soundParam.m_path].initParam(soundParam);

                LoadParam param = Ctx.m_instance.m_poolSys.newObject<LoadParam>();
                param.m_path = soundParam.m_path;
                param.m_loadEventHandle = onLoadEventHandle;
                param.m_loadNeedCoroutine = false;
                param.m_resNeedCoroutine = false;
                Ctx.m_instance.m_resLoadMgr.loadResources(param);
                Ctx.m_instance.m_poolSys.deleteObj(param);
            }
        }
예제 #3
0
        public void play(SoundParam soundParam)
        {
            if (!soundParam.m_bLoop)
            {
                addTimer();
            }

            soundParam.m_path = Ctx.m_instance.m_pPakSys.getCurResPakPathByResPath(soundParam.m_path, null);

            if (m_path2SoundDic.ContainsKey(soundParam.m_path))      // 如果已经有了直接返回
            {
                if (!m_path2SoundDic[soundParam.m_path].bInCurState(SoundPlayState.eSS_Play))
                {
                    m_path2SoundDic[soundParam.m_path].Play();
                }
            }
            else
            {
                // 创建
                if (isPrefab(soundParam.m_path))
                {
                    m_path2SoundDic[soundParam.m_path] = new SoundPrefabItem();
                    m_path2SoundDic[soundParam.m_path].m_soundResType = SoundResType.eSRT_Prefab;
                }
                else
                {
                    m_path2SoundDic[soundParam.m_path] = new SoundClipItem();
                    m_path2SoundDic[soundParam.m_path].m_soundResType = SoundResType.eSRT_Clip;
                }
                m_audioList.Add(m_path2SoundDic[soundParam.m_path]);
                m_path2SoundDic[soundParam.m_path].initParam(soundParam);

                LoadParam param = Ctx.m_instance.m_poolSys.newObject <LoadParam>();
                param.m_path              = soundParam.m_path;
                param.m_loadEventHandle   = onLoadEventHandle;
                param.m_loadNeedCoroutine = false;
                param.m_resNeedCoroutine  = false;
                Ctx.m_instance.m_resLoadMgr.loadResources(param);
                Ctx.m_instance.m_poolSys.deleteObj(param);
            }
        }
예제 #4
0
 public void initParam(SoundParam soundParam)
 {
     m_trans = soundParam.m_trans;
     m_bLoop = soundParam.m_bLoop;
     m_path  = soundParam.m_path;
 }
예제 #5
0
 public void initParam(SoundParam soundParam)
 {
     m_trans = soundParam.m_trans;
     m_bLoop = soundParam.m_bLoop;
     m_path = soundParam.m_path;
 }