Пример #1
0
    //服务端返回用户选牌
    public void OnEventChooseCard(byte[] buffer, int size)
    {
        CMD_S_SelectCard sendCard = NetUtil.BytesToStruct <CMD_S_SelectCard>(buffer);

        MyDebug.Log("========================用户选择的牌================================" + sendCard.w_selected_type);
        MyDebug.Log("========================选好后剩余的牌的可选牌型================================" + sendCard.w_left_card_type);
    }
Пример #2
0
    //状态
    private void OnSocketSubUserStatus(byte[] data, int dataSize)
    {
        if (dataSize < Marshal.SizeOf(typeof(CMD_GR_UserStatus)))
        {
            return;
        }
        CMD_GR_UserStatus pUserStatus = NetUtil.BytesToStruct <CMD_GR_UserStatus>(data);

        MyDebug.Log("=========" + pUserStatus.dwUserID + "==" + pUserStatus.UserStatus.wChairID + "==" +
                    pUserStatus.UserStatus.wTableID);
        PlayerStateVO state = new PlayerStateVO
        {
            userId     = (int)pUserStatus.dwUserID,
            chairState = pUserStatus.UserStatus.cbUserStatus
        };

        MyDebug.Log("UserStatus.cbUserStatus:" + pUserStatus.UserStatus.cbUserStatus);
        if (pUserStatus.UserStatus.cbUserStatus == Define.US_NULL)
        {
            //删除用户
        }
        else if (pUserStatus.UserStatus.cbUserStatus == Define.US_FREE)
        {
            //退出房间
            SetClientResponse(APIS.OUT_ROOM_RESPONSE, NetUtil.ObjToJson(state));
        }
    }
Пример #3
0
    //收到小战绩
    private void UerRoomRoundScore(byte[] tmpBuf)
    {
        CMD_MB_ROUND_LIST roundList = NetUtil.BytesToStruct <CMD_MB_ROUND_LIST>(tmpBuf);

        MainNewsDataManager.instance.SetMyQueryList(roundList);
        SocketEngine.Instance.SocketQuit();
    }
Пример #4
0
    //查找房间
    public void queryGomeInfo(byte[] tmpBuf, int size)
    {
        CMD_MB_QueryGameServer createLoginFail = NetUtil.BytesToStruct <CMD_MB_QueryGameServer>(tmpBuf);

        MyDebug.Log("###############################" + (createLoginFail.dwUserID));
        MyDebug.Log("###############################" + createLoginFail.dwUserID);
    }
Пример #5
0
    void HandReceiveData(TCP_Info tInfo, byte[] recvByte)
    {
        wRealySize = recvByte.Length;
        MyDebug.SocketLog("解密前wRealySize:" + wRealySize);
        if (wRealySize == 0)
        {
            SocketConnet();
            return;
        }

        var tmpBuf = new byte[wRealySize + 3];

        Array.Copy(recvByte, tmpBuf, wRealySize);
        wRealySize = NetUtil.CrevasseBuffer(tInfo, tmpBuf, wRealySize);
        MyDebug.SocketLog("解密后wRealySize:" + wRealySize);
        //解释数据
        var wDataSize = wRealySize - 4;
        var command   = (TCP_Command)NetUtil.BytesToStruct(tmpBuf, typeof(TCP_Command), 4);
        var buff      = new byte[wDataSize];

        Array.Copy(tmpBuf, 4, buff, 0, wDataSize);
        MyDebug.SocketLog("HandReceiveData 11:");
        if (command.wMainCmdID == (int)CMD_TYPE.MDM_KN_COMMAND &&
            command.wSubCmdID == (int)CMD_TYPE.SUB_KN_DETECT_SOCKET)
        {
        }
        else
        {
            MyDebug.SocketLog("REV- --main command: " + command.wMainCmdID + "-- Sub Command:" + command.wSubCmdID);
            //处理消息
            socketEvent.OnEventTCPSocketRead(command.wMainCmdID, command.wSubCmdID, buff, wDataSize);
        }

        MyDebug.SocketLog("HandReceiveData Over:");
    }
