mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-05 02:00:13 +08:00
tweaks (#1142)
* opt: unused layout * mod: semantics * opt: DanmakuMsg type * opt: avoid cast * opt: unnecessary_lambdas * opt: use isEven * opt: logger * opt: invalid common page * tweak * opt: unify DynController
This commit is contained in:
committed by
GitHub
parent
56ffc2781f
commit
5f8313901b
22
lib/models_new/live/live_danmaku/danmaku_msg.dart
Normal file
22
lib/models_new/live/live_danmaku/danmaku_msg.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:PiliPlus/models_new/live/live_danmaku/live_emote.dart';
|
||||
|
||||
class DanmakuMsg {
|
||||
late String name;
|
||||
late Object uid;
|
||||
late String text;
|
||||
Map<String, BaseEmote>? emots;
|
||||
BaseEmote? uemote;
|
||||
|
||||
DanmakuMsg();
|
||||
|
||||
DanmakuMsg.fromPrefetch(Map<String, dynamic> obj) {
|
||||
final user = obj['user'];
|
||||
name = user['base']['name'];
|
||||
uid = user['uid'];
|
||||
text = obj['text'];
|
||||
emots = (obj['emots'] as Map<String, dynamic>?)?.map((k, v) => MapEntry(k, BaseEmote.fromJson(v)));
|
||||
if ((obj['emoticon']?['emoticon_unique'] as String?)?.isNotEmpty == true) {
|
||||
uemote = BaseEmote.fromJson(obj['emoticon']);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
lib/models_new/live/live_danmaku/live_emote.dart
Normal file
48
lib/models_new/live/live_danmaku/live_emote.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
class BaseEmote {
|
||||
late String url;
|
||||
late String emoticonUnique;
|
||||
late double width;
|
||||
double? height;
|
||||
|
||||
BaseEmote.fromJson(Map<String, dynamic> json) {
|
||||
url = json['url'];
|
||||
emoticonUnique = json['emoticon_unique'];
|
||||
width = (json['width'] as num).toDouble();
|
||||
height = (json['height'] as num?)?.toDouble();
|
||||
}
|
||||
}
|
||||
|
||||
// class Emote extends BaseEmote {
|
||||
// late int count;
|
||||
// late String descript;
|
||||
// late String emoji;
|
||||
// late int emoticonId;
|
||||
// }
|
||||
|
||||
/*
|
||||
{
|
||||
"bulge_display": 1,
|
||||
"emoticon_unique": "upower_[{{emote}}]",
|
||||
"height": {{height}},
|
||||
"in_player_area": 1,
|
||||
"is_dynamic": 0, // 0 or 1
|
||||
"url": "{{url}}",
|
||||
"width": {{width}}
|
||||
}
|
||||
|
||||
{
|
||||
"bulge_display": 1,
|
||||
"emoticon_unique": "room_{{room_id}}_{{int}}",
|
||||
"height": {{height}},
|
||||
"in_player_area": 1,
|
||||
"is_dynamic": 1,
|
||||
"url": "{{url}}",
|
||||
"width": {{width}}
|
||||
}
|
||||
|
||||
*/
|
||||
// class Uemote extends BaseEmote {
|
||||
// late int bulgeDisplay;
|
||||
// late int inPlayerArea;
|
||||
// late int isDynamic;
|
||||
// }
|
||||
Reference in New Issue
Block a user