public override void Play(ISkillAttacker attacker, SkillEffect se) { m_ef = se; SoundNodeProp prop = m_NodeProp as SoundNodeProp; if (prop == null) { return; } m_NodeProp.only_main_role = true; if (prop.snd_name == "") { return; } bLoop = prop.bloop; m_fAudioEndTime = prop.endTime; Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio == null) { return; } if (attacker == null) { Log.LogGroup("ZDY", "attacker is null"); return; } if (attacker.GetGameObject() == null) { Log.LogGroup("ZDY", "entity is null"); return; } if (attacker.GetGameObject().GetNode() == null) { Log.LogGroup("ZDY", "entity GetNode is null"); return; } Transform trans = attacker.GetGameObject().GetTransForm(); if (trans == null) { Log.LogGroup("ZDY", "entity GetNode GetTransForm is null"); return; } m_audioID = audio.PlayEffect(trans.gameObject, prop.snd_name, bLoop); uint stopTime = (uint)(m_fAudioEndTime * 1000); if (bLoop) { TimerAxis.Instance().SetTimer(m_uAuidoStopTimerID, stopTime, this, 1); } }
public void OnTimer(uint uTimerID) { if (uTimerID == m_timerID) { if (!string.IsNullOrEmpty(m_strAudioPath)) { Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio == null) { return; } Transform trans = m_Owner.GetTransForm(); if (trans != null) { audio.PlayEffect(trans.gameObject, m_strAudioPath); } } } }
/// <summary> /// 执行跳过 /// </summary> private void DoJump() { if (m_dialogInfo != null) { if (m_dialogInfo.talkVoice != null && m_dialogInfo.lstTalks.Count == m_dialogInfo.talkVoice.Length) { if (m_nindex == m_dialogInfo.talkVoice.Length - 1) { JumpEnd(); return; } Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null && m_nPlayingAudioId != 0) { audio.StopEffect(m_nPlayingAudioId); } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(m_dialogInfo.talkVoice[m_dialogInfo.lstTalks.Count - 1]); if (resDB == null) { Engine.Utility.Log.Error("找不到选择角色的Mp3资源"); } if (audio != null && resDB != null) { //m_nPlayingAudioId = audio.PlayUIEffect(resDB.strPath); Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer; Transform tf = mainPlayer.GetTransForm(); if (tf != null) { m_nPlayingAudioId = audio.PlayEffect(tf.gameObject, resDB.strPath, false, true); } } } } JumpEnd(); }
bool ShowTalkStr(int nindex) { bool success = false; if (m_dialogInfo != null) { if (m_dialogInfo.buttons != null) { if (m_dialogInfo.buttons.Count < 2) { StopAllCoroutines(); //倒计时 tempTime = 0; CLOSETIME = CONST_TASK_CD; m_label_LabelNext.gameObject.SetActive(true); m_label_LabelNext.text = ((int)CLOSETIME).ToString() + "秒后自动跳过"; StartCoroutine(WaitToClose()); } else { m_label_LabelNext.gameObject.SetActive(false); } } } ResetDes(); if (m_dialogInfo != null) { if (m_dialogInfo.lstTalks != null) { if (nindex < m_dialogInfo.lstTalks.Count) { LangTalkData.Talk talkInfo = m_dialogInfo.lstTalks[nindex]; if (talkInfo.bUser) { string name = ""; if (Client.ClientGlobal.Instance().MainPlayer != null) { name = Client.ClientGlobal.Instance().MainPlayer.GetName(); } m_label_nameLabel.text = name; ShowRoleTexture(true); } else { table.NpcDataBase npcdata = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(m_dialogInfo.nNpcId); if (npcdata != null) { ShowRoleTexture(false, npcdata); m_label_nameLabel.text = npcdata.strName; } } bool useRichText = false;//富文本有泄漏bug 暂时不用 if (useRichText) { string desc = string.Format("<size value=\"24\"><color value=\"#1c2850\">{0} </color></size>", talkInfo.strText); if (uiXmlRichText != null) { this.uiXmlRichText.fontSize = 24; this.uiXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(desc)); } } else { string desc = string.Format("[1c2850]{0}[-]", talkInfo.strText); m_label_normalText.text = desc; } success = true; } } if (m_dialogInfo.talkVoice != null && nindex < m_dialogInfo.talkVoice.Length) { Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null && m_nPlayingAudioId != 0) { audio.StopEffect(m_nPlayingAudioId); } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(m_dialogInfo.talkVoice[nindex]); if (resDB == null) { Engine.Utility.Log.Error("找不到选择角色的Mp3资源"); } if (audio != null && resDB != null) { //m_nPlayingAudioId = audio.PlayUIEffect(resDB.strPath); Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer != null) { Transform tf = mainPlayer.GetTransForm(); if (tf != null) { m_nPlayingAudioId = audio.PlayEffect(tf.gameObject, resDB.strPath, false, true); } } } } } //是否显示下一个 //bool nextVisible = (null != m_dialogInfo // && null != m_dialogInfo.lstTalks // && (m_dialogInfo.lstTalks.Count > nindex + 1)); //if (null != m_label_LabelNext && m_label_LabelNext.gameObject.activeSelf != nextVisible) //{ // m_label_LabelNext.gameObject.SetActive(nextVisible); //} return(success); }