Пример #6
0
    //发送扑克
    private void OnEventSendCard(byte[] tmpBuf, int size)
    {
        CMD_SSS_SendCard sendCard = NetUtil.BytesToStruct <CMD_SSS_SendCard>(tmpBuf);

        GlobalDataScript.Instance.cardInfo          = new PlayerCardInfo();
        GlobalDataScript.Instance.cardInfo.cardlist = new int[sendCard.cbHandCardData.Length];
        GlobalDataScript.Instance.iswSpecialType    = sendCard.wSpecialType;
        MyDebug.Log("-------------------------------+++++++++++++++++++++++++++++++++++++" + GlobalDataScript.Instance.iswSpecialType);
        for (int i = 0; i < sendCard.cbHandCardData.Length; i++)
        {
            MyDebug.Log("发送扑克发送扑克发送扑克发送扑克发送扑克:" + sendCard.cbHandCardData[i]);
            GlobalDataScript.Instance.cardInfo.cardlist[i] = NetUtil.PuCardChange((PU_KE)sendCard.cbHandCardData[i]);
        }
        GlobalDataScript.Instance.cardInfo.sortedList = new List <List <int> >();
        for (int i = 0; i < sendCard.cb_sorted_card.Length; i++)
        {
            List <int> list = new List <int>();
            for (int j = 0; j < sendCard.cb_sorted_card[i].sorted_card.Length; j++)
            {
                list.Add(NetUtil.PuCardChange((PU_KE)sendCard.cb_sorted_card[i].sorted_card[j]));
            }
            GlobalDataScript.Instance.cardInfo.sortedList.Add(list);
        }
        SetPuKType(sendCard.w_select_card_type);
        SocketEventHandle.Instance.SetClientResponse(APIS.STARTGAME_RESPONSE_NOTICE, null);
    }
Пример #7
0
    //服务端返回用户选牌
    public void OnEventChooseCard(byte[] buffer, int size)
    {
        GameDataSSS.Instance.choiceCard.Clear();
        CMD_S_SelectCard sendCard = NetUtil.BytesToStruct <CMD_S_SelectCard>(buffer);

        if (sendCard.cb_select_card[4] > 0)
        {
            GameDataSSS.Instance.choiceCard.Clear();
            for (int i = 0; i < sendCard.cb_select_card.Length; i++)
            {
                int cardPoint = NetUtil.PuCardChange((PU_KE)sendCard.cb_select_card[i]);
                GameDataSSS.Instance.choiceCard.Add(cardPoint);
                GameDataSSS.Instance.lastCard.Remove(cardPoint);
            }
            MyDebug.Log("LastCard:" + GameDataSSS.Instance.lastCard.Count);
            MyDebug.Log("ChoicedCard:" + GameDataSSS.Instance.choiceCard.Count);
            SocketEventHandle.Instance.SetClientResponse(APIS.PICKCARD_RESPONSE, null);
            //用户选牌,返回选的牌
        }
        else
        {
            //用户放牌,剩余可选类型
            SetPuKType(sendCard.w_left_card_type);
            SocketEventHandle.Instance.SetClientResponse(APIS.RETURN_INFO_RESPONSE, null);
            MyDebug.Log("LastCard:" + GameDataSSS.Instance.lastCard.Count);
            MyDebug.Log("ChoicedCard:" + GameDataSSS.Instance.choiceCard.Count);
        }
        MyDebug.Log("========================用户选择的牌================================" + sendCard.w_selected_type);
        MyDebug.Log("========================选好后剩余的牌的可选牌型================================" + sendCard.w_left_card_type);
    }
Пример #8
0
 //登陆成功
 private void OnSocketSubLogonSuccess(byte[] tmpBuf, int size)
 {
     GlobalDataScript.userData = NetUtil.BytesToStruct <CMD_MB_LogonSuccess>(tmpBuf);
     // string name = NetUtil.BytesToString(GlobalDataScript.userData.szNickName);
     #region
     //MyDebug.Log("登陆成功  222");
     //AvatarVO avatar = new AvatarVO
     //{
     //    account = new Account()
     //};
     //avatar.account.nickname = LoginData.wxUserInfo.nickname;
     //avatar.account.sex = LoginData.wxUserInfo.sex;
     //avatar.account.uuid = (int)logSucess.dwUserID;
     //avatar.account.headicon = LoginData.wxUserInfo.headimgurl;
     //avatar.account.roomcard = (int)logSucess.lUserScore;
     //if (GlobalDataScript.weChatInformation == null)
     //    GlobalDataScript.weChatInformation = new WeChatInformation();
     //GlobalDataScript.weChatInformation.weChatName = LoginData.wxUserInfo.nickname;
     //GlobalDataScript.weChatInformation.sex = LoginData.wxUserInfo.sex;
     //MyDebug.Log("登陆成功  333");
     //avatar.IP = "0"; // GlobalDataScript.getInstance().getIpAddress();
     //response.message = JsonMapper.ToJson(avatar);
     //GlobalDataScript.userData = logSucess;
     //MyDebug.Log("登陆成功   444");
     //SocketEventHandle.Instance.AddResponse(response);
     //MyDebug.Log("登陆成功    555");
     #endregion
 }
