import 'package:flutter/material.dart'; enum XYPkBattlingStatus { XYPkBattlingStatusLeftDefault,//表示显示左边头像 XYPkBattlingStatusRightDefault,//表示显示右边新增邀请按钮 XYPkBattlingStatusWait,//等待加入 XYPkBattlingStatusBattling,//PK 中 XYPkBattlingStatusPunish,//惩罚 XYPkBattlingStatusOver,//结束 } class LiveRoomMessageInfo { //消息类型 String? type; /// 消息时间戳 String? timestamp; /// 用户配置信息字符串 通过截取字段 String? profileString; /// 发送者用户id // String? senderId; /// 发送者用户名 String? senderNickname; /// 发送者头像url String? senderAvatarUrl; /// 接收者用户id String? reciveId; /// 接收者用户id String? reciveNickname; /// 接收者的头像url String? reciveAvatarUrl; /// 主播的用户id String? anchorUserId; /// 用户等级 int? grageNum; /// 主播等级 int? anchorGrageNum; /// 贵族等级 int? nobility; /// 官方 int? isOfficial; /// 房主 int? isHouseOwer; /// 房管 int? isHouseManager; /// 主持人 int? isHost; /// 性别 1男 2女 int? userSex; /// 年龄 String? userAge; ///聊天用户标签(等级、靓号、官方等)+ 用户名字AWRichText // @property (nonatomic, strong) AWRichText userMarkRichText; // ///聊天、礼物文字 // @property (nonatomic, strong) AWRichText textRichText; // ///飘屏通知AWRichText // @property (nonatomic, strong) AWRichText noticeRichText; /// 内容标识 String? contentText1; String? contentText2; String? contentText3; ///聊天列表总高度 num? cellHeight; ///聊天列表需要显示的宽度 num? cellShadowWidth; ///聊天列表用户标签高度 num? cellUserMarkHeight; /// 礼物对应的动画资源id String? giftAnimationId; /// 是否为贴纸 String? giftIsSticker; /// 贴纸名字 String? giftStickerName; /// 贴纸路径url String? giftStickerPath; /// 贴纸显示时间 String? giftStickerDuration; /// 礼物id String? giftId; /// 礼物数量 String? giftQuantity; /// 礼物价格 String? giftPrice; /// 1 - 购买的 2 - 从背包送的 3 - 百变礼盒开出 String? giftSourceType; /// 礼物连击次数 String? giftCombo; /// 礼物连击标识 String? comboKeyHash; /// 礼物图片url String? giftImageUrl; /// 是否聊天列表显示 bool? showInComment; /// 是否弹幕显示 isComboTimeout = true 时 标识这是一条连击结束的消息,只在弹幕中构造 bool? isComboTimeout; /// 是否连击banner显示 bool? isCombo; /// 礼物连击等级 int? comboValueLevel; /// 礼物连击倒计时秒数 int? comboPeriodSec; /// 礼物连击banner背景动画id String? giftBannerAnimationId; /// 礼物连击时全区通知的背景动画id String? floatScreenAnimationId; /// 礼物连击时全区通知的停留的时间 num? floatScreenStayTime; /// 头饰动效id String? headWearAnimationId; /// 汽泡动效id String? bubbleId; /// 礼物名字 String? giftName; /// 中奖金额 String? winAmount; /// 中奖倍数 String? winMultiple; /// 中奖最大倍数 String? winMultipleMax; /// 热度 String? heatNum; /// 观看人数 String? watchNum; /// 直播状态 String? liveStatus; /// 直播流状态 String? streamStatus; /// 推流地址 String? pullUrl; /// 房管 int? userMasterAction; /// 神秘人 String? anonymousGift; /// 目标类型 // String? targetType; /// 用户角色 String? userRole; /// 主播收入改变 String? scoreValue; /// 官方 String? offical; /// 11weath财富 21charm魅力 String? scoreType; /// 主播魅力值 String? glamorousNum; /// 主播收入 String? incomeAmount; /// 是否为活动消息(太空旅行、幸运礼物/等)一排 bool? isActivity; /// 是否为房间提示消息(进房,上下麦,房间上锁等)一排 bool? isAlert; /// 是否为礼物或者聊天文字消,两排 bool? isTextOrGift; /// 活动图片url String? activityIcon; /// 活动跳转链接 String? activityUrl; /// 靓号 String? niceNo; /// 靓号等级 int? niceLevel; /// 坐骑id String? mountsId; /// 坐骑名字 String? mountsName; /// 坐骑动画id String? mountsAnimationId; /// 勋章显示时间 int? nobleTime; /// 勋章等级 String? nobleValue; /// vip等级 String? vipValue; /// 星耀等级 String? starLevel; /// 勋章ID String? medalId; //1v1视频剩余可用时间 String? minutesRemain; //通话计费时长 String? hisMinutes; //通话费用 String? hisAmount; //pk String? pkToken; String? pkBattleId; ////0拒绝 1同意 String? pkDecision; int? pkProceedTime; int? pkPunishTime; int? pkChangeValue; String? pkUserId; List? pkTopGivers; ///battlingStatus 1等待加入 2PK中 3惩罚 4结束 XYPkBattlingStatus? pkBattlingStatus; ///battleRole 1 红方 2 蓝方 int? pkRole; ///battleResult 0 打平 1 红方胜 2 蓝方胜 int? pkResult; int? pkRankIndex; ///battleResult 0 打平 1胜 2败 int? pkRankResult; ///临时类型标识 int? tempType; /// noticeType : 0 无消息 , 1 聊天框显示 , 2顶部显示 , 3都显示 int? noticeType; /// 语音房消息 /// 聊天室房间id String? roomId; /// 麦位 int? seatNo; /// 上麦下麦用户id String? userId; /// 表情id String? expId; /// 表情url String? expUrl; /// 表情播放时间 int? playTimes; /// 表情最后帧数 int? finalFrame; /// 通知类型 String? noticestyle; //用户信息实体 XYLiveUserModel? userInfo; String? _groupId; SenderProfile? _senderProfile; int? _targetType; Msg? _msg; int? _senderId; String? get groupId => _groupId; SenderProfile? get senderProfile => _senderProfile; int? get targetType => _targetType; Msg? get msg => _msg; int? get senderId => _senderId; LiveRoomMessageInfo({ String? groupId, SenderProfile? senderProfile, int? targetType, Msg? msg, int? senderId}){ _groupId = groupId; _senderProfile = senderProfile; _targetType = targetType; _msg = msg; _senderId = senderId; } LiveRoomMessageInfo.fromJson(dynamic json) { _groupId = json['groupId']; _senderProfile = json['senderProfile'] != null ? SenderProfile.fromJson(json['senderProfile']) : null; _targetType = json['targetType']; _msg = json['msg'] != null ? Msg.fromJson(json['msg']) : null; _senderId = json['senderId']; userInfo = XYLiveUserModel(); userInfo!.setPro(json["senderProfile"]["profileString"]); //这里是消息类型 //1, 用户进入直播间 if(_msg!.type == ""){ } //2, } Map toJson() { var map = {}; map['groupId'] = _groupId; if (_senderProfile != null) { map['senderProfile'] = _senderProfile?.toJson(); } map['targetType'] = _targetType; if (_msg != null) { map['msg'] = _msg?.toJson(); } map['senderId'] = _senderId; return map; } } class XYLiveUserModel { //粉丝等级 int? fansLevel; /// 会员等级 int? vipLevel; /// 守护等级 int? guardLevel; /// 勋章 id String? medalIds; /// 是否房管 1观众 2房管 3主播 int? userRole; /// 附加信息 String? profileString; /// 是否新人 webscoket解析用户信息使用 bool? isNew; /// 用户id String? userId; /// 用户头像 String? userAvatar; /// 用户名字 String? userName; /// 靓号 不是每个人都有 String? niceNo; ///靓号等级 int? niceLevel; /// 用户等级(财富等级) int? wealthLevel; ///星耀等级 int? starLevel; /// 贵族等级 int? nobleLevel; /// 是否正在直播 bool? isLive; int? userSex; int? userAge; /// ID String? userNo; /// 在线状态 int? isOnline; /// 是否实名认证 bool? isAuth; /// 是否在房间 0不在 1在 bool? isInRoom; /// tag String? userTag; void setPro(String profileString){ if(profileString.length > 9){ this.wealthLevel = int.parse(profileString.substring(0,3)); this.nobleLevel = int.parse(profileString.substring(3,4)); this.guardLevel = int.parse(profileString.substring(4,5)); this.vipLevel = int.parse(profileString.substring(5,6)); this.fansLevel = int.parse(profileString.substring(6,8)); } this.niceLevel = int.parse(profileString.substring(9,10)); if(profileString.length > 19){ this.niceNo = (profileString.substring(10,20)); } if (int.parse(profileString.substring(8,9)) == 0) { this.isNew = false; } else { this.isNew = true; } } } class Msg { String? _type; int? _timestamp; String? get type => _type; int? get timestamp => _timestamp; Msg({ String? type, int? timestamp}){ _type = type; _timestamp = timestamp; } Msg.fromJson(dynamic json) { _type = json['type']; _timestamp = json['timestamp']; } Map toJson() { var map = {}; map['type'] = _type; map['timestamp'] = _timestamp; return map; } } /// userNo : 10811379 /// userAvatar : "http://user.qn.timichat.net/avatar/162116510154752/1631951244395.png" /// userRole : 1 /// profileString : "00110000000000000000" /// userId : 162116510154752 /// userName : "好好66" class SenderProfile { int? _userNo; String? _userAvatar; int? _userRole; String? _profileString; int? _userId; String? _userName; int? get userNo => _userNo; String? get userAvatar => _userAvatar; int? get userRole => _userRole; String? get profileString => _profileString; int? get userId => _userId; String? get userName => _userName; SenderProfile({ int? userNo, String? userAvatar, int? userRole, String? profileString, int? userId, String? userName}){ _userNo = userNo; _userAvatar = userAvatar; _userRole = userRole; _profileString = profileString; _userId = userId; _userName = userName; } SenderProfile.fromJson(dynamic json) { _userNo = json['userNo']; _userAvatar = json['userAvatar']; _userRole = json['userRole']; _profileString = json['profileString']; _userId = json['userId']; _userName = json['userName']; } Map toJson() { var map = {}; map['userNo'] = _userNo; map['userAvatar'] = _userAvatar; map['userRole'] = _userRole; map['profileString'] = _profileString; map['userId'] = _userId; map['userName'] = _userName; return map; } }