GameModelComp.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-04-10 14:49:42
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-28 16:40:03
  6. * @Description:
  7. */
  8. import { ecs } from "db://oops-framework/libs/ecs/ECS";
  9. interface CurLevelInfo {
  10. level: number;
  11. score: number;
  12. }
  13. interface CurLevelConfig {
  14. level: number; //当前关卡
  15. score: number; //当前关卡目标分数
  16. skipCount: number; //当前关卡跳过次数
  17. eliminateScope: number[]; //消除配置 用于展示惊喜翻倍弹窗
  18. eventType: string //消除配置
  19. }
  20. //费用配置
  21. interface CostInfo {
  22. handlingCharge: number; //处理费
  23. giftNum: number; //赠送金
  24. }
  25. //提现记录
  26. interface RecordInfo {
  27. title: string,
  28. amount: number,
  29. payMethod: number,
  30. createTime: number,
  31. successTime: number,
  32. status: number
  33. }
  34. interface goodsList {
  35. propId: string,
  36. propNum: number
  37. }
  38. interface PassViewInfo {
  39. showReward: goodsList[]
  40. doubleReward: boolean
  41. }
  42. //微信提现页信息
  43. interface wechat_tx_info {
  44. money: number, //已有金额
  45. gapGoldNum: number, //差多少金砖
  46. handingChargeProgress: cost_info
  47. }
  48. //手续费信息
  49. interface cost_info {
  50. totalMoney: number, //已有金额
  51. handingCharge: number, //设置的手续费
  52. hasNum: number, //已经有
  53. gapNum: number, //还差
  54. }
  55. //红包币提现页信息
  56. interface taskList_info {
  57. level: number,
  58. target: number,
  59. reward: goodsList[],
  60. status: number
  61. }
  62. //翻倍奖励信息
  63. interface doubleRewardInfo {
  64. showReward: goodsList[],
  65. handingChargeProgress: cost_info,
  66. levelProgress: levelProgress
  67. }
  68. //翻倍奖励进度信息
  69. interface levelProgress {
  70. nextProgress: number, //下一关提现点距离
  71. levelInfoList: levelInfo[]
  72. }
  73. interface levelInfo {
  74. level: number,
  75. eventType: string,
  76. withdraw: boolean,
  77. }
  78. interface loadBarInfo {
  79. levelProgress: levelProgress,
  80. wealCount: number //福利次数
  81. }
  82. // 游戏状态枚举
  83. enum GameState {
  84. READY, // 准备中
  85. PLAYING, // 游戏中
  86. PAUSED, // 暂停 --进其他界面,广告等,游戏自动状态暂停
  87. GAME_OVER, // 游戏结束
  88. GAME_PASS
  89. }
  90. /** 数据层对象 */
  91. @ecs.register('GameModel')
  92. export class GameModelComp extends ecs.Comp {
  93. id: number = -1;
  94. // /**手续费*/
  95. _handlingCharge: number = 0;
  96. /**当前分数*/
  97. _curScore: number = 0;
  98. /**目标分数*/
  99. _targetScore: number = 0;
  100. /**协议类型 1隐私 2用户*/
  101. _protocolType: number = 1;
  102. //当前关卡信息
  103. _curLevelInfo: CurLevelInfo = null!;
  104. /**当前关卡配置*/
  105. _curLevelConfig: CurLevelConfig = null!;
  106. /**游戏费用配置*/
  107. _costInfo: CostInfo = null!;
  108. //提现记录
  109. _recordList: RecordInfo[] = [];
  110. //是否是广告时间
  111. _isShowAd: boolean = false;
  112. /**激励广告价值*/
  113. _price: number = 0;
  114. /**看完广告是否发奖励*/
  115. _isDone: boolean = false;
  116. /**通关奖励*/
  117. _passViewInfo: PassViewInfo = null!;
  118. /**视频签名*/
  119. _sign: string = "";
  120. //改变的红包币数
  121. _changeHbCoin: number = 0;
  122. //微信币数
  123. _changeWxCoin: number = 0;
  124. /**页面类型*/
  125. _viewType: string = ""; //1翻倍 2通关 3加速 4复活
  126. /**提现必反*/
  127. _cashNum: number = 0;
  128. //微信提现页金钱
  129. _txNum: number = 0;
  130. //事件类型 WITHDRAW_POINT-提现点 SIGN_POINT--预约登记 --PROCEDURE_POINT手续费
  131. _eventType: string = "";
  132. /**提现方式 1正常提现 2红包币提现,不要打开提现返利*/
  133. _txType: number = 1;
  134. //微信提现页信息
  135. _wechat_tx_info: wechat_tx_info = null!;
  136. //红包提现页信息
  137. _wxCash: number = 0;
  138. _taskList: taskList_info = null!;
  139. //2倍速时长
  140. _doubleSpeedTime: number = 0;
  141. _doubleRewardInfo: doubleRewardInfo = null!;
  142. _loadBarInfo: loadBarInfo = null!;
  143. _popupType: string = "";
  144. _popupShow: boolean = false;
  145. _gameState: GameState = GameState.READY;
  146. //广告跳过次数
  147. _skipAdCount: number = 0;
  148. //广告跳过次数配置
  149. _skipAdConfig: number = -1;
  150. /**统计少量领取广告次数*/
  151. _smallAdCount: number = 0;
  152. /**统计点击全都要的统计次数*/
  153. _allAdCount: number = 0;
  154. /**统计直接弹出激励视频广告的统计次数*/
  155. _directAdCount: number = 0;
  156. /**二倍速视频广告统计*/
  157. _doubleSpeedAdCount: number = 0;
  158. /** 数据层组件移除时,重置所有数据为默认值 */
  159. reset() {
  160. this.id = -1;
  161. this.protocolType = 1;
  162. this.curLevelInfo = null!;
  163. this.curLevelConfig = null!;
  164. this.costInfo = null!;
  165. this.recordList = [];
  166. this.isShowAd = false;
  167. this.price = 0;
  168. this.isDone = false;
  169. this.sign = "";
  170. this.changeHbCoin = 0;
  171. this.changeWxCoin = 0;
  172. this.viewType = "";
  173. this.txType = 1;
  174. this.txNum = 0;
  175. this.eventType = "";
  176. this.wechat_tx_info = null!;
  177. this.wxCash = 0;
  178. this.taskList = null!;
  179. this.doubleSpeedTime = 0;
  180. this.doubleRewardInfo = null!;
  181. this.loadbarInfo = null!;
  182. this.popupType = "";
  183. this.popupShow = false;
  184. this.gameState = GameState.READY;
  185. this.skipAdCount = 0;
  186. this.skipAdConfig = -1;
  187. }
  188. set doubleSpeedAdCount(v: number) {
  189. this._doubleSpeedAdCount = v;
  190. }
  191. get doubleSpeedAdCount() {
  192. return this._doubleSpeedAdCount;
  193. }
  194. set smallAdCount(v: number) {
  195. this._smallAdCount = v;
  196. }
  197. get smallAdCount() {
  198. return this._smallAdCount;
  199. }
  200. set allAdCount(v: number) {
  201. this._allAdCount = v;
  202. }
  203. get allAdCount() {
  204. return this._allAdCount;
  205. }
  206. set directAdCount(v: number) {
  207. this._directAdCount = v;
  208. }
  209. get directAdCount() {
  210. return this._directAdCount;
  211. }
  212. set skipAdCount(v: number) {
  213. this._skipAdCount = v;
  214. }
  215. get skipAdCount() {
  216. return this._skipAdCount;
  217. }
  218. set skipAdConfig(v: number) {
  219. this._skipAdConfig = v;
  220. }
  221. get skipAdConfig() {
  222. return this._skipAdConfig;
  223. }
  224. set gameState(v: GameState) {
  225. this._gameState = v;
  226. }
  227. get gameState() {
  228. return this._gameState;
  229. }
  230. set popupShow(v: boolean) {
  231. this._popupShow = v;
  232. }
  233. get popupShow() {
  234. return this._popupShow
  235. }
  236. set popupType(v: string) {
  237. this._popupType = v;
  238. }
  239. get popupType() {
  240. return this._popupType;
  241. }
  242. get doubleSpeedTime() {
  243. return this._doubleSpeedTime;
  244. }
  245. set doubleSpeedTime(value: number) {
  246. this._doubleSpeedTime = value;
  247. }
  248. set wxCash(v: number) {
  249. this._wxCash = v;
  250. }
  251. get wxCash() {
  252. return this._wxCash;
  253. }
  254. set taskList(v: taskList_info) {
  255. this._taskList = v;
  256. }
  257. get taskList() {
  258. return this._taskList;
  259. }
  260. set wechat_tx_info(value: wechat_tx_info) {
  261. this._wechat_tx_info = value;
  262. }
  263. get wechat_tx_info() {
  264. return this._wechat_tx_info;
  265. }
  266. set eventType(v: string) {
  267. this._eventType = v;
  268. }
  269. get eventType() {
  270. return this._eventType;
  271. }
  272. set txType(v: number) {
  273. this._txType = v;
  274. }
  275. get txType() {
  276. return this._txType;
  277. }
  278. //提现成功的金额
  279. set txNum(v: number) {
  280. this._txNum = v;
  281. }
  282. get txNum() {
  283. return this._txNum;
  284. }
  285. /**改变的红包币*/
  286. set changeHbCoin(value: number) {
  287. this._changeHbCoin = value;
  288. }
  289. get changeHbCoin() {
  290. return this._changeHbCoin;
  291. }
  292. set changeWxCoin(v: number) {
  293. this._changeWxCoin = v;
  294. }
  295. get changeWxCoin() {
  296. return this._changeWxCoin;
  297. }
  298. set viewType(value: string) {
  299. this._viewType = value;
  300. }
  301. get viewType() {
  302. return this._viewType;
  303. }
  304. set price(value: number) {
  305. this._price = value;
  306. }
  307. get price() {
  308. return this._price;
  309. }
  310. set isDone(value: boolean) {
  311. this._isDone = value;
  312. }
  313. get isDone() {
  314. return this._isDone;
  315. }
  316. set sign(value: string) {
  317. this._sign = value;
  318. }
  319. get sign() {
  320. return this._sign;
  321. }
  322. get handlingCharge() {
  323. return this._handlingCharge;
  324. }
  325. set handlingCharge(value: number) {
  326. this._handlingCharge = value;
  327. }
  328. set curScore(value: number) {
  329. this._curScore = value;
  330. }
  331. get curScore() {
  332. return this._curScore;
  333. }
  334. get targetScore() {
  335. return this._targetScore;
  336. }
  337. set targetScore(value: number) {
  338. this._targetScore = value;
  339. }
  340. get protocolType() {
  341. return this._protocolType;
  342. }
  343. set protocolType(value: number) {
  344. this._protocolType = value;
  345. }
  346. get curLevelInfo() {
  347. return this._curLevelInfo;
  348. }
  349. set curLevelInfo(value: CurLevelInfo) {
  350. this._curLevelInfo = value;
  351. }
  352. get curLevelConfig() {
  353. return this._curLevelConfig;
  354. }
  355. set curLevelConfig(value: CurLevelConfig) {
  356. this._curLevelConfig = value;
  357. }
  358. get costInfo() {
  359. return this._costInfo;
  360. }
  361. set costInfo(value: CostInfo) {
  362. this._costInfo = value;
  363. }
  364. get recordList() {
  365. return this._recordList;
  366. }
  367. set recordList(value: RecordInfo[]) {
  368. this._recordList = value;
  369. }
  370. get isShowAd() {
  371. return this._isShowAd;
  372. }
  373. set isShowAd(value: boolean) {
  374. this._isShowAd = value
  375. }
  376. get passViewInfo() {
  377. return this._passViewInfo;
  378. }
  379. set passViewInfo(value: PassViewInfo) {
  380. this._passViewInfo = value;
  381. }
  382. set cashNum(value: number) {
  383. this._cashNum = value;
  384. }
  385. get cashNum() {
  386. return this._cashNum;
  387. }
  388. //翻倍
  389. set doubleRewardInfo(value: doubleRewardInfo) {
  390. this._doubleRewardInfo = value;
  391. }
  392. get doubleRewardInfo() {
  393. return this._doubleRewardInfo;
  394. }
  395. //进度条奖励
  396. set loadbarInfo(v: loadBarInfo) {
  397. this._loadBarInfo = v;
  398. }
  399. get loadbarInfo() {
  400. return this._loadBarInfo;
  401. }
  402. }