Пример #9
0
    private void ShowPlayerCard(byte[] tmpBuf)
    {
        CMD_S_ShowCard showCard = NetUtil.BytesToStruct <CMD_S_ShowCard>(tmpBuf);

        GameDataSSS.Instance.playersCard = showCard;
        if (GlobalDataScript.Instance.myGameRoomInfo.chairId == showCard.wChairID)
        {
            if (showCard.m_b_dao_shui == 1)
            {
                SocketEventHandle.Instance.SetTips("请按照:第一墩<第二墩<第三墩 牌型排列!");
                SocketEventHandle.Instance.SetClientResponse(APIS.CHUPAI_RESPONSE, "0");
            }
            else
            {
                SocketEventHandle.Instance.SetClientResponse(APIS.CHUPAI_RESPONSE, "1");
            }
        }
        else
        {
            if (showCard.m_b_dao_shui == 1)
            {
                return;
            }

            SocketEventHandle.Instance.SetClientResponse(APIS.CHUPAI_RESPONSE, null);
        }
    }
Пример #10
0
    //房主强制结算返回信息
    public void OnEnventDissumeTable(byte[] buffer, int size)
    {
        isDisslove = true;
        CMD_GR_DissumeTable dissumeTable = NetUtil.BytesToStruct <CMD_GR_DissumeTable>(buffer);

        SocketSendManager.Instance.StandUp();
    }
Пример #11
0
    // 登陆失败
    private void OnSocketSubLogonFailure(byte[] tmpBuf, int size)
    {
        CMD_MB_LogonFailure logonError =
            (CMD_MB_LogonFailure)NetUtil.BytesToStruct(tmpBuf, typeof(CMD_MB_LogonFailure), size);

        OnGPLoginFailure(logonError.lResultCode, NetUtil.BytesToString(logonError.szDescribeString));
    }
Пример #12
0
    //返回搜索房间结果
    public void Search_Result(byte[] tmpBuf, int size)
    {
        CMD_MB_SearchResult result = NetUtil.BytesToStruct <CMD_MB_SearchResult>(tmpBuf);

        if (result.dwServerID == 0)
        {
            MyDebug.Log("返回搜索房间结果");
            SocketEventHandle.Instance.SetTips("房间号不存在!!!");
            SocketEngine.Instance.SocketQuit();
            return;
        }
        SocketEngine.Instance.SocketQuit(false);
        TagGameServer serverInfo = CServerListData.Instance.GetTagServerByServerID((int)result.dwServerID);

        if (serverInfo.wKindID == GlobalDataScript.SSS_KIND_ID)
        {
            SocketSSSEvent.instance.Init();
            SocketSSSEvent.instance.tableId = (int)result.dwTableID;
            SocketSSSEvent.instance.ConnectGameServerByServerID(serverInfo.wServerID);
        }

        //牛牛待添加...
        else if (serverInfo.wKindID == GlobalDataScript.NN_KIND_ID)
        {
            SocketNiuNiuEvent.instance.Init();
            SocketNiuNiuEvent.instance.tableId = (int)result.dwTableID;
            SocketNiuNiuEvent.instance.ConnectGameServerByServerID(serverInfo.wServerID);
        }
    }
