Commit 8b75ca38 authored by wangzhujun's avatar wangzhujun

123

parent 464acbfa
...@@ -34,6 +34,7 @@ import RecordMapScene from './yazuwei/RecordMapScene'; ...@@ -34,6 +34,7 @@ import RecordMapScene from './yazuwei/RecordMapScene';
import NoCreditsPanel from './yazuwei/NoCreditsPanel'; import NoCreditsPanel from './yazuwei/NoCreditsPanel';
import PKScene from './yazuwei/PKScene'; import PKScene from './yazuwei/PKScene';
import PKRulePanel from './yazuwei/PKRulePanel'; import PKRulePanel from './yazuwei/PKRulePanel';
import PKPrizePanel from './yazuwei/PKPrizePanel';
class Main extends MainBase { class Main extends MainBase {
...@@ -66,7 +67,7 @@ class Main extends MainBase { ...@@ -66,7 +67,7 @@ class Main extends MainBase {
PanelCtrl.instance.registerClass(ModuleTypes.PLACE_PANEL,PlacePanel) PanelCtrl.instance.registerClass(ModuleTypes.PLACE_PANEL,PlacePanel)
PanelCtrl.instance.registerClass(ModuleTypes.NOCREDITS_PANEL,NoCreditsPanel) PanelCtrl.instance.registerClass(ModuleTypes.NOCREDITS_PANEL,NoCreditsPanel)
PanelCtrl.instance.registerClass(ModuleTypes.PKRULE_PANEL,PKRulePanel); PanelCtrl.instance.registerClass(ModuleTypes.PKRULE_PANEL,PKRulePanel);
PanelCtrl.instance.registerClass(ModuleTypes.PKPRIZE_PANEL,PKPrizePanel)
// NetManager.ins.onNotSuccess = (msg) => { // NetManager.ins.onNotSuccess = (msg) => {
// showAlertPanel(msg) // showAlertPanel(msg)
......
...@@ -82,12 +82,12 @@ export class yzwNet{ ...@@ -82,12 +82,12 @@ export class yzwNet{
* 1.4解锁地区 * 1.4解锁地区
* @param callback 回调 * @param callback 回调
*/ */
public static collect(callback, projectId){ public static unlockArea(callback, projectId){
let param: any = { let param: any = {
} }
const net: INetData = { const net: INetData = {
name: 'collect', name: 'unlockArea',
uri: `/projectx/${projectId}/join_1/unlockArea.do`, uri: `/projectx/${projectId}/join_1/unlockArea.do`,
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
......
...@@ -31,10 +31,13 @@ export default class StartScene extends Scene { ...@@ -31,10 +31,13 @@ export default class StartScene extends Scene {
protected get skinKey() { return 'Start' } protected get skinKey() { return 'Start' }
private level; private level;
private startdata;
constructor(data){ constructor(data){
super(); super();
this.startdata = data;
this.level = data.currentLevel this.level = data.currentLevel
this.initUI(data); this.initUI(data);
this.hand.visible = false;
} }
onSkinComplete() { onSkinComplete() {
...@@ -51,7 +54,8 @@ export default class StartScene extends Scene { ...@@ -51,7 +54,8 @@ export default class StartScene extends Scene {
onEnterFrame(){ onEnterFrame(){
} }
initUI(data) { initUI(data) {
this.hand.visible = false; this.peolab.text = "总共有"+data.activityJoinNum+"人参与活动";
this.scorelab.text = "我的分数:"+data.currentScore;
if(!GCache.readCache("isGuide")){ if(!GCache.readCache("isGuide")){
GCache.writeCache("isGuide",true); GCache.writeCache("isGuide",true);
this.openGuide(); this.openGuide();
...@@ -61,38 +65,43 @@ export default class StartScene extends Scene { ...@@ -61,38 +65,43 @@ export default class StartScene extends Scene {
this.hand.visible = true; this.hand.visible = true;
this.onTap(this.unlockBtn,this.GuideFive); this.onTap(this.unlockBtn,this.GuideFive);
} }else{
this.peolab.text = "总共有"+data.activityJoinNum+"人参与活动"; if(data.currentLevel>0){
this.scorelab.text = "我的分数:"+data.currentScore; this.needscore.visible = true;
if(data.currentLevel>0){ this.needscore.text = "需要达到"+data.nextLevelScore+"分数"
this.needscore.visible = true; if(data.nextLevelScore>data.currentScore){
this.needscore.text = "需要达到"+data.nextLevelScore+"分数" this.onTap(this.unlockBtn,this.noCredits);
if(data.nextLevelScore>data.currentScore){ this.unlockBtn.icon = "lockBtn_png";
this.onTap(this.unlockBtn,this.noCredits); this.needscore.textColor = 0x99b3ca;
this.unlockBtn.icon = "lockBtn_png"; }else{
this.needscore.textColor = 0x99b3ca; this.unlockBtn.icon = "getBtn_png"
this.needscore.textColor = 0x343a75;
this.onTap(this.unlockBtn,this.unlockArea);
}
this.showMap(data.currentLevel)
if(data.currentLevel == 8){
this.unlockBtn.touchEnabled = false;
this.unlockBtn.touchChildren = false;
this.unlockBtn.icon = "waitBtn_png"
this.needscore.visible = false;
}
}else{ }else{
this.unlockBtn.icon = "getBtn_png" this.unlockBtn.icon = "startBtn_png"
this.needscore.textColor = 0x343a75; this.onTap(this.unlockBtn,this.unlockArea);
} }
this.showMap(data.currentLevel)
if(data.currentLevel == 8){
this.unlockBtn.touchEnabled = false;
this.unlockBtn.touchChildren = false;
this.unlockBtn.icon = "getBtn_png"
}
}else{
this.unlockBtn.icon = "startBtn_png"
} }
} }
noCredits(){ noCredits(){
PanelCtrl.instance.show(ModuleTypes.NOCREDITS_PANEL) PanelCtrl.instance.show(ModuleTypes.NOCREDITS_PANEL)
} }
private arr = ["hz","am","xg","tb","rb","hg","cx","mg"]
showMap(num){ showMap(num){
const arr = ["hz","am","xg","tb","rb","hg","cx","mg"]
for(let i = 0;i<num;i++){ for(let i = 0;i<num;i++){
this[arr[i]].source = this[arr[i]].source.substring(2); this[this.arr[i]].source = this[this.arr[i]].source.substring(2);
} }
} }
openGuide(){ openGuide(){
...@@ -133,7 +142,14 @@ export default class StartScene extends Scene { ...@@ -133,7 +142,14 @@ export default class StartScene extends Scene {
SceneCtrl.instance.change(ModuleTypes.RECORD_SCENE,this.level) SceneCtrl.instance.change(ModuleTypes.RECORD_SCENE,this.level)
} }
unlockArea(){ unlockArea(){
yzwNet.unlockArea((s)=>{
if(!s){
ToastCtrl.instance.show("网络异常请重试~");
return
}
this[this.arr[this.level]].source = this[this.arr[this.level]].source.substring(2);
PanelCtrl.instance.show(ModuleTypes.PLACE_PANEL,this.level+1);
},window['projectId']);
} }
initEvents(){ initEvents(){
...@@ -152,7 +168,8 @@ export default class StartScene extends Scene { ...@@ -152,7 +168,8 @@ export default class StartScene extends Scene {
return return
} }
let data = DataManager.ins.getData("getPkBaseInfo").data; let data = DataManager.ins.getData("getPkBaseInfo").data;
SceneCtrl.instance.change(ModuleTypes.PK_SCENE,data); let pkdata = {data:data,startdata:this.startdata}
SceneCtrl.instance.change(ModuleTypes.PK_SCENE,pkdata);
},window['projectId']); },window['projectId']);
} }
setColor(group) { setColor(group) {
......
...@@ -34,7 +34,7 @@ export enum ModuleTypes { ...@@ -34,7 +34,7 @@ export enum ModuleTypes {
NOCREDITS_PANEL, NOCREDITS_PANEL,
PK_SCENE, PK_SCENE,
PKRULE_PANEL, PKRULE_PANEL,
PKPRIZE_PANEL,
TOAST TOAST
......
import { NetManager } from './../../libs/tw/manager/NetManager';
import { DataManager } from './../../libs/tw/manager/DataManager';
import Panel from "../views/Panel";
import NetConst from '../NetConst';
import Waiting from '../waiting/Waiting';
import { HtmlTextParser } from '../rulePanel/HtmlTextParser';
export default class PKRulePanel extends Panel {
public labContent: eui.Label;
public scroller: eui.Scroller;
public textstring:string = "";
public endstr:string = "";
start() {
Waiting.instance.hide()
if (window['PKruleTxt']) {
this.labContent.textFlow = (new HtmlTextParser).parser(window['PKruleTxt']);
this.labContent.textColor = 0xb1d1e7;;
} else {
if (!DataManager.ins.getData("gameAjaxElement").data || !DataManager.ins.getData("gameAjaxElement").data.rule) {
NetConst.ajaxElement(() => {
// DataManager
this.addRule();
});
}
else {
this.addRule();
}
}
}
group: eui.Group;
private addRule() {
const text = DataManager.ins.getData("gameAjaxElement").data.rule;
this.textstring = text;
this.replaceWord();
this.labContent.textFlow = (new HtmlTextParser).parser(this.textstring);
this.labContent.textColor = parseInt("fcffb4",16);
}
replaceWord(){
if (this.textstring.search("</p>") == -1) {
if(this.endstr){
this.textstring = this.endstr;
}
} else {
this.textstring = this.textstring.replace("</p>", "</p><br>");
this.endstr = this.endstr.concat(this.textstring.slice(0, this.textstring.search("</p>") + 8));
this.textstring = this.textstring.slice(this.textstring.search("</p>") + 8, this.textstring.length);
this.replaceWord();
}
}
get skinKey() { return 'PKRule' }
}
\ No newline at end of file
import { NetManager } from './../../libs/tw/manager/NetManager';
import { DataManager } from './../../libs/tw/manager/DataManager';
import Panel from "../views/Panel"; import Panel from "../views/Panel";
import NetConst from '../NetConst';
import Waiting from '../waiting/Waiting';
import { HtmlTextParser } from '../rulePanel/HtmlTextParser';
export default class PKRulePanel extends Panel {
public labContent: eui.Label;
public scroller: eui.Scroller;
public textstring:string = "";
public endstr:string = "";
export default class PKRulePanel extends Panel{ start() {
Waiting.instance.hide()
if (window['PKruleTxt']) {
this.labContent.textFlow = (new HtmlTextParser).parser(window['PKruleTxt']);
this.labContent.textColor = 0xb1d1e7;;
} else {
if (!DataManager.ins.getData("gameAjaxElement").data || !DataManager.ins.getData("gameAjaxElement").data.rule) {
NetConst.ajaxElement(() => {
// DataManager
this.addRule();
});
}
else {
this.addRule();
}
}
}
protected get skinKey(){return 'PKRule'} group: eui.Group;
constructor(){ private addRule() {
super() const text = DataManager.ins.getData("gameAjaxElement").data.rule;
this.textstring = text;
this.replaceWord();
this.labContent.textFlow = (new HtmlTextParser).parser(this.textstring);
this.labContent.textColor = parseInt("fcffb4",16);
} }
replaceWord(){
if (this.textstring.search("</p>") == -1) {
if(this.endstr){
this.textstring = this.endstr;
}
} else {
this.textstring = this.textstring.replace("</p>", "</p><br>");
this.endstr = this.endstr.concat(this.textstring.slice(0, this.textstring.search("</p>") + 8));
this.textstring = this.textstring.slice(this.textstring.search("</p>") + 8, this.textstring.length);
this.replaceWord();
}
}
get skinKey() { return 'PKRule' }
} }
\ No newline at end of file
import Scene from "../views/Scene"; import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl"; import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes"; import { ModuleTypes } from "../types/sceneTypes";
import { yzwNet } from "../NetConst";
import ToastCtrl from "../ctrls/toastCtrl";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class PKScene extends Scene{ export default class PKScene extends Scene{
protected get skinKey(){return 'PK'} protected get skinKey(){return 'PK'}
...@@ -30,7 +33,15 @@ export default class PKScene extends Scene{ ...@@ -30,7 +33,15 @@ export default class PKScene extends Scene{
constructor(data){ constructor(data){
super(); super();
this.initUI(data); let _data = data.data;
this.initUI(_data);
let startdata = data.startdata;
if(startdata.treasureBoxNum>0){
this.onTap(this.box,this.onTap_OpenBox);
}else{
this.setColor(this.box);
this.box.touchEnabled = false;
}
} }
initUI(data){ initUI(data){
this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this); this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this);
...@@ -54,6 +65,14 @@ export default class PKScene extends Scene{ ...@@ -54,6 +65,14 @@ export default class PKScene extends Scene{
} }
this.myline.anchorOffsetY = this.myline.height this.myline.anchorOffsetY = this.myline.height
this.otherline.anchorOffsetY = this.otherline.height this.otherline.anchorOffsetY = this.otherline.height
this.myline.y = 1624;
this.otherline.y = 1624;
this.myteam.y = this.myline.y-this.myline.height-70;
this.myteamnum.y = this.myline.y-this.myline.height-35;
this.otherteam.y = this.otherline.y-this.otherline.height-70;
this.otherteamnum.y = this.otherline.y-this.otherline.height-35;
console.log(this.myteam.y)
for(let i = 1;i<data.myTeamMembers.length+1;i++){ for(let i = 1;i<data.myTeamMembers.length+1;i++){
this["team"+i]["onnum"].text = "+"+data.myTeamMembers[i-1].steps; this["team"+i]["onnum"].text = "+"+data.myTeamMembers[i-1].steps;
this["team"+i]["onphone"].text = data.myTeamMembers[i-1].phone; this["team"+i]["onphone"].text = data.myTeamMembers[i-1].phone;
...@@ -79,6 +98,9 @@ export default class PKScene extends Scene{ ...@@ -79,6 +98,9 @@ export default class PKScene extends Scene{
this.setColor(this["team"+i]["headimg"]); this.setColor(this["team"+i]["headimg"]);
this["team"+i]["notonphone"].text = data.myTeamMembers[i-1].phone; this["team"+i]["notonphone"].text = data.myTeamMembers[i-1].phone;
} }
if(data.myTeamMembers[i-1].myFlag == 1){
this["team"+i]["onphone"].text = "我"
}
} }
for(let n = 5;n>data.myTeamMembers.length;n--){ for(let n = 5;n>data.myTeamMembers.length;n--){
this["team"+n]["notonline"].visible = false; this["team"+n]["notonline"].visible = false;
...@@ -110,6 +132,18 @@ export default class PKScene extends Scene{ ...@@ -110,6 +132,18 @@ export default class PKScene extends Scene{
initEvents(){ initEvents(){
this.onTap(this.ruleBtn,()=>{PanelCtrl.instance.show(ModuleTypes.PKRULE_PANEL)}); this.onTap(this.ruleBtn,()=>{PanelCtrl.instance.show(ModuleTypes.PKRULE_PANEL)});
} }
onTap_OpenBox(){
yzwNet.getTreasureBox((s)=>{
if(!s){
ToastCtrl.instance.show("网络异常请重试~");
return
}
let data = DataManager.ins.getData("getTreasureBox").data;
this.setColor(this.box)
this.clearTap(this.box,this.onTap_OpenBox);
PanelCtrl.instance.show(ModuleTypes.PKPRIZE_PANEL,data)
},window['projectId'])
}
setColor(group) { setColor(group) {
let colorMatrix = [ let colorMatrix = [
0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0,
......
import Panel from "../views/Panel"; import Panel from "../views/Panel";
import { yzwNet } from "../NetConst";
import ToastCtrl from "../ctrls/toastCtrl";
import Waiting from "../waiting/Waiting";
import { DataManager } from "../../libs/tw/manager/DataManager";
import SceneCtrl from "../ctrls/sceneCtrl";
import { ModuleTypes } from "../types/sceneTypes";
export default class PlacePanel extends Panel{ export default class PlacePanel extends Panel{
protected get skinKey(){return 'Place'} protected get skinKey(){return 'Place'}
...@@ -32,10 +38,22 @@ export default class PlacePanel extends Panel{ ...@@ -32,10 +38,22 @@ export default class PlacePanel extends Panel{
initEvents(){ initEvents(){
super.initEvents(); super.initEvents();
this.onTap(this.closeBtn,()=>{this.hidePanel();}) this.onTap(this.closeBtn,this.backStart)
this.onTap(this.knowBtn,()=>{this.hidePanel();}) this.onTap(this.knowBtn,this.backStart)
} }
backStart(){
yzwNet.homeBaseInfo((s)=>{
if(!s){
ToastCtrl.instance.show("网络异常请重试~");
return;
}
Waiting.instance.hide();
let data = DataManager.ins.getData("homeBaseInfo").data;
this.hidePanel()
SceneCtrl.instance.change(ModuleTypes.START_SCENE,data);
},window['projectId'])
}
} }
\ No newline at end of file
{
"code":null,
"data":{
"image":"//yun.dui88.com/projectxh5/credits-250-250.png",
"optionId":"o0e116a8d",
"prizeId":"credits_30",
"prizeName":"能量30",
"prizeType":2,
"url":"/aaw/projectx/takePrize?projectOrderNo=2190",
"userRecordId":2190
},
"message":null,
"success":true
}
\ No newline at end of file
{
"code":null,
"data":null,
"message":null,
"success":true
}
\ 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