mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 12:23:43 +08:00
[Party Room] 暂时搁置
This commit is contained in:
parent
828785ced4
commit
9f63fc9fe4
@ -24,18 +24,26 @@ class PartyRoomHomeUI extends BaseUI<PartyRoomHomeUIModel> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final model = ref.watch(provider);
|
// final model = ref.watch(provider);
|
||||||
return PageView(
|
return const Center(
|
||||||
controller: model.pageCtrl,
|
child: Column(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
super.build(context),
|
Text("敬请期待!"),
|
||||||
BaseUIContainer(
|
],
|
||||||
uiCreate: () => PartyRoomChatUI(),
|
),
|
||||||
modelCreate: () =>
|
|
||||||
model.getChildUIModelProviders<PartyRoomChatUIModel>("chat"))
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
// return PageView(
|
||||||
|
// controller: model.pageCtrl,
|
||||||
|
// physics: const NeverScrollableScrollPhysics(),
|
||||||
|
// children: [
|
||||||
|
// super.build(context),
|
||||||
|
// BaseUIContainer(
|
||||||
|
// uiCreate: () => PartyRoomChatUI(),
|
||||||
|
// modelCreate: () =>
|
||||||
|
// model.getChildUIModelProviders<PartyRoomChatUIModel>("chat"))
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -90,6 +98,7 @@ class PartyRoomHomeUI extends BaseUI<PartyRoomHomeUIModel> {
|
|||||||
DateTime.fromMillisecondsSinceEpoch(item.createTime.toInt());
|
DateTime.fromMillisecondsSinceEpoch(item.createTime.toInt());
|
||||||
return Tilt(
|
return Tilt(
|
||||||
borderRadius: BorderRadius.circular(13),
|
borderRadius: BorderRadius.circular(13),
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(13),
|
borderRadius: BorderRadius.circular(13),
|
||||||
|
@ -45,12 +45,6 @@ class PartyRoomHomeUIModel extends BaseUIModel {
|
|||||||
|
|
||||||
final pageCtrl = PageController();
|
final pageCtrl = PageController();
|
||||||
|
|
||||||
@override
|
|
||||||
void initModel() {
|
|
||||||
super.initModel();
|
|
||||||
_loadTypes();
|
|
||||||
_touchUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
BaseUIModel? onCreateChildUIModel(modelKey) {
|
BaseUIModel? onCreateChildUIModel(modelKey) {
|
||||||
@ -63,66 +57,66 @@ class PartyRoomHomeUIModel extends BaseUIModel {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future loadData() async {
|
Future loadData() async {
|
||||||
if (pingServerMessage != "") {
|
// if (pingServerMessage != "") {
|
||||||
pingServerMessage = null;
|
// pingServerMessage = null;
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
await _pingServer();
|
// await _pingServer();
|
||||||
}
|
// }
|
||||||
await _loadPage();
|
// await _loadPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
reloadData() async {
|
// reloadData() async {
|
||||||
pageNum = 0;
|
// pageNum = 0;
|
||||||
rooms = null;
|
// rooms = null;
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
_touchUser();
|
// _touchUser();
|
||||||
return super.reloadData();
|
// return super.reloadData();
|
||||||
}
|
// }
|
||||||
|
|
||||||
_loadPage() async {
|
// _loadPage() async {
|
||||||
final r = await handleError(() => PartyRoomGrpcServer.getRoomList(
|
// final r = await handleError(() => PartyRoomGrpcServer.getRoomList(
|
||||||
RoomListPageReqData(
|
// RoomListPageReqData(
|
||||||
pageNum: Int64.tryParseInt("$pageNum"),
|
// pageNum: Int64.tryParseInt("$pageNum"),
|
||||||
typeID: selectedRoomType?.id ?? "",
|
// typeID: selectedRoomType?.id ?? "",
|
||||||
subTypeID: selectedRoomSubType?.id ?? "",
|
// subTypeID: selectedRoomSubType?.id ?? "",
|
||||||
status: selectedStatus)));
|
// status: selectedStatus)));
|
||||||
if (r == null) return;
|
// if (r == null) return;
|
||||||
if (r.pageData.hasNext) {
|
// if (r.pageData.hasNext) {
|
||||||
pageNum++;
|
// pageNum++;
|
||||||
} else {
|
// } else {
|
||||||
pageNum = -1;
|
// pageNum = -1;
|
||||||
}
|
// }
|
||||||
rooms = r.rooms;
|
// rooms = r.rooms;
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
_pingServer() async {
|
// _pingServer() async {
|
||||||
try {
|
// try {
|
||||||
final r = await PartyRoomGrpcServer.pingServer();
|
// final r = await PartyRoomGrpcServer.pingServer();
|
||||||
dPrint(
|
// dPrint(
|
||||||
"[PartyRoomHomeUIModel] Connected! serverVersion ==> ${r.serverVersion}");
|
// "[PartyRoomHomeUIModel] Connected! serverVersion ==> ${r.serverVersion}");
|
||||||
pingServerMessage = "";
|
// pingServerMessage = "";
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
pingServerMessage = "服务器连接失败,请稍后重试。\n$e";
|
// pingServerMessage = "服务器连接失败,请稍后重试。\n$e";
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Future<void> _loadTypes() async {
|
// Future<void> _loadTypes() async {
|
||||||
final r = await handleError(() => PartyRoomGrpcServer.getRoomTypes());
|
// final r = await handleError(() => PartyRoomGrpcServer.getRoomTypes());
|
||||||
if (r == null) return;
|
// if (r == null) return;
|
||||||
selectedRoomType =
|
// selectedRoomType =
|
||||||
RoomType(id: "", name: "全部", desc: "查看所有类型的房间,寻找一起玩的伙伴。");
|
// RoomType(id: "", name: "全部", desc: "查看所有类型的房间,寻找一起玩的伙伴。");
|
||||||
selectedRoomSubType = RoomSubtype(id: "", name: "全部");
|
// selectedRoomSubType = RoomSubtype(id: "", name: "全部");
|
||||||
roomTypes = {"": selectedRoomType!};
|
// roomTypes = {"": selectedRoomType!};
|
||||||
for (var element in r.roomTypes) {
|
// for (var element in r.roomTypes) {
|
||||||
roomTypes![element.id] = element;
|
// roomTypes![element.id] = element;
|
||||||
}
|
// }
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
}
|
// }
|
||||||
|
|
||||||
Map<String, RoomSubtype>? getCurRoomSubTypes() {
|
Map<String, RoomSubtype>? getCurRoomSubTypes() {
|
||||||
if (selectedRoomType?.subTypes == null) return null;
|
if (selectedRoomType?.subTypes == null) return null;
|
||||||
@ -184,19 +178,19 @@ class PartyRoomHomeUIModel extends BaseUIModel {
|
|||||||
reloadData();
|
reloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _touchUser() async {
|
// Future<void> _touchUser() async {
|
||||||
if (getCreatedChildUIModel<PartyRoomChatUIModel>("chat")?.selectRoom ==
|
// if (getCreatedChildUIModel<PartyRoomChatUIModel>("chat")?.selectRoom ==
|
||||||
null) {
|
// null) {
|
||||||
final userName = await globalUIModel.getRunningGameUser();
|
// final userName = await globalUIModel.getRunningGameUser();
|
||||||
if (userName == null) return;
|
// if (userName == null) return;
|
||||||
// 检测用户已加入的房间
|
// // 检测用户已加入的房间
|
||||||
final room = await handleError(() =>
|
// final room = await handleError(() =>
|
||||||
PartyRoomGrpcServer.touchUserRoom(userName, AppConf.deviceUUID));
|
// PartyRoomGrpcServer.touchUserRoom(userName, AppConf.deviceUUID));
|
||||||
dPrint("touch room == ${room?.toProto3Json()}");
|
// dPrint("touch room == ${room?.toProto3Json()}");
|
||||||
if (room == null || room.id == "") return;
|
// if (room == null || room.id == "") return;
|
||||||
onTapRoom(room);
|
// onTapRoom(room);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
onTapRoom(RoomData item) {
|
onTapRoom(RoomData item) {
|
||||||
getCreatedChildUIModel<PartyRoomChatUIModel>("chat", create: true)
|
getCreatedChildUIModel<PartyRoomChatUIModel>("chat", create: true)
|
||||||
|
Loading…
Reference in New Issue
Block a user