Пример #13
0
    //解散房间
    private bool OnSocketSubPrivateDismissInfo(byte[] data, int dataSize)
    {
        if (dataSize != Marshal.SizeOf(typeof(CMD_GF_Private_Dismiss_Info)))
        {
            return(false);
        }
        var pNetInfo = NetUtil.BytesToStruct <CMD_GF_Private_Dismiss_Info>(data);
        var orrv     = new OutRoomResponseVo
        {
            dwDissUserCout     = (int)pNetInfo.dwDissUserCout,
            dwNotAgreeUserCout = (int)pNetInfo.dwNotAgreeUserCout,
            dwDissChairID      = new int[pNetInfo.dwDissUserCout],
            dwNotAgreeChairID  = new int[pNetInfo.dwNotAgreeUserCout]
        };

        for (int i = 0; i < pNetInfo.dwDissUserCout; i++)
        {
            orrv.dwDissChairID[i] = (int)pNetInfo.dwDissChairID[i];
        }

        for (int i = 0; i < pNetInfo.dwNotAgreeUserCout; i++)
        {
            orrv.dwNotAgreeChairID[i] = (int)pNetInfo.dwNotAgreeChairID[i];
        }

        MyDebug.Log("OnSocketSubPrivateDismissInfo:解散房间");
        SetClientResponse(APIS.DISSOLIVE_ROOM_RESPONSE, NetUtil.ObjToJson(orrv));
        return(true);
    }
Пример #14
0
    //开始游戏
    public void OnEventGameStart(byte[] tmpBuf, int size)
    {
        CMD_S_GameStart gameStart = NetUtil.BytesToStruct <CMD_S_GameStart>(tmpBuf);

        MyDebug.Log("房间号" + (long)(gameStart.lUserScore));
        MyDebug.Log("房间号" + (ushort)(gameStart.wSpecialType));
        MyDebug.Log("房间号" + NetUtil.BytesToStruct <CMD_S_GameStart>(tmpBuf));
    }
Пример #15
0
 // 升级提示
 private void OnSocketSubUpdateNotify(int sub, byte[] tmpBuf, int size)
 {
     if (sub == (int)SUB_GP_LOGON_STATE.SUB_MB_UPDATE_NOTIFY)
     {
         CMD_MB_UpdateNotify update = NetUtil.BytesToStruct <CMD_MB_UpdateNotify>(tmpBuf);
         // OnGPLoginFailure(updateTip.cbAdviceUpdate, NetUtil.BytesToString(logonError.szDescribeString));
     }
 }
Пример #16
0
    //创建房间失败
    public void CreateFail(byte[] tmpBuf, int size)
    {
        CMD_GR_CreateFailure createFail = NetUtil.BytesToStruct <CMD_GR_CreateFailure>(tmpBuf);

        SocketEventHandle.Instance.SetTips(NetUtil.BytesToString(createFail.szDescribeString));
        SocketEngine.Instance.SocketQuit();
        MyDebug.Log("创建房间失败" + NetUtil.BytesToString(createFail.szDescribeString));
    }
Пример #17
0
    private bool OnSocketSubPrivateInfo(byte[] data, int dataSize)
    {
        var pNetInfo = NetUtil.BytesToStruct <CMD_GR_Private_Info>(data);

        SocketSendManager.Instance.OnSocketSubPrivateInfo();
        SocketSendManager.Instance.GetGameOption();
        return(true);
    }
Пример #18
0
    public void RequestFailure(byte[] buffer)
    {
        CMD_GR_RequestFailure requestFailure = NetUtil.BytesToStruct <CMD_GR_RequestFailure>(buffer);

        SocketEngine.Instance.SocketQuit();
        MyDebug.Log("=============================请求失败====================" + NetUtil.BytesToString(requestFailure.szDescribeString));
        SocketEventHandle.Instance.SetTips(NetUtil.BytesToString(requestFailure.szDescribeString));
    }
