GameModelComp.ts 8.3 KB

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