Example #1
0
            /// <summary>
            /// 初始化声音代理的新实例。
            /// </summary>
            /// <param name="soundGroup">所在的声音组。</param>
            /// <param name="soundHelper">声音辅助器接口。</param>
            /// <param name="soundAgentHelper">声音代理辅助器接口。</param>
            public SoundAgent(SoundGroup soundGroup, ISoundHelper soundHelper, ISoundAgentHelper soundAgentHelper)
            {
                if (soundGroup == null)
                {
                    throw new GameFrameworkException("Sound group is invalid.");
                }

                if (soundHelper == null)
                {
                    throw new GameFrameworkException("Sound helper is invalid.");
                }

                if (soundAgentHelper == null)
                {
                    throw new GameFrameworkException("Sound agent helper is invalid.");
                }

                m_SoundGroup       = soundGroup;
                m_SoundHelper      = soundHelper;
                m_SoundAgentHelper = soundAgentHelper;
                m_SoundAgentHelper.ResetSoundAgent += OnResetSoundAgent;
                m_SerialId   = 0;
                m_SoundAsset = null;
                Reset();
            }
        /// <summary>
        /// 设置声音辅助器。
        /// </summary>
        /// <param name="soundHelper">声音辅助器。</param>
        public void SetSoundHelper(ISoundHelper soundHelper)
        {
            if (soundHelper == null)
            {
                throw new GameFrameworkException("Sound helper is invalid.");
            }

            m_SoundHelper = soundHelper;
        }
Example #3
0
        /// <summary>
        /// 设置声音辅助器。
        /// </summary>
        /// <param name="soundHelper">声音辅助器。</param>
        public void SetSoundHelper(ISoundHelper soundHelper)
        {
            if (soundHelper == null)
            {
                throw new System.Exception("Sound helper is invalid.");
            }

            m_SoundHelper = soundHelper;
        }
Example #4
0
 public void OnAwake()
 {
     m_SoundGroups           = new Dictionary <string, SoundGroup>(StringComparer.Ordinal);
     m_SoundsBeingLoaded     = new List <int>();
     m_SoundsToReleaseOnLoad = new HashSet <int>();
     m_LoadAssetCallbacks    = new LoadAssetCallbacks(LoadAssetSuccessCallback, LoadAssetFailureCallback, LoadAssetUpdateCallback, LoadAssetDependencyAssetCallback);
     m_ResourceManager       = null;
     m_SoundHelper           = null;
     m_Serial = 0;
 }
Example #5
0
 /// <summary>
 /// 初始化声音管理器的新实例。
 /// </summary>
 public SoundManager()
 {
     m_SoundGroups                          = new Dictionary <string, SoundGroup>();
     m_LoadAssetCallbacks                   = new LoadAssetCallbacks(LoadSoundSuccessCallback, LoadSoundFailureCallback, LoadSoundUpdateCallback, LoadSoundDependencyAssetCallback);
     m_ResourceManager                      = null;
     m_SoundHelper                          = null;
     m_Serial                               = 0;
     m_PlaySoundSuccessEventHandler         = null;
     m_PlaySoundFailureEventHandler         = null;
     m_PlaySoundUpdateEventHandler          = null;
     m_PlaySoundDependencyAssetEventHandler = null;
 }
 /// <summary>
 /// 初始化声音管理器的新实例。
 /// </summary>
 public SoundManager()
 {
     m_SoundGroups           = new Dictionary <string, SoundGroup>();
     m_SoundsBeingLoaded     = new List <int>();
     m_SoundsToReleaseOnLoad = new HashSet <int>();
     m_LoadAssetCallbacks    = new LoadAssetCallbacks(LoadSoundSuccessCallback, LoadSoundFailureCallback, LoadSoundUpdateCallback, LoadSoundDependencyAssetCallback);
     m_ResourceManager       = null;
     m_SoundHelper           = null;
     m_Serial = 1;
     m_PlaySoundSuccessEventHandler         = null;
     m_PlaySoundFailureEventHandler         = null;
     m_PlaySoundUpdateEventHandler          = null;
     m_PlaySoundDependencyAssetEventHandler = null;
 }
Example #7
0
 /// <summary>
 /// 增加声音代理辅助器。
 /// </summary>
 /// <param name="soundHelper">声音辅助器接口。</param>
 /// <param name="soundAgentHelper">要增加的声音代理辅助器。</param>
 public void AddSoundAgentHelper(ISoundHelper soundHelper, ISoundAgentHelper soundAgentHelper)
 {
     m_SoundAgents.Add(new SoundAgent(this, soundHelper, soundAgentHelper));
 }