Commit 1fd66a6e authored by wildfirecode's avatar wildfirecode

1

parent ee5b6817
...@@ -11,6 +11,10 @@ export default class Scene extends ComponentBase { ...@@ -11,6 +11,10 @@ export default class Scene extends ComponentBase {
this.playAnimation(); this.playAnimation();
} }
updateScene(){
}
playAnimation() { playAnimation() {
} }
......
...@@ -14,6 +14,11 @@ export default class SceneCtrl { ...@@ -14,6 +14,11 @@ export default class SceneCtrl {
this._parent = parent; this._parent = parent;
} }
updateScene() {
if(this._currentScene)
this._currentScene.updateScene();
}
change(type: ModuleTypes, data?, onComplete?: Function) { change(type: ModuleTypes, data?, onComplete?: Function) {
const cls = this._sceneClassMap[type]; const cls = this._sceneClassMap[type];
const scene: Scene = new cls(); const scene: Scene = new cls();
......
...@@ -439,7 +439,7 @@ export class NetManager extends ABNetManager { ...@@ -439,7 +439,7 @@ export class NetManager extends ABNetManager {
dataType: 'json', dataType: 'json',
param: { param: {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
gameData:gamedata gameData: gamedata
}, },
hideMsg: true, hideMsg: true,
callback: callback callback: callback
...@@ -752,14 +752,14 @@ export class NetManager extends ABNetManager { ...@@ -752,14 +752,14 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public hc_home(callback: Function,collectRuleId:number): void { public hc_home(callback: Function, collectRuleId: number): void {
const net: INetData = { const net: INetData = {
name: 'hc_home', name: 'hc_home',
uri: '/customActivity/happyclear/home', uri: '/customActivity/happyclear/home',
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: { param: {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
collectRuleId: collectRuleId, collectRuleId: collectRuleId,
}, },
...@@ -767,14 +767,14 @@ export class NetManager extends ABNetManager { ...@@ -767,14 +767,14 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
public hc_getLevelInfo(callback: Function,getLevelInfo:number): void { public hc_getLevelInfo(callback: Function, getLevelInfo: number): void {
const net: INetData = { const net: INetData = {
name: 'hc_getLevelInfo', name: 'hc_getLevelInfo',
uri: '/customActivity/happyclear/getLevelInfo', uri: '/customActivity/happyclear/getLevelInfo',
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: { param: {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
getLevelInfo: getLevelInfo, getLevelInfo: getLevelInfo,
}, },
...@@ -782,17 +782,20 @@ export class NetManager extends ABNetManager { ...@@ -782,17 +782,20 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
public hc_exchange(callback: Function,category:number,propType:number): void { public hc_exchange(callback: Function, category: number, propType?: number): void {
const d:any = {
activityId: DataManager.ins.customCfgData.actId,
category: category
};
if(propType) {
d.propType=propType;
}
const net: INetData = { const net: INetData = {
name: 'hc_exchange', name: 'hc_exchange',
uri: '/customActivity/happyclear/exchange', uri: '/customActivity/happyclear/exchange',
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
param: { param:d ,
activityId: DataManager.ins.customCfgData.actId,
category:category,
propType:propType
},
callback: callback callback: callback
}; };
this.send(net); this.send(net);
...@@ -810,7 +813,7 @@ export class NetManager extends ABNetManager { ...@@ -810,7 +813,7 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
public hc_useProp(callback: Function,propType:number): void { public hc_useProp(callback: Function, propType: number): void {
const net: INetData = { const net: INetData = {
name: 'hc_useProp', name: 'hc_useProp',
uri: '/customActivity/happyclear/useProp', uri: '/customActivity/happyclear/useProp',
...@@ -840,13 +843,13 @@ export class NetManager extends ABNetManager { ...@@ -840,13 +843,13 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public reportMusic(callback: Function,durationOfPlay,songListId,songId,playCount,timestamp,bitrate,songDuration): void { public reportMusic(callback: Function, durationOfPlay, songListId, songId, playCount, timestamp, bitrate, songDuration): void {
const data: any = { const data: any = {
durationOfPlay:durationOfPlay,songListId:songListId,songId:songId,timestamp:timestamp, durationOfPlay: durationOfPlay, songListId: songListId, songId: songId, timestamp: timestamp,
action:7, action: 7,
playCount:playCount, playCount: playCount,
bitrate:bitrate, bitrate: bitrate,
isOnline:1,songDuration:songDuration isOnline: 1, songDuration: songDuration
}; };
// if (categoryID) data.categoryID = categoryID; // if (categoryID) data.categoryID = categoryID;
...@@ -935,7 +938,7 @@ export class NetManager extends ABNetManager { ...@@ -935,7 +938,7 @@ export class NetManager extends ABNetManager {
}; };
this.getToken(net); this.getToken(net);
} }
public hc_doJoin(callback: Function, credits?: number, collectRuleId?: number): void { public hc_doJoin(callback: Function, credits?: number, collectRuleId?: number): void {
const param: any = { const param: any = {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<e:Group id="top" x="36" y="24"> <e:Group id="top" x="36" y="24">
<e:Image source="元宝bg_png" x="0" y="0"/> <e:Image source="元宝bg_png" x="0" y="0"/>
<e:Label id="bloodTxt" text="50/50" x="78.04" y="27.84" width="82" verticalAlign="middle" textAlign="center"/> <e:Label id="bloodTxt" text="50/50" x="78.04" y="27.84" width="82" verticalAlign="middle" textAlign="center"/>
<e:Label id="goldTzt" text="50/50" x="396.04" y="27.84" width="88" verticalAlign="middle" textAlign="center"/> <e:Label id="goldTxt" text="50/50" x="396.04" y="27.84" width="88" verticalAlign="middle" textAlign="center"/>
<e:Button id="bloodBtn" label="" x="165.72" y="16.6"> <e:Button id="bloodBtn" label="" x="165.72" y="16.6">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
......
import { DataManager } from "../libs/tw/manager/DataManager";
interface IHomeData {
levels:{levelNum,maxScore,stars}[];
totalRemainStarts;
wealth;
heartNums;
}
export default ():IHomeData=>{
const {data} = DataManager.ins.getData('hc_home');
return data;
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import MapRpeatPart from "./MapRpeatPart"; ...@@ -5,6 +5,7 @@ import MapRpeatPart from "./MapRpeatPart";
import MapTopPart from "./MapTopPart"; import MapTopPart from "./MapTopPart";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { ModuleTypes } from "../../libs/new_wx/types/sceneTypes"; import { ModuleTypes } from "../../libs/new_wx/types/sceneTypes";
import getHomeData from "../getHomeData";
export default class MapScene extends Scene { export default class MapScene extends Scene {
scrollGroup: eui.Group; scrollGroup: eui.Group;
...@@ -39,20 +40,37 @@ export default class MapScene extends Scene { ...@@ -39,20 +40,37 @@ export default class MapScene extends Scene {
this.scrollGroup.addChild(data.bottom); this.scrollGroup.addChild(data.bottom);
data.bottom.y = data.top.height + (data.list.length * data.list[0].height); data.bottom.y = data.top.height + (data.list.length * data.list[0].height);
this.setGray(1); // this.setGray(1);
for (const key in MapScene.iconHash) { for (const key in MapScene.iconHash) {
const element = MapScene.iconHash[key]; const element = MapScene.iconHash[key];
element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
PanelCtrl.instance.show('StartPanel',key); PanelCtrl.instance.show('StartPanel', key);
}, this) }, this)
} }
// setTimeout(() => { // setTimeout(() => {
// PanelCtrl.instance.show('box'); // PanelCtrl.instance.show('box');
// }, 2000); // }, 2000);
this.updateHomeData();
}
updateScene() {
this.updateHomeData();
} }
updateHomeData() {
const homeData = getHomeData();
this['bloodTxt'].text = `${homeData.heartNums}/5`;
this['goldTxt'].text = `${homeData.wealth}`;
this['totalStarTxt'].text = `${homeData.totalRemainStarts}/210`;
for (let i = 0; i < homeData.levels.length; i++) {
const level = homeData.levels[i];
const star = MapScene.starHash[i + 1];
if (level)
star.setStar(level.stars);
}
}
protected initEvents() { protected initEvents() {
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this) // this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
this['bloodBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_bloodBtn, this) this['bloodBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_bloodBtn, this)
...@@ -61,20 +79,20 @@ export default class MapScene extends Scene { ...@@ -61,20 +79,20 @@ export default class MapScene extends Scene {
this['questionBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this) this['questionBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
} }
onTap_questionBtn(){ onTap_questionBtn() {
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL); PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
this.toggleSettings(); this.toggleSettings();
} }
onTap_shopBtn(){ onTap_shopBtn() {
PanelCtrl.instance.show('Shop') PanelCtrl.instance.show('Shop')
} }
toggleSettings(){ toggleSettings() {
this['settingGroup'].visible=!this['settingGroup'].visible; this['settingGroup'].visible = !this['settingGroup'].visible;
} }
// onTap_goldBtn() { // onTap_goldBtn() {
// PanelCtrl.instance.show('GoldPanel') // PanelCtrl.instance.show('GoldPanel')
// } // }
onTap_bloodBtn() { onTap_bloodBtn() {
......
import Panel from "../../libs/new_wx/components/Panel"; import Panel from "../../libs/new_wx/components/Panel";
import getHomeData from "../getHomeData";
import { NetManager } from "../../libs/tw/manager/NetManager";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
export default class BloodPanel extends Panel { export default class BloodPanel extends Panel {
start(data) { start(data) {
super.start(); super.start();
this.updateData();
} }
private updateData() {
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.heartNums}`;
}
initEvents() {
super.initEvents();
this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this)
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapBuy, this)
}
onTapBuy() {
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => {
this['buyBtn'].enabled = true;
if (success) {
NetManager.ins.hc_home(() => {
this.updateData();
SceneCtrl.instance.updateScene();
}, window['collectRuleId'])
}
}, 1);
}
onTapInvite() {
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['resumeBtns']] }
get skinKey() { return 'Blood' } get skinKey() { return 'Blood' }
} }
\ No newline at end of file
{ {
"success":true "code":"0000000000",
"data":{
"heartNums":1,
"levels":[
{
"levelNum":1,
"maxScore":23,
"stars":3
},
{
"levelNum":2,
"maxScore":45,
"stars":2
}
],
"switchConf":[
{
"status":1,
"type":1
},
{
"status":1,
"type":2
}
],
"totalRemainStarts":5,
"wealth":5
},
"desc":"OK",
"success":true,
"timestamp":1565752605970
} }
\ No newline at end of file
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