Exemplo n.º 1
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);
    }