コード例 #1
0
ファイル: SoundNode.cs プロジェクト: sjb8100/src
 public override void Stop()
 {
     Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
     if (audio != null)
     {
         audio.StopEffect(m_audioID);
     }
 }
コード例 #2
0
 private void QuitRoomAudioUpdate()
 {
     Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
     if (au != null)
     {
         if (m_fSrcEffectVolume > 0f)
         {
             au.SetEffectVolume(m_fSrcEffectVolume);
         }
         au.SetMusicVolume(m_fSrcMusicVolume);
     }
 }
コード例 #3
0
ファイル: SoundNode.cs プロジェクト: sjb8100/src
        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);
            }
        }
コード例 #4
0
 public void CloseMicInRoom_Small()
 {
     IsOpenMicInRoom = false;
     CloseMic();
     //GVoiceManger.Instance.SoundMute(true);
     Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
     if (au != null)
     {
         m_fSrcEffectVolume = au.GetEffectVolume();
         float f = m_fSrcEffectVolume * 0.7f;
         au.SetEffectVolume(f);
     }
 }
コード例 #5
0
        //-------------------------------------------------------------------------------------------------------
        // 关掉游戏中声音
        public void MuteGameSound(bool bMute)
        {
            bool bMuteSound = (gameOption.GetInt("Sound", "CheckSound", 1) == 1);

            if (!bMuteSound)
            {
                Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
                if (audio != null)
                {
                    audio.Mute(bMute);
                }
            }
        }
コード例 #6
0
    private void JoinRoomAudioUpdate()
    {
        Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
        if (au != null)
        {
            m_fSrcMusicVolume  = au.GetMusicVolume();
            m_fSrcEffectVolume = au.GetEffectVolume();

            au.SetMusicVolume(0);

            float f = m_fSrcEffectVolume * 0.7f;
            au.SetEffectVolume(f);
        }
    }
コード例 #7
0
 //说话的时候暂时把背景音乐关掉
 public void SoundMute(bool flag)
 {
     Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
     if (flag == true)
     {
         Client.IGameOption option = Client.ClientGlobal.Instance().gameOption;
         bool value = option.GetInt("Sound", "CheckSound", 1) == 1;
         au.Mute(value);
     }
     else
     {
         au.Mute(!flag);
     }
 }
コード例 #8
0
ファイル: SoundNode.cs プロジェクト: sjb8100/src
 public override void Dead()
 {
     if (TimerAxis.Instance().IsExist(m_uAuidoStopTimerID, this))
     {
         TimerAxis.Instance().KillTimer(m_uAuidoStopTimerID, this);
     }
     Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
     if (audio != null)
     {
         audio.StopEffect(m_audioID);
     }
     bLoop = false;
     FreeToNodePool();
 }
コード例 #9
0
    public void OpenMicInRoom_Small()
    {
        IsOpenMicInRoom = true;
        OpenMic();
        //GVoiceManger.Instance.SoundMute(false);

        Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
        if (au != null)
        {
            if (m_fSrcEffectVolume > 0f)
            {
                au.SetEffectVolume(m_fSrcEffectVolume);
            }
        }
    }
コード例 #10
0
        //-------------------------------------------------------------------------------------------------------

        /**
         * @brief 用来处理游戏中退回到登录或者选人界面 或者地图时使用
         * @param bFlag 标识是否清理主角 true清理主角
         */
        public void Clear(bool bFlag = false)
        {
            Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem();
            if (renderSys != null && bFlag)
            {
                // 设置主Camera
                string         strCameraName = "MainCamera";
                Engine.ICamera cam           = renderSys.GetCamera(ref strCameraName);
                if (cam != null)
                {
                    cam.Enable(false);
                }
            }

            // 停止背景音乐
            Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
            if (audio != null && bFlag)
            {
                audio.StopMusic();
            }

            if (bFlag)
            {
                CmdManager.Instance().Clear();
            }
            if (m_ControllerSys != null)
            {
                m_ControllerSys.GetCombatRobot().Stop(true);
            }

            if (MainPlayer != null)
            {
                MainPlayer.SendMessage(EntityMessage.EntityCommand_StopMove, MainPlayer.GetPos());
            }

            if (m_EntitySys != null)
            {
                m_EntitySys.Clear(bFlag);
            }

            if (m_MapSystem != null)
            {
                m_MapSystem.ExitMap();
            }
            MainPlayer = null;

            Engine.RareEngine.Instance().UnloadUnusedResources();
        }
コード例 #11
0
ファイル: ChooseRolePanel.cs プロジェクト: zuojiashun/src
    protected override void OnHide()
    {
        ResetSelectRole();

        if (m_scene_obj)
        {
            if (m_Avater != null)
            {
                m_Avater.Destroy();
                m_Avater = null;
            }
        }
        Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
        if (audio != null)
        {
            audio.StopMusic();
        }
    }
コード例 #12
0
 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);
             }
         }
     }
 }
コード例 #13
0
    /// <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();
    }
コード例 #14
0
    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);
    }