示例#1
0
文件: Chat.cs 项目: isoundy000/shmj3d
    void playVoice()
    {
        VoiceMgr vmr = VoiceMgr.GetInstance();
        RoomMgr  rm  = RoomMgr.GetInstance();

        if (_playingSeat < 0 && mVoiceQueue.Count > 0)
        {
            ChatItem vm    = mVoiceQueue.Dequeue();
            string   msg   = vm.voice.msg;
            string   file  = vm.path;
            int      si    = rm.getSeatIndexByID(vm.sender);
            int      local = rm.getLocalIndex(si);
            _playingSeat = local;

            vmr.writeVoice(file, msg);
            vmr.play(file);

            if (playing != null)
            {
                playing.SetActive(false);
                playing = null;
            }

            playing = vm.vobj;
            if (playing != null)
            {
                playing.SetActive(true);
            }

            _lastPlayTime = PUtils.getMilliSeconds() + vm.voice.time;
        }
    }