Commit 8b75ca38 authored by wangzhujun's avatar wangzhujun

123

parent 464acbfa
......@@ -34,6 +34,7 @@ import RecordMapScene from './yazuwei/RecordMapScene';
import NoCreditsPanel from './yazuwei/NoCreditsPanel';
import PKScene from './yazuwei/PKScene';
import PKRulePanel from './yazuwei/PKRulePanel';
import PKPrizePanel from './yazuwei/PKPrizePanel';
class Main extends MainBase {
......@@ -66,7 +67,7 @@ class Main extends MainBase {
PanelCtrl.instance.registerClass(ModuleTypes.PLACE_PANEL,PlacePanel)
PanelCtrl.instance.registerClass(ModuleTypes.NOCREDITS_PANEL,NoCreditsPanel)
PanelCtrl.instance.registerClass(ModuleTypes.PKRULE_PANEL,PKRulePanel);
PanelCtrl.instance.registerClass(ModuleTypes.PKPRIZE_PANEL,PKPrizePanel)
// NetManager.ins.onNotSuccess = (msg) => {
// showAlertPanel(msg)
......
......@@ -82,12 +82,12 @@ export class yzwNet{
* 1.4解锁地区
* @param callback 回调
*/
public static collect(callback, projectId){
public static unlockArea(callback, projectId){
let param: any = {
}
const net: INetData = {
name: 'collect',
name: 'unlockArea',
uri: `/projectx/${projectId}/join_1/unlockArea.do`,
type: 'get',
dataType: 'json',
......
......@@ -31,10 +31,13 @@ export default class StartScene extends Scene {
protected get skinKey() { return 'Start' }
private level;
private startdata;
constructor(data){
super();
this.startdata = data;
this.level = data.currentLevel
this.initUI(data);
this.hand.visible = false;
}
onSkinComplete() {
......@@ -51,7 +54,8 @@ export default class StartScene extends Scene {
onEnterFrame(){
}
initUI(data) {
this.hand.visible = false;
this.peolab.text = "总共有"+data.activityJoinNum+"人参与活动";
this.scorelab.text = "我的分数:"+data.currentScore;
if(!GCache.readCache("isGuide")){
GCache.writeCache("isGuide",true);
this.openGuide();
......@@ -61,9 +65,7 @@ export default class StartScene extends Scene {
this.hand.visible = true;
this.onTap(this.unlockBtn,this.GuideFive);
}
this.peolab.text = "总共有"+data.activityJoinNum+"人参与活动";
this.scorelab.text = "我的分数:"+data.currentScore;
}else{
if(data.currentLevel>0){
this.needscore.visible = true;
this.needscore.text = "需要达到"+data.nextLevelScore+"分数"
......@@ -74,25 +76,32 @@ export default class StartScene extends Scene {
}else{
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 = "getBtn_png"
this.unlockBtn.icon = "waitBtn_png"
this.needscore.visible = false;
}
}else{
this.unlockBtn.icon = "startBtn_png"
this.onTap(this.unlockBtn,this.unlockArea);
}
}
}
noCredits(){
PanelCtrl.instance.show(ModuleTypes.NOCREDITS_PANEL)
}
private arr = ["hz","am","xg","tb","rb","hg","cx","mg"]
showMap(num){
const arr = ["hz","am","xg","tb","rb","hg","cx","mg"]
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(){
......@@ -133,7 +142,14 @@ export default class StartScene extends Scene {
SceneCtrl.instance.change(ModuleTypes.RECORD_SCENE,this.level)
}
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(){
......@@ -152,7 +168,8 @@ export default class StartScene extends Scene {
return
}
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']);
}
setColor(group) {
......
......@@ -34,7 +34,7 @@ export enum ModuleTypes {
NOCREDITS_PANEL,
PK_SCENE,
PKRULE_PANEL,
PKPRIZE_PANEL,
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 NetConst from '../NetConst';
import Waiting from '../waiting/Waiting';
import { HtmlTextParser } from '../rulePanel/HtmlTextParser';
export default class PKRulePanel extends Panel{
export default class PKRulePanel extends Panel {
public labContent: eui.Label;
public scroller: eui.Scroller;
public textstring:string = "";
public endstr:string = "";
protected get skinKey(){return 'PKRule'}
constructor(){
super()
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 Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
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{
protected get skinKey(){return 'PK'}
......@@ -30,7 +33,15 @@ export default class PKScene extends Scene{
constructor(data){
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){
this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this);
......@@ -54,6 +65,14 @@ export default class PKScene extends Scene{
}
this.myline.anchorOffsetY = this.myline.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++){
this["team"+i]["onnum"].text = "+"+data.myTeamMembers[i-1].steps;
this["team"+i]["onphone"].text = data.myTeamMembers[i-1].phone;
......@@ -79,6 +98,9 @@ export default class PKScene extends Scene{
this.setColor(this["team"+i]["headimg"]);
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--){
this["team"+n]["notonline"].visible = false;
......@@ -110,6 +132,18 @@ export default class PKScene extends Scene{
initEvents(){
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) {
let colorMatrix = [
0.3, 0.3, 0.3, 0, 0,
......
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{
protected get skinKey(){return 'Place'}
......@@ -32,10 +38,22 @@ export default class PlacePanel extends Panel{
initEvents(){
super.initEvents();
this.onTap(this.closeBtn,()=>{this.hidePanel();})
this.onTap(this.knowBtn,()=>{this.hidePanel();})
this.onTap(this.closeBtn,this.backStart)
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