Пример #19
0
    private void OnSocketSubSystemMessage(byte[] data, int dataSize)
    {
        var pSystemMessage = NetUtil.BytesToStruct <CMD_CM_SystemMessage>(data);
        var wType          = pSystemMessage.wType;

        SocketEventHandle.Instance.iscloseLoading = true;
        SocketEventHandle.Instance.SetTips(NetUtil.GetServerLog(pSystemMessage.szString));
        //关闭处理
        if ((wType & (Define.SMT_CLOSE_ROOM | Define.SMT_CLOSE_LINK)) != 0)
        {
            MyDebug.Log("关闭处理");
        }

        //显示消息
        if ((wType & Define.SMT_CHAT) == 1)
        {
            MyDebug.Log("显示消息");
            //SocketEventHandle.Instance.iscloseLoading = true;
            //if (mIStringMessageSink)
            //{
            //    mIStringMessageSink->InsertSystemString(pSystemMessage->szString);
            //}
        }
        //弹出消息
        else if ((wType & Define.SMT_EJECT) == 1)
        {
            MyDebug.Log("弹出消息");
            //if (mIStringMessageSink)
            //{
            //    mIStringMessageSink->InsertPromptString(pSystemMessage->szString, 0);
            //}
        }

        //关闭游戏
        if ((wType & Define.SMT_CLOSE_GAME) == 1)
        {
            MyDebug.Log("关闭游戏s");
            //if (mIStringMessageSink)
            //{
            //    mIStringMessageSink->InsertSystemString(pSystemMessage->szString);
            //}
            //OnGFGameClose(0);
        }



        //关闭房间
        if ((wType & Define.SMT_CLOSE_ROOM) == 1)
        {
            MyDebug.Log("关闭房间");
            //if (mIStringMessageSink)
            //{
            //    mIStringMessageSink->InsertSystemString(pSystemMessage->szString);
            //}
            //OnGFGameClose(0);
        }
    }
Пример #20
0
    private void OnSubOperateNotify(byte[] tmpBuf, int size)
    {
        var mm             = new MahjongMotion();
        var pOperateNotify = NetUtil.BytesToStruct <CMD_S_OperateNotify>(tmpBuf);

        MyDebug.Log("还原用户:" + pOperateNotify.wResumeUser);
        if (pOperateNotify.cbActionMask != (int)WIK.WIK_NULL)
        {
            MyDebug.Log(MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateNotify.cbActionCard) +
                        "操作命令llllllllllllllllllllllllllllllllllllllllllllllllllll:" + pOperateNotify.cbActionMask);
            mm.cardID = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateNotify.cbActionCard);
            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_CHI_HU)) > 0)
            {
                //胡
                mm.isChiHuMotion = true;
            }

            if ((pOperateNotify.cbActionMask & (byte)WIK.WIK_GANG) > 0)
            {
                mm.isGangMotion = true;
                //杠
            }

            if ((pOperateNotify.cbActionMask & (byte)WIK.WIK_PENG) > 0)
            {
                mm.isPengMotion = true;
                //碰
            }

            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_LEFT)) > 0)
            {
                //吃
                MyDebug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1Chi Type:WIK_LEFT");
                mm.isLeftMotion = true;
                mm.chiCount++;
                mm.type = pOperateNotify.cbActionMask;
            }

            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_CENTER)) > 0)
            {
                MyDebug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1Chi Type:WIK_CENTER");
                mm.isCenterMotion = true;
                mm.chiCount++;
                mm.type = pOperateNotify.cbActionMask;
            }

            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_RIGHT)) > 0)
            {
                MyDebug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1Chi Type:WIK_RIGHT");
                mm.isRightMotion = true;
                mm.chiCount++;
                mm.type = pOperateNotify.cbActionMask;
            }
        }

        SetClientResponse(APIS.RETURN_INFO_RESPONSE, NetUtil.ObjToJson(mm));
    }
Пример #21
0
    //用户进入返回用户信息
    public void UserInfoHead(byte[] tmpBuf, int size)
    {
        if (GlobalDataScript.Instance.playerInfos == null)
        {
            GlobalDataScript.Instance.playerInfos = new List <PlayerGameRoomInfo>();//登录完成初玩家始化信息
        }
        MyDebug.Log("USerID:" + GlobalDataScript.userData.dwUserID);
        tagMobileUserInfoHead tagUserInfo = NetUtil.BytesToStruct <tagMobileUserInfoHead>(tmpBuf);

        if (tagUserInfo.wTableID != tableId)
        {
            return;
        }
        MyDebug.Log(tagUserInfo.dwUserID + "=======================" + size + "===table ID=========================" + tagUserInfo.wTableID);
        PlayerGameRoomInfo info = new PlayerGameRoomInfo();

        info.chairId = tagUserInfo.wChairID;
        info.tableId = tagUserInfo.wTableID;
        info.userID  = (int)tagUserInfo.dwUserID;
        info.wFaceID = tagUserInfo.wFaceID;
        MyDebug.Log(tagUserInfo.szNickName.Length);
        try
        {
            info.name = NetUtil.ChatsToString(tagUserInfo.szNickName);
        }
        catch
        {
            MyDebug.LogError("---------------------------------------------------------------------+++++++++++++++++++++++++++");
        }
        MyDebug.Log(info.name);

        if (tagUserInfo.cbUserStatus == 2)
        {
            if (GlobalDataScript.type == ModeType.None)
            {
                SocketEventHandle.Instance.SetClientResponse(APIS.JOIN_ROOM_NOICE, NetUtil.ObjToJson(info));
            }
        }
        if (GlobalDataScript.userData.dwUserID == info.userID)
        {
            GlobalDataScript.Instance.myGameRoomInfo = info;
        }

        for (int i = 0; i < GlobalDataScript.Instance.playerInfos.Count; i++)
        {
            if (GlobalDataScript.Instance.playerInfos[i].userID == info.userID)
            {
                return;
            }
        }
        if (GlobalDataScript.Instance.roomInfo != null)
        {
            MyDebug.Log(GlobalDataScript.Instance.roomInfo.PlayGameCount);
        }
        MyDebug.Log(isDisConnect);
        GlobalDataScript.Instance.playerInfos.Add(info);
    }
