/// <summary> /// 播放特殊枚举标注的音效 /// </summary> /// <param name="ComboId">组合ID</param> /// <param name="type">类型</param> /// <param name="palce">第几人称</param> /// <param name="alreadyPrepare">是否已经 Prepare 加载了 一般给 false</param> /// <param name="point">位置</param> public static void PlaySound(int ComboId, WwiseMusicSpecialType type, WwiseMusicPalce palce, bool alreadyPrepare, Vector3 point, Action <SystemObject> playEndAction = null, SystemObject userEndData = null) { MsgPlaySpecialTypeMusicOrSound parame = new MsgPlaySpecialTypeMusicOrSound(); parame.ComboId = ComboId; parame.type = type; parame.palce = palce; parame.alreadyPrepare = alreadyPrepare; parame.point = point; parame.UseSoundParent = false; parame.endAction = playEndAction; parame.userEndData = userEndData; GameFacade.Instance.SendNotification(NotificationName.MSG_SOUND_PLAY, parame); }
public override void OnInitialize(ISpacecraftSoundProperty property) { m_SpacecraftSoundProperty = property; m_Cgeternityproxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; if (m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htMonster) { /// TODO 怪物后续走表 m_MusicComboID = 1001; } else if (m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htPlayer) { m_MusicComboID = m_Cgeternityproxy.GetItemByKey(property.GetItemID()).ItemUnion <Warship>().Value.MusicComboID; } if (!m_SpacecraftSoundProperty.IsMain()) { m_WwiseMusicPalce = WwiseMusicPalce.Palce_3st; } /// TODO. /// 处理探查掉落音效,先在newhero中处理跑通流程,后续根据状态协议处理 KHeroType heroType = m_SpacecraftSoundProperty.GetHeroType(); if (heroType == KHeroType.htNormalChest) { PlayVideoSound((int)m_Cgeternityproxy.GetGamingConfig(1).Value.Treasure.Value.Sound.Value.OrdinaryChestRefresh); } else if ((heroType == KHeroType.htRareChestGuard || heroType == KHeroType.htNormalChestGuard) && m_SpacecraftSoundProperty.IsSeal()) { PlaySystemSound(WwiseMusicSpecialType.SpecialType_Voice_treasure_event2, (object obj) => { PlayVideoSound((int)m_Cgeternityproxy.GetGamingConfig(1).Value.Treasure.Value.Sound.Value.JammerRefresh); }); } }
/// <summary> /// 播放特殊枚举类型音效 /// 注:必须属于组合表内表明定义的 /// </summary> /// <param name="ComboId">组合Id</param> /// <param name="type">类型枚举</param> /// <param name="place">主角or其他 --玩家跟主角音效不同,目前只有船有需求</param> ///<param name="alreadyPrepare">是否已经执行了预先加载事件 Prepare</param> /// <param name="point">播放位置</param> public static void PlaySpecialTypeMusicOrSound(int ComboId, WwiseMusicSpecialType type, WwiseMusicPalce place, bool alreadyPrepare, Vector3 point, Action<object> endAction = null, SystemObject userEndData = null) { if (ComboId <= 0) return; CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; SoundComboData?[] soundCombos = cfgEternityProxy.GetSoundComboDataByKey(ComboId); int musicId = -1; for (int i = 0; i < soundCombos.Length; i++) { if (soundCombos[i].Value.Type == (int)type && soundCombos[i].Value.Place == (int)place) { musicId = soundCombos[i].Value.MusicId; break; } } if (musicId <= 0) { Debug.LogWarning(string.Format("检查表SoundCombo 表,数据不对 ComboId = {0}, type = {1}", ComboId, (int)type)); return; } PlayMusicOrSound(musicId, alreadyPrepare, point, endAction); }