Commit e1f2e312 authored by wjf's avatar wjf

l

parent 84f09f41
This diff is collapsed.
This diff is collapsed.
......@@ -13,6 +13,7 @@ import { showShare } from "../shareCtrl";
import { gotoNextLevel } from "./gotoNextLevel";
import BloodPanel2 from "./BloodPanel2";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
export default class BloodPanel extends Panel {
start(data) {
......@@ -36,17 +37,17 @@ export default class BloodPanel extends Panel {
private _countDown: CountDown;
private updateData() {
if(this._countDown == null) {
if (this._countDown == null) {
this._countDown = new CountDown(this['countdownTxt'], (str) => `距离下一次体力补给时间:${str}`);
}
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
const data = getHomeData();
this['invitTxt'].text = `(已领${data.askForEnergy}/${BloodPanel.MAX})`;
if(data.askForEnergy >= BloodPanel.MAX) {
if (data.askForEnergy >= BloodPanel.MAX) {
this['inviteBtn2'].visible = true;
}
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
this._countDown.stop();
this['countdownTxt'].visible = false;
......@@ -73,7 +74,7 @@ export default class BloodPanel extends Panel {
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success, res) => {
this['buyBtn'].enabled = true;
if(success) {
if (success) {
showToast('兑换成功');
NetManager.ins.hc_home(() => {
this.updateData();
......@@ -81,43 +82,92 @@ export default class BloodPanel extends Panel {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
if(res.code == '600005') {
if (res.code == '600005') {
showToast('体力已满,快去闯关吧');
} else {
PanelCtrl.instance.show('shopTip', {from: 'bloodPanel', data: null});
PanelCtrl.instance.show('shopTip', { from: 'bloodPanel', data: null });
}
}
}, 1);
}
onTapInvite() {
// onTapInvite() {
if(iswx()) {
getShareUrl(this.stage);
} else
showShare(1);
// if(iswx()) {
// getShareUrl(this.stage);
// } else
// showShare(1);
// NetManager.ins.clickLog(getlogItem(4));
// const data = getHomeData();
// if(data.askForEnergy >= BloodPanel.MAX) {
// showToast('对不起,索要体力的机会已经用完了~');
// return;
// }
// this['inviteBtn'].enabled = false;
// NetManager.ins.hc_askForEnergy((success) => {
// this['inviteBtn'].enabled = true;
// if(success) {
// }
// NetManager.ins.hc_home(() => {
// this.updateData();
// updateMainTimer();
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId']);
// wait(2000).then(() => {
// showToast('分享成功~');
// });
// })
// }
//0224修改
onTapInvite() {
NetManager.ins.clickLog(getlogItem(4));
const data = getHomeData();
if(data.askForEnergy >= BloodPanel.MAX) {
showToast('对不起,索要体力的机会已经用完了~');
return;
}
this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true;
if(success) {
if (iswx()) {
//微信流程不变
getShareUrl(this.stage);
if (data.askForEnergy >= BloodPanel.MAX) {
showToast('对不起,索要体力的机会已经用完了~');
return;
}
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true;
if (success) {
}
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
} else {
showShareCodePanel(CodeChannels.AddBlood, null, () => {
if (data.askForEnergy >= BloodPanel.MAX) {
wait(2000).then(() => {
showToast('对不起,索要体力的机会已经用完了~');
});
} else {
NetManager.ins.hc_askForEnergy((success) => {
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
}
})
}
}
protected get closeBtns(): eui.Button[] {
return [this['closeBtn'], this['resumeBtn']]
}
......
......@@ -12,6 +12,7 @@ import CountDown from "../mapScene/CountDown";
import { showShare } from "../shareCtrl";
import BloodPanel from "./BloodPanel";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
export default class BloodPanel2 extends Panel {
start(data) {
......@@ -31,17 +32,17 @@ export default class BloodPanel2 extends Panel {
private _countDown: CountDown;
private updateData() {
if(this._countDown == null) {
if (this._countDown == null) {
this._countDown = new CountDown(this['countdownTxt'], (str) => `距离下一次体力补给时间:${str}`);
}
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
const data = getHomeData();
this['invitTxt'].text = `(已领${data.askForEnergy}/${BloodPanel.MAX})`;
if(data.askForEnergy >= BloodPanel.MAX) {
if (data.askForEnergy >= BloodPanel.MAX) {
this['inviteBtn2'].visible = true;
}
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
this._countDown.stop();
this['countdownTxt'].visible = false;
......@@ -68,7 +69,7 @@ export default class BloodPanel2 extends Panel {
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success, res) => {
this['buyBtn'].enabled = true;
if(success) {
if (success) {
showToast('兑换成功');
NetManager.ins.hc_home(() => {
this.updateData();
......@@ -77,42 +78,90 @@ export default class BloodPanel2 extends Panel {
}, window['collectRuleId']);
} else {
if(res.code == '600005') {
if (res.code == '600005') {
showToast('体力已满,快去闯关吧');
} else {
PanelCtrl.instance.show('shopTip', {from: 'blood2Panel', data: null});
PanelCtrl.instance.show('shopTip', { from: 'blood2Panel', data: null });
}
}
}, 1);
}
onTapInvite() {
// onTapInvite() {
if(iswx()) {
getShareUrl(this.stage);
} else
showShare(1);
// if(iswx()) {
// getShareUrl(this.stage);
// } else
// showShare(1);
// NetManager.ins.clickLog(getlogItem(4));
// const data = getHomeData();
// if(data.askForEnergy >= BloodPanel.MAX) {
// showToast('对不起,索要体力的机会已经用完了~');
// return;
// }
// this['inviteBtn'].enabled = false;
// NetManager.ins.hc_askForEnergy((success) => {
// this['inviteBtn'].enabled = true;
// if(success) {
// }
// NetManager.ins.hc_home(() => {
// this.updateData();
// updateMainTimer();
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId']);
// wait(2000).then(() => {
// showToast('分享成功~');
// });
// })
// }
//0224修改
onTapInvite() {
NetManager.ins.clickLog(getlogItem(4));
const data = getHomeData();
if(data.askForEnergy >= BloodPanel.MAX) {
showToast('对不起,索要体力的机会已经用完了~');
return;
}
this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true;
if(success) {
if (iswx()) {
getShareUrl(this.stage);
//原先微信流程不变
if (data.askForEnergy >= BloodPanel.MAX) {
showToast('对不起,索要体力的机会已经用完了~');
return;
}
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true;
if (success) {
}
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
} else {
showShareCodePanel(CodeChannels.AddBlood, null, () => {
if (data.askForEnergy >= BloodPanel.MAX) {
wait(2000).then(() => {
showToast('对不起,索要体力的机会已经用完了~');
});
} else {
NetManager.ins.hc_askForEnergy((success) => {
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
}
})
}
}
protected get closeBtns(): eui.Button[] {
......
......@@ -7,6 +7,7 @@ import { showShare3 } from "../shareCtrl3";
import FriendItemRenderer from "./FriendItemRenderer";
import { getFriendShareUrl } from "../getFriendSharePic";
import { getlogItem } from "../Main";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
export default class FriendPanel extends Panel {
public list: eui.List;
......@@ -66,9 +67,9 @@ export default class FriendPanel extends Panel {
this['avatar'].source = this['avatar0'].source = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
else
this['avatar'].source = this['avatar0'].source = "http://yun.duiba.com.cn/db_games/default_avatar.png";
if (data&&data.nickname)
if (data && data.nickname)
this['nameTxt'].text = getNick(data.nickname, 10);
if (data&&data.nickname)
if (data && data.nickname)
this['nameTxt0'].text = getNick(data.nickname, 10);
});
}
......@@ -92,7 +93,8 @@ export default class FriendPanel extends Panel {
if (iswx()) {
getFriendShareUrl(this.stage);
} else
showShare3();
// showShare3();
showShareCodePanel(CodeChannels.RankPlay);
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn']] }
......
......@@ -7,6 +7,7 @@ import Utils from "../Utils";
import InviteRulePanel from "./InviteRulePanel";
import wait from "../../libs/new_tc/wait";
import { getlogItem } from "../Main";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
export default class InvitePanel extends Panel {
public prizeImg: eui.Image;
......@@ -30,7 +31,7 @@ export default class InvitePanel extends Panel {
super.start();
this.showlog();
this['light1'].visible = this['light2'].visible = false;
this['con'].addChild(this.data.svga);
this.data.svga.gotoAndPlay(1, true);
this.data.svga.once(egret.Event.COMPLETE, () => {
......@@ -118,13 +119,15 @@ export default class InvitePanel extends Panel {
CFG.wxShareLink = window['h5URL'] + "&shareCode=" + shareCode; // 分享链接
CFG.wxShareTitle = '狮狮连萌超好玩~我已经玩到第一了!';
CFG.wxShareDesc = '我在萌狮消消乐等你来挑战哦';
CFG.wxShareImg="http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg";
CFG.wxShareImg = "http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg";
if (iswx()) { //微信端
this.wxShareTip.visible = true;
window["invokeWX"]();
} else {//端内
this.wxShareTip.visible = false;
window["inviteShare"](shareCode);
// window["inviteShare"](shareCode);
//0224修改,去掉原先邀请逻辑,新增口令逻辑
showShareCodePanel(CodeChannels.InvitePrize, shareCode)
}
});
}
......@@ -189,7 +192,7 @@ export default class InvitePanel extends Panel {
destroy() {
super.destroy();
if(this.timer){
if (this.timer) {
this.timer.stop();
this.timer.removeEventListener(egret.TimerEvent.TIMER, this.cutTimer, this);
}
......
......@@ -7,6 +7,7 @@ import ScratchRulePanel from "./ScratchRulePanel";
import CutTimer from "../CutTimer";
import { getlogItem } from "../Main";
import { HtmlTextParser } from "../../libs/new_wx/HtmlTextParser";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
export default class ScratchPanel extends Panel {
private cutTimer: CutTimer;
......@@ -258,7 +259,9 @@ class ScratchItem extends eui.ItemRenderer {
window["invokeWX"]();
} else {//端内
this.data.wxShareTip.visible = false;
window["scratchShare"](code);
// window["scratchShare"](code);
//0224修改,去掉原先邀请逻辑,新增口令逻辑
showShareCodePanel(CodeChannels.InvitePrize, code)
}
}, this.data.scratchTaskId);
}, this);
......
......@@ -5,6 +5,8 @@ import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import layers from "../../libs/new_wx/views/layers";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import wait from "../../libs/new_tc/wait";
export enum CodeChannels {
/**
......@@ -36,7 +38,11 @@ const panelMsg = {
"2": "快去邀请好友帮你刮卡",
"3": "快去邀请好友闯关赢现金"
}
interface ShareData {
channel: CodeChannels,
shareCode?: string,//0224期加体力和排行榜分享好友没有分享码
addFun: Function,//点击立即前往的额外操作
}
class ShareCodePanel extends ComponentBase {
public closeBtn: eui.Button;
......@@ -52,15 +58,12 @@ class ShareCodePanel extends ComponentBase {
* 0表示微信,1表示朋友圈
*/
private mark: 0 | 1
data: {
channel: CodeChannels,
shareCode?: string,
}
data: ShareData
/**
* 口令
*/
private code: string
setData(data) {
setData(data: ShareData) {
this.data = data;
//显示提示文案
this.msg.text = panelMsg[this.data.channel];
......@@ -70,11 +73,7 @@ class ShareCodePanel extends ComponentBase {
super.start();
this.height = this.stage.stageHeight;
}
//不再关闭
public onTouchTap_closeBtn() {
// super.onTouchTap_closeBtn();
this.panelGroup.visible = false;
}
initEvents() {
super.initEvents();
......@@ -82,6 +81,7 @@ class ShareCodePanel extends ComponentBase {
this.wxpyq.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchWxpyqBtn, this);
this.goBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchGoBtn, this);
this.clickBg.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClickBg, this);
this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchCloseBtn, this);
}
onTouchWxBtn() {
......@@ -102,13 +102,16 @@ class ShareCodePanel extends ComponentBase {
linkWxpyq();
break;
}
//还需要根据channel加体力接口
this.data.addFun && this.data.addFun();
}
onTouchClickBg() {
layers.shareLayer.visible = false;
//关闭后要置null
//关闭后要置null,因为不同渠道进来要获取不同的code
this.code = null
}
onTouchCloseBtn() {
this.panelGroup.visible = false;
}
private codeOpr() {
//如果是开发中,获取不到口令就用假的
......@@ -153,6 +156,7 @@ class ShareCodePanel extends ComponentBase {
this.wxpyq.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchWxpyqBtn, this);
this.goBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchGoBtn, this);
this.clickBg.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClickBg, this);
this.closeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchCloseBtn, this);
}
get skinKey() {
......@@ -169,12 +173,12 @@ const initShare = () => {
share.start();
_share = share;
};
export const showShareCodePanel = (data: { channel: CodeChannels, shareCode?: string, }) => {
export const showShareCodePanel = (channel: CodeChannels, shareCode?: string, addFun?: Function) => {
if (!inited) {
initShare();
inited = true;
}
_share.setData(data);
_share.setData({ channel, shareCode, addFun });
layers.shareLayer.visible = true;
}
......
......@@ -20,6 +20,7 @@ import { addRankFriendList } from "../mapScene/RankFriendList";
import { addAdComp } from "./BoxPanel";
import { getChapterData } from "../something/chapters/getChapter";
import { getlogItem } from "../Main";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
export default class StartPanel extends Panel {
static currlevel;
......@@ -38,7 +39,7 @@ export default class StartPanel extends Panel {
this['price4'].text = `-${window['price4']}元宝`;
const homedata = getHomeData();
if(data > homedata.levels.length) {
if (data > homedata.levels.length) {
addAdComp(84, 901, this, 29);
NetManager.ins.showLog(getlogItem(29));
} else
......@@ -51,7 +52,7 @@ export default class StartPanel extends Panel {
this['targetGroup'].visible = false;
this['scoreGroup'].visible = false;
const levelType = getChapterData(mapDataIndex).passTarget.type;
if(levelType == PassType.ELEMENT_TARGET) {
if (levelType == PassType.ELEMENT_TARGET) {
this['targetGroup'].visible = true;
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
......@@ -59,9 +60,9 @@ export default class StartPanel extends Panel {
const ac = new eui.ArrayCollection(getChapterData(mapDataIndex).passTarget.elements);
this.list.dataProvider = ac;
const elements = getChapterData(mapDataIndex).passTarget.elements;
if(elements.length == 1 && elements[0].type == ElementType.LOLLIPOP)
if (elements.length == 1 && elements[0].type == ElementType.LOLLIPOP)
this['tips'].text = '在指定步数内将目标元素移至最底部';
} else if(levelType == PassType.SCORE_TARGET) {
} else if (levelType == PassType.SCORE_TARGET) {
this['scoreGroup'].visible = true;
this['targetScoreTxt'].text = `${getChapterData(mapDataIndex).passTarget.score}`;
// this['targetTxt'].text = `在规定步数内\n分数达到${getChapterData(mapDataIndex).passTarget.score}分`;
......@@ -85,22 +86,45 @@ export default class StartPanel extends Panel {
onTap_startBtn() {
const homeData = getHomeData();
if(homeData.remainEnargy <= 0) {
if(homeData.askForEnergy) {
if (homeData.remainEnargy <= 0) {
if (homeData.askForEnergy) {
PanelCtrl.instance.show('blood2Panel');
} else {
if(iswx()) {
// if(iswx()) {
// getShareUrl(this.stage);
// } else
// showShare(1);
// NetManager.ins.hc_askForEnergy((success) => {
// NetManager.ins.hc_home(() => {
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId']);
// wait(2000).then(() => {
// showToast('分享成功~');
// });
// })
//0224修改,微信环境不变
if (iswx()) {
getShareUrl(this.stage);
NetManager.ins.hc_askForEnergy((success) => {
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
} else
showShare(1);
NetManager.ins.hc_askForEnergy((success) => {
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
// showShare(1);
showShareCodePanel(CodeChannels.AddBlood, null, () => {
NetManager.ins.hc_askForEnergy((success) => {
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(() => {
showToast('分享成功~');
});
})
});
})
}
return;
}
......@@ -121,7 +145,7 @@ export default class StartPanel extends Panel {
wait(5000).then(() => {
updateMainTimerAfterGetData();
});
if(success) {
if (success) {
// Loading.instace.show();
this.hidePanel();
try {
......@@ -129,12 +153,12 @@ export default class StartPanel extends Panel {
await Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
} catch(error) {
} catch (error) {
}
// Loading.instace.hide();
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE, {chapter: this._level});
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE, { chapter: this._level });
StartPanel.currlevel = this._level
}
}, this._level);
......@@ -143,15 +167,15 @@ export default class StartPanel extends Panel {
}
onTap_buy1btn() {
PanelCtrl.instance.show('Buy1', {from: 'StartPanel', data: this._level});
PanelCtrl.instance.show('Buy1', { from: 'StartPanel', data: this._level });
}
onTap_buy2btn() {
PanelCtrl.instance.show('Buy2', {from: 'StartPanel', data: this._level});
PanelCtrl.instance.show('Buy2', { from: 'StartPanel', data: this._level });
}
onTap_buy3btn() {
PanelCtrl.instance.show('Buy3', {from: 'StartPanel', data: this._level});
PanelCtrl.instance.show('Buy3', { from: 'StartPanel', data: this._level });
}
get skinKey() {
......
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