GameModelComp.ts 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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-24 15:56:23
  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. reset() {
  152. this.id = -1;
  153. this.protocolType = 1;
  154. this.curLevelInfo = null!;
  155. this.curLevelConfig = null!;
  156. this.costInfo = null!;
  157. }
  158. set skipAdCount(v: number) {
  159. this._skipAdCount = v;
  160. }
  161. get skipAdCount() {
  162. return this._skipAdCount;
  163. }
  164. set skipAdConfig(v: number) {
  165. this._skipAdConfig = v;
  166. }
  167. get skipAdConfig() {
  168. return this._skipAdConfig;
  169. }
  170. set gameState(v: GameState) {
  171. this._gameState = v;
  172. }
  173. get gameState() {
  174. return this._gameState;
  175. }
  176. set popupShow(v: boolean) {
  177. this._popupShow = v;
  178. }
  179. get popupShow() {
  180. return this._popupShow
  181. }
  182. set popupType(v: string) {
  183. this._popupType = v;
  184. }
  185. get popupType() {
  186. return this._popupType;
  187. }
  188. get doubleSpeedTime() {
  189. return this._doubleSpeedTime;
  190. }
  191. set doubleSpeedTime(value: number) {
  192. this._doubleSpeedTime = value;
  193. }
  194. set wxCash(v: number) {
  195. this._wxCash = v;
  196. }
  197. get wxCash() {
  198. return this._wxCash;
  199. }
  200. set taskList(v: taskList_info) {
  201. this._taskList = v;
  202. }
  203. get taskList() {
  204. return this._taskList;
  205. }
  206. set wechat_tx_info(value: wechat_tx_info) {
  207. this._wechat_tx_info = value;
  208. }
  209. get wechat_tx_info() {
  210. return this._wechat_tx_info;
  211. }
  212. set eventType(v: string) {
  213. this._eventType = v;
  214. }
  215. get eventType() {
  216. return this._eventType;
  217. }
  218. set txType(v: number) {
  219. this._txType = v;
  220. }
  221. get txType() {
  222. return this._txType;
  223. }
  224. //提现成功的金额
  225. set txNum(v: number) {
  226. this._txNum = v;
  227. }
  228. get txNum() {
  229. return this._txNum;
  230. }
  231. /**改变的红包币*/
  232. set changeHbCoin(value: number) {
  233. this._changeHbCoin = value;
  234. }
  235. get changeHbCoin() {
  236. return this._changeHbCoin;
  237. }
  238. set changeWxCoin(v: number) {
  239. this._changeWxCoin = v;
  240. }
  241. get changeWxCoin() {
  242. return this._changeWxCoin;
  243. }
  244. set viewType(value: string) {
  245. this._viewType = value;
  246. }
  247. get viewType() {
  248. return this._viewType;
  249. }
  250. set price(value: number) {
  251. this._price = value;
  252. }
  253. get price() {
  254. return this._price;
  255. }
  256. set isDone(value: boolean) {
  257. this._isDone = value;
  258. }
  259. get isDone() {
  260. return this._isDone;
  261. }
  262. set sign(value: string) {
  263. this._sign = value;
  264. }
  265. get sign() {
  266. return this._sign;
  267. }
  268. get handlingCharge() {
  269. return this._handlingCharge;
  270. }
  271. set handlingCharge(value: number) {
  272. this._handlingCharge = value;
  273. }
  274. set curScore(value: number) {
  275. this._curScore = value;
  276. }
  277. get curScore() {
  278. return this._curScore;
  279. }
  280. get targetScore() {
  281. return this._targetScore;
  282. }
  283. set targetScore(value: number) {
  284. this._targetScore = value;
  285. }
  286. get protocolType() {
  287. return this._protocolType;
  288. }
  289. set protocolType(value: number) {
  290. this._protocolType = value;
  291. }
  292. get curLevelInfo() {
  293. return this._curLevelInfo;
  294. }
  295. set curLevelInfo(value: CurLevelInfo) {
  296. this._curLevelInfo = value;
  297. }
  298. get curLevelConfig() {
  299. return this._curLevelConfig;
  300. }
  301. set curLevelConfig(value: CurLevelConfig) {
  302. this._curLevelConfig = value;
  303. }
  304. get costInfo() {
  305. return this._costInfo;
  306. }
  307. set costInfo(value: CostInfo) {
  308. this._costInfo = value;
  309. }
  310. get recordList() {
  311. return this._recordList;
  312. }
  313. set recordList(value: RecordInfo[]) {
  314. this._recordList = value;
  315. }
  316. get isShowAd() {
  317. return this._isShowAd;
  318. }
  319. set isShowAd(value: boolean) {
  320. this._isShowAd = value
  321. }
  322. get passViewInfo() {
  323. return this._passViewInfo;
  324. }
  325. set passViewInfo(value: PassViewInfo) {
  326. this._passViewInfo = value;
  327. }
  328. set cashNum(value: number) {
  329. this._cashNum = value;
  330. }
  331. get cashNum() {
  332. return this._cashNum;
  333. }
  334. //翻倍
  335. set doubleRewardInfo(value: doubleRewardInfo) {
  336. this._doubleRewardInfo = value;
  337. }
  338. get doubleRewardInfo() {
  339. return this._doubleRewardInfo;
  340. }
  341. //进度条奖励
  342. set loadbarInfo(v: loadBarInfo) {
  343. this._loadBarInfo = v;
  344. }
  345. get loadbarInfo() {
  346. return this._loadBarInfo;
  347. }
  348. }