GameModelComp.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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. _isRelease: boolean = false;
  160. /** 数据层组件移除时,重置所有数据为默认值 */
  161. reset() {
  162. this.id = -1;
  163. this.protocolType = 1;
  164. this.curLevelInfo = null!;
  165. this.curLevelConfig = null!;
  166. this.costInfo = null!;
  167. this.recordList = [];
  168. this.isShowAd = false;
  169. this.price = 0;
  170. this.isDone = false;
  171. this.sign = "";
  172. this.changeHbCoin = 0;
  173. this.changeWxCoin = 0;
  174. this.viewType = "";
  175. this.txType = 1;
  176. this.txNum = 0;
  177. this.eventType = "";
  178. this.wechat_tx_info = null!;
  179. this.wxCash = 0;
  180. this.taskList = null!;
  181. this.doubleSpeedTime = 0;
  182. this.doubleRewardInfo = null!;
  183. this.loadbarInfo = null!;
  184. this.popupType = "";
  185. this.popupShow = false;
  186. this.gameState = GameState.READY;
  187. this.skipAdCount = 0;
  188. this.skipAdConfig = -1;
  189. }
  190. set isRelease(v: boolean) {
  191. this._isRelease = v;
  192. }
  193. get isRelease() {
  194. return this._isRelease
  195. }
  196. set doubleSpeedAdCount(v: number) {
  197. this._doubleSpeedAdCount = v;
  198. }
  199. get doubleSpeedAdCount() {
  200. return this._doubleSpeedAdCount;
  201. }
  202. set smallAdCount(v: number) {
  203. this._smallAdCount = v;
  204. }
  205. get smallAdCount() {
  206. return this._smallAdCount;
  207. }
  208. set allAdCount(v: number) {
  209. this._allAdCount = v;
  210. }
  211. get allAdCount() {
  212. return this._allAdCount;
  213. }
  214. set directAdCount(v: number) {
  215. this._directAdCount = v;
  216. }
  217. get directAdCount() {
  218. return this._directAdCount;
  219. }
  220. set skipAdCount(v: number) {
  221. this._skipAdCount = v;
  222. }
  223. get skipAdCount() {
  224. return this._skipAdCount;
  225. }
  226. set skipAdConfig(v: number) {
  227. this._skipAdConfig = v;
  228. }
  229. get skipAdConfig() {
  230. return this._skipAdConfig;
  231. }
  232. set gameState(v: GameState) {
  233. this._gameState = v;
  234. }
  235. get gameState() {
  236. return this._gameState;
  237. }
  238. set popupShow(v: boolean) {
  239. this._popupShow = v;
  240. }
  241. get popupShow() {
  242. return this._popupShow
  243. }
  244. set popupType(v: string) {
  245. this._popupType = v;
  246. }
  247. get popupType() {
  248. return this._popupType;
  249. }
  250. get doubleSpeedTime() {
  251. return this._doubleSpeedTime;
  252. }
  253. set doubleSpeedTime(value: number) {
  254. this._doubleSpeedTime = value;
  255. }
  256. set wxCash(v: number) {
  257. this._wxCash = v;
  258. }
  259. get wxCash() {
  260. return this._wxCash;
  261. }
  262. set taskList(v: taskList_info) {
  263. this._taskList = v;
  264. }
  265. get taskList() {
  266. return this._taskList;
  267. }
  268. set wechat_tx_info(value: wechat_tx_info) {
  269. this._wechat_tx_info = value;
  270. }
  271. get wechat_tx_info() {
  272. return this._wechat_tx_info;
  273. }
  274. set eventType(v: string) {
  275. this._eventType = v;
  276. }
  277. get eventType() {
  278. return this._eventType;
  279. }
  280. set txType(v: number) {
  281. this._txType = v;
  282. }
  283. get txType() {
  284. return this._txType;
  285. }
  286. //提现成功的金额
  287. set txNum(v: number) {
  288. this._txNum = v;
  289. }
  290. get txNum() {
  291. return this._txNum;
  292. }
  293. /**改变的红包币*/
  294. set changeHbCoin(value: number) {
  295. this._changeHbCoin = value;
  296. }
  297. get changeHbCoin() {
  298. return this._changeHbCoin;
  299. }
  300. set changeWxCoin(v: number) {
  301. this._changeWxCoin = v;
  302. }
  303. get changeWxCoin() {
  304. return this._changeWxCoin;
  305. }
  306. set viewType(value: string) {
  307. this._viewType = value;
  308. }
  309. get viewType() {
  310. return this._viewType;
  311. }
  312. set price(value: number) {
  313. this._price = value;
  314. }
  315. get price() {
  316. return this._price;
  317. }
  318. set isDone(value: boolean) {
  319. this._isDone = value;
  320. }
  321. get isDone() {
  322. return this._isDone;
  323. }
  324. set sign(value: string) {
  325. this._sign = value;
  326. }
  327. get sign() {
  328. return this._sign;
  329. }
  330. get handlingCharge() {
  331. return this._handlingCharge;
  332. }
  333. set handlingCharge(value: number) {
  334. this._handlingCharge = value;
  335. }
  336. set curScore(value: number) {
  337. this._curScore = value;
  338. }
  339. get curScore() {
  340. return this._curScore;
  341. }
  342. get targetScore() {
  343. return this._targetScore;
  344. }
  345. set targetScore(value: number) {
  346. this._targetScore = value;
  347. }
  348. get protocolType() {
  349. return this._protocolType;
  350. }
  351. set protocolType(value: number) {
  352. this._protocolType = value;
  353. }
  354. get curLevelInfo() {
  355. return this._curLevelInfo;
  356. }
  357. set curLevelInfo(value: CurLevelInfo) {
  358. this._curLevelInfo = value;
  359. }
  360. get curLevelConfig() {
  361. return this._curLevelConfig;
  362. }
  363. set curLevelConfig(value: CurLevelConfig) {
  364. this._curLevelConfig = value;
  365. }
  366. get costInfo() {
  367. return this._costInfo;
  368. }
  369. set costInfo(value: CostInfo) {
  370. this._costInfo = value;
  371. }
  372. get recordList() {
  373. return this._recordList;
  374. }
  375. set recordList(value: RecordInfo[]) {
  376. this._recordList = value;
  377. }
  378. get isShowAd() {
  379. return this._isShowAd;
  380. }
  381. set isShowAd(value: boolean) {
  382. this._isShowAd = value
  383. }
  384. get passViewInfo() {
  385. return this._passViewInfo;
  386. }
  387. set passViewInfo(value: PassViewInfo) {
  388. this._passViewInfo = value;
  389. }
  390. set cashNum(value: number) {
  391. this._cashNum = value;
  392. }
  393. get cashNum() {
  394. return this._cashNum;
  395. }
  396. //翻倍
  397. set doubleRewardInfo(value: doubleRewardInfo) {
  398. this._doubleRewardInfo = value;
  399. }
  400. get doubleRewardInfo() {
  401. return this._doubleRewardInfo;
  402. }
  403. //进度条奖励
  404. set loadbarInfo(v: loadBarInfo) {
  405. this._loadBarInfo = v;
  406. }
  407. get loadbarInfo() {
  408. return this._loadBarInfo;
  409. }
  410. }