Commit 5e7a2c9f authored by 邱旭's avatar 邱旭

NoEnergyPanel

parent 3454b109
......@@ -2,14 +2,46 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="0d3cb18d-e144-41a0-bc8b-4877c2e1fef1" name="默认的" comment="">
<change afterPath="$PROJECT_DIR$/resource/UseStep/useStepBg.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/UseStep/useStepCancel.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/UseStep/useStepOk.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/panels/UseStep.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/NoEnergyPanel/体力不足.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/StartPanel/关卡弹窗Bg.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/common/panelBgS.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/miniTb/babycare.getIndex.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/miniTb/babycare.getIndex.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/output.js" beforeDir="false" afterPath="$PROJECT_DIR$/output.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/BuyPowerPanel/增加体力背景.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/BuyPowerPanel/无字按钮底.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/CreditsOutPanel/积分不足背景.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/CreditsOutPanel/赚取积分.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/ExchangeSucPanel/兑换成功背景.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/ExchangeSucPanel/知道啦.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/JoinPanel/joinBg.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/JoinPanel/joinBtn.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/NoEnergyPanel/体力不足Bg.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/NoEnergyPanel/体力不足按钮.png" beforeDir="false" afterPath="$PROJECT_DIR$/resource/NoEnergyPanel/体力不足按钮.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/StartPanel/开始闯关Bg.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/StartPanelPrize/关卡弹窗Bg.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/ToolsOutPanel/道具不足背景.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/UseStep/useStepBg.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/UseToolPanel/使用道具背景.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/resource/res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ResJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ResJson.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/SkinJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/SkinJson.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Tools.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/Tools.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/BuyPowerPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/CreditsOutPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/ExchangeSucPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/JoinPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/NoEnergyPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/NoEnergyPanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/NoStepPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/NoStepPanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/StartPanel.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/StartPanel.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/StartPanelPrize.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/TaskPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/ToolsOutPanel.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/panels/UseStep.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/panels/UseStep.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/PlayScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/PlayScene.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/map/CheckBtn.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/CheckBtn.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/map/MapUI.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapUI.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -113,7 +145,7 @@
<option name="presentableId" value="Default" />
<updated>1612576978320</updated>
<workItem from="1612576979459" duration="13000" />
<workItem from="1612577003915" duration="15938000" />
<workItem from="1612577003915" duration="18185000" />
</task>
<task id="LOCAL-00001" summary="斐乐消消乐">
<created>1612581213298</created>
......@@ -143,7 +175,14 @@
<option name="project" value="LOCAL" />
<updated>1612598313143</updated>
</task>
<option name="localTasksCounter" value="5" />
<task id="LOCAL-00005" summary="Rule">
<created>1612599420632</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1612599420632</updated>
</task>
<option name="localTasksCounter" value="6" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......
{
"code": "000000",
"data": {
"currentLevel": 1,
"currentLevel": 3,
"isFristLogin": false,
"visitors": [
{
"activityId": "5f1a528e964f9796f92d3ccf",
"score": 18940,
"level": 3,
"createTime": 1595851954663,
"openId": "AAFgCvE-ALiIWXYsJuSLKdVt",
"isVisitSuccess": true,
"updateTime": 1595851954663,
"_id": "5f1ec4b367f137665474cffb",
"stars": 3,
"isPrizeLevel": false,
"sendAwardType": true
},
{
"activityId": "5f1a528e964f9796f92d3ccf",
"score": 960,
......@@ -51,7 +38,7 @@
"openId": "AAFgCvE-ALiIWXYsJuSLKdVt",
"prizes": [],
"loginAddPower": 0,
"power": 21,
"power": 0,
"tools": {
"HAMMERS": 9,
"STEPS": 99,
......
......@@ -17619,7 +17619,7 @@ var StartPanelPrize = (function (_super) {
};
return StartPanelPrize;
}(Panel_1.Panel));
exports.StartPanelPrize = StartPanelPrize;
exports.StartPanel = StartPanelPrize;
/***/ }),
{
"groups": [
{
"keys": "增加体力背景.png,无字按钮底.png",
"name": "BuyPowerPanel"
},
{
"keys": "积分不足背景.png,赚取积分.png",
"name": "CreditsOutPanel"
},
{
"keys": "兑换成功背景.png,知道啦.png",
"name": "ExchangeSucPanel"
},
{
"keys": "失败Bg.png,失败重新闯关.png",
"name": "FailedPanel"
......@@ -21,11 +9,7 @@
"name": "FreePowerPanel"
},
{
"keys": "joinBg.png,joinBtn.png",
"name": "JoinPanel"
},
{
"keys": "体力不足Bg.png,体力不足按钮.png",
"keys": "体力不足.png,体力不足按钮.png",
"name": "NoEnergyPanel"
},
{
......@@ -44,13 +28,9 @@
"keys": "ruleBtn.png,活动规则背景.png",
"name": "RulePanel"
},
{
"keys": "开始闯关Bg.png",
"name": "StartPanel"
},
{
"keys": "关卡弹窗Bg.png",
"name": "StartPanelPrize"
"name": "StartPanel"
},
{
"keys": "star_dis.png,star_en.png,去抽奖.png,圆角矩形 648.png,开奖按钮120.png,道具圆圈.png,闯关成功.png,闯关成功Bg.png,闯关成功不满星按钮.png",
......@@ -61,23 +41,15 @@
"name": "TaskPanel"
},
{
"keys": "道具不足背景.png",
"name": "ToolsOutPanel"
},
{
"keys": "useStepBg.png,useStepCancel.png,useStepOk.png",
"keys": "useStepCancel.png,useStepOk.png",
"name": "UseStep"
},
{
"keys": "使用道具背景.png",
"name": "UseToolPanel"
},
{
"keys": "0250abc4-fabc-4bf3-970a-46ceeb12d416.png,03756d82-4e5c-4bdc-8247-7f704ed92ba7.png,0b1a21c5-2e2f-43bc-81f7-ee1c4474d07f.png,0f025d15-5a0b-4e5d-81e9-4a822c469467.png,445121aa-3bae-4b89-a8e9-fd41e2779276.png,54e427a5-b930-4506-a07d-8f1d7eb83ff5.png,560f6473-1e86-433f-a2fb-8e6d0c06d32f.png,8d000f4d-318a-47a1-9fa4-53c7b203a8fd.png,9ed4a149-8df3-45d4-b531-63b82833255a.png,b0c2b486-8dab-4c34-bec4-02e4b4ef835b.png,cd544214-fe15-402a-99a0-a57072952722.png",
"name": "bonus_lottie"
},
{
"keys": "boomBtn.png,comCloseBtn.png,comm_light.png,ele0.png,ele1.png,ele10.png,ele11.png,ele12.png,ele13.png,ele14.png,ele2.png,ele3.png,ele4.png,ele5.png,ele6.png,ele7.png,ele8.png,ele9.png,hammerBtn.png,powerImg.png,stepBtn.png,target0.png,target1.png,target2.png,target3.png,target4.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,再想想.png,开始闯关不要能量.png,开始闯关要能量.png,确定.png,继续闯关大.png,继续闯关小.png",
"keys": "boomBtn.png,comCloseBtn.png,comm_light.png,ele0.png,ele1.png,ele10.png,ele11.png,ele12.png,ele13.png,ele14.png,ele2.png,ele3.png,ele4.png,ele5.png,ele6.png,ele7.png,ele8.png,ele9.png,hammerBtn.png,panelBgS.png,powerImg.png,stepBtn.png,target0.png,target1.png,target2.png,target3.png,target4.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,再想想.png,开始闯关不要能量.png,开始闯关要能量.png,确定.png,继续闯关大.png,继续闯关小.png",
"name": "common"
},
{
......
......@@ -8,13 +8,7 @@ import { ResJson } from "./ResJson";
import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet";
import { SkinJson } from "./SkinJson";
import { G_EVENT } from "./common/G_EVENT";
import { MapScene } from "./scene/map/MapScene";
import { PlayScene } from "./scene/PlayScene";
import { LoadingScene } from "./scene/LoadingScene";
import { JoinPanel } from "./panels/JoinPanel";
import { NoStepPanel } from "./panels/NoStepPanel";
import { NoPrizePanel } from "./panels/NoPrizePanel";
import { LotteryScene } from "./scene/LotteryScene";
/**
* 全局事件,为了和小程序交互
......
export const ResJson = {
"groups": [
{
"keys": "增加体力背景.png,无字按钮底.png",
"name": "BuyPowerPanel"
},
{
"keys": "积分不足背景.png,赚取积分.png",
"name": "CreditsOutPanel"
},
{
"keys": "兑换成功背景.png,知道啦.png",
"name": "ExchangeSucPanel"
},
{
"keys": "失败Bg.png,失败重新闯关.png",
"name": "FailedPanel"
......@@ -21,11 +9,7 @@ export const ResJson = {
"name": "FreePowerPanel"
},
{
"keys": "joinBg.png,joinBtn.png",
"name": "JoinPanel"
},
{
"keys": "体力不足Bg.png,体力不足按钮.png",
"keys": "体力不足.png,体力不足按钮.png",
"name": "NoEnergyPanel"
},
{
......@@ -44,13 +28,9 @@ export const ResJson = {
"keys": "ruleBtn.png,活动规则背景.png",
"name": "RulePanel"
},
{
"keys": "开始闯关Bg.png",
"name": "StartPanel"
},
{
"keys": "关卡弹窗Bg.png",
"name": "StartPanelPrize"
"name": "StartPanel"
},
{
"keys": "star_dis.png,star_en.png,去抽奖.png,圆角矩形 648.png,开奖按钮120.png,道具圆圈.png,闯关成功.png,闯关成功Bg.png,闯关成功不满星按钮.png",
......@@ -61,23 +41,15 @@ export const ResJson = {
"name": "TaskPanel"
},
{
"keys": "道具不足背景.png",
"name": "ToolsOutPanel"
},
{
"keys": "useStepBg.png,useStepCancel.png,useStepOk.png",
"keys": "useStepCancel.png,useStepOk.png",
"name": "UseStep"
},
{
"keys": "使用道具背景.png",
"name": "UseToolPanel"
},
{
"keys": "0250abc4-fabc-4bf3-970a-46ceeb12d416.png,03756d82-4e5c-4bdc-8247-7f704ed92ba7.png,0b1a21c5-2e2f-43bc-81f7-ee1c4474d07f.png,0f025d15-5a0b-4e5d-81e9-4a822c469467.png,445121aa-3bae-4b89-a8e9-fd41e2779276.png,54e427a5-b930-4506-a07d-8f1d7eb83ff5.png,560f6473-1e86-433f-a2fb-8e6d0c06d32f.png,8d000f4d-318a-47a1-9fa4-53c7b203a8fd.png,9ed4a149-8df3-45d4-b531-63b82833255a.png,b0c2b486-8dab-4c34-bec4-02e4b4ef835b.png,cd544214-fe15-402a-99a0-a57072952722.png",
"name": "bonus_lottie"
},
{
"keys": "boomBtn.png,comCloseBtn.png,comm_light.png,ele0.png,ele1.png,ele10.png,ele11.png,ele12.png,ele13.png,ele14.png,ele2.png,ele3.png,ele4.png,ele5.png,ele6.png,ele7.png,ele8.png,ele9.png,hammerBtn.png,powerImg.png,stepBtn.png,target0.png,target1.png,target2.png,target3.png,target4.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,再想想.png,开始闯关不要能量.png,开始闯关要能量.png,确定.png,继续闯关大.png,继续闯关小.png",
"keys": "boomBtn.png,comCloseBtn.png,comm_light.png,ele0.png,ele1.png,ele10.png,ele11.png,ele12.png,ele13.png,ele14.png,ele2.png,ele3.png,ele4.png,ele5.png,ele6.png,ele7.png,ele8.png,ele9.png,hammerBtn.png,panelBgS.png,powerImg.png,stepBtn.png,target0.png,target1.png,target2.png,target3.png,target4.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,再想想.png,开始闯关不要能量.png,开始闯关要能量.png,确定.png,继续闯关大.png,继续闯关小.png",
"name": "common"
},
{
......
This diff is collapsed.
......@@ -9,17 +9,21 @@ import { showPanel } from "../module/ctrls";
import { FailedPanel } from "./panels/FailedPanel";
import { SuccessPrizePanel } from "./panels/SuccessPrizePanel";
import { SuccessNoPrizePanel } from "./panels/SuccessNoPrizePanel";
import { CreditsOutPanel } from "./panels/CreditsOutPanel";
/**
* 定制,记录一些全局量和方法
*/
export class Tools {
public static openTask(){
console.error('TODO 打开任务');
alert('TODO 打开任务');
}
/**
* 缓存key
*/
public static cacheKey: string = "guideThreeSquirrels"
public static cacheKey: string = "guideFLXXL"
public static isMember: boolean;
......@@ -139,9 +143,9 @@ export class Tools {
showPanel(FailedPanel, data);
} else if ((data.prize && data.prize.image) || (data.tool && data.tool.type) || data.level == 120) { // 闯关成功,奖励关卡
//120关,如果没有奖品图片,伪造一个
if (data.level == 120 && (!data.prize || !data.prize.image)) {
if (data.level == 99 && (!data.prize || !data.prize.image)) {
data.prize = data.prize || {};
data.prize.image = Tools.baseInfo.levelPrize['level_120'];
data.prize.image = Tools.baseInfo.levelPrize['level_99'];
}
showPanel(SuccessPrizePanel, data);
} else { // 闯关成功,不是奖励关卡
......@@ -149,45 +153,6 @@ export class Tools {
}
}
/**
* 兑换道具,根据返回参数判断
*/
public static async exchange(type: PropType): Promise<boolean | string> {
//先获取积分,判断是否有积分
var creditsData = await sendTbNet(TbNetName.queryCredits, null, null, true)
//接口失败,没数据时,返回false
if (!creditsData || !creditsData.data) {
showToast("网络异常,请重试")//上面禁掉了提示,这里提示下
return false
}
//非会员,返回会员路径
if (creditsData && !creditsData.success && !creditsData.data.isvip) {
return creditsData.data.url
}
//判断积分,不足兑换
if (!creditsData.data.credits ||
creditsData.data.credits < getTbData(TbNetName.getActivityBaseInfoById).data.buyCredits[type]
) {
showPanel(CreditsOutPanel)
return false
}
const res = await sendTbNet(TbNetName.exchange, { type, credits: creditsData.data.credits }, null, true)
if (res.success) {
//修改道具数量和体力
this.gameData.power = res.data.power;
this.gameData.tools = res.data.tools;
return true;//可根据gameData修改视图
} else {
//如果code积分不足,弹出赚积分弹窗
if (res.code == "730005") {
showPanel(CreditsOutPanel)
} else {
showToast(res.message || "网络开小差了,请重试")
}
return false;
}
}
/**
* 询问权限用
*/
......
import { Panel } from "../../module/views/Panel";
import { Tools } from "../Tools";
import { getCurrentScene, hideWaiting, showPanel, showToast, showWaiting } from "../../module/ctrls";
import { JoinPanel } from "./JoinPanel";
import { PropType } from "../something/enum/PropType";
import VERTICAL_ALIGN = FYGE.VERTICAL_ALIGN;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import TextField = FYGE.TextField;
export class BuyPowerPanel extends Panel {
get groupNames() {
return ["BuyPowerPanel"]
}
get skinName() {
return "BuyPowerPanel"
}
msgTxt: FYGE.TextField;
exchangeBtn: FYGE.Button;
closeBtn: FYGE.Button;
initUi() {
const btnTxt: TextField = this.exchangeBtn.addChild(Tools.getText(
'1店铺积分', 36, '#ffffff',
TEXT_ALIGN.CENTER, this.exchangeBtn.width, 0, -6
));
btnTxt.textHeight = this.exchangeBtn.height;
btnTxt.verticalAlign = VERTICAL_ALIGN.MIDDLE;
btnTxt.bold = true;
btnTxt.stroke = 3;
btnTxt.strokeColor = '#21926e';
this.msgTxt.bold = true;
this.msgTxt.stroke = 3;
this.msgTxt.strokeColor = '#21926e';
this.exchangeBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
//购买道具
showWaiting();
var res = await Tools.exchange(PropType.POWER);
hideWaiting();
//如果是链接,弹出加入会员弹框
if (typeof res == "string") {
showPanel(JoinPanel, { url: res });
}
//成功了,关闭弹框,修改道具信息
else if (res) {
showToast("兑换成功");
this.hidePanel();
getCurrentScene().updateScene();
}
}, this);
}
start(data) {
super.start();
}
initEvents() {
super.initEvents();
}
removeEvents() {
super.removeEvents();
}
}
import { Panel } from "../../module/views/Panel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { Tools } from "../Tools";
export class CreditsOutPanel extends Panel {
get groupNames() { return ["CreditsOutPanel"] }
get skinName() { return "CreditsOutPanel" }
earnBtn: FYGE.Button;
closeBtn: FYGE.Button;
initUi() {
}
start(data) {
super.start();
}
initEvents() {
super.initEvents();
this.earnBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
Tools.btnDelay(this);
sendTbNet(TbNetName.navigateToOutside, {
url: "https://market.m.taobao.com/app/tb-source-app/shopact/pages/index?wh_weex=true&pathInfo=shop/activity&userId=2275046294&shopId=114637892&pageId=187145736&alisite=true"
})//赚积分路径
}, this)
}
removeEvents() {
super.removeEvents();
}
}
import { Panel } from "../../module/views/Panel";
export class ExchangeSucPanel extends Panel {
get groupNames() { return ["ExchangeSucPanel"] }
get skinName() { return "ExchangeSucPanel" }
knowBtn:FYGE.Button;
closeBtn:FYGE.Button;
get closeBtns(){
return [this.knowBtn,this.closeBtn]
}
}
import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { wait } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
export class JoinPanel extends Panel {
get groupNames() {
return ["JoinPanel"]
}
data: { url: string }
initUi() {
this.addChild(FYGE.Sprite.fromFrame("joinBg.png"))
this.addChild(new FYGE.Button(RES.getRes("关闭按钮.png")))
.addEventListener(FYGE.MouseEvent.CLICK, () => { this.hidePanel(); }, this)
.position.set(634, 472)
this.addChild(new FYGE.Button(RES.getRes("joinBtn.png")))
.addEventListener(FYGE.MouseEvent.CLICK, () => {
this.enableMouseEvt(false);
wait(() => { this.enableMouseEvt(true) }, 2000)
sendTbNet(TbNetName.navigateToOutside, { url: this.data.url })
//回来时关闭,回来讲道理必执行
GDispatcher.once(G_EVENT.ON_SHOW, () => {
this.hidePanel();
}, this)
}, this)
.position.set(166, 744)
}
}
import { Panel } from "../../module/views/Panel";
import MouseEvent = FYGE.MouseEvent;
import { showPanel } from "../../module/ctrls";
import { BuyPowerPanel } from "./BuyPowerPanel";
import { Tools } from "../Tools";
import Button = FYGE.Button;
import { RES } from "../../module/RES";
export class NoEnergyPanel extends Panel {
get groupNames() {
return ["NoEnergyPanel"]
}
get skinName() {
return "NoEnergyPanel"
}
closeBtn: FYGE.Button;
okBtn: FYGE.Button;
initUi() {
this.addChild(Tools.getSprite('panelBgS.png')).position.set(79, 513);
this.addChild(Tools.getSprite('体力不足.png')).position.set(171, 582);
this.okBtn = this.addChild(new Button(RES.getRes('体力不足按钮.png')));
this.okBtn.position.set(190, 830);
}
start(data) {
......@@ -26,7 +27,7 @@ export class NoEnergyPanel extends Panel {
initEvents() {
super.initEvents();
this.okBtn.addEventListener(MouseEvent.CLICK, () => {
showPanel(BuyPowerPanel);
Tools.openTask();
this.hidePanel();
}, this);
}
......
import { Panel } from "../../module/views/Panel";
import { Tools } from "../Tools";
import { getCurrentScene, showPanel } from "../../module/ctrls";
import { ToolsOutPanel } from "./ToolsOutPanel";
import { PropType } from "../something/enum/PropType";
export class NoStepPanel extends Panel {
get groupNames() { return ["NoStepPanel"] }
get skinName() { return "NoStepPanel" }
......@@ -34,7 +32,7 @@ export class NoStepPanel extends Panel {
this.liveBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
//无步数道具,弹出积分兑换
if (!Tools.gameData.tools.STEPS) {
showPanel(ToolsOutPanel, { type: PropType.STEPS, showSucPanel: false })
// showPanel(ToolsOutPanel, { type: PropType.STEPS, showSucPanel: false })
} else {
this.data.reviveFun();
this.hidePanel();
......
import { Panel } from "../../module/views/Panel";
import { getChapterData } from "../something/chapters/getChapter";
import { Tools } from "../Tools";
import { ElementTargetData } from "../something/interface/ElementTargetData";
import Container = FYGE.Container;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import MouseEvent = FYGE.MouseEvent;
import { changeScene, showPanel } from "../../module/ctrls";
import { PlayScene } from "../scene/PlayScene";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import { Tools } from "../Tools";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { NoEnergyPanel } from "./NoEnergyPanel";
import { ElementTargetData } from "../something/interface/ElementTargetData";
import Container = FYGE.Container;
import { getChapterData } from "../something/chapters/getChapter";
export class StartPanel extends Panel {
get groupNames() {
......@@ -21,12 +23,6 @@ export class StartPanel extends Panel {
return "StartPanel"
}
closeBtn: FYGE.Button;
checkTex: FYGE.TextField;
tipsTex: FYGE.TextField;
startBtn2: FYGE.Button;
startBtn: FYGE.Button;
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
......@@ -39,6 +35,13 @@ export class StartPanel extends Panel {
});
}
closeBtn: FYGE.Button;
startBtn: FYGE.Button;
startBtn2: FYGE.Button;
tipsTex: FYGE.TextField;
checkTex: FYGE.TextField;
prizeImg: Sprite;
initUi() {
this.checkTex.textWidth = 750;
this.checkTex.textAlign = TEXT_ALIGN.CENTER;
......@@ -47,12 +50,13 @@ export class StartPanel extends Panel {
this.startBtn.visible = !this.data.isPlayed;
this.startBtn2.visible = this.data.isPlayed;
this.tipsTex.visible = !this.data.isPlayed;
this.addChild(new StartTarget(this.data.level))
.position.set(0, 682);
// console.log(this.data);
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${this.data.level}`]);
this.prizeImg.anchorTexture.x = 0.5;
this.prizeImg.x = 750 / 2;
}
start(data) {
......@@ -64,17 +68,18 @@ export class StartPanel extends Panel {
if (!this.data.isPlayed && Tools.gameData.power <= 0) {// 体力不足
showPanel(NoEnergyPanel);
this.enableMouseEvt(true);
this.hidePanel();
return;
}
sendTbNet(TbNetName.dojoin, {level: this.data.level},
(success, res) => {
this.enableMouseEvt(true);
if (!success) return;
Tools.gameData.power = res.data.power;
// 访问页面埋点
sendTbNet(TbNetName.reportAnalytics, {logkey: 'join'});
Tools.gameData.power = res.data.power;
changeScene(PlayScene, {chapter: this.data.level});
this.hidePanel();
}
......@@ -94,6 +99,7 @@ export class StartPanel extends Panel {
}
}
const pos = [
[325],
[240, 410],
......@@ -151,3 +157,4 @@ export class StartTargetItem extends Container {
.to({scaleX: 1, scaleY: 1}, 500, Ease.backOut)
}
}
import { Panel } from "../../module/views/Panel";
import MouseEvent = FYGE.MouseEvent;
import { changeScene, showPanel } from "../../module/ctrls";
import { PlayScene } from "../scene/PlayScene";
import { StartTarget } from "./StartPanel";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import { Tools } from "../Tools";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { NoEnergyPanel } from "./NoEnergyPanel";
export class StartPanelPrize extends Panel {
get groupNames() {
return ["StartPanelPrize"]
}
get skinName() {
return "StartPanelPrize"
}
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
this.anchor.set(375, 812);
Tween.get(this)
.set({scaleX: 0, scaleY: 0})
.to({scaleX: 1, scaleY: 1}, 400, Ease.backOut)
.call(() => {
this.isShowing = false;
});
}
closeBtn: FYGE.Button;
startBtn: FYGE.Button;
startBtn2: FYGE.Button;
tipsTex: FYGE.TextField;
checkTex: FYGE.TextField;
prizeImg: Sprite;
initUi() {
this.checkTex.textWidth = 750;
this.checkTex.textAlign = TEXT_ALIGN.CENTER;
this.checkTex.x = 0;
this.checkTex.text = `第\t${this.data.level}\t关`;
this.startBtn.visible = !this.data.isPlayed;
this.startBtn2.visible = this.data.isPlayed;
this.addChild(new StartTarget(this.data.level))
.position.set(0, 682);
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${this.data.level}`]);
this.prizeImg.anchorTexture.x = 0.5;
this.prizeImg.x = 750 / 2;
}
start(data) {
super.start();
}
private startGame() {
this.enableMouseEvt(false);
if (!this.data.isPlayed && Tools.gameData.power <= 0) {// 体力不足
showPanel(NoEnergyPanel);
this.enableMouseEvt(true);
return;
}
sendTbNet(TbNetName.dojoin, {level: this.data.level},
(success, res) => {
this.enableMouseEvt(true);
if (!success) return;
// 访问页面埋点
sendTbNet(TbNetName.reportAnalytics, {logkey: 'join'});
Tools.gameData.power = res.data.power;
changeScene(PlayScene, {chapter: this.data.level});
this.hidePanel();
}
);
}
initEvents() {
super.initEvents();
this.startBtn.addEventListener(MouseEvent.CLICK, this.startGame, this);
this.startBtn2.addEventListener(MouseEvent.CLICK, this.startGame, this);
}
removeEvents() {
super.removeEvents();
this.startBtn.removeEventListener(MouseEvent.CLICK, this.startGame, this);
this.startBtn2.removeEventListener(MouseEvent.CLICK, this.startGame, this);
}
}
import { Panel } from "../../module/views/Panel";
import { layers } from "../../module/views/layers";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
import { Tools } from "../Tools";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { RES } from "../../module/RES";
import { showWaiting, hideWaiting, showToast, getCurrentScene } from "../../module/ctrls";
//任务类型(member/invites/browseGoods/follow)
export enum TaskType {
member = "member",
invites = "invites",
browseGoods = "browseGoods",
follow = "follow"
}
interface TaskData {
/**
* 任务类型
*/
taskType: TaskType,
/**
* 加入会员的链接
*/
value?: string,
/**
* 奖励的体力值
*/
rewards: number
/**
* 当前完成次数
*/
todayCompleteTimes: number
/**
* 需要完成次数
*/
times: number
/**
* 待领取体力值
*/
waitReceive: number
}
export class TaskPanel extends Panel {
get groupNames() {
return ["TaskPanel"]
}
get skinName() {
return "TaskPanel"
}
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
let oriY = 1624 - this.height - layers.stageOffsetY - 580;
this.y = layers.stageHeight + this.height;
Tween.get(this)
.to({ y: oriY }, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
}
closeBtn: Button;
taskBtn1: Button; // 浏览商品
taskBtn2: Button; // 邀请
taskBtn3: Button; // 关注
taskBtn4: Button; // 加入会员
[TaskType.browseGoods]: CusButton;
[TaskType.invites]: CusButton;
[TaskType.follow]: CusButton;
[TaskType.member]: CusButton;
initUi() {
//移除了吧,只需要位置
this.removeChild(this.taskBtn1)
this.removeChild(this.taskBtn2)
this.removeChild(this.taskBtn3)
this.removeChild(this.taskBtn4);
//四个按钮,先默认状态,然后start里刷任务接口
var ps = [this.taskBtn1, this.taskBtn2, this.taskBtn3, this.taskBtn4];
[TaskType.browseGoods, TaskType.invites, TaskType.follow, TaskType.member].forEach((e, i) => {
this[e] = this.addChild(new CusButton(e))
this[e].position.copy(ps[i].position);
this[e].visible = false;
})
}
start(data) {
super.start();
this.updateTask();
}
public updateTask() {
showWaiting();
sendTbNet(TbNetName.getTaskList, null,
(success, res) => {
hideWaiting();
if (!success) return;
var data: TaskData[] = res.data;
data.forEach((d) => {
this[d.taskType].visible = true;
//如果有入会链接
if (d.value) this[d.taskType].memberUrl = d.value;
//如果有待领取的
if (d.waitReceive) {
this[d.taskType].canGetStatus = true;
this[d.taskType].enabled = true;
}
//如果已全部完成
else if (d.todayCompleteTimes == d.times) {
this[d.taskType].canGetStatus = false;
this[d.taskType].enabled = false;
}
//去完成状态
else {
this[d.taskType].canGetStatus = false;
this[d.taskType].enabled = true;
}
})
}
);
}
initEvents() {
super.initEvents();
GDispatcher.addEventListener(G_EVENT.UPDATE_TASK, this.updateTask, this);
}
removeEvents() {
super.removeEvents();
GDispatcher.removeEventListener(G_EVENT.UPDATE_TASK, this.updateTask, this);
}
}
class CusButton extends Button {
private type: TaskType
private _canGetStatus: boolean;
get canGetStatus() {
return this._canGetStatus
}
set canGetStatus(value) {
this._canGetStatus = value;
var t: [FYGE.Texture, FYGE.Texture]
if (value) {//能领取时换图
t = [
RES.getRes("待领取.png"),
RES.getRes("待领取.png"),
]
} else {
t = [
RES.getRes("去完成.png"),
RES.getRes("去完成灰.png"),
]
}
this.changeTexture(t[0], t[0], t[1])
}
//外部自行赋值
memberUrl: string
constructor(type: TaskType) {
var t = [
RES.getRes("去完成.png"),
RES.getRes("去完成灰.png"),
]
super(t[0], t[0], t[1])
this.type = type;
//事件统一写吧
this.addEventListener(MouseEvent.CLICK, this.onClick, this)
}
onClick() {
if (this.canGetStatus) {//能领取,发接口
showWaiting();
sendTbNet(
TbNetName.receiveTaskRewards,
{ taskType: this.type },
(s, res) => {
hideWaiting();
if (s) {
//领取成功,TODO显示啥toast
showToast("领取成功");
//刷新任务列表
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
//刷新体力
Tools.gameData.power = res.data.power;
getCurrentScene().updateScene()
}
}
)
} else {//发对应任务方法
//都弄个延时
Tools.btnDelay(this)
switch (this.type) {
case TaskType.follow:
GDispatcher.removeAllEventListenerByType(TbNetName.favorShop);
sendTbNet(TbNetName.favorShop, {},
(success, res) => {
if (!success) return;
//关注成功了,发完成接口,注意小程序那边就不用发接口了
sendTbNet(
TbNetName.completeTask,
{ taskType: TaskType.follow },
(success, res) => {
if (!success) return;
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
}
);
}, true
);
break;
case TaskType.browseGoods:
sendTbNet(
TbNetName.navigateTo,
{ url: '/pages/browseProductList/browseProductList' },
() => { },
true
);
break;
case TaskType.invites:
sendTbNet(
TbNetName.showSharePanel,
{ openId: Tools.globalData.openId },//注意小程序那边处理参数
() => { },
true
);
break;
case TaskType.member:
sendTbNet(
TbNetName.navigateToOutside,
{ url: this.memberUrl },//下单页面路径待写
() => { },
true
);
break;
}
if (this.type == TaskType.browseGoods || this.type == TaskType.member) {
//都需要添加事件,回来时,派发事件刷任务接口
GDispatcher.once(G_EVENT.ON_SHOW, () => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK)
}, this)
}
}
}
}
\ No newline at end of file
import { Panel } from "../../module/views/Panel";
import { PropType } from "../something/enum/PropType";
import { getTbData, TbNetName } from "../TaoBaoNet";
import { Tools } from "../Tools";
import { showWaiting, hideWaiting, getCurrentScene, showPanel, showToast } from "../../module/ctrls";
import { JoinPanel } from "./JoinPanel";
import { ExchangeSucPanel } from "./ExchangeSucPanel";
export class ToolsOutPanel extends Panel {
get groupNames() {
return ["ToolsOutPanel"]
}
get skinName() {
return "ToolsOutPanel"
}
get closeBtns() {
return [this.consideBtn, this.closeBtn]
}
consideBtn: FYGE.Button;
sureBtn: FYGE.Button;
closeBtn: FYGE.Button;
msgTxt: FYGE.TextField;
data: { type: PropType, showSucPanel: boolean }
initUi() {
// 文案居中
Tools.changeTextAlign(this.msgTxt, FYGE.TEXT_ALIGN.CENTER, 500)
}
start(data) {
super.start();
//文案按接口返回的来
this.msgTxt.text = "要消耗" +
getTbData(TbNetName.getActivityBaseInfoById).data.buyCredits[data.type] +
"积分兑换吗?"
}
initEvents() {
super.initEvents();
this.sureBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
//购买道具
showWaiting();
var res = await Tools.exchange(this.data.type);
hideWaiting();
//如果是链接,弹出加入会员弹框
if (typeof res == "string") {
showPanel(JoinPanel, { url: res })
}
//成功了,关闭弹框,修改道具信息
else if (res) {
// showToast("兑换成功")
if (this.data.showSucPanel) showPanel(ExchangeSucPanel)
this.hidePanel();
getCurrentScene().updateScene()
}
}, this)
}
removeEvents() {
super.removeEvents();
}
}
......@@ -11,7 +11,7 @@ export class UseStep extends Panel {
};
initUi() {
this.addChild(Tools.getSprite('useStepBg.png')).position.set(86, 512);
this.addChild(Tools.getSprite('panelBgS.png')).position.set(86, 512);
this.addChild(Tools.getText( /// TODO 道具加步数
`确定要使用步数道具+5步数吗?`, 33, '#744f1d',
......
......@@ -919,7 +919,7 @@ export class PlayScene extends Scene {
// ele.type != ElementType.ROCK &&
ele.type != ElementType.LOLLIPOP) {
this.elementContainer.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, fun, this);
var index = ele.index;
const index = ele.index;
this.sendPropUse(prop, index);
}
}, this)
......
......@@ -10,7 +10,6 @@ import FrameAni = FYGE.FrameAni;
import Tween = FYGE.Tween;
import { showPanel } from "../../../module/ctrls";
import { StartPanel } from "../../panels/StartPanel";
import { StartPanelPrize } from "../../panels/StartPanelPrize";
import BitmapText = FYGE.BitmapText;
export enum CHECK_TYPE {
......@@ -179,7 +178,7 @@ export default class CheckBtn extends Container {
public clickStart() {
console.log(`关卡:${this.checkNum}`);
console.log(this.checkData);
showPanel(StartPanelPrize, this.checkData);
showPanel(StartPanel, this.checkData);
}
}
......
......@@ -7,7 +7,6 @@ import { Tools } from "../../Tools";
import MouseEvent = FYGE.MouseEvent;
import { showPanel } from "../../../module/ctrls";
import { RulePanel } from "../../panels/RulePanel";
import { TaskPanel } from "../../panels/TaskPanel";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
export default class MapUI extends Container {
......@@ -53,8 +52,7 @@ export default class MapUI extends Container {
break;
case this.taskBtn:
console.log('任务');
showPanel(TaskPanel);
Tools.openTask();
break;
}
}
......
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