Commit 99c9d4e4 authored by wjf's avatar wjf

l

parent 3879dfd7
...@@ -533,6 +533,8 @@ export default class MainBase extends eui.UILayer { ...@@ -533,6 +533,8 @@ export default class MainBase extends eui.UILayer {
this.getBackReward(), this.getBackReward(),
this.hcRedBoobBaseInfo(), this.hcRedBoobBaseInfo(),
]); ]);
//获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager.ins.getUserShareCode(()=>{})
MapScene.adData = DataManager.ins.getData('hc_advert'); MapScene.adData = DataManager.ins.getData('hc_advert');
......
...@@ -60,8 +60,18 @@ export default class MapScene extends Scene { ...@@ -60,8 +60,18 @@ export default class MapScene extends Scene {
//0224修改,取sceneCode, //0224修改,取sceneCode,
const sceneCode = Utils.getRequestByKey('sceneCode') const sceneCode = Utils.getRequestByKey('sceneCode')
if (sceneCode == CodeChannels.AddBlood) {//加体力的,0228到时会修改成助力,这里要加逻辑 if (sceneCode == CodeChannels.AddBlood) {//加体力的,0228到时会修改成助力,这里要加逻辑
if (window["test0228"]) { if (window["test0228"]) {//测试助力,到时失败code再和后端对接
NetManager.ins.doHelpNew((s, res) => {
if (s) {
showToast("助力成功!")
}
else if (res) {
if (res.code == "0000") {
} else if (res.code == "00001") { }
} else {
showToast("助力失败")
}
}, code)
} else { } else {
showToast("欢迎加入游戏,去闯关吧"); showToast("欢迎加入游戏,去闯关吧");
} }
......
...@@ -14,6 +14,7 @@ import { gotoNextLevel } from "./gotoNextLevel"; ...@@ -14,6 +14,7 @@ import { gotoNextLevel } from "./gotoNextLevel";
import BloodPanel2 from "./BloodPanel2"; import BloodPanel2 from "./BloodPanel2";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel"; import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class BloodPanel extends Panel { export default class BloodPanel extends Panel {
start(data) { start(data) {
...@@ -144,6 +145,24 @@ export default class BloodPanel extends Panel { ...@@ -144,6 +145,24 @@ export default class BloodPanel extends Panel {
showToast('分享成功~'); showToast('分享成功~');
}); });
}) })
} else {
if (window["test0228"]) {
//如果之前没获取到,就再发接口,几率很低
if (!DataManager.ins.getData("getUserShareCode")) {
this.touchEnabled = false
this.touchChildren = false
NetManager.ins.getUserShareCode((s, res) => {
this.touchEnabled = true
this.touchChildren = true
if (!s) {
showToast("获取分享信息失败,请重试")
} else {
showShareCodePanel(CodeChannels.AddBlood, res.data)
}
})
} else {
showShareCodePanel(CodeChannels.AddBlood, DataManager.ins.getData("getUserShareCode").data);
}
} else { } else {
showShareCodePanel(CodeChannels.AddBlood, null, () => { showShareCodePanel(CodeChannels.AddBlood, null, () => {
if (data.askForEnergy >= BloodPanel.MAX) { if (data.askForEnergy >= BloodPanel.MAX) {
...@@ -165,6 +184,7 @@ export default class BloodPanel extends Panel { ...@@ -165,6 +184,7 @@ export default class BloodPanel extends Panel {
}) })
} }
} }
}
......
...@@ -13,6 +13,7 @@ import { showShare } from "../shareCtrl"; ...@@ -13,6 +13,7 @@ import { showShare } from "../shareCtrl";
import BloodPanel from "./BloodPanel"; import BloodPanel from "./BloodPanel";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel"; import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class BloodPanel2 extends Panel { export default class BloodPanel2 extends Panel {
start(data) { start(data) {
...@@ -142,6 +143,24 @@ export default class BloodPanel2 extends Panel { ...@@ -142,6 +143,24 @@ export default class BloodPanel2 extends Panel {
showToast('分享成功~'); showToast('分享成功~');
}); });
}) })
} else {
if (window["test0228"]) {
//如果之前没获取到,就再发接口,几率很低
if (!DataManager.ins.getData("getUserShareCode")) {
this.touchEnabled = false
this.touchChildren = false
NetManager.ins.getUserShareCode((s, res) => {
this.touchEnabled = true
this.touchChildren = true
if (!s) {
showToast("获取分享信息失败,请重试")
} else {
showShareCodePanel(CodeChannels.AddBlood, res.data)
}
})
} else {
showShareCodePanel(CodeChannels.AddBlood, DataManager.ins.getData("getUserShareCode").data);
}
} else { } else {
showShareCodePanel(CodeChannels.AddBlood, null, () => { showShareCodePanel(CodeChannels.AddBlood, null, () => {
if (data.askForEnergy >= BloodPanel.MAX) { if (data.askForEnergy >= BloodPanel.MAX) {
...@@ -163,6 +182,7 @@ export default class BloodPanel2 extends Panel { ...@@ -163,6 +182,7 @@ export default class BloodPanel2 extends Panel {
}) })
} }
} }
}
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
return [this['closeBtn']] return [this['closeBtn']]
......
...@@ -111,7 +111,12 @@ export default class InvitePanel extends Panel { ...@@ -111,7 +111,12 @@ export default class InvitePanel extends Panel {
} }
for (let i = 0; i < this.data.invitationUser.length; i++) { for (let i = 0; i < this.data.invitationUser.length; i++) {
this.data.invitationUser[i]['callFun'] = () => { this.data.invitationUser[i]['callFun'] = () => {
NetManager.ins.getShareCode((success, res) => { //加个防连点,这里影响功能了,要加
this.touchEnabled = false;
this.touchChildren = false;
NetManager.ins.getShareCode((success, res) => {//shareCode为啥不缓存,每次好像都一样吧,还有下面失败是否要给个toast
this.touchEnabled = true;
this.touchChildren = true;
if (!success) { if (!success) {
return; return;
} }
......
...@@ -23,20 +23,20 @@ export default class ScratchPanel extends Panel { ...@@ -23,20 +23,20 @@ export default class ScratchPanel extends Panel {
setGtaphics(x, y) { setGtaphics(x, y) {
setTimeout(() => { setTimeout(() => {
if(this.pIndex % 2 == 0) { // 双数 if (this.pIndex % 2 == 0) { // 双数
y -= 25; y -= 25;
if(y <= this["prizeImg"].y) { if (y <= this["prizeImg"].y) {
this.pIndex++; this.pIndex++;
} }
} else { // 单数 } else { // 单数
y += 25; y += 25;
if(y >= (this["prizeImg"].y + this["prizeImg"].height)) { if (y >= (this["prizeImg"].y + this["prizeImg"].height)) {
this.pIndex++; this.pIndex++;
} }
} }
x += 5; x += 5;
this.myShape.graphics.lineTo(x, y); this.myShape.graphics.lineTo(x, y);
if(x > this["prizeImg"].x + (+this.data.completePercent) / 100 * this["prizeImg"].width - 60) { if (x > this["prizeImg"].x + (+this.data.completePercent) / 100 * this["prizeImg"].width - 60) {
return; return;
} }
this.setGtaphics(x, y); this.setGtaphics(x, y);
...@@ -77,8 +77,8 @@ export default class ScratchPanel extends Panel { ...@@ -77,8 +77,8 @@ export default class ScratchPanel extends Panel {
playBgAni() { playBgAni() {
this['light1'].visible = this['light2'].visible = true; this['light1'].visible = this['light2'].visible = true;
const time = 7000; const time = 7000;
egret.Tween.get(this['light1'], {loop: true}).to({rotation: 360}, time); egret.Tween.get(this['light1'], { loop: true }).to({ rotation: 360 }, time);
egret.Tween.get(this['light2'], {loop: true}).to({rotation: -360}, time); egret.Tween.get(this['light2'], { loop: true }).to({ rotation: -360 }, time);
} }
showlog() { showlog() {
...@@ -126,17 +126,17 @@ export default class ScratchPanel extends Panel { ...@@ -126,17 +126,17 @@ export default class ScratchPanel extends Panel {
this["prizeImg"].source = this.data.prizeImage; this["prizeImg"].source = this.data.prizeImage;
if(!this.data.avatarList) { if (!this.data.avatarList) {
this.data.avatarList = []; this.data.avatarList = [];
} }
// 添加邀请图标 // 添加邀请图标
let noAvatarNum = this.data.helpedCount - this.data.avatarList.length; // 没有头像的人数 let noAvatarNum = this.data.helpedCount - this.data.avatarList.length; // 没有头像的人数
let dNum = this.data.totalNeedCount - this.data.avatarList.length - noAvatarNum; // 没邀请的人数 let dNum = this.data.totalNeedCount - this.data.avatarList.length - noAvatarNum; // 没邀请的人数
for(let i = 0; i < noAvatarNum; i++) { for (let i = 0; i < noAvatarNum; i++) {
this.data.avatarList.push(""); this.data.avatarList.push("");
} }
for(let i = 0; i < dNum; i++) { for (let i = 0; i < dNum; i++) {
this.data.avatarList.push("scratch_invite_png"); this.data.avatarList.push("scratch_invite_png");
} }
// 添加假用户 // 添加假用户
...@@ -144,7 +144,7 @@ export default class ScratchPanel extends Panel { ...@@ -144,7 +144,7 @@ export default class ScratchPanel extends Panel {
// 创建渲染列表 // 创建渲染列表
let rendererList = []; let rendererList = [];
for(let i = 0; i < this.data.avatarList.length; i++) { for (let i = 0; i < this.data.avatarList.length; i++) {
rendererList.push({ rendererList.push({
avatar: this.data.avatarList[i], // 传递头像 avatar: this.data.avatarList[i], // 传递头像
wxShareTip: this["wxShareTip"], // 传递shareGroup的引用 wxShareTip: this["wxShareTip"], // 传递shareGroup的引用
...@@ -165,7 +165,7 @@ export default class ScratchPanel extends Panel { ...@@ -165,7 +165,7 @@ export default class ScratchPanel extends Panel {
} }
); );
let cutTime = this.data.endTime - this.data.currentTime + 3000; let cutTime = this.data.endTime - this.data.currentTime + 3000;
if(!this.cutTimer.start(cutTime)) { if (!this.cutTimer.start(cutTime)) {
this.cutTimer.stop(); this.cutTimer.stop();
this.cutTimer.start(cutTime); this.cutTimer.start(cutTime);
} }
...@@ -176,18 +176,18 @@ export default class ScratchPanel extends Panel { ...@@ -176,18 +176,18 @@ export default class ScratchPanel extends Panel {
* @param progress 进度 0 - 100 * @param progress 进度 0 - 100
*/ */
private setProgress(progress) { private setProgress(progress) {
if(progress > 100) { if (progress > 100) {
progress = 100; progress = 100;
} else if(progress < 0) { } else if (progress < 0) {
progress = 0; progress = 0;
} }
this['numLabel'].textFlow = (new HtmlTextParser).parser(`共<b>${2 + this.data.helpedCount}</b>位好友帮你刮了<b>${progress.toFixed(2)}</b>%`) ; this['numLabel'].textFlow = (new HtmlTextParser).parser(`共<b>${2 + this.data.helpedCount}</b>位好友帮你刮了<b>${progress.toFixed(2)}</b>%`);
this["progressLabel"].textFlow = (new HtmlTextParser).parser(`仅剩<b>${(100 - progress).toFixed(2)}</b>%`); // 进度条文字 this["progressLabel"].textFlow = (new HtmlTextParser).parser(`仅剩<b>${(100 - progress).toFixed(2)}</b>%`); // 进度条文字
let _width = this["progressBg"].width * progress / 100; // 宽度 let _width = this["progressBg"].width * progress / 100; // 宽度
let dProgress = Math.abs(progress - this["progress"].width / this["progressBg"].width); // 比当前进度的差值的绝对值 let dProgress = Math.abs(progress - this["progress"].width / this["progressBg"].width); // 比当前进度的差值的绝对值
let _duration = 1000 * dProgress / 100; // 算出变化的时间 let _duration = 1000 * dProgress / 100; // 算出变化的时间
egret.Tween.get(this["progress"]).to({width: _width}, _duration); egret.Tween.get(this["progress"]).to({ width: _width }, _duration);
} }
private setWXShareTip() { private setWXShareTip() {
...@@ -197,7 +197,7 @@ export default class ScratchPanel extends Panel { ...@@ -197,7 +197,7 @@ export default class ScratchPanel extends Panel {
} }
private hongbaoEffect() { private hongbaoEffect() {
egret.Tween.get(this["hongbao"]).to({scaleX: 0.8, scaleY: 0.8}, 200, egret.Ease.quadInOut).call(() => { egret.Tween.get(this["hongbao"]).to({ scaleX: 0.8, scaleY: 0.8 }, 200, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this["hongbao"]).to({ egret.Tween.get(this["hongbao"]).to({
scaleX: 1, scaleX: 1,
scaleY: 1 scaleY: 1
...@@ -243,9 +243,14 @@ class ScratchItem extends eui.ItemRenderer { ...@@ -243,9 +243,14 @@ class ScratchItem extends eui.ItemRenderer {
let s = this.data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png"; let s = this.data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
this.img.source = this.data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png"; this.img.source = this.data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
this.img.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this.img.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
//加个防连点,这里影响功能了,要加,但是这里没阻止整个场景的点击事件,再说了
this.touchEnabled = false;
this.touchChildren = false;
NetManager.ins.clickLog(getlogItem(50)); NetManager.ins.clickLog(getlogItem(50));
NetManager.ins.scratchGetShareCode((success, res) => { NetManager.ins.scratchGetShareCode((success, res) => {//shareCode为啥不缓存,每次好像都一样吧,还有下面失败是否要给个toast
if(!success) { this.touchEnabled = true;
this.touchChildren = true;
if (!success) {
return; return;
} }
let shareCode = res.data; // 分享码 let shareCode = res.data; // 分享码
...@@ -254,14 +259,14 @@ class ScratchItem extends eui.ItemRenderer { ...@@ -254,14 +259,14 @@ class ScratchItem extends eui.ItemRenderer {
CFG.wxShareTitle = '萌狮消消消'; CFG.wxShareTitle = '萌狮消消消';
CFG.wxShareDesc = '超好玩的萌狮消消乐,快来和我一起玩吧~'; 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()) { //微信端 if (iswx()) { //微信端
this.data.wxShareTip.visible = true; this.data.wxShareTip.visible = true;
window["invokeWX"](); window["invokeWX"]();
} else {//端内 } else {//端内
this.data.wxShareTip.visible = false; this.data.wxShareTip.visible = false;
// window["scratchShare"](code); // window["scratchShare"](code);
//0224修改,去掉原先邀请逻辑,新增口令逻辑 //0224修改,去掉原先邀请逻辑,新增口令逻辑
showShareCodePanel(CodeChannels.InvitePrize, code) showShareCodePanel(CodeChannels.Scratch, code)
} }
}, this.data.scratchTaskId); }, this.data.scratchTaskId);
}, this); }, this);
......
...@@ -41,7 +41,7 @@ const panelMsg = { ...@@ -41,7 +41,7 @@ const panelMsg = {
interface ShareData { interface ShareData {
channel: CodeChannels, channel: CodeChannels,
shareCode?: string,//0224期加体力和排行榜分享好友没有分享码 shareCode?: string,//0224期加体力和排行榜分享好友没有分享码
addFun: Function,//点击立即前往的额外操作 addFun?: Function,//点击立即前往的额外操作
} }
class ShareCodePanel extends ComponentBase { class ShareCodePanel extends ComponentBase {
...@@ -254,10 +254,18 @@ function linkWx() { ...@@ -254,10 +254,18 @@ function linkWx() {
/** /**
* 唤起微信朋友圈 * 唤起微信朋友圈
* 暂未实现 * 暂未实现,也跳微信
*/ */
function linkWxpyq() { function linkWxpyq() {
var locatUrl = "weixin://";
if (/ipad|iphone|mac/i.test(navigator.userAgent)) {
var ifr = document.createElement("iframe");
ifr.src = locatUrl;
ifr.style.display = "none";
document.body.appendChild(ifr);
} else {
window.location.href = locatUrl;
}
} }
/** /**
......
...@@ -21,6 +21,7 @@ import { addAdComp } from "./BoxPanel"; ...@@ -21,6 +21,7 @@ import { addAdComp } from "./BoxPanel";
import { getChapterData } from "../something/chapters/getChapter"; import { getChapterData } from "../something/chapters/getChapter";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { showShareCodePanel, CodeChannels } from "./ShareCodePanel"; import { showShareCodePanel, CodeChannels } from "./ShareCodePanel";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class StartPanel extends Panel { export default class StartPanel extends Panel {
static currlevel; static currlevel;
...@@ -115,6 +116,25 @@ export default class StartPanel extends Panel { ...@@ -115,6 +116,25 @@ export default class StartPanel extends Panel {
}) })
} else } else
// showShare(1); // showShare(1);
{
if (window["test0228"]) {
//如果之前没获取到,就再发接口,几率很低
if (!DataManager.ins.getData("getUserShareCode")) {
this.touchEnabled = false
this.touchChildren = false
NetManager.ins.getUserShareCode((s, res) => {
this.touchEnabled = true
this.touchChildren = true
if (!s) {
showToast("获取分享信息失败,请重试")
} else {
showShareCodePanel(CodeChannels.AddBlood, res.data)
}
})
} else {
showShareCodePanel(CodeChannels.AddBlood, DataManager.ins.getData("getUserShareCode").data);
}
} else {
showShareCodePanel(CodeChannels.AddBlood, null, () => { showShareCodePanel(CodeChannels.AddBlood, null, () => {
NetManager.ins.hc_askForEnergy((success) => { NetManager.ins.hc_askForEnergy((success) => {
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
...@@ -126,6 +146,8 @@ export default class StartPanel extends Panel { ...@@ -126,6 +146,8 @@ export default class StartPanel extends Panel {
}) })
}); });
} }
}
}
return; return;
} }
......
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