AccountModelComp.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * @Author: dgflash
  3. * @Date: 2021-11-12 10:02:31
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-09 16:31:00
  6. */
  7. import { oops } from "db://oops-framework/core/Oops";
  8. import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
  9. /**
  10. * 游戏账号数据
  11. */
  12. interface CurLevelInfo {
  13. level: number;
  14. score: number;
  15. }
  16. interface CurLevelConfig {
  17. level: number; //当前关卡
  18. score: number; //当前关卡目标分数
  19. skipCount: number; //当前关卡跳过次数
  20. eliminateScope: []; //消除配置
  21. eventType: string //消除配置
  22. }
  23. //费用配置
  24. interface CostInfo {
  25. handlingCharge: number; //处理费
  26. giftNum: number; //赠送金
  27. }
  28. @ecs.register('AccountModel')
  29. export class AccountModelComp extends ecs.Comp {
  30. /** 账号名 */
  31. _accountName: string = null!;
  32. /**玩家UID */
  33. _uid: number = -1;
  34. /**玩家头像*/
  35. _headUrl: string = null!
  36. /**当前关卡--默认从0开始*/
  37. _curLevel: number = 0;
  38. /**游戏币*/
  39. _gameCoin: number = 0;
  40. /**红包币*/
  41. _cashCoin: number = 0;
  42. /**金块*/
  43. _goldCoin: number = 0;
  44. /**手续费*/
  45. _handlingCharge: number = 0;
  46. /**目标分数*/
  47. _targetScore: number = 0;
  48. /**协议类型 1隐私 2用户*/
  49. _protocolType: number = 1;
  50. //当前关卡信息
  51. _curLevelInfo: CurLevelInfo = null!;
  52. /**当前关卡配置*/
  53. _curLevelConfig: CurLevelConfig = null!;
  54. /**游戏费用配置*/
  55. _costInfo: CostInfo = null!;
  56. /**是否登录过*/
  57. _isLogined: boolean = false;
  58. reset() {
  59. this.accountName = null!;
  60. this.uid = -1;
  61. this.headUrl = null!;
  62. this.curLevel = 0;
  63. this.gameCoin = 0;
  64. this.cashCoin = 0;
  65. this.protocolType = 1;
  66. this.curLevelInfo = null!;
  67. this.curLevelConfig = null!;
  68. this.costInfo = null!;
  69. }
  70. get accountName() {
  71. return this._accountName;
  72. }
  73. set accountName(value: string) {
  74. this._accountName = value;
  75. }
  76. get uid() {
  77. return this._uid;
  78. }
  79. set uid(value: number) {
  80. this._uid = value;
  81. }
  82. get headUrl() {
  83. return this._headUrl;
  84. }
  85. set headUrl(value: string) {
  86. this._headUrl = value;
  87. }
  88. get curLevel() {
  89. return this._curLevel;
  90. }
  91. set curLevel(value: number) {
  92. this._curLevel = value;
  93. }
  94. get gameCoin() {
  95. return this._gameCoin;
  96. }
  97. set gameCoin(value: number) {
  98. this._gameCoin = value;
  99. }
  100. get cashCoin() {
  101. return this._cashCoin;
  102. }
  103. set cashCoin(value: number) {
  104. this._cashCoin = value;
  105. }
  106. get goldCoin() {
  107. return this._goldCoin;
  108. }
  109. set goldCoin(value: number) {
  110. this._goldCoin = value;
  111. }
  112. get handlingCharge() {
  113. return this._handlingCharge;
  114. }
  115. set handlingCharge(value: number) {
  116. this._handlingCharge = value;
  117. }
  118. get targetScore() {
  119. return this._targetScore;
  120. }
  121. set targetScore(value: number) {
  122. this._targetScore = value;
  123. }
  124. get protocolType() {
  125. return this._protocolType;
  126. }
  127. set protocolType(value: number) {
  128. this._protocolType = value;
  129. }
  130. get curLevelInfo() {
  131. return this._curLevelInfo;
  132. }
  133. set curLevelInfo(value: CurLevelInfo) {
  134. this._curLevelInfo = value;
  135. }
  136. get curLevelConfig() {
  137. return this._curLevelConfig;
  138. }
  139. set curLevelConfig(value: CurLevelConfig) {
  140. this._curLevelConfig = value;
  141. }
  142. get costInfo() {
  143. return this._costInfo;
  144. }
  145. set costInfo(value: CostInfo) {
  146. this._costInfo = value;
  147. }
  148. get isLogined() {
  149. return this._isLogined;
  150. }
  151. set isLogined(value: boolean) {
  152. this._isLogined = value;
  153. }
  154. }