Commit 3c6c7cfd authored by wildfirecode's avatar wildfirecode

1

parent eed920c1
{
"global": {
"globalBindingDataTestObj": []
"globalBindingDataTestObj": [],
"globalBackgroundAlpha": 100,
"globalBackgroundX": 0,
"globalBackgroundY": 0,
"globalBackgroundWidth": -1,
"globalBackgroundHeight": -1,
"globalBackgroundColor": "#ffffff",
"globalBackgroundImage": "/Users/wanghongyuan/db-game-template/egret/resource/assets/startScene/startscenebg.jpg"
},
"1667fb18fa6": {
"bindingDataTestObj": [
......@@ -30,5 +37,10 @@
"backgroundWidth": -1,
"backgroundHeight": -1,
"backgroundAlpha": 100
},
"16705cb4eec": {
"backgroundType": "user",
"backgroundImage": "/Users/wanghongyuan/db-game-template/egret/resource/assets/startScene/startscenebg.jpg",
"backgroundAlpha": 100
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -41,7 +41,7 @@ export default class MainBase extends eui.UILayer {
const scenes = [
[ModuleTypes.START_SCENE, this.startSceneConfig],
[ModuleTypes.PALY_SCENE, this.playSceneConfig]
[ModuleTypes.PLAY_SCENE, this.playSceneConfig]
];
panels.forEach(item => PanelCtrl.instance.registerPanel(item[0], item[1]));
......
......@@ -7,6 +7,10 @@ import { ModuleTypes } from "../types/sceneTypes";
import showAlertPanel from "../ctrls/showAlertPanel";
export default class PlaySceneBase extends Scene {
score = 0;
start() {
egret.Tween.get(this).set({ x: 750 }).to({ x: 0 }, 300);
}
sendSubmit() {
submit(() => {
let panel: Panel;
......
......@@ -17,6 +17,7 @@ export default class StartSceneBase extends Scene {
startBtn: eui.Button;
rankBtn: eui.Button;
countdownTxt: eui.Label;
elements: eui.Group;
countTxt: eui.Label;
exemptionTxt: eui.Label;
......@@ -26,16 +27,16 @@ export default class StartSceneBase extends Scene {
this.startBtn.visible = false;
this.updateGetInfoView();
this.updateExemptionTxt();
this.showElements();
this.autoStart();
// this.autoStart();
this.addEventListener(egret.Event.ADDED_TO_STAGE, () => {
this.height = this.stage.stageHeight;
}, this);
this.playAnimation();
}
autoStart() {
const n = 9999;
const n = 3;
const timer = new egret.Timer(1000, n);
timer.addEventListener(egret.TimerEvent.TIMER, () => {
this.updateCountdownTxt(n - timer.currentCount);
......@@ -52,11 +53,30 @@ export default class StartSceneBase extends Scene {
this.countdownTxt.text = `生活不容易,(${n})秒后帮您自动开始游戏`
}
showElements() {
async playAnimation() {
this.startBtn.horizontalCenter = 750;
this.countTxt.horizontalCenter = 750;
const btns = [this.ruleBtn, this.optionBtn, this.recordBtn, this.rankBtn];
btns.forEach(btn => btn.alpha = 0)
for (const item of ['e1', 'e2', 'e3', 'e4']) {
egret.Tween.get(this[item]).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.getBackOut(2));
}
egret.Tween.get(this['logo']).set({ x: this['logo'].x + 750 }).wait(500).to({ x: this['logo'].x }, 300, egret.Ease.backOut).call(async () => {
egret.Tween.get(this.startBtn).to({ horizontalCenter: 0 }, 400, egret.Ease.backOut);
egret.Tween.get(this.countTxt).wait(400).to({ horizontalCenter: 0 }, 300, egret.Ease.backOut);
const btns = [this.ruleBtn, this.optionBtn, this.recordBtn, this.rankBtn];
btns.forEach(btn => {
egret.Tween.get(btn).set({ alpha: 0 }).to({ alpha: 1 }, 700, egret.Ease.backOut);
})
egret.Tween.get(btn).to({ alpha: 1 }, 700, egret.Ease.backOut);
});
await wait(500);
egret.Tween.get(this.startBtn, { loop: true })
.to({ scaleY: 1.1, scaleX: 0.9 }, 1000, egret.Ease.bounceOut)
.wait(500)
.to({ scaleY: 1, scaleX: 1 }, 1000)
.to({ scaleX: 1.1, scaleY: 0.9 }, 1000)
.to({ scaleX: 1, scaleY: 1 }, 1000);
});
}
private updateGetInfoView() {
......@@ -72,21 +92,14 @@ export default class StartSceneBase extends Scene {
if (this.startBtn) {
this.startBtn.visible = true;
this.startBtn.enabled = getStartBtnEnable();
egret.Tween.get(this.startBtn).set({ horizontalCenter: 750 }).to({ horizontalCenter: 0 }, 400, egret.Ease.elasticOut);
await wait(500);
egret.Tween.get(this.startBtn, { loop: true })
.to({ scaleY: 1.1, scaleX: 0.9 }, 1000, egret.Ease.bounceOut)
.wait(500)
.to({ scaleY: 1, scaleX: 1 }, 1000)
.to({ scaleX: 1.1, scaleY: 0.9 }, 1000)
.to({ scaleX: 1, scaleY: 1 }, 1000);
}
}
updateCountTxt() {
if (this.countTxt) {
this.countTxt.text = getCountTxt();
egret.Tween.get(this.countTxt).set({ horizontalCenter: 750 }).wait(400).to({ horizontalCenter: 0 }, 300, egret.Ease.backOut);
}
}
......@@ -132,13 +145,25 @@ export default class StartSceneBase extends Scene {
async onTap_startBtn(e?: egret.Event) {
this.stopTimer();
egret.Tween.removeTweens(this.startBtn);
egret.Tween.get(this.startBtn).to({ horizontalCenter: 750 }, 200);
egret.Tween.get(this.countTxt).to({ horizontalCenter: -750 }, 200);
doStart();
egret.Tween.get(this['logo']).to({ x: this['logo'].x - 750 }, 200);
egret.Tween.get(this.startBtn).to({ horizontalCenter: -750 }, 200);
egret.Tween.get(this.countTxt).to({ horizontalCenter: -750 }, 200);
const btns = [this.ruleBtn, this.optionBtn, this.recordBtn, this.rankBtn];
btns.forEach(btn => {
egret.Tween.get(btn).to({ alpha: 0 }, 200);
});
await wait(200);
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE);
for (const item of ['e1', 'e2', 'e3', 'e4']) {
egret.Tween.get(this[item]).to({ scaleX: 0, scaleY: 0 }, 300,egret.Ease.backIn);
}
await wait(300);
SceneCtrl.instance.change(ModuleTypes.PLAY_SCENE);
}
private stopTimer() {
if (this._timer)
this._timer.stop();
egret.Tween.get(this.countdownTxt).to({ alpha: 0 }, 200);
}
......
......@@ -32,33 +32,13 @@ export default class SceneCtrl {
}
}
// loadAtlasAndBg(scene, callback) {
// let counter = 2;
// const check = () => {
// if (counter == 0) {
// callback && callback();
// }
// }
// RES.getResAsync(`${scene.skinKey.toLowerCase()}_json`, (sheet: egret.SpriteSheet) => {
// counter--;
// check();
// }, this);
// RES.getResAsync(`${scene.skinKey.toLowerCase()}scenebg_jpg`, () => {
// counter--;
// check();
// }, this);
// }
showAfterLoadAtlas(scene: Scene, data, onComplete: Function) {
Loading.instace.hide();
if (this._currentScene) {
const oldScene = this._currentScene;
egret.Tween.get(oldScene).to({ alpha: 0 }, 0).call(() => {
oldScene.destroy();
this._parent.removeChild(oldScene);
});
}
egret.Tween.get(scene).set({ alpha: 0 }).to({ alpha: 1 }, 500);
scene.loadSkin();
scene.start();
this.addToStage(scene);
......
export enum ModuleTypes {
START_SCENE,
PALY_SCENE,
PLAY_SCENE,
ALERT_PANEL,
RULE_PANEL,
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload","version":5,"files":["../assets/startScene/e4.png","../assets/startScene/e3.png","../assets/startScene/e2.png","../assets/startScene/e1.png","../assets/startScene/文案.png","../assets/文案.png"]}
\ No newline at end of file
......@@ -30,7 +30,7 @@
},
{
"name": "preload",
"keys": "playscenebg_jpg,startscenebg_jpg"
"keys": "playscenebg_jpg,e4_png,e3_png,e2_png,e1_png,文案_png,startscenebg_jpg,文案2_png"
}
],
"resources": [
......@@ -209,10 +209,40 @@
"type": "image",
"url": "assets/playscene/playscenebg.jpg"
},
{
"name": "e4_png",
"type": "image",
"url": "assets/startScene/e4.png"
},
{
"name": "e3_png",
"type": "image",
"url": "assets/startScene/e3.png"
},
{
"name": "e2_png",
"type": "image",
"url": "assets/startScene/e2.png"
},
{
"name": "e1_png",
"type": "image",
"url": "assets/startScene/e1.png"
},
{
"name": "文案_png",
"type": "image",
"url": "assets/startScene/文案.png"
},
{
"name": "startscenebg_jpg",
"type": "image",
"url": "assets/startScene/startscenebg.jpg"
},
{
"name": "文案2_png",
"type": "image",
"url": "assets/文案.png"
}
]
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PlaySkin" width="750" height="1663" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image horizontalCenter="0" top="0" source="playscenebg_jpg"/>
<e:Button id="testBtn" label="点击出奖" y="409" scaleX="1" scaleY="1" horizontalCenter="18.5">
<e:skinName>
<e:Skin states="up,down,disabled">
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StartSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16705cb4eec"/>
<e:Group id="elements" horizontalCenter="0" verticalCenter="-172" height="664" width="756">
<e:Image id="e1" source="e1_png" x="154.5" y="124" anchorOffsetX="38" anchorOffsetY="35.5"/>
<e:Image id="e2" source="e2_png" x="756" y="531.5" anchorOffsetX="122" anchorOffsetY="131.5"/>
<e:Image id="e3" source="e3_png" x="604" y="12" anchorOffsetY="20" anchorOffsetX="130"/>
<e:Image id="e4" source="e4_png" x="0" y="436.5" anchorOffsetY="69.5"/>
<e:Image id="logo" source="文案_png" x="157" y="121"/>
</e:Group>
<e:Group horizontalCenter="0" verticalCenter="32">
<e:Button id="startBtn" label="" scaleX="1" scaleY="1" anchorOffsetX="152.5" anchorOffsetY="49.5" y="108.21" horizontalCenter="0">
<e:skinName>
......@@ -10,7 +18,7 @@
</e:skinName>
</e:Button>
<e:Label id="countTxt" text="1/1" width="100%" verticalAlign="middle" textAlign="center" y="183.39" horizontalCenter="0"/>
<e:Label id="countdownTxt" text="00:00:00" width="100%" verticalAlign="middle" textAlign="center" y="0" horizontalCenter="0"/>
<e:Label id="countdownTxt" text="" width="100%" verticalAlign="middle" textAlign="center" y="0" horizontalCenter="0"/>
</e:Group>
<e:Label id="exemptionTxt" text="*兑换项与活动均与设备制造商Apple Inc.公司无关*" width="100%" horizontalCenter="0" bottom="5"
verticalAlign="middle" textAlign="center" textColor="0x333333" size="18" />
......
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