Пример #22
0
 //大结算返回消息
 public void OnEventAllGameOver(byte[] buffer)
 {
     GameDataNN.Instance.AllgameEnd       = NetUtil.BytesToStruct <CMD_GR_PersonalTableEnd>(buffer);
     GlobalDataScript.Instance.isExitGame = true;
     if (GlobalDataScript.Instance.isSigGameOver)
     {
         GlobalDataScript.Instance.showAllGameEnd = true;
     }
 }
Пример #23
0
    //=============================读取结构方法========================//
    #region 读取
    //创建房间时登录失败
    public void LogInFail(byte[] tmpBuf, int size)
    {
        CMD_GR_CreateLogonFailure createLoginFail = NetUtil.BytesToStruct <CMD_GR_CreateLogonFailure>(tmpBuf);

        SocketEventHandle.Instance.SetTips(NetUtil.BytesToString(createLoginFail.szDescribeString));
        SocketEngine.Instance.SocketQuit();
        MyDebug.Log("###############################" + NetUtil.BytesToString(createLoginFail.szDescribeString));
        MyDebug.Log("###############################" + createLoginFail.lErrorCode);
    }
Пример #24
0
    private bool OnSocketSubGameStatus(byte[] data, int dataSize)
    {
        if (dataSize != Marshal.SizeOf(typeof(CMD_GF_GameStatus)))
        {
            return(false);
        }
        var pGameStatus = NetUtil.BytesToStruct <CMD_GF_GameStatus>(data);

        return(true);
    }
Пример #25
0
    private bool OnSocketSubConfigServer(byte[] data, int dataSize)
    {
        if (dataSize < Marshal.SizeOf(typeof(CMD_GR_ConfigServer)))
        {
            return(false);
        }
        CMD_GR_ConfigServer pConfigServer = NetUtil.BytesToStruct <CMD_GR_ConfigServer>(data);

        return(true);
    }
Пример #26
0
    private bool OnSocketSubLogonFailure(byte[] data, int dataSize)
    {
        CMD_GR_LogonFailure pGameServer = NetUtil.BytesToStruct <CMD_GR_LogonFailure>(data);

        MyDebug.SocketLog("IErrorCode:" + pGameServer.lErrorCode + "--" + NetUtil.GetServerLog(pGameServer.szDescribeString));
        SocketEventHandle.Instance.SetTips("IErrorCode:" + pGameServer.lErrorCode + "--" +
                                           NetUtil.GetServerLog(pGameServer.szDescribeString));
        SocketEngine.Instance.SocketQuit();
        return(true);
    }
Пример #27
0
    private bool OnSocketSubMatchGoldUpdate(byte[] data, int dataSize)
    {
        if (dataSize != Marshal.SizeOf(typeof(CMD_GR_MatchGoldUpdate)))
        {
            return(false);
        }
        var pNetInfo = NetUtil.BytesToStruct <CMD_GR_MatchGoldUpdate>(data);

        return(true);
    }
Пример #28
0
    //断线重连
    private bool OnSocketSubGameScene(byte[] data, int dataSize)
    {
        if (dataSize != Marshal.SizeOf(typeof(CMD_S_StatusPlay)))
        {
            return(false);
        }
        CMD_S_StatusPlay gsmeStatus = NetUtil.BytesToStruct <CMD_S_StatusPlay>(data);

        return(true); //TODO:
    }
