[Party Room] 房间索引

This commit is contained in:
xkeyC 2024-01-13 13:54:32 +08:00
parent ab6e660ea0
commit 85f488c118
7 changed files with 666 additions and 5 deletions

View File

@ -14,6 +14,8 @@ import 'dart:core' as $core;
import 'package:fixnum/fixnum.dart' as $fixnum; import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb; import 'package:protobuf/protobuf.dart' as $pb;
import 'index.pbenum.dart';
export 'index.pbenum.dart'; export 'index.pbenum.dart';
class Empty extends $pb.GeneratedMessage { class Empty extends $pb.GeneratedMessage {
@ -48,6 +50,176 @@ class Empty extends $pb.GeneratedMessage {
static Empty? _defaultInstance; static Empty? _defaultInstance;
} }
class BaseRespData extends $pb.GeneratedMessage {
factory BaseRespData({
$core.int? code,
$core.String? message,
}) {
final $result = create();
if (code != null) {
$result.code = code;
}
if (message != null) {
$result.message = message;
}
return $result;
}
BaseRespData._() : super();
factory BaseRespData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory BaseRespData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'BaseRespData', createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'code', $pb.PbFieldType.O3)
..aOS(2, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
BaseRespData clone() => BaseRespData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
BaseRespData copyWith(void Function(BaseRespData) updates) => super.copyWith((message) => updates(message as BaseRespData)) as BaseRespData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static BaseRespData create() => BaseRespData._();
BaseRespData createEmptyInstance() => create();
static $pb.PbList<BaseRespData> createRepeated() => $pb.PbList<BaseRespData>();
@$core.pragma('dart2js:noInline')
static BaseRespData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BaseRespData>(create);
static BaseRespData? _defaultInstance;
@$pb.TagNumber(1)
$core.int get code => $_getIZ(0);
@$pb.TagNumber(1)
set code($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasCode() => $_has(0);
@$pb.TagNumber(1)
void clearCode() => clearField(1);
@$pb.TagNumber(2)
$core.String get message => $_getSZ(1);
@$pb.TagNumber(2)
set message($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasMessage() => $_has(1);
@$pb.TagNumber(2)
void clearMessage() => clearField(2);
}
class BasePageRespData extends $pb.GeneratedMessage {
factory BasePageRespData({
$core.int? code,
$core.String? message,
$core.bool? hasNext,
$fixnum.Int64? curPageNum,
$fixnum.Int64? pageSize,
}) {
final $result = create();
if (code != null) {
$result.code = code;
}
if (message != null) {
$result.message = message;
}
if (hasNext != null) {
$result.hasNext = hasNext;
}
if (curPageNum != null) {
$result.curPageNum = curPageNum;
}
if (pageSize != null) {
$result.pageSize = pageSize;
}
return $result;
}
BasePageRespData._() : super();
factory BasePageRespData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory BasePageRespData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'BasePageRespData', createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'code', $pb.PbFieldType.O3)
..aOS(2, _omitFieldNames ? '' : 'message')
..aOB(3, _omitFieldNames ? '' : 'hasNext', protoName: 'hasNext')
..a<$fixnum.Int64>(4, _omitFieldNames ? '' : 'curPageNum', $pb.PbFieldType.OU6, protoName: 'curPageNum', defaultOrMaker: $fixnum.Int64.ZERO)
..aInt64(5, _omitFieldNames ? '' : 'pageSize', protoName: 'pageSize')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
BasePageRespData clone() => BasePageRespData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
BasePageRespData copyWith(void Function(BasePageRespData) updates) => super.copyWith((message) => updates(message as BasePageRespData)) as BasePageRespData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static BasePageRespData create() => BasePageRespData._();
BasePageRespData createEmptyInstance() => create();
static $pb.PbList<BasePageRespData> createRepeated() => $pb.PbList<BasePageRespData>();
@$core.pragma('dart2js:noInline')
static BasePageRespData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BasePageRespData>(create);
static BasePageRespData? _defaultInstance;
@$pb.TagNumber(1)
$core.int get code => $_getIZ(0);
@$pb.TagNumber(1)
set code($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasCode() => $_has(0);
@$pb.TagNumber(1)
void clearCode() => clearField(1);
@$pb.TagNumber(2)
$core.String get message => $_getSZ(1);
@$pb.TagNumber(2)
set message($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasMessage() => $_has(1);
@$pb.TagNumber(2)
void clearMessage() => clearField(2);
@$pb.TagNumber(3)
$core.bool get hasNext => $_getBF(2);
@$pb.TagNumber(3)
set hasNext($core.bool v) { $_setBool(2, v); }
@$pb.TagNumber(3)
$core.bool hasHasNext() => $_has(2);
@$pb.TagNumber(3)
void clearHasNext() => clearField(3);
@$pb.TagNumber(4)
$fixnum.Int64 get curPageNum => $_getI64(3);
@$pb.TagNumber(4)
set curPageNum($fixnum.Int64 v) { $_setInt64(3, v); }
@$pb.TagNumber(4)
$core.bool hasCurPageNum() => $_has(3);
@$pb.TagNumber(4)
void clearCurPageNum() => clearField(4);
@$pb.TagNumber(5)
$fixnum.Int64 get pageSize => $_getI64(4);
@$pb.TagNumber(5)
set pageSize($fixnum.Int64 v) { $_setInt64(4, v); }
@$pb.TagNumber(5)
$core.bool hasPageSize() => $_has(4);
@$pb.TagNumber(5)
void clearPageSize() => clearField(5);
}
class PingData extends $pb.GeneratedMessage { class PingData extends $pb.GeneratedMessage {
factory PingData({ factory PingData({
$core.String? data, $core.String? data,
@ -334,6 +506,328 @@ class RoomSubtype extends $pb.GeneratedMessage {
void clearName() => clearField(2); void clearName() => clearField(2);
} }
class RoomData extends $pb.GeneratedMessage {
factory RoomData({
$core.String? id,
$core.String? roomTypeID,
$core.Iterable<$core.String>? roomSubTypeIds,
$core.String? owner,
$core.int? maxPlayer,
$fixnum.Int64? createTime,
$core.int? curPlayer,
RoomStatus? status,
$core.String? deviceUUID,
}) {
final $result = create();
if (id != null) {
$result.id = id;
}
if (roomTypeID != null) {
$result.roomTypeID = roomTypeID;
}
if (roomSubTypeIds != null) {
$result.roomSubTypeIds.addAll(roomSubTypeIds);
}
if (owner != null) {
$result.owner = owner;
}
if (maxPlayer != null) {
$result.maxPlayer = maxPlayer;
}
if (createTime != null) {
$result.createTime = createTime;
}
if (curPlayer != null) {
$result.curPlayer = curPlayer;
}
if (status != null) {
$result.status = status;
}
if (deviceUUID != null) {
$result.deviceUUID = deviceUUID;
}
return $result;
}
RoomData._() : super();
factory RoomData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RoomData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'RoomData', createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'id')
..aOS(2, _omitFieldNames ? '' : 'roomTypeID', protoName: 'roomTypeID')
..pPS(3, _omitFieldNames ? '' : 'roomSubTypeIds', protoName: 'roomSubTypeIds')
..aOS(4, _omitFieldNames ? '' : 'owner')
..a<$core.int>(5, _omitFieldNames ? '' : 'maxPlayer', $pb.PbFieldType.O3, protoName: 'maxPlayer')
..aInt64(6, _omitFieldNames ? '' : 'createTime', protoName: 'createTime')
..a<$core.int>(7, _omitFieldNames ? '' : 'curPlayer', $pb.PbFieldType.O3, protoName: 'curPlayer')
..e<RoomStatus>(8, _omitFieldNames ? '' : 'status', $pb.PbFieldType.OE, defaultOrMaker: RoomStatus.All, valueOf: RoomStatus.valueOf, enumValues: RoomStatus.values)
..aOS(9, _omitFieldNames ? '' : 'deviceUUID', protoName: 'deviceUUID')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
RoomData clone() => RoomData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RoomData copyWith(void Function(RoomData) updates) => super.copyWith((message) => updates(message as RoomData)) as RoomData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RoomData create() => RoomData._();
RoomData createEmptyInstance() => create();
static $pb.PbList<RoomData> createRepeated() => $pb.PbList<RoomData>();
@$core.pragma('dart2js:noInline')
static RoomData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RoomData>(create);
static RoomData? _defaultInstance;
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
@$pb.TagNumber(2)
$core.String get roomTypeID => $_getSZ(1);
@$pb.TagNumber(2)
set roomTypeID($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasRoomTypeID() => $_has(1);
@$pb.TagNumber(2)
void clearRoomTypeID() => clearField(2);
@$pb.TagNumber(3)
$core.List<$core.String> get roomSubTypeIds => $_getList(2);
@$pb.TagNumber(4)
$core.String get owner => $_getSZ(3);
@$pb.TagNumber(4)
set owner($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasOwner() => $_has(3);
@$pb.TagNumber(4)
void clearOwner() => clearField(4);
@$pb.TagNumber(5)
$core.int get maxPlayer => $_getIZ(4);
@$pb.TagNumber(5)
set maxPlayer($core.int v) { $_setSignedInt32(4, v); }
@$pb.TagNumber(5)
$core.bool hasMaxPlayer() => $_has(4);
@$pb.TagNumber(5)
void clearMaxPlayer() => clearField(5);
@$pb.TagNumber(6)
$fixnum.Int64 get createTime => $_getI64(5);
@$pb.TagNumber(6)
set createTime($fixnum.Int64 v) { $_setInt64(5, v); }
@$pb.TagNumber(6)
$core.bool hasCreateTime() => $_has(5);
@$pb.TagNumber(6)
void clearCreateTime() => clearField(6);
@$pb.TagNumber(7)
$core.int get curPlayer => $_getIZ(6);
@$pb.TagNumber(7)
set curPlayer($core.int v) { $_setSignedInt32(6, v); }
@$pb.TagNumber(7)
$core.bool hasCurPlayer() => $_has(6);
@$pb.TagNumber(7)
void clearCurPlayer() => clearField(7);
@$pb.TagNumber(8)
RoomStatus get status => $_getN(7);
@$pb.TagNumber(8)
set status(RoomStatus v) { setField(8, v); }
@$pb.TagNumber(8)
$core.bool hasStatus() => $_has(7);
@$pb.TagNumber(8)
void clearStatus() => clearField(8);
@$pb.TagNumber(9)
$core.String get deviceUUID => $_getSZ(8);
@$pb.TagNumber(9)
set deviceUUID($core.String v) { $_setString(8, v); }
@$pb.TagNumber(9)
$core.bool hasDeviceUUID() => $_has(8);
@$pb.TagNumber(9)
void clearDeviceUUID() => clearField(9);
}
class RoomListPageReqData extends $pb.GeneratedMessage {
factory RoomListPageReqData({
$core.String? typeID,
$core.String? subTypeID,
RoomStatus? status,
RoomSortType? sort,
$fixnum.Int64? pageNum,
}) {
final $result = create();
if (typeID != null) {
$result.typeID = typeID;
}
if (subTypeID != null) {
$result.subTypeID = subTypeID;
}
if (status != null) {
$result.status = status;
}
if (sort != null) {
$result.sort = sort;
}
if (pageNum != null) {
$result.pageNum = pageNum;
}
return $result;
}
RoomListPageReqData._() : super();
factory RoomListPageReqData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RoomListPageReqData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'RoomListPageReqData', createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'typeID', protoName: 'typeID')
..aOS(2, _omitFieldNames ? '' : 'subTypeID', protoName: 'subTypeID')
..e<RoomStatus>(3, _omitFieldNames ? '' : 'status', $pb.PbFieldType.OE, defaultOrMaker: RoomStatus.All, valueOf: RoomStatus.valueOf, enumValues: RoomStatus.values)
..e<RoomSortType>(4, _omitFieldNames ? '' : 'sort', $pb.PbFieldType.OE, defaultOrMaker: RoomSortType.Default, valueOf: RoomSortType.valueOf, enumValues: RoomSortType.values)
..a<$fixnum.Int64>(5, _omitFieldNames ? '' : 'pageNum', $pb.PbFieldType.OU6, protoName: 'pageNum', defaultOrMaker: $fixnum.Int64.ZERO)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
RoomListPageReqData clone() => RoomListPageReqData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RoomListPageReqData copyWith(void Function(RoomListPageReqData) updates) => super.copyWith((message) => updates(message as RoomListPageReqData)) as RoomListPageReqData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RoomListPageReqData create() => RoomListPageReqData._();
RoomListPageReqData createEmptyInstance() => create();
static $pb.PbList<RoomListPageReqData> createRepeated() => $pb.PbList<RoomListPageReqData>();
@$core.pragma('dart2js:noInline')
static RoomListPageReqData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RoomListPageReqData>(create);
static RoomListPageReqData? _defaultInstance;
@$pb.TagNumber(1)
$core.String get typeID => $_getSZ(0);
@$pb.TagNumber(1)
set typeID($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasTypeID() => $_has(0);
@$pb.TagNumber(1)
void clearTypeID() => clearField(1);
@$pb.TagNumber(2)
$core.String get subTypeID => $_getSZ(1);
@$pb.TagNumber(2)
set subTypeID($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasSubTypeID() => $_has(1);
@$pb.TagNumber(2)
void clearSubTypeID() => clearField(2);
@$pb.TagNumber(3)
RoomStatus get status => $_getN(2);
@$pb.TagNumber(3)
set status(RoomStatus v) { setField(3, v); }
@$pb.TagNumber(3)
$core.bool hasStatus() => $_has(2);
@$pb.TagNumber(3)
void clearStatus() => clearField(3);
@$pb.TagNumber(4)
RoomSortType get sort => $_getN(3);
@$pb.TagNumber(4)
set sort(RoomSortType v) { setField(4, v); }
@$pb.TagNumber(4)
$core.bool hasSort() => $_has(3);
@$pb.TagNumber(4)
void clearSort() => clearField(4);
@$pb.TagNumber(5)
$fixnum.Int64 get pageNum => $_getI64(4);
@$pb.TagNumber(5)
set pageNum($fixnum.Int64 v) { $_setInt64(4, v); }
@$pb.TagNumber(5)
$core.bool hasPageNum() => $_has(4);
@$pb.TagNumber(5)
void clearPageNum() => clearField(5);
}
class RoomListData extends $pb.GeneratedMessage {
factory RoomListData({
BasePageRespData? pageData,
$core.Iterable<RoomData>? rooms,
}) {
final $result = create();
if (pageData != null) {
$result.pageData = pageData;
}
if (rooms != null) {
$result.rooms.addAll(rooms);
}
return $result;
}
RoomListData._() : super();
factory RoomListData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RoomListData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'RoomListData', createEmptyInstance: create)
..aOM<BasePageRespData>(1, _omitFieldNames ? '' : 'pageData', protoName: 'pageData', subBuilder: BasePageRespData.create)
..pc<RoomData>(2, _omitFieldNames ? '' : 'rooms', $pb.PbFieldType.PM, subBuilder: RoomData.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
RoomListData clone() => RoomListData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RoomListData copyWith(void Function(RoomListData) updates) => super.copyWith((message) => updates(message as RoomListData)) as RoomListData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RoomListData create() => RoomListData._();
RoomListData createEmptyInstance() => create();
static $pb.PbList<RoomListData> createRepeated() => $pb.PbList<RoomListData>();
@$core.pragma('dart2js:noInline')
static RoomListData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RoomListData>(create);
static RoomListData? _defaultInstance;
@$pb.TagNumber(1)
BasePageRespData get pageData => $_getN(0);
@$pb.TagNumber(1)
set pageData(BasePageRespData v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasPageData() => $_has(0);
@$pb.TagNumber(1)
void clearPageData() => clearField(1);
@$pb.TagNumber(1)
BasePageRespData ensurePageData() => $_ensure(0);
@$pb.TagNumber(2)
$core.List<RoomData> get rooms => $_getList(1);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -29,6 +29,14 @@ class IndexServiceClient extends $grpc.Client {
'/IndexService/GetRoomTypes', '/IndexService/GetRoomTypes',
($0.Empty value) => value.writeToBuffer(), ($0.Empty value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.RoomTypesData.fromBuffer(value)); ($core.List<$core.int> value) => $0.RoomTypesData.fromBuffer(value));
static final _$createRoom = $grpc.ClientMethod<$0.RoomData, $0.RoomData>(
'/IndexService/CreateRoom',
($0.RoomData value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.RoomData.fromBuffer(value));
static final _$getRoomList = $grpc.ClientMethod<$0.RoomListPageReqData, $0.RoomListData>(
'/IndexService/GetRoomList',
($0.RoomListPageReqData value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.RoomListData.fromBuffer(value));
IndexServiceClient($grpc.ClientChannel channel, IndexServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options, {$grpc.CallOptions? options,
@ -43,6 +51,14 @@ class IndexServiceClient extends $grpc.Client {
$grpc.ResponseFuture<$0.RoomTypesData> getRoomTypes($0.Empty request, {$grpc.CallOptions? options}) { $grpc.ResponseFuture<$0.RoomTypesData> getRoomTypes($0.Empty request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$getRoomTypes, request, options: options); return $createUnaryCall(_$getRoomTypes, request, options: options);
} }
$grpc.ResponseFuture<$0.RoomData> createRoom($0.RoomData request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$createRoom, request, options: options);
}
$grpc.ResponseFuture<$0.RoomListData> getRoomList($0.RoomListPageReqData request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$getRoomList, request, options: options);
}
} }
@$pb.GrpcServiceName('IndexService') @$pb.GrpcServiceName('IndexService')
@ -64,6 +80,20 @@ abstract class IndexServiceBase extends $grpc.Service {
false, false,
($core.List<$core.int> value) => $0.Empty.fromBuffer(value), ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),
($0.RoomTypesData value) => value.writeToBuffer())); ($0.RoomTypesData value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.RoomData, $0.RoomData>(
'CreateRoom',
createRoom_Pre,
false,
false,
($core.List<$core.int> value) => $0.RoomData.fromBuffer(value),
($0.RoomData value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.RoomListPageReqData, $0.RoomListData>(
'GetRoomList',
getRoomList_Pre,
false,
false,
($core.List<$core.int> value) => $0.RoomListPageReqData.fromBuffer(value),
($0.RoomListData value) => value.writeToBuffer()));
} }
$async.Future<$0.PingData> pingServer_Pre($grpc.ServiceCall call, $async.Future<$0.PingData> request) async { $async.Future<$0.PingData> pingServer_Pre($grpc.ServiceCall call, $async.Future<$0.PingData> request) async {
@ -74,6 +104,16 @@ abstract class IndexServiceBase extends $grpc.Service {
return getRoomTypes(call, await request); return getRoomTypes(call, await request);
} }
$async.Future<$0.RoomData> createRoom_Pre($grpc.ServiceCall call, $async.Future<$0.RoomData> request) async {
return createRoom(call, await request);
}
$async.Future<$0.RoomListData> getRoomList_Pre($grpc.ServiceCall call, $async.Future<$0.RoomListPageReqData> request) async {
return getRoomList(call, await request);
}
$async.Future<$0.PingData> pingServer($grpc.ServiceCall call, $0.PingData request); $async.Future<$0.PingData> pingServer($grpc.ServiceCall call, $0.PingData request);
$async.Future<$0.RoomTypesData> getRoomTypes($grpc.ServiceCall call, $0.Empty request); $async.Future<$0.RoomTypesData> getRoomTypes($grpc.ServiceCall call, $0.Empty request);
$async.Future<$0.RoomData> createRoom($grpc.ServiceCall call, $0.RoomData request);
$async.Future<$0.RoomListData> getRoomList($grpc.ServiceCall call, $0.RoomListPageReqData request);
} }

View File

@ -59,6 +59,38 @@ const Empty$json = {
final $typed_data.Uint8List emptyDescriptor = $convert.base64Decode( final $typed_data.Uint8List emptyDescriptor = $convert.base64Decode(
'CgVFbXB0eQ=='); 'CgVFbXB0eQ==');
@$core.Deprecated('Use baseRespDataDescriptor instead')
const BaseRespData$json = {
'1': 'BaseRespData',
'2': [
{'1': 'code', '3': 1, '4': 1, '5': 5, '10': 'code'},
{'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
],
};
/// Descriptor for `BaseRespData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List baseRespDataDescriptor = $convert.base64Decode(
'CgxCYXNlUmVzcERhdGESEgoEY29kZRgBIAEoBVIEY29kZRIYCgdtZXNzYWdlGAIgASgJUgdtZX'
'NzYWdl');
@$core.Deprecated('Use basePageRespDataDescriptor instead')
const BasePageRespData$json = {
'1': 'BasePageRespData',
'2': [
{'1': 'code', '3': 1, '4': 1, '5': 5, '10': 'code'},
{'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
{'1': 'hasNext', '3': 3, '4': 1, '5': 8, '10': 'hasNext'},
{'1': 'curPageNum', '3': 4, '4': 1, '5': 4, '10': 'curPageNum'},
{'1': 'pageSize', '3': 5, '4': 1, '5': 3, '10': 'pageSize'},
],
};
/// Descriptor for `BasePageRespData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List basePageRespDataDescriptor = $convert.base64Decode(
'ChBCYXNlUGFnZVJlc3BEYXRhEhIKBGNvZGUYASABKAVSBGNvZGUSGAoHbWVzc2FnZRgCIAEoCV'
'IHbWVzc2FnZRIYCgdoYXNOZXh0GAMgASgIUgdoYXNOZXh0Eh4KCmN1clBhZ2VOdW0YBCABKARS'
'CmN1clBhZ2VOdW0SGgoIcGFnZVNpemUYBSABKANSCHBhZ2VTaXpl');
@$core.Deprecated('Use pingDataDescriptor instead') @$core.Deprecated('Use pingDataDescriptor instead')
const PingData$json = { const PingData$json = {
'1': 'PingData', '1': 'PingData',
@ -118,3 +150,61 @@ const RoomSubtype$json = {
final $typed_data.Uint8List roomSubtypeDescriptor = $convert.base64Decode( final $typed_data.Uint8List roomSubtypeDescriptor = $convert.base64Decode(
'CgtSb29tU3VidHlwZRIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbmFtZQ=='); 'CgtSb29tU3VidHlwZRIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbmFtZQ==');
@$core.Deprecated('Use roomDataDescriptor instead')
const RoomData$json = {
'1': 'RoomData',
'2': [
{'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
{'1': 'roomTypeID', '3': 2, '4': 1, '5': 9, '10': 'roomTypeID'},
{'1': 'roomSubTypeIds', '3': 3, '4': 3, '5': 9, '10': 'roomSubTypeIds'},
{'1': 'owner', '3': 4, '4': 1, '5': 9, '10': 'owner'},
{'1': 'maxPlayer', '3': 5, '4': 1, '5': 5, '10': 'maxPlayer'},
{'1': 'createTime', '3': 6, '4': 1, '5': 3, '10': 'createTime'},
{'1': 'curPlayer', '3': 7, '4': 1, '5': 5, '10': 'curPlayer'},
{'1': 'status', '3': 8, '4': 1, '5': 14, '6': '.RoomStatus', '10': 'status'},
{'1': 'deviceUUID', '3': 9, '4': 1, '5': 9, '10': 'deviceUUID'},
],
};
/// Descriptor for `RoomData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List roomDataDescriptor = $convert.base64Decode(
'CghSb29tRGF0YRIOCgJpZBgBIAEoCVICaWQSHgoKcm9vbVR5cGVJRBgCIAEoCVIKcm9vbVR5cG'
'VJRBImCg5yb29tU3ViVHlwZUlkcxgDIAMoCVIOcm9vbVN1YlR5cGVJZHMSFAoFb3duZXIYBCAB'
'KAlSBW93bmVyEhwKCW1heFBsYXllchgFIAEoBVIJbWF4UGxheWVyEh4KCmNyZWF0ZVRpbWUYBi'
'ABKANSCmNyZWF0ZVRpbWUSHAoJY3VyUGxheWVyGAcgASgFUgljdXJQbGF5ZXISIwoGc3RhdHVz'
'GAggASgOMgsuUm9vbVN0YXR1c1IGc3RhdHVzEh4KCmRldmljZVVVSUQYCSABKAlSCmRldmljZV'
'VVSUQ=');
@$core.Deprecated('Use roomListPageReqDataDescriptor instead')
const RoomListPageReqData$json = {
'1': 'RoomListPageReqData',
'2': [
{'1': 'typeID', '3': 1, '4': 1, '5': 9, '10': 'typeID'},
{'1': 'subTypeID', '3': 2, '4': 1, '5': 9, '10': 'subTypeID'},
{'1': 'status', '3': 3, '4': 1, '5': 14, '6': '.RoomStatus', '10': 'status'},
{'1': 'sort', '3': 4, '4': 1, '5': 14, '6': '.RoomSortType', '10': 'sort'},
{'1': 'pageNum', '3': 5, '4': 1, '5': 4, '10': 'pageNum'},
],
};
/// Descriptor for `RoomListPageReqData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List roomListPageReqDataDescriptor = $convert.base64Decode(
'ChNSb29tTGlzdFBhZ2VSZXFEYXRhEhYKBnR5cGVJRBgBIAEoCVIGdHlwZUlEEhwKCXN1YlR5cG'
'VJRBgCIAEoCVIJc3ViVHlwZUlEEiMKBnN0YXR1cxgDIAEoDjILLlJvb21TdGF0dXNSBnN0YXR1'
'cxIhCgRzb3J0GAQgASgOMg0uUm9vbVNvcnRUeXBlUgRzb3J0EhgKB3BhZ2VOdW0YBSABKARSB3'
'BhZ2VOdW0=');
@$core.Deprecated('Use roomListDataDescriptor instead')
const RoomListData$json = {
'1': 'RoomListData',
'2': [
{'1': 'pageData', '3': 1, '4': 1, '5': 11, '6': '.BasePageRespData', '10': 'pageData'},
{'1': 'rooms', '3': 2, '4': 3, '5': 11, '6': '.RoomData', '10': 'rooms'},
],
};
/// Descriptor for `RoomListData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List roomListDataDescriptor = $convert.base64Decode(
'CgxSb29tTGlzdERhdGESLQoIcGFnZURhdGEYASABKAsyES5CYXNlUGFnZVJlc3BEYXRhUghwYW'
'dlRGF0YRIfCgVyb29tcxgCIAMoCzIJLlJvb21EYXRhUgVyb29tcw==');

View File

@ -26,4 +26,8 @@ class PartyRoomGrpcServer {
final r = await _indexService.getRoomTypes(Empty()); final r = await _indexService.getRoomTypes(Empty());
return r; return r;
} }
static Future<RoomListData> getRoomList(RoomListPageReqData req) async {
return await _indexService.getRoomList(req);
}
} }

View File

@ -16,6 +16,13 @@ class PartyRoomHomeUI extends BaseUI<PartyRoomHomeUIModel> {
return Column( return Column(
children: [ children: [
makeHeader(context, model), makeHeader(context, model),
if (model.rooms == null)
Expanded(child: makeLoading(context))
else if (model.rooms!.isEmpty)
const Expanded(
child: Center(
child: Text("没有符合条件的房间!"),
)),
], ],
); );
} }

View File

@ -1,3 +1,4 @@
import 'package:fixnum/fixnum.dart';
import 'package:starcitizen_doctor/base/ui_model.dart'; import 'package:starcitizen_doctor/base/ui_model.dart';
import 'package:starcitizen_doctor/generated/grpc/party_room_server/index.pb.dart'; import 'package:starcitizen_doctor/generated/grpc/party_room_server/index.pb.dart';
import 'package:starcitizen_doctor/grpc/party_room_server.dart'; import 'package:starcitizen_doctor/grpc/party_room_server.dart';
@ -32,6 +33,16 @@ class PartyRoomHomeUIModel extends BaseUIModel {
RoomSortType selectedSortType = RoomSortType.Default; RoomSortType selectedSortType = RoomSortType.Default;
int pageNum = 1;
List<RoomData>? rooms;
@override
void initModel() {
super.initModel();
_loadTypes();
}
@override @override
Future loadData() async { Future loadData() async {
if (pingServerMessage != "") { if (pingServerMessage != "") {
@ -39,7 +50,22 @@ class PartyRoomHomeUIModel extends BaseUIModel {
notifyListeners(); notifyListeners();
} }
await _pingServer(); await _pingServer();
await _loadTypes(); _loadPage();
}
_loadPage() async {
final r = await PartyRoomGrpcServer.getRoomList(RoomListPageReqData(
pageNum: Int64.tryParseInt("$pageNum"),
typeID: selectedRoomType?.id,
subTypeID: selectedRoomSubType?.id,
status: selectedStatus));
if (r.pageData.hasNext) {
pageNum++;
} else {
pageNum = -1;
}
rooms = r.rooms;
notifyListeners();
} }
_pingServer() async { _pingServer() async {
@ -56,12 +82,12 @@ class PartyRoomHomeUIModel extends BaseUIModel {
} }
} }
_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: null, name: "全部", desc: "查看所有类型的房间,寻找一起玩的伙伴。"); RoomType(id: "", name: "全部", desc: "查看所有类型的房间,寻找一起玩的伙伴。");
selectedRoomSubType = RoomSubtype(id: "all", name: "全部"); selectedRoomSubType = RoomSubtype(id: "", name: "全部");
roomTypes = {null: selectedRoomType!}; roomTypes = {null: selectedRoomType!};
for (var element in r.roomTypes) { for (var element in r.roomTypes) {
roomTypes![element.id] = element; roomTypes![element.id] = element;

@ -1 +1 @@
Subproject commit 123be1e3d8170c86e121392e8bffa4def7dc3447 Subproject commit 8d8ff67e506cdee4a69123f3bea31b0465a48fe2