Commit 6c294f7e authored by wildfirecode's avatar wildfirecode

1

parent 86276783
......@@ -5,8 +5,23 @@ interface IHomeData {
wealth;
heartNums;
shared;
props:{propType,nums}[]
}
export default ():IHomeData=>{
const {data} = DataManager.ins.getData('hc_home');
return data;
}
export const getPropNums = (type)=>{
const data:IHomeData= DataManager.ins.getData('hc_home').data;
const props = data.props;
let nums = 0;
for (const prop of props) {
if(type== prop.propType)
{
nums = prop.nums;
break;
}
}
return nums;
}
\ No newline at end of file
......@@ -5,6 +5,8 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { ModuleTypes } from "../../libs/new_wx/types/sceneTypes";
import { Chapters } from "../something/Chapters";
import { PassType } from "../something/enum/PassType";
import { getPropNums } from "../getHomeData";
import PropType from "../PropType";
export default class StartPanel extends Panel {
private _level;
......@@ -22,6 +24,19 @@ export default class StartPanel extends Panel {
this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
else if (levelType == PassType.SCORE_TARGET)
this['targetTxt'].text = `在规定步数内\n分数达到${Chapters[data].passTarget.score}分`;
const prop2Nums = getPropNums(PropType.BOOM);
const prop1Nums = getPropNums(PropType.HAMMER);
const prop3Nums = getPropNums(PropType.CHANCE_NUM);
this['buy1btn'].visible=prop1Nums <=0;
this['nums1'].visible=prop1Nums >0;
this['buy2btn'].visible=prop2Nums <=0;
this['nums2'].visible=prop2Nums >0;
this['buy3btn'].visible=prop3Nums <=0;
this['nums3'].visible=prop3Nums >0;
this['nums1Txt'].text = prop1Nums;
this['nums2Txt'].text = prop2Nums;
this['nums3Txt'].text = prop3Nums;
}
initEvents() {
......
......@@ -3,6 +3,10 @@
"data":{
"shared":1,
"heartNums":1,
"props" :[
{"propType":1,"nums":1},
{"propType":2,"nums":2}
],
"levels":[
{
"levelNum":1,
......
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