Commit 1fd66a6e authored by wildfirecode's avatar wildfirecode

1

parent ee5b6817
......@@ -11,6 +11,10 @@ export default class Scene extends ComponentBase {
this.playAnimation();
}
updateScene(){
}
playAnimation() {
}
......
......@@ -14,6 +14,11 @@ export default class SceneCtrl {
this._parent = parent;
}
updateScene() {
if(this._currentScene)
this._currentScene.updateScene();
}
change(type: ModuleTypes, data?, onComplete?: Function) {
const cls = this._sceneClassMap[type];
const scene: Scene = new cls();
......
......@@ -439,7 +439,7 @@ export class NetManager extends ABNetManager {
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
gameData:gamedata
gameData: gamedata
},
hideMsg: true,
callback: callback
......@@ -752,14 +752,14 @@ export class NetManager extends ABNetManager {
this.send(net);
}
public hc_home(callback: Function,collectRuleId:number): void {
public hc_home(callback: Function, collectRuleId: number): void {
const net: INetData = {
name: 'hc_home',
uri: '/customActivity/happyclear/home',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
collectRuleId: collectRuleId,
},
......@@ -767,14 +767,14 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_getLevelInfo(callback: Function,getLevelInfo:number): void {
public hc_getLevelInfo(callback: Function, getLevelInfo: number): void {
const net: INetData = {
name: 'hc_getLevelInfo',
uri: '/customActivity/happyclear/getLevelInfo',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
getLevelInfo: getLevelInfo,
},
......@@ -782,17 +782,20 @@ export class NetManager extends ABNetManager {
};
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 = {
name: 'hc_exchange',
uri: '/customActivity/happyclear/exchange',
type: 'post',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
category:category,
propType:propType
},
param:d ,
callback: callback
};
this.send(net);
......@@ -810,7 +813,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_useProp(callback: Function,propType:number): void {
public hc_useProp(callback: Function, propType: number): void {
const net: INetData = {
name: 'hc_useProp',
uri: '/customActivity/happyclear/useProp',
......@@ -840,13 +843,13 @@ export class NetManager extends ABNetManager {
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 = {
durationOfPlay:durationOfPlay,songListId:songListId,songId:songId,timestamp:timestamp,
action:7,
playCount:playCount,
bitrate:bitrate,
isOnline:1,songDuration:songDuration
durationOfPlay: durationOfPlay, songListId: songListId, songId: songId, timestamp: timestamp,
action: 7,
playCount: playCount,
bitrate: bitrate,
isOnline: 1, songDuration: songDuration
};
// if (categoryID) data.categoryID = categoryID;
......@@ -935,7 +938,7 @@ export class NetManager extends ABNetManager {
};
this.getToken(net);
}
public hc_doJoin(callback: Function, credits?: number, collectRuleId?: number): void {
const param: any = {
activityId: DataManager.ins.customCfgData.actId,
......
......@@ -19,7 +19,7 @@
<e:Group id="top" x="36" y="24">
<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="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:skinName>
<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";
import MapTopPart from "./MapTopPart";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { ModuleTypes } from "../../libs/new_wx/types/sceneTypes";
import getHomeData from "../getHomeData";
export default class MapScene extends Scene {
scrollGroup: eui.Group;
......@@ -39,20 +40,37 @@ export default class MapScene extends Scene {
this.scrollGroup.addChild(data.bottom);
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) {
const element = MapScene.iconHash[key];
element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
PanelCtrl.instance.show('StartPanel',key);
PanelCtrl.instance.show('StartPanel', key);
}, this)
}
// setTimeout(() => {
// PanelCtrl.instance.show('box');
// }, 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() {
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
this['bloodBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_bloodBtn, this)
......@@ -61,20 +79,20 @@ export default class MapScene extends Scene {
this['questionBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
}
onTap_questionBtn(){
onTap_questionBtn() {
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
this.toggleSettings();
}
onTap_shopBtn(){
onTap_shopBtn() {
PanelCtrl.instance.show('Shop')
}
toggleSettings(){
this['settingGroup'].visible=!this['settingGroup'].visible;
toggleSettings() {
this['settingGroup'].visible = !this['settingGroup'].visible;
}
// onTap_goldBtn() {
// PanelCtrl.instance.show('GoldPanel')
// PanelCtrl.instance.show('GoldPanel')
// }
onTap_bloodBtn() {
......
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 {
start(data) {
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' }
}
\ 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