Commit 6e9a9bcf authored by haiyoucuv's avatar haiyoucuv

Success Panel Effect!

parent dd9d6742
This diff is collapsed.
{
"code": "000000",
"data": {
"inviteFriends": {
"type": 2,
"value": 10,
"taskNum": 3
},
"openId": "AAFwCvE-ALiIWXYsJuTQVRpH",
"rule": "测试规则4455334354",
"updateTime": 1594627802429,
"title": "测试活动",
"toolsProbability": {
"HAMMERS": {
"properiodfrom": 1,
"properiodto": 500,
"probability": 5
},
"STEPS": {
"properiodfrom": 1001,
"properiodto": 1400,
"probability": 4
},
"BOOMS": {
"properiodfrom": 501,
"properiodto": 1000,
"probability": 5
}
},
"levelPrize": {
"level_90": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png",
"level_60": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01Llkz1U1wMhRqE4D0f_!!2275046294-2-miniprogram.png",
"level_120": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01WvSfpG1wMhRrsjqFq_!!2275046294-2-miniprogram.png",
"level_30": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01Mf9wLi1wMhRoCuoOs_!!2275046294-2-miniprogram.png",
"level_10": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01bsypJm1wMhRsRMjh1_!!2275046294-2-miniprogram.png"
},
"buyCredits": {
"HAMMERS": "8",
"POWERS": "9",
"BOOMS": "6",
"STEPS": "7"
},
"beMembership": 65,
"openPrizeMsg": "",
"createTime": 1594361933457,
"deleteStatus": 1,
"browseGoods": {
"itemIds": "32223",
"type": 1,
"value": 10,
"taskNum": 3
},
"startTime": 1592448580000,
"_id": "5f08084ec3ad3494b9201c0e",
"endTime": 1594966980000,
"attentionStore": 7,
"openPrizeStatus": 3
},
"success": true,
"message": "成功"
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"message": "OK", "message": "OK",
"data": { "data": {
"power": 100, "power": 100,
"currentLevel": 96, "currentLevel": 1,
"tools": { "tools": {
"STEPS": 1, "STEPS": 1,
"BOOMS": 2, "BOOMS": 2,
...@@ -12,13 +12,29 @@ ...@@ -12,13 +12,29 @@
}, },
"prizes": [ "prizes": [
{ {
"level": 5 "receiveTime": "",
"level": 120,
"isReceive": false
}, },
{ {
"level": 4 "receiveTime": "",
"level": 90,
"isReceive": false
}, },
{ {
"level": 1 "receiveTime": "",
"level": 60,
"isReceive": false
},
{
"receiveTime": "",
"level": 30,
"isReceive": false
},
{
"receiveTime": "",
"level": 10,
"isReceive": false
} }
], ],
"visitors": [ "visitors": [
......
{ {
"success": true, "success": true,
"data": { "data": {
"avatar": "string", "avatar": "https://source.unsplash.com/user/erondu/76x76",
"nickName": "我啊是大请问", "nickName": "我啊是大请问",
"activityId": "string", "activityId": "string",
"openId": "string", "openId": "string",
"inviteId": "string", "inviteId": "string",
"isFollow": true "isFollow": true
} }
} }
\ No newline at end of file
...@@ -569,7 +569,8 @@ export const SkinJson = { ...@@ -569,7 +569,8 @@ export const SkinJson = {
"type": "sprite", "type": "sprite",
"props": { "props": {
"source": "prize.png" "source": "prize.png"
} },
"id": "prizeImg"
}, },
{ {
"name": "关闭按钮", "name": "关闭按钮",
......
...@@ -14,6 +14,15 @@ export enum TbNetName { ...@@ -14,6 +14,15 @@ export enum TbNetName {
* activityId userNick avatar follow inviteId * activityId userNick avatar follow inviteId
*/ */
getIndex = "babycare.getIndex", getIndex = "babycare.getIndex",
/**
* 活动基本信息
* @param activityId
* @type {string}
*/
getActivityBaseInfoById = "babycare.getActivityBaseInfoById",
/** /**
* 获取游戏信息 * 获取游戏信息
* activityId * activityId
......
...@@ -54,6 +54,19 @@ export class Tools { ...@@ -54,6 +54,19 @@ export class Tools {
"isFristLogin": boolean,//是否是首次 "isFristLogin": boolean,//是否是首次
"topAward": any//120关自动开奖 "topAward": any//120关自动开奖
} }
public static baseInfo: {
prizeLevels: number[],
inviteFriends: any,
openId: string,
rule: string,
updateTime: number,
title: string,
toolsProbability: any,
levelPrize: any,
buyCredits: any, /// TODO ……
};// 活动基本信息
/** /**
* 首页数据,loading页面执行一次 * 首页数据,loading页面执行一次
*/ */
...@@ -70,6 +83,7 @@ export class Tools { ...@@ -70,6 +83,7 @@ export class Tools {
}) })
}) })
} }
/** /**
* 进入地图页面刷新 * 进入地图页面刷新
*/ */
...@@ -81,12 +95,13 @@ export class Tools { ...@@ -81,12 +95,13 @@ export class Tools {
}) })
}) })
} }
/** /**
* 消耗道具 * 消耗道具
*/ */
public static consumerTools(type: PropType): Promise<boolean> { public static consumerTools(type: PropType): Promise<boolean> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
sendTbNet(TbNetName.consumerTools, { type }, (s, res) => { sendTbNet(TbNetName.consumerTools, {type}, (s, res) => {
if (s) { if (s) {
//修改道具数量 //修改道具数量
this.gameData.tools = res.data.tools; this.gameData.tools = res.data.tools;
...@@ -98,6 +113,7 @@ export class Tools { ...@@ -98,6 +113,7 @@ export class Tools {
}) })
}) })
} }
/** /**
* 兑换道具,根据返回参数判断 * 兑换道具,根据返回参数判断
*/ */
...@@ -112,7 +128,7 @@ export class Tools { ...@@ -112,7 +128,7 @@ export class Tools {
if (creditsData && !creditsData.success && !creditsData.data.isvip) { if (creditsData && !creditsData.success && !creditsData.data.isvip) {
return creditsData.data.url return creditsData.data.url
} }
const res = await sendTbNet(TbNetName.exchange, { type, credits: creditsData.data.credits }) const res = await sendTbNet(TbNetName.exchange, {type, credits: creditsData.data.credits})
if (res.success) { if (res.success) {
//修改道具数量和体力 //修改道具数量和体力
this.gameData.power = res.data.power; this.gameData.power = res.data.power;
...@@ -122,6 +138,7 @@ export class Tools { ...@@ -122,6 +138,7 @@ export class Tools {
return false; return false;
} }
} }
/** /**
* 询问权限用 * 询问权限用
*/ */
...@@ -130,11 +147,11 @@ export class Tools { ...@@ -130,11 +147,11 @@ export class Tools {
var tbMy = my var tbMy = my
if (!tbMy) return; if (!tbMy) return;
//@ts-ignore //@ts-ignore
const { cloud } = getApp(); const {cloud} = getApp();
//测试地址//到时云存储传一个小json,,改路径 //测试地址//到时云存储传一个小json,,改路径
var url = "cloud://B4F0300E5148F478B506DEDC26EA4C6C//butterfly0.svga"; var url = "cloud://B4F0300E5148F478B506DEDC26EA4C6C//butterfly0.svga";
//获取临时地址 //获取临时地址
var urls = await cloud.file.getTempFileURL({ fileId: [url] }) var urls = await cloud.file.getTempFileURL({fileId: [url]})
url = urls[0].url.replace('-internal', ''); url = urls[0].url.replace('-internal', '');
tbMy.downloadFile({ tbMy.downloadFile({
url: url, url: url,
...@@ -143,10 +160,10 @@ export class Tools { ...@@ -143,10 +160,10 @@ export class Tools {
tbMy.getFileSystemManager().readFile({ tbMy.getFileSystemManager().readFile({
filePath: i, filePath: i,
// encoding: "utf8", // encoding: "utf8",
success: function (r) { success: function(r) {
}, },
fail: function (res) { fail: function(res) {
} }
}) })
...@@ -290,11 +307,11 @@ export class Tools { ...@@ -290,11 +307,11 @@ export class Tools {
showTime: number = 300 showTime: number = 300
) { ) {
Tween.get(target) Tween.get(target)
.set({ alpha: 0, visible: true }) .set({alpha: 0, visible: true})
.to({ alpha: 1 }, showTime, Ease.quadIn) .to({alpha: 1}, showTime, Ease.quadIn)
.wait(time) .wait(time)
.to({ alpha: 0 }, showTime, Ease.quadOut) .to({alpha: 0}, showTime, Ease.quadOut)
.set({ alpha: 0, visible: false }) .set({alpha: 0, visible: false})
.call(() => { .call(() => {
call(); call();
}); });
...@@ -316,11 +333,11 @@ export class Tools { ...@@ -316,11 +333,11 @@ export class Tools {
/** /**
* 根据名字获取0到9的贴图 * 根据名字获取0到9的贴图
* @param name * @param name
*/ */
public static getNumTextures(name: string): { [key: number]: FYGE.Texture } { public static getNumTextures(name: string): { [key: number]: FYGE.Texture } {
var arr = {} var arr = {}
for (var i = 0; i <= 9; i++)arr[i] = RES.getRes(name + i + ".png") for (var i = 0; i <= 9; i++) arr[i] = RES.getRes(name + i + ".png")
return arr return arr
} }
} }
...@@ -6,6 +6,10 @@ import { StartTarget } from "./StartPanel"; ...@@ -6,6 +6,10 @@ import { StartTarget } from "./StartPanel";
import TEXT_ALIGN = FYGE.TEXT_ALIGN; import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Tween = FYGE.Tween; import Tween = FYGE.Tween;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import { Tool } from "../something/Tool";
import { Tools } from "../Tools";
export class StartPanelPrize extends Panel { export class StartPanelPrize extends Panel {
get groupNames() { get groupNames() {
...@@ -33,6 +37,7 @@ export class StartPanelPrize extends Panel { ...@@ -33,6 +37,7 @@ export class StartPanelPrize extends Panel {
startBtn2: FYGE.Button; startBtn2: FYGE.Button;
tipsTex: FYGE.TextField; tipsTex: FYGE.TextField;
checkTex: FYGE.TextField; checkTex: FYGE.TextField;
prizeImg: Sprite;
initUi() { initUi() {
this.checkTex.textWidth = 750; this.checkTex.textWidth = 750;
...@@ -45,6 +50,10 @@ export class StartPanelPrize extends Panel { ...@@ -45,6 +50,10 @@ export class StartPanelPrize extends Panel {
this.addChild(new StartTarget(this.data.level)) this.addChild(new StartTarget(this.data.level))
.position.set(0, 682); .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) { start(data) {
......
...@@ -9,8 +9,6 @@ import { MapScene } from "./map/MapScene"; ...@@ -9,8 +9,6 @@ import { MapScene } from "./map/MapScene";
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
import { GTool } from "../../module/tools/GTool"; import { GTool } from "../../module/tools/GTool";
export class LoadingScene extends Scene { export class LoadingScene extends Scene {
get groupNames() { get groupNames() {
return ["loadingScene"] return ["loadingScene"]
...@@ -38,7 +36,7 @@ export class LoadingScene extends Scene { ...@@ -38,7 +36,7 @@ export class LoadingScene extends Scene {
.position.set((750 - 577) / 2, 1288 - 24) .position.set((750 - 577) / 2, 1288 - 24)
//进度条帧动画 //进度条帧动画
var arr = []; var arr = [];
for (var i = 0; i <= 11; i++)arr.push(RES.getRes("loadingPro" + i + ".png")) for (var i = 0; i <= 11; i++) arr.push(RES.getRes("loadingPro" + i + ".png"))
var pro = this.addChild(new FYGE.FrameAni(arr)); var pro = this.addChild(new FYGE.FrameAni(arr));
pro.play(0) pro.play(0)
pro.position.set(375, 1288)//位置按正常满条的位置 pro.position.set(375, 1288)//位置按正常满条的位置
...@@ -68,8 +66,9 @@ export class LoadingScene extends Scene { ...@@ -68,8 +66,9 @@ export class LoadingScene extends Scene {
GDispatcher.addEventListener(FYGE.Event.PROGRESS, this.progressEvent, this) GDispatcher.addEventListener(FYGE.Event.PROGRESS, this.progressEvent, this)
//首次进度一点 //首次进度一点
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.2) GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.2)
//获取app数据 //获取app数据
const { data } = await sendTbNet(TbNetName.getAppData); const {data} = await sendTbNet(TbNetName.getAppData);
Tools.globalData = data; Tools.globalData = data;
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.3) GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.3)
//询问读取权限,不阻止进程 //询问读取权限,不阻止进程
...@@ -77,7 +76,18 @@ export class LoadingScene extends Scene { ...@@ -77,7 +76,18 @@ export class LoadingScene extends Scene {
//获取首页数据 //获取首页数据
var getIndexSuccesss = await Tools.getIndex() var getIndexSuccesss = await Tools.getIndex()
//失败不进入 //失败不进入
if (!getIndexSuccesss) return; if (!getIndexSuccesss) return;
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.3);
// 游戏基本信息
const baseInfo = await sendTbNet(TbNetName.getActivityBaseInfoById);
Tools.baseInfo = baseInfo.data;
Tools.baseInfo.prizeLevels = [];
for (let k in Tools.baseInfo.levelPrize) {
Tools.baseInfo.prizeLevels.push(+k.split('_')[1]);
}
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.5); GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.5);
//首次进入,地图页面需要引导 //首次进入,地图页面需要引导
// if (Tools.gameData.isFristLogin) { // if (Tools.gameData.isFristLogin) {
...@@ -90,7 +100,9 @@ export class LoadingScene extends Scene { ...@@ -90,7 +100,9 @@ export class LoadingScene extends Scene {
'mapOwlEffect', 'mapOwlEffect',
'mapWhaleEffect', 'mapWhaleEffect',
'mapCheckPrizeEffect' 'mapCheckPrizeEffect'
].map((e) => { return RES.loadGroup(e) })) ].map((e) => {
return RES.loadGroup(e)
}))
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 1); GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 1);
} }
...@@ -98,11 +110,11 @@ export class LoadingScene extends Scene { ...@@ -98,11 +110,11 @@ export class LoadingScene extends Scene {
// private lastP=0 // private lastP=0
progressEvent(e: FYGE.Event) { progressEvent(e: FYGE.Event) {
FYGE.Tween.get(this.progressBar, null, null, true) FYGE.Tween.get(this.progressBar, null, null, true)
.to({ value: e.data }, 2000/**(p-this.lastP)*/) .to({value: e.data}, 2000/**(p-this.lastP)*/)
.call(() => { .call(() => {
if (e.data >= 1) { if (e.data >= 1) {
GDispatcher.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this); GDispatcher.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this);
changeScene(MapScene, { from: "loading" }) changeScene(MapScene, {from: "loading"})
} }
}) })
// this.lastP=p // this.lastP=p
...@@ -165,19 +177,19 @@ class Title extends FYGE.Container { ...@@ -165,19 +177,19 @@ class Title extends FYGE.Container {
this.y = -560;//待调整 this.y = -560;//待调整
//新建就动画出现吧, //新建就动画出现吧,
FYGE.Tween.get(this) FYGE.Tween.get(this)
.to({ y: targetY + 25 }, 300) .to({y: targetY + 25}, 300)
.to({ y: targetY - 30 }, 100) .to({y: targetY - 30}, 100)
.to({ y: targetY }, 100); .to({y: targetY}, 100);
[line, title].forEach((e) => { [line, title].forEach((e) => {
FYGE.Tween.get(e) FYGE.Tween.get(e)
.to({ rotation: 1.5 }, 300) .to({rotation: 1.5}, 300)
.to({ rotation: -0.5 }, 100) .to({rotation: -0.5}, 100)
.to({ rotation: 0 }, 100) .to({rotation: 0}, 100)
if (e === line) { if (e === line) {
FYGE.Tween.get(e) FYGE.Tween.get(e)
.to({ scaleY: 1.05 }, 300) .to({scaleY: 1.05}, 300)
.to({ scaleY: 0.96 }, 100) .to({scaleY: 0.96}, 100)
.to({ scaleY: 1 }, 100) .to({scaleY: 1}, 100)
} }
}) })
......
...@@ -5,13 +5,13 @@ import MapUI from "./MapUI"; ...@@ -5,13 +5,13 @@ import MapUI from "./MapUI";
import MapMid from "./MapMid"; import MapMid from "./MapMid";
import CheckBtn, { CHECK_TYPE } from "./CheckBtn"; import CheckBtn, { CHECK_TYPE } from "./CheckBtn";
import { layers } from "../../../module/views/layers"; import { layers } from "../../../module/views/layers";
import { Tools } from "../../Tools";
import { getTbData, sendTbNet, TbNetName } from "../../TaoBaoNet";
import ScrollPage = FYGE.ScrollPage; import ScrollPage = FYGE.ScrollPage;
import Container = FYGE.Container; import Container = FYGE.Container;
import { Tools } from "../../Tools";
import Graphics = FYGE.Graphics; import Graphics = FYGE.Graphics;
import { showPanel } from "../../../module/ctrls"; import Sprite = FYGE.Sprite;
import { SuccessNoPrizePanel } from "../../panels/SuccessNoPrizePanel"; import Texture = FYGE.Texture;
import { SuccessPrizePanel } from "../../panels/SuccessPrizePanel";
export class MapScene extends Scene { export class MapScene extends Scene {
private mapContainer: Container = null; private mapContainer: Container = null;
...@@ -49,7 +49,7 @@ export class MapScene extends Scene { ...@@ -49,7 +49,7 @@ export class MapScene extends Scene {
this.initMap(); this.initMap();
this.updateMapCheck(); this.updateMapCheck();
showPanel(SuccessNoPrizePanel) // showPanel(SuccessNoPrizePanel)
} }
private updateMapCheck() { private updateMapCheck() {
...@@ -169,6 +169,8 @@ export class MapScene extends Scene { ...@@ -169,6 +169,8 @@ export class MapScene extends Scene {
*/ */
export class MapAvatar extends Container { export class MapAvatar extends Container {
private avatarImg: Sprite = null;
constructor() { constructor() {
super(); super();
...@@ -181,7 +183,11 @@ export class MapAvatar extends Container { ...@@ -181,7 +183,11 @@ export class MapAvatar extends Container {
const mask = this.addChild(new Graphics()); const mask = this.addChild(new Graphics());
mask.drawCircle(0, -58, 38); mask.drawCircle(0, -58, 38);
/// TODO 加头像 this.avatarImg = this.addChild(new Sprite(Texture.fromUrl(
Tools.globalData.avatar
)));
this.avatarImg.width = this.avatarImg.height = 76;
this.avatarImg.position.set(-38, -96);
this.avatarImg.mask = mask;
} }
} }
...@@ -10,6 +10,8 @@ import { showPanel } from "../../../module/ctrls"; ...@@ -10,6 +10,8 @@ import { showPanel } from "../../../module/ctrls";
import { RulePanel } from "../../panels/RulePanel"; import { RulePanel } from "../../panels/RulePanel";
import { BuyPowerPanel } from "../../panels/BuyPowerPanel"; import { BuyPowerPanel } from "../../panels/BuyPowerPanel";
import { TaskPanel } from "../../panels/TaskPanel"; import { TaskPanel } from "../../panels/TaskPanel";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
import Texture = FYGE.Texture;
export default class MapUI extends Container { export default class MapUI extends Container {
public energyBox: EnergyBox = null; public energyBox: EnergyBox = null;
...@@ -160,16 +162,24 @@ class CreditsBox extends Container { ...@@ -160,16 +162,24 @@ class CreditsBox extends Container {
this.initUi(data); this.initUi(data);
} }
private initUi(data) { private async initUi(data) {
this.position.set(544, 184); this.position.set(544, 184);
this.addChild(Tools.getSprite('map_creditsBg.png')); this.addChild(Tools.getSprite('map_creditsBg.png'));
const creditsData = await sendTbNet(TbNetName.queryCredits, {}, () => {
}, true);
let jfLabel = '积分:0';
if (!creditsData || !creditsData.data) {
jfLabel = '积分:0';
} else {
jfLabel = `积分:${creditsData.data.credits}`;
}
this.countLabel = this.addChild(Tools.getText( this.countLabel = this.addChild(Tools.getText(
'积分:0', 20, '#ffffff', jfLabel, 20, '#ffffff',
TEXT_ALIGN.CENTER, 105, 58, 21 TEXT_ALIGN.CENTER, 105, 58, 21
)); ));
} }
} }
...@@ -208,6 +218,40 @@ class PrizeBox extends Button { ...@@ -208,6 +218,40 @@ class PrizeBox extends Button {
this.prizeImg = this.addChild(Tools.getSprite('map_star_enable.png', 39, 150)); this.prizeImg = this.addChild(Tools.getSprite('map_star_enable.png', 39, 150));
this.prizeImg.width = 80; this.prizeImg.width = 80;
this.prizeImg.height = 33; this.prizeImg.height = 33;
const prizes = Tools.gameData.prizes;
if (prizes.length <= 0) {
const curLevel: number = Tools.gameData.currentLevel;
let upLevel: number = 120;
let dLevel: number = 120;
Tools.baseInfo.prizeLevels.forEach((value, index) => {
const d: number = value - curLevel;
if (curLevel <= value && d >= 0 && d <= dLevel) {
upLevel = value;
dLevel = d + 1;
}
});
console.log(upLevel, dLevel);
this.checkTip.text = `再闯${dLevel}关`;
this.tip.text = '';
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${upLevel}`]);
} else if (prizes.length == 1 && +prizes[0].level == 120) {
this.checkTip.text = `等待开奖`;
this.tip.text = `8月28日10点\n开启大奖`;
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize['level_120']);
} else {
let lowerLevel = 120;
prizes.forEach((value) => {
if (value.level < lowerLevel) {
lowerLevel = value.level;
}
});
this.checkTip.text = `点击抽奖`;
this.tip.text = `抽取${lowerLevel}关奖励`;
this.tip.y += 10;
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${lowerLevel}`]);
}
} }
initEvent() { initEvent() {
......
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