Commit ace1d696 authored by wildfirecode's avatar wildfirecode

1

parent 15aadf7b
import { DataManager } from "../libs/tw/manager/DataManager";
interface IHomeData {
levels:{levelNum,maxScore,stars}[];
totalRemainStarts;
totalStarts;
canReceiveTreasureBoxNum;
wealth;
heartNums;
remainEnargy;
askForEnergy:boolean;
props:{propType,nums}[]
remainProp:{type,num}[]
}
export default ():IHomeData=>{
const {data} = DataManager.ins.getData('hc_home');
......@@ -15,12 +15,12 @@ export default ():IHomeData=>{
export const getPropNums = (type)=>{
const data:IHomeData= DataManager.ins.getData('hc_home').data;
const props = data.props;
const props = data.remainProp;
let nums = 0;
for (const prop of props) {
if(type== prop.propType)
if(type== prop.type)
{
nums = prop.nums;
nums = prop.num;
break;
}
}
......
......@@ -83,9 +83,9 @@ export default class MapScene extends Scene {
}
updateHomeData() {
const homeData = getHomeData();
this['bloodTxt'].text = `${homeData.heartNums}/5`;
this['bloodTxt'].text = `${homeData.remainEnargy}/5`;
this['goldTxt'].text = `${homeData.wealth}`;
this['totalStarTxt'].text = `${homeData.totalRemainStarts}/210`;
this['totalStarTxt'].text = `${homeData.totalStarts}/${homeData.canReceiveTreasureBoxNum}`;
this['boxNumsTxt'].text = `${homeData.canReceiveTreasureBoxNum}`;
for (let j = 0; j < 70; j++) {
this.disableIcon(j + 1);
......
......@@ -19,7 +19,7 @@ export default class BloodPanel extends Panel {
private updateData() {
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.heartNums}`;
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
const data = getHomeData();
this['invitTxt'].text = `(已领0/1)`;
if (data.askForEnergy)
......
......@@ -11,7 +11,6 @@ export default class StartScene extends Scene {
private STOP_PERCENT = 99;
private _current = 0;
private _timer;
private startSceneData: any = {};
async start(data?) {
super.start();
......@@ -22,20 +21,20 @@ export default class StartScene extends Scene {
this['progressmask2'].scaleX = 0;
this['percentTxt'].text = `0%`;
if(data) {
if (data) {
this['container3'].addChild(data[0]);
this['container2'].addChild(data[1]);
this['container1'].addChild(data[2]);
}
else {
await Promise.all([
loadSvga(getResPath() +'resource/assets/svgas/loading_progress.svga', this['container3']),
loadSvga(getResPath() +'resource/assets/svgas/loading_animals.svga', this['container2']),
loadSvga(getResPath() +'resource/assets/svgas/loading_title.svga', this['container1'])
await Promise.all([
loadSvga(getResPath() + 'resource/assets/svgas/loading_progress.svga', this['container3']),
loadSvga(getResPath() + 'resource/assets/svgas/loading_animals.svga', this['container2']),
loadSvga(getResPath() + 'resource/assets/svgas/loading_title.svga', this['container1'])
]);
}
this._timer = setInterval(() => {
this._current += 2;
......@@ -57,34 +56,16 @@ export default class StartScene extends Scene {
]
);
promise.then(() => {
this.createMap(() => this.onProgressComplete());
this.createMap((d) => this.onProgressComplete(d));
});
} else {
this.createMap(() => this.onProgressComplete())
this.createMap((d) => this.onProgressComplete(d))
}
}
async createMap(callback: Function) { //提前创建地图,以防止卡顿
this.startSceneData.top = new MapTopPart();
this.startSceneData.top.loadSkin();this.startSceneData.top.start();
this.startSceneData.bottom = new MapBottomPart();
this.startSceneData.bottom.loadSkin();this.startSceneData.bottom.start();
const list = [];
this.startSceneData.list=list;
for (let i = 0; i < 4; i++) {
const repeat = new MapRpeatPart(i);
repeat.loadSkin();repeat.start();
list.push(repeat);
}
let timer, count = 0;
timer = setInterval(() => {
count++;
if (count >= 4)
clearInterval(timer);
}, 1000 / 60 * 2);
callback();
const data = createData();
callback(data);
}
setProgress(per: number) {
......@@ -93,11 +74,11 @@ export default class StartScene extends Scene {
this['percentTxt'].text = `${per}%`
}
onProgressComplete() {
onProgressComplete(d) {
setTimeout(() => {
egret.Tween.removeTweens(this['progressmask2']);
egret.Tween.get(this['progressmask2']).to({ scaleX: 1 }, 200).wait(200).call(() => {
SceneCtrl.instance.change(ModuleTypes.MAP_SCENE, this.startSceneData)
SceneCtrl.instance.change(ModuleTypes.MAP_SCENE, d)
});
this['percentTxt'].text = `100%`
clearInterval(this._timer);
......@@ -105,4 +86,21 @@ export default class StartScene extends Scene {
}
get skinKey() { return 'Start' }
}
export const createData = () => {
const startSceneData: any = {};
startSceneData.top = new MapTopPart();
startSceneData.top.loadSkin(); startSceneData.top.start();
startSceneData.bottom = new MapBottomPart();
startSceneData.bottom.loadSkin(); startSceneData.bottom.start();
const list = [];
startSceneData.list = list;
for (let i = 0; i < 4; i++) {
const repeat = new MapRpeatPart(i);
repeat.loadSkin(); repeat.start();
list.push(repeat);
}
return startSceneData
}
\ No newline at end of file
......@@ -2,11 +2,12 @@
"code":"0000000000",
"data":{
"askForEnergy":true,
"canReceiveTreasureBoxNum":101,
"heartNums":1,
"props" :[
{"propType":1,"nums":1},
{"propType":2,"nums":2}
"canReceiveTreasureBoxNum":23,
"nextRangeStarsNum":10,
"remainEnargy":11,
"remainProp" :[
{"type":1,"num":1},
{"type":2,"num":2}
],
"levels":[
{
......@@ -35,7 +36,7 @@
"type":2
}
],
"totalRemainStarts":5,
"totalStarts":15,
"wealth":5
},
"desc":"OK",
......
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