Пример #29
0
    public void ExitTheRoom()
    {
        SoundManager.Instance.PlaySoundBGM("clickbutton");
        //判断如果只有房主,强制解散
        if (GlobalDataScript.Instance.roomInfo.tableOwnerUserID == GlobalDataScript.Instance.myGameRoomInfo.userID)
        {
            if (GlobalDataScript.Instance.roomInfo.PlayGameCount == 0)
            {
                //强制
                MyDebug.Log("=========================房主====================" + GlobalDataScript.Instance.roomInfo.tableOwnerUserID);
                CMD_GR_HostDissumeGame HostJ = new CMD_GR_HostDissumeGame();
                HostJ.dwUserID  = (uint)GlobalDataScript.Instance.myGameRoomInfo.userID;
                HostJ.dwTableID = (uint)GlobalDataScript.Instance.myGameRoomInfo.tableId;
                MyDebug.Log("=====================桌子 I D====================" + HostJ.dwTableID);
                MyDebug.Log("=====================桌子 I D====================" + HostJ.dwUserID);

                SocketSendManager.Instance.SendData((int)GameServer.MDM_GP_Cretate,
                                                    (int)MDM_GR_PRIVATE.SUB_GR_HOSTL_DISSUME_TABLE, NetUtil.StructToBytes(HostJ), Marshal.SizeOf(HostJ));
                MyDebug.Log("===============强制解散================" + HostJ);
            }
            else
            {
                //申请解散
                CMD_GR_CancelRequest CancelRequest = NetUtil.BytesToStruct <CMD_GR_CancelRequest>(send_buffer);
                CancelRequest.dwUserID  = GlobalDataScript.userData.dwUserID;
                CancelRequest.dwTableID = (uint)GlobalDataScript.Instance.myGameRoomInfo.tableId;
                CancelRequest.dwChairID = (uint)GlobalDataScript.Instance.myGameRoomInfo.chairId;
                SocketSendManager.Instance.SendData((int)GameServer.MDM_GP_Cretate,
                                                    (int)MDM_GR_PRIVATE.SUB_GR_CANCEL_REQUEST, NetUtil.StructToBytes(CancelRequest), Marshal.SizeOf(CancelRequest));
                SetMySelfDisslove();
            }
        }
        else
        {
            if (GlobalDataScript.Instance.roomInfo.PlayGameCount > 0)
            {
                CMD_GR_CancelRequest CancelRequest = NetUtil.BytesToStruct <CMD_GR_CancelRequest>(send_buffer);
                CancelRequest.dwUserID  = GlobalDataScript.userData.dwUserID;
                CancelRequest.dwTableID = (uint)GlobalDataScript.Instance.myGameRoomInfo.tableId;
                CancelRequest.dwChairID = (uint)GlobalDataScript.Instance.myGameRoomInfo.chairId;
                SocketSendManager.Instance.SendData((int)GameServer.MDM_GP_Cretate,
                                                    (int)MDM_GR_PRIVATE.SUB_GR_CANCEL_REQUEST, NetUtil.StructToBytes(CancelRequest), Marshal.SizeOf(CancelRequest));
                SetMySelfDisslove();
            }
            else
            {
                //自己退出--发送站立,退场景
                SocketSSSEvent.instance.isDisslove    = true;
                SocketNiuNiuEvent.instance.isDisslove = true;
                SocketSendManager.Instance.StandUp();
            }
        }

        CloseUI();
    }
Пример #30
0
    //申请解散房间返回用户选择信息
    public void OnEventRequestReply(byte[] buffer, int size)
    {
        CMD_GR_RequestReply requestReply = NetUtil.BytesToStruct <CMD_GR_RequestReply>(buffer);

        MyDebug.Log(requestReply.cbAgree + "================请求答复===================" + requestReply.dwUserID);
        DissloveRoomResponseVo vo = new DissloveRoomResponseVo();

        vo.result = requestReply.cbAgree;
        vo.userId = (int)requestReply.dwUserID;
        SocketEventHandle.Instance.SetClientResponse(APIS.DISSOLIVE_ROOM_RESPONSE, NetUtil.ObjToJson(vo));
    }