mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-01-13 19:50:28 +00:00
Merge remote-tracking branch 'origin/feat/party_room' into feat/party_room
This commit is contained in:
commit
f551ccfbde
@ -11,10 +11,9 @@ class URLConf {
|
|||||||
static const String analyticsApiHome = "https://scbox.org";
|
static const String analyticsApiHome = "https://scbox.org";
|
||||||
|
|
||||||
/// PartyRoom Server
|
/// PartyRoom Server
|
||||||
static const String partyRoomServerAddress = "partyroom.grpc.scbox.xkeyc.cn";
|
static const String partyRoomServerAddress = "ecdn.partyroom.grpc.scbox.xkeyc.cn";
|
||||||
static const int partyRoomServerPort = 443;
|
static const int partyRoomServerPort = 443;
|
||||||
|
|
||||||
|
|
||||||
static bool isUrlCheckPass = false;
|
static bool isUrlCheckPass = false;
|
||||||
|
|
||||||
/// URLS
|
/// URLS
|
||||||
|
|||||||
@ -781,9 +781,9 @@ class PartyRoom extends _$PartyRoom {
|
|||||||
void _handleRoomEvent(partroom.RoomEvent event) {
|
void _handleRoomEvent(partroom.RoomEvent event) {
|
||||||
dPrint('[PartyRoom] Event received: ${event.type}');
|
dPrint('[PartyRoom] Event received: ${event.type}');
|
||||||
|
|
||||||
// 添加到最近事件列表(保留最近 50 条)
|
// 添加到最近事件列表(保留最近 1000 条)
|
||||||
final recentEvents = [...state.room.recentEvents, event];
|
final recentEvents = [...state.room.recentEvents, event];
|
||||||
if (recentEvents.length > 50) {
|
if (recentEvents.length > 1000) {
|
||||||
recentEvents.removeAt(0);
|
recentEvents.removeAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,13 +794,24 @@ class PartyRoom extends _$PartyRoom {
|
|||||||
case partroom.RoomEventType.MEMBER_JOINED:
|
case partroom.RoomEventType.MEMBER_JOINED:
|
||||||
case partroom.RoomEventType.MEMBER_LEFT:
|
case partroom.RoomEventType.MEMBER_LEFT:
|
||||||
case partroom.RoomEventType.MEMBER_KICKED:
|
case partroom.RoomEventType.MEMBER_KICKED:
|
||||||
case partroom.RoomEventType.MEMBER_STATUS_UPDATED:
|
|
||||||
// 刷新成员列表
|
// 刷新成员列表
|
||||||
if (state.room.roomUuid != null) {
|
if (state.room.roomUuid != null) {
|
||||||
getRoomMembers(state.room.roomUuid!);
|
getRoomMembers(state.room.roomUuid!);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case partroom.RoomEventType.MEMBER_STATUS_UPDATED:
|
||||||
|
// 刷新成员状态,只更新对应成员的 status
|
||||||
|
state = state.copyWith(
|
||||||
|
room: state.room.copyWith(
|
||||||
|
members: state.room.members.map((member) {
|
||||||
|
if (member.gameUserId == event.member.gameUserId) {
|
||||||
|
return member.deepCopy()..status = event.member.status;
|
||||||
|
}
|
||||||
|
return member;
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
case partroom.RoomEventType.OWNER_CHANGED:
|
case partroom.RoomEventType.OWNER_CHANGED:
|
||||||
// 检查是否自己成为房主
|
// 检查是否自己成为房主
|
||||||
final isOwner = event.member.gameUserId == state.auth.userInfo?.gameUserId;
|
final isOwner = event.member.gameUserId == state.auth.userInfo?.gameUserId;
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class CreateRoomDialog extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
InfoLabel(
|
InfoLabel(
|
||||||
label: '目标人数 (2-600)',
|
label: '目标人数 (2-100)',
|
||||||
child: TextBox(
|
child: TextBox(
|
||||||
controller: targetMembersController,
|
controller: targetMembersController,
|
||||||
placeholder: '输入目标人数',
|
placeholder: '输入目标人数',
|
||||||
@ -194,12 +194,12 @@ class CreateRoomDialog extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final targetMembers = int.tryParse(targetMembersController.text);
|
final targetMembers = int.tryParse(targetMembersController.text);
|
||||||
if (targetMembers == null || targetMembers < 2 || targetMembers > 600) {
|
if (targetMembers == null || targetMembers < 2 || targetMembers > 100) {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => ContentDialog(
|
builder: (context) => ContentDialog(
|
||||||
title: const Text('提示'),
|
title: const Text('提示'),
|
||||||
content: const Text('目标人数必须在 2-600 之间'),
|
content: const Text('目标人数必须在 2-100 之间'),
|
||||||
actions: [FilledButton(child: const Text('确定'), onPressed: () => Navigator.pop(context))],
|
actions: [FilledButton(child: const Text('确定'), onPressed: () => Navigator.pop(context))],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user