Commit ec0044b8 authored by wildfirecode13's avatar wildfirecode13

u

parent 0f544424
......@@ -67,7 +67,7 @@
<!-- 构建的js -->
<script src="output.js" crossorigin="anonymous"></script>
<!-- <script src="https://yun.duiba.com.cn/db_games/activity/template/1628493535/output.js" crossorigin="anonymous"></script> -->
<!-- <script src="https://yun.duiba.com.cn/db_games/activity/template/1628494686/output.js" crossorigin="anonymous"></script> -->
......
......@@ -73,7 +73,7 @@ export class Main {
//显示场景
if (isShare()) {
changeScene(ShareScene, { query: getQueryParams() });
changeScene(ShareScene);
} else {
const alreadyAcquiredResult = await sendWebNet(WebNetName.alreadyAcquired)
......
This diff is collapsed.
import { changeScene } from "../../module/ctrls";
import { RES } from "../../module/RES";
import { Scene } from "../../module/views/Scene";
import { ProgressBarS } from "../common/ProgressBarS";
import getObject from "../getObject";
import { getWebData, sendWebNet, WebNetName } from "../WebNet";
import { StartScene } from "./StartScene";
export class LoadingScene extends Scene {
get groupNames() {
return ["loading"]
}
get skinName() { return "loading" }
progressBar: ProgressBarS;
initUi() {
// //进度条
var pro = getObject(this,'loading_progressfront');
console.log(pro)
//进度条托管
this.progressBar = new ProgressBarS(pro);
}
async start() {
super.start()
console.log(this)
//监听进度条事件
this.addEventListener(FYGE.Event.PROGRESS, this.progressEvent, this)
//首次进度一点
this.dispatchEvent(FYGE.Event.PROGRESS, 0.2)
//做些啥?
this.dispatchEvent(FYGE.Event.PROGRESS, 0.3);
// 接口示例
// var res1 = await sendWebNet(WebNetName.index)
// //做些啥?
// if (!res1.success) return
//判断是否结束
//
this.dispatchEvent(FYGE.Event.PROGRESS, 0.5);
//资源1
await RES.loadGroup("StartScene")
this.dispatchEvent(FYGE.Event.PROGRESS, 0.6);
//资源2
// await RES.loadGroup("mapCrabEffect")
this.dispatchEvent(FYGE.Event.PROGRESS, 0.7);
//资源
// await RES
this.dispatchEvent(FYGE.Event.PROGRESS, 0.8);
//随便异步示例
await new Promise((r) => {
setTimeout(r, 100)
})
this.dispatchEvent(FYGE.Event.PROGRESS, 1);
}
progressEvent(e: FYGE.Event) {
let pro = e.data;
FYGE.Tween.removeTweens(this.progressBar)
FYGE.Tween.get(this.progressBar)
.to({ value: pro }, 2000)
.call(() => {
if (pro >= 1) {
this.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this);
// changeScene(StartScene,getWebData(WebNetName.index).data)
}
})
}
}
import { Scene } from "../../module/views/Scene";
import { showPanel, showWaiting, hideWaiting, showToast, changeScene } from "../../module/ctrls";
import { RulePanel } from "../panels/rule";
import { Tools } from "../Tools";
import { layers } from "../../module/views/layers";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { PlayScene } from "./PlayScene";
import { sendWebNet, WebNetName } from "../WebNet";
export class StartScene extends Scene {
get groupNames() { return ["StartScene"] }
get skinName() { return "StartScene" }
taskBtn: FYGE.Button;
lotBtn: FYGE.Button;
rankBtn: FYGE.Button;
timesTxt: FYGE.TextField;
startBtn: FYGE.Button;
ruleBtn: FYGE.Button;
recordBtn: FYGE.Button;
initUi() {
// this.y -= layers.stageOffsetY;
//次数文案居中
Tools.changeTextAlign(this.timesTxt, FYGE.TEXT_ALIGN.CENTER, 300);
//加滚动
if (layers.stageHeight < 1624) {
var scroll = new FYGE.ScrollPage(750, layers.stageHeight, 1624 - layers.stageOffsetY, true, true)
// 所有内容加入滚动
// this.children.forEach((c)=>{ //这种方式有问题,因为子级的索引
// scroll.view.addChild(c);
// })
scroll.view.addChildren(...this.removeChildren());
// scroll.view.addChildren.apply(scroll.view,this.removeChildren())
// //滚动加入加入父级
this.addChild(scroll);
}
}
async start(data) {
super.start()
//次数文案修改
this.timesTxt.text = "剩余次数:" + this.data.gameCounts + "次";
}
initEvents() {
super.initEvents();
//开始游戏
// this.startBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
// showWaiting();
// var res = await sendWebNet(WebNetName)
// hideWaiting();
// if (res.success) {
// changeScene(PlayScene, { ...res.data });
// } else {
// //TODO
// }
// }, this)
//规则按钮
this.ruleBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
showPanel(RulePanel)
}, this)
//我的奖品按钮
this.recordBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
//弄个延时
Tools.btnDelay(this.recordBtn)
//跳转,链接待定
location.href = window["recordUrl"];
}, this)
//排行榜按钮
this.rankBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
console.log("点击了排行榜弹框")
}, this)
//任务弹框
this.taskBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
console.log("点击了任务弹框")
}, this)
//监听下次数修改
GDispatcher.addEventListener(G_EVENT.UPDATE_SCENE, this.updateScene, this);
}
removeEvents() {
super.removeEvents();
//移除次数监听
GDispatcher.removeEventListener(G_EVENT.UPDATE_SCENE, this.updateScene, this);
//其他的按钮事件不写了,没存引用,反正destroy会把挂在场景上的所有显示对象的事件都清除
}
}
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