Commit 79ddb845 authored by haiyoucuv's avatar haiyoucuv

init

parent 6fb14c27
import { import {
_decorator, _decorator,
Button, Button,
instantiate, instantiate,
Label, Label,
loadWasmModuleBullet, loadWasmModuleBullet,
Node, Node,
Prefab, Prefab,
ProgressBar, ProgressBar,
Sprite, Sprite,
SpriteFrame SpriteFrame
} from "cc"; } from "cc";
import Scene from "db://assets/core/Module/Scene"; import Scene from "db://assets/core/Module/Scene";
import { changeScene, showPanel } from "db://assets/core/Module/UIFast"; import { changeScene, showPanel } from "db://assets/core/Module/UIFast";
...@@ -29,114 +29,114 @@ const { ccclass, property } = _decorator; ...@@ -29,114 +29,114 @@ const { ccclass, property } = _decorator;
@ccclass('HomeScene') @ccclass('HomeScene')
export class HomeScene extends Scene { export class HomeScene extends Scene {
static bundle: string = "HomeScene"; static bundle: string = "HomeScene";
static skin: string = "HomeScene"; static skin: string = "HomeScene";
// static group: string[] = ["HomeScene"]; // static group: string[] = ["HomeScene"];
@property(Node) startBtn: Node = null; @property(Node) startBtn: Node = null;
@property(Label) timesLabel: Label = null; @property(Label) timesLabel: Label = null;
@property(Node) ruleBtn: Node = null; @property(Node) ruleBtn: Node = null;
@property(Node) prizeBtn: Node = null; @property(Node) prizeBtn: Node = null;
@property(ProgressBar) progress: ProgressBar = null; @property(ProgressBar) progress: ProgressBar = null;
@property(Node) boxRoot: Node = null; @property(Node) boxRoot: Node = null;
@property(Prefab) boxItemPrefab: Prefab = null; @property(Prefab) boxItemPrefab: Prefab = null;
@property(SpriteFrame) boxStatus1: SpriteFrame = null; @property(SpriteFrame) boxStatus1: SpriteFrame = null;
@property(SpriteFrame) boxStatus2: SpriteFrame = null; @property(SpriteFrame) boxStatus2: SpriteFrame = null;
@property(SpriteFrame) boxStatus3: SpriteFrame = null; @property(SpriteFrame) boxStatus3: SpriteFrame = null;
onLoad() { onLoad() {
this.startBtn.on(Button.EventType.CLICK, this.clickStart, this); this.startBtn.on(Button.EventType.CLICK, this.clickStart, this);
this.ruleBtn.on(Button.EventType.CLICK, this.clickRule, this); this.ruleBtn.on(Button.EventType.CLICK, this.clickRule, this);
this.prizeBtn.on(Button.EventType.CLICK, this.clickPrize, this); this.prizeBtn.on(Button.EventType.CLICK, this.clickPrize, this);
} }
async start() { async start() {
if (this.data.from != "Loading") { if (this.data.from != "Loading") {
await store.updateIndex(); await store.updateIndex();
}
} }
}
clickRule = () => {
clickRule = () => { if (!store.checkActTime(true)) return;
if(store.checkActTime(true)) return; showPanel(RulePanel);
showPanel(RulePanel); };
};
clickPrize = () => {
clickPrize = () => { if (!store.checkActTime(true)) return;
if(store.checkActTime(true)) return; changeScene(PrizeScene);
changeScene(PrizeScene);
}
@render
render() {
const {
freeTimes = 0,
boxConfigs = [],
} = store.homeInfo || {};
if (+freeTimes) {
this.timesLabel.string = `免费次数:${freeTimes}`;
} else {
this.timesLabel.string = `20积分/次`;
} }
this.boxRoot.removeAllChildren(); @render
const len = boxConfigs.length; render() {
let maxIndex = 0; const {
for (let i = 0; i < boxConfigs.length; i++) { freeTimes = 0,
boxConfigs = [],
} = store.homeInfo || {};
const { id, status, targetLevel } = boxConfigs[i]; if (+freeTimes) {
this.timesLabel.string = `免费次数:${freeTimes}`;
} else {
this.timesLabel.string = `20积分/次`;
}
const item = instantiate(this.boxItemPrefab); this.boxRoot.removeAllChildren();
const sp = item.getComponent(Sprite); const len = boxConfigs.length;
const txt = item.getComponentInChildren(Label); let maxIndex = 0;
txt.string = `通过${targetLevel}关`; for (let i = 0; i < boxConfigs.length; i++) {
if (+status === 2 || +status === 3) { const { id, status, targetLevel } = boxConfigs[i];
sp.spriteFrame = this[`boxStatus${status}`];
maxIndex = Math.max(maxIndex, i);
} else {
sp.spriteFrame = this.boxStatus1;
}
this.boxRoot.addChild(item); const item = instantiate(this.boxItemPrefab);
item.setPosition(-500 / 2 + i / Math.max(1, len - 1) * 500, 0); const sp = item.getComponent(Sprite);
const txt = item.getComponentInChildren(Label);
txt.string = `通过${targetLevel}关`;
item.on(Button.EventType.CLICK, this.openBox.bind(this, boxConfigs[i]), this); if (+status === 2 || +status === 3) {
} sp.spriteFrame = this[`boxStatus${status}`];
maxIndex = Math.max(maxIndex, i);
} else {
sp.spriteFrame = this.boxStatus1;
}
this.progress.progress = maxIndex / Math.max(1, len - 1); this.boxRoot.addChild(item);
item.setPosition(-500 / 2 + i / Math.max(1, len - 1) * 500, 0);
} item.on(Button.EventType.CLICK, this.openBox.bind(this, boxConfigs[i]), this);
}
openBox = _asyncThrottle(async function (item) { this.progress.progress = maxIndex / Math.max(1, len - 1);
const { id, status, targetLevel } = item;
if (+status != 2) return;
const { success, data } = await sendWebNet(WebNetName.openBox, { id });
if (!success) return;
await showPanel(BoxPanel, data);
}, 500)
clickStart = _asyncThrottle(async () => { }
if(store.checkActTime()) return; openBox = _asyncThrottle(async function (item) {
const { id, status, targetLevel } = item;
if (+status != 2) return;
const { success, data } = await sendWebNet(WebNetName.openBox, { id });
if (!success) return;
await showPanel(BoxPanel, data);
}, 500)
await loadWasmModuleBullet(); clickStart = _asyncThrottle(async () => {
const suc = await gameStore.start();
if (!suc) return
if (!gameStore.startInfo.guideFlag) { if (!store.checkActTime()) return;
changeScene(GuideScene);
} else { await loadWasmModuleBullet();
changeScene(MainGame); const suc = await gameStore.start();
} if (!suc) return
});
if (!gameStore.startInfo.guideFlag) {
changeScene(GuideScene);
} else {
changeScene(MainGame);
}
});
} }
...@@ -98,14 +98,14 @@ ...@@ -98,14 +98,14 @@
</style> </style>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/assets/plugin/zepto.min.js"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/assets/plugin/declare-process.js"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/assets/plugin/jszip.min.v3.10.1.js"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/assets/plugin/rem.min.js"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/assets/plugin/rem.min.js"></script>
<script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/style.css" />--> <!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/style.css" />-->
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/custom.css" />--> <!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/custom.css" />-->
<!-- <script src="//yun-duiba-credits-test.duibatest.com.cn/TNGD_GAMES/libs/eruda.min.js"></script>--> <!-- <script src="//yun-duiba-credits-test.duibatest.com.cn/TNGD_GAMES/libs/eruda.min.js"></script>-->
<!-- <script>eruda.init()</script>--> <!-- <script>eruda.init()</script>-->
...@@ -118,20 +118,20 @@ ...@@ -118,20 +118,20 @@
</div> </div>
<!-- Polyfills bundle. --> <!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/polyfills.bundle.js" charset="utf-8"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. --> <!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/system.bundle.js" charset="utf-8"></script> <script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map --> <!-- Import map -->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>--> <!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<script type="systemjs-importmap" charset="utf-8"> <script type="systemjs-importmap" charset="utf-8">
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/cocos-js/cc.js"}} {"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/cocos-js/cc.js"}}
</script> </script>
<script> <script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1748921865345/index.js').catch(function (err) { System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1748922649776/index.js').catch(function (err) {
console.error(err); console.error(err);
}) })
</script> </script>
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
"progress": 1, "progress": 1,
"state": "success", "state": "success",
"stage": "build", "stage": "build",
"message": "2025-6-3 11:39:16 build success in 1 min 33 s!", "message": "2025-6-3 11:51:41 build success in 51 s!",
"detailMessage": "%c兑吧发布插件 >> 版本号:1748921865345\rcolor: green\r", "detailMessage": "builder:build-project-total (51407ms)\r",
"options": { "options": {
"name": "card", "name": "card",
"server": "", "server": "",
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
"__version__": "1.3.9", "__version__": "1.3.9",
"logDest": "project://temp/builder/log/web-mobile2025-5-30 16-01.log" "logDest": "project://temp/builder/log/web-mobile2025-5-30 16-01.log"
}, },
"time": "2025-6-3 11:37:43", "time": "2025-6-3 11:50:49",
"dirty": false "dirty": false
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment