Commit 09c58fc1 authored by haiyoucuv's avatar haiyoucuv

Success Panel Effect!

parent b6293615
This diff is collapsed.
......@@ -128,6 +128,21 @@
"sendAwardType": "prize"
}
],
"isFristLogin": false
"isFristLogin": false,
"topAward": {
"image":"https://img.alicdn.com/imgextra/i1/2275046294/O1CN01TrcMYF1wMhRuCphHI_!!2275046294-2-miniprogram.png",
"level":90,
"drawStatus":1,
"openId":"AAHuCvE-ALiIWXYsJuTb5S4W",
"createDay":"2020/07/14",
"avatar":"sdfwerwerwer",
"type":3,
"prizeId":"5f08084e0cb7338a0a377c8d",
"activityId":"5f08084ec3ad3494b9201c0e",
"ename":"",
"userNick":"wmmmmm",
"name":"90关奖品4",
"_id":"AAHuCvE-ALiIWXYsJuTb5S4W1594715684002"
}
}
}
......@@ -32,6 +32,10 @@
"keys": "步数耗尽Bg.png,步数耗尽复活.png,步数耗尽结束按钮.png",
"name": "NoStepPanel"
},
{
"keys": "prizePanel.png,prizePanelBtn.png",
"name": "PrizePanel"
},
{
"keys": "活动规则背景.png",
"name": "RulePanel"
......
......@@ -32,6 +32,10 @@ export const ResJson = {
"keys": "步数耗尽Bg.png,步数耗尽复活.png,步数耗尽结束按钮.png",
"name": "NoStepPanel"
},
{
"keys": "prizePanel.png,prizePanelBtn.png",
"name": "PrizePanel"
},
{
"keys": "活动规则背景.png",
"name": "RulePanel"
......
......@@ -720,6 +720,71 @@ export const SkinJson = {
}
]
},
{
"name": "PrizePanel",
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "背景",
"x": 55,
"y": 376,
"alpha": 1,
"type": "sprite",
"props": {
"source": "prizePanel.png"
}
},
{
"name": "关闭按钮",
"x": 631,
"y": 500,
"alpha": 1,
"type": "button",
"props": {
"tUp": "关闭按钮.png"
},
"id": "closeBtn"
},
{
"name": "文案",
"x": 203,
"y": 650,
"alpha": 1,
"type": "text",
"props": {
"text": "恭喜获得XX奖品",
"size": 34,
"fillColor": "#df5942",
"textAlpha": 1
},
"id": "prizeTxt"
},
{
"name": "prizeImg",
"x": 250,
"y": 732,
"alpha": 1,
"type": "sprite",
"props": {
"source": ""
},
"id": "prizeImg"
},
{
"name": "立即领取",
"x": 163,
"y": 1002,
"alpha": 1,
"type": "button",
"props": {
"tUp": "prizePanelBtn.png"
},
"id": "prizeBtn"
}
]
},
{
"name": "TaskPanel",
"x": 0,
......
......@@ -15,6 +15,9 @@ export enum TbNetName {
*/
getIndex = "babycare.getIndex",
// 领取权益奖励
receiveEnamePrize = "babycare.receiveEnamePrize",
/**
* 活动基本信息
......
import { Panel } from "../../module/views/Panel";
import TextField = FYGE.TextField;
import Button = FYGE.Button;
import Sprite = FYGE.Sprite;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Texture = FYGE.Texture;
import MouseEvent = FYGE.MouseEvent;
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { showToast } from "../../module/ctrls";
import { Tool } from "../something/Tool";
import { Tools } from "../Tools";
export class PrizePanel extends Panel {
get groupNames() {
return ["PrizePanel"]
}
get skinName() {
return "PrizePanel"
}
closeBtn: Button;
prizeTxt: TextField;
prizeImg: Sprite;
prizeBtn: Button;
initUi() {
this.prizeTxt.textAlign = TEXT_ALIGN.CENTER;
this.prizeTxt.textWidth = 750;
this.prizeTxt.x = 0;
this.prizeTxt.text = `恭喜获得${this.data.name}`;
this.prizeImg.anchorTexture.x = 0.5;
this.prizeImg.x = 375;
this.prizeImg.texture = Texture.fromUrl(this.data.image);
}
start(data) {
super.start();
}
private clickPrizeBtn(){
this.btnDelay(this.prizeBtn);
switch (this.data.type) {
case 1: // 权益
sendTbNet(TbNetName.receiveEnamePrize, {id: this.data.id},
(success, res) => {
if (!success || !res) {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
this.hidePanel();
return;
}
if (res.data) {
showToast('奖品发放成功\n请前往我的奖品处查看');
} else {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
}
this.hidePanel();
}, true
);
break;
case 3: // 实物
sendTbNet(TbNetName.getUserAddress, {prizeId: this.data.id},
(success, res) => {
if (!success) {
// showToast('奖品发放失败\n请前往我的奖品处进行处理');
return;
}
showToast('奖品发放成功\n请前往我的奖品处查看');
this.hidePanel();
}, true
);
break;
case 2: // 积分
case 5: // 谢谢参与
this.hidePanel();
break;
}
}
initEvents() {
super.initEvents();
this.prizeBtn.addEventListener(MouseEvent.CLICK, this.clickPrizeBtn, this);
}
removeEvents() {
super.removeEvents();
this.prizeBtn.removeEventListener(MouseEvent.CLICK, this.clickPrizeBtn, this);
}
}
......@@ -15,6 +15,7 @@ import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import { showPanel } from "../../../module/ctrls";
import { FreePowerPanel } from "../../panels/FreePowerPanel";
import { PrizePanel } from "../../panels/PrizePanel";
export class MapScene extends Scene {
private mapContainer: Container = null;
......@@ -52,12 +53,14 @@ export class MapScene extends Scene {
this.initMap();
this.updateMapCheck();
// showPanel(SuccessNoPrizePanel)
if (Tools.gameData.loginAddPower && !Tools.gameData.isFristLogin) {
showPanel(FreePowerPanel);
Tools.gameData.loginAddPower = false;
}
if (Tools.gameData.topAward) {
showPanel(PrizePanel, Tools.gameData.topAward);
}
}
private updateMapCheck() {
......
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