Ejemplo n.º 1
0
    //登录完成
    public void CreateLogonFinish(byte[] tmpBuf, int size)
    {
        if (GlobalDataScript.Instance.playerInfos == null)
        {
            GlobalDataScript.Instance.playerInfos = new List <PlayerGameRoomInfo>();//登录完成初玩家始化信息
        }
        if (GlobalDataScript.type == ModeType.Create)
        {
            nnCreateRoom();
        }
        else
        {
            if ((playStatue)myStatue < playStatue.US_SIT)
            {
                CMD_GR_UserSitDown sitDown = new CMD_GR_UserSitDown();
                sitDown.wTableID = (ushort)tableId;
                sitDown.wChairID = 0xff;
                //if (chairId == -1)
                //    sitDown.wChairID = 0xff;
                //else if ((playStatue)myStatue >= playStatue.US_SIT)
                //    sitDown.wChairID = (byte)chairId;
                sitDown.szPassword = new byte[66];
                SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GR_USER, (int)MDM_GR_USER.SUB_GR_USER_SITDOWN, NetUtil.StructToBytes(sitDown), Marshal.SizeOf(sitDown));
                return;
            }

            CMD_GR_ChairUserInfoReq chairInfo = new CMD_GR_ChairUserInfoReq();
            chairInfo.wChairID = (byte)chairId;
            chairInfo.wTableID = (byte)tableId;

            SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GR_USER, (int)MDM_GR_USER.SUB_GR_USER_CHAIR_INFO_REQ, NetUtil.StructToBytes(chairInfo), Marshal.SizeOf(chairInfo));
        }
    }
Ejemplo n.º 2
0
    //==================================客户端发送请求==================================//
    //用户状态
    private void SuerStatus(byte[] buffer, int size)
    {
        MyDebug.Log("Set User Statue!!!!!!");
        CMD_GR_UserStatus userStatus = NetUtil.BytesToStruct <CMD_GR_UserStatus>(buffer);

        if (GlobalDataScript.Instance.isExitGame)
        {
            return;
        }
        if (userStatus.UserStatus.cbUserStatus == 1 && myStatue != userStatus.UserStatus.cbUserStatus)    //站立
        {
            PlayerGameRoomInfo info = new PlayerGameRoomInfo();
            info.userID = (int)userStatus.dwUserID;
            SocketEventHandle.Instance.SetClientResponse(APIS.OUT_ROOM_RESPONSE, NetUtil.ObjToJson(info));
            for (int i = 0; i < GlobalDataScript.Instance.playerInfos.Count; i++)
            {
                if (GlobalDataScript.Instance.playerInfos[i].userID == (int)userStatus.dwUserID)
                {
                    GlobalDataScript.Instance.playerInfos.RemoveAt(i);
                }
            }
            return;
        }
        if (userStatus.dwUserID != GlobalDataScript.userData.dwUserID)
        {
            return;
        }


        tableId = userStatus.UserStatus.wTableID;
        chairId = userStatus.UserStatus.wChairID;

        CMD_GR_ChairUserInfoReq chairInfo = new CMD_GR_ChairUserInfoReq();

        chairInfo.wChairID = (byte)chairId;
        chairInfo.wTableID = (byte)tableId;

        SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GR_USER, (int)MDM_GR_USER.SUB_GR_USER_CHAIR_INFO_REQ, NetUtil.StructToBytes(chairInfo), Marshal.SizeOf(chairInfo));


        byte[] bytes = new byte[10];
        SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GF_FRAME, (int)SUB_GF_GAME_STATUS.SUB_GF_GAME_OPTION, bytes, 10);
        myStatue = userStatus.UserStatus.cbUserStatus;
    }