PlayerInfo.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'package:json_annotation/json_annotation.dart';
  2. import 'UserInfo.dart';
  3. import 'GameInfo.dart';
  4. import 'HouseInfo.dart';
  5. part 'PlayerInfo.g.dart';
  6. @JsonSerializable()
  7. class PlayerInfo {
  8. PlayerInfo(
  9. this.id, this.houseId, this.userId, this.statusFlag, this.userInfo,this.bonus,this.gameInfo,this.houseInfo,this.rank,this.houseRank,this.video,this.platinum,this.gold,this.silver,this.bronze);
  10. int id;
  11. int houseId; //房间id
  12. int userId; //用户id
  13. int statusFlag; //状态 0加入 1准备 2开始 3结束 6未比赛
  14. UserInfo userInfo;
  15. int bonus;//奖金
  16. GameInfo gameInfo;
  17. HouseInfo houseInfo;
  18. int rank;//名次
  19. int houseRank;//房间比赛名次
  20. String video;//视频地址
  21. int platinum; //铂金
  22. int gold;//金牌
  23. int silver;//银牌
  24. int bronze;//铜牌
  25. factory PlayerInfo.fromJson(Map<String, dynamic> json) =>
  26. _$PlayerInfoFromJson(json);
  27. Map<String, dynamic> toJson() => _$PlayerInfoToJson(this);
  28. // 命名构造函数
  29. PlayerInfo.empty();
  30. String getPlatinum() {
  31. return this.platinum.toString();
  32. }
  33. String getGold() {
  34. return this.gold.toString();
  35. }
  36. String getSilver() {
  37. return this.silver.toString();
  38. }
  39. String getBronze() {
  40. return this.bronze.toString();
  41. }
  42. @override
  43. String toString() {
  44. return _$PlayerInfoToJson(this).toString();
  45. }
  46. }