Ejemplo n.º 1
0
    /// <summary>
    /// 进入上一个频道 没有就直接主播频道
    /// </summary>
    /// <param name="go"></param>
    void OnClickMuteBtn(GameObject go)
    {
        //如果当前加入房间则退出

        if (GVoiceManger.Instance.JoinRoomType != JoinRoomEnum.None)
        {
            GVoiceManger.Instance.QuitRoom(GVoiceManger.Instance.JoinRoomName);
            return;
        }

        JoinRoomEnum preRoom = GVoiceManger.Instance.PreJoinRoomType;

        if (preRoom == JoinRoomEnum.None)
        {
            //TODO 加入主播频道
            JoinCommand();
        }
        else if (preRoom == JoinRoomEnum.Nation)
        {
            JoinClan();
        }
        else if (preRoom == JoinRoomEnum.Team)
        {
            JoinTeam();
        }
    }
Ejemplo n.º 2
0
    public void OnQuitRoomComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string roomName, int memberID)
    {
        Debug.Log(string.Format("GVoiceManger OnQuitRoomComplete {0}/{1}/{2}", code, roomName, memberID));
        if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_QUITROOM_SUCC)
        {
            GameCmd.stVoiceChatOperChatUserCmd_CS cmd = new GameCmd.stVoiceChatOperChatUserCmd_CS();
            if (roomName.StartsWith("team"))
            {
                QuitRoomAudioUpdate();

                cmd.chtype = GameCmd.VoChatType.VoChatType_Team;
                //退出游戏的时候退出聊天室 回调没有回来 重新登入游戏 回调回再次回来
                if (JoinRoomType != JoinRoomEnum.None)
                {
                    PreJoinRoomType = JoinRoomEnum.Team;
                }
                if (DataManager.Manager <TeamDataManager>().IsJoinTeam)
                {
                    cmd.posid  = (uint)memberID;
                    cmd.optype = GameCmd.VoChatOpType.VoChatOpType_Leave;
                    NetService.Instance.Send(cmd);
                }
            }
            else if (roomName.StartsWith("national"))
            {
                cmd.chtype = GameCmd.VoChatType.VoChatType_Clan;
                if (JoinRoomType != JoinRoomEnum.None)
                {
                    PreJoinRoomType = JoinRoomEnum.Nation;
                }

                if (DataManager.Manager <ClanManger>().IsJoinClan)
                {
                    cmd.posid  = (uint)memberID;
                    cmd.optype = GameCmd.VoChatOpType.VoChatOpType_Leave;
                    NetService.Instance.Send(cmd);
                }
            }
            else
            {
                QuitRoomAudioUpdate();
            }

            JoinRoomType = JoinRoomEnum.None;
            JoinRoomName = "";
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CHAT_LEVELROOM, null);

            if (m_onQuitRoom != null)
            {
                m_onQuitRoom(true);
            }
        }
        else
        {
            QuitRoom(roomName);
        }
        IsOpenMic             = false;
        m_strLastJoinRoomName = "";
    }
Ejemplo n.º 3
0
    /// 进入房间回调
    /// </summary>
    /// <param name="code"></param>
    /// <param name="roomName"></param>
    /// <param name="memberID"></param>
    ///
    public void OnJoinRoomCompleteHandler(IGCloudVoice.GCloudVoiceCompleteCode code, string roomName, int memberID)
    {
        Debug.Log(string.Format("GVoiceManger OnJoinRoomCompleteHandler {0}/{1}/{2}", code, roomName, memberID));

        if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_SUCC)
        {
            if (roomName.StartsWith("team"))
            {
                JoinRoomAudioUpdate();
            }
            else if (roomName.StartsWith("national"))
            {
            }
            else
            {
                JoinRoomAudioUpdate();
            }
        }


        if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_SUCC)
        {
            m_nJoinRoomErrorTime = 0;
            this.JoinRoomName    = roomName;
            this.MemberId        = memberID;
            GameCmd.stVoiceChatOperChatUserCmd_CS cmd = new GameCmd.stVoiceChatOperChatUserCmd_CS();
            if (roomName.StartsWith("team"))
            {
                cmd.chtype   = GameCmd.VoChatType.VoChatType_Team;
                JoinRoomType = JoinRoomEnum.Team;
            }
            else if (roomName.StartsWith("national"))
            {
                cmd.chtype   = GameCmd.VoChatType.VoChatType_Clan;
                JoinRoomType = JoinRoomEnum.Nation;
            }

            cmd.posid  = (uint)memberID;
            cmd.optype = GameCmd.VoChatOpType.VoChatOpType_Add;
            NetService.Instance.Send(cmd);

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CHAT_JOINROOM, new Client.stVoiceJoinRoom()
            {
                succ = true, memberid = memberID, name = roomName
            });
        }
        else if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_TIMEOUT || code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_SVR_ERR)
        {
            if (!string.IsNullOrEmpty(m_strLastJoinRoomName))
            {
                m_nJoinRoomErrorTime++;
                if (m_strLastJoinRoomName.StartsWith("team"))
                {
                    if (m_nJoinRoomErrorTime >= 3)
                    {
                        TipsManager.Instance.ShowTips("加入队伍聊天室失败重新加入");
                    }
                    JoinTeamRoom();
                }
                else if (m_strLastJoinRoomName.StartsWith("national"))
                {
                    if (m_nJoinRoomErrorTime >= 3)
                    {
                        TipsManager.Instance.ShowTips("加入氏族聊天室失败重新加入");
                    }
                    JoinClanRoom();
                }
                else
                {
                    TipsManager.Instance.ShowTips("加入房间失败 房间名字未知");
                }
            }
            else
            {
                TipsManager.Instance.ShowTips("加入房间失败 房间名字为空");
            }
        }
    }