Commit f35c4a9c authored by wjf's avatar wjf

l

parent b4bb891d
{
"code": "000000",
"data": {
"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"
},
"success": true,
"message": "成功"
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -19,4 +19,6 @@ RES修改成与FYGE独立的贴图缓存,否则FYGE多页面应该会有同名 ...@@ -19,4 +19,6 @@ RES修改成与FYGE独立的贴图缓存,否则FYGE多页面应该会有同名
多page上的canvas,destroy最好别执行removeAllTweens, 多page上的canvas,destroy最好别执行removeAllTweens,
多page上的canvas,对于相同资源是否考虑,还有公用弹框,(还是不考虑吧,多page只在活动相互独立的情况下使用) 多page上的canvas,对于相同资源是否考虑,还有公用弹框(可以考虑用dom的component),
\ No newline at end of file
(多page最好只在活动相互独立的情况下使用)
\ No newline at end of file
This diff is collapsed.
var fs = require("fs");
//测试脚本,白鹭的图集格式转fyge的图集格式
var readPath = "./scripts/";
var writePath = "./psd/"
//取指令后的参数
let arg = process.argv.splice(2);
//json名字
var jsonName = arg[0];
var data = fs.readFileSync(readPath + jsonName + ".json");
//反序列化
data = JSON.parse(data);
let frames = data.frames;
var obj = {};
for (var key in frames) {
let f = frames[key];
obj[jsonName + key + ".png"] = {
"x": f.x,
"y": f.y,
"w": f.w,
"h": f.h,
"ox": f.offX,
"oy": f.offY,
"sw": f.sourceW,
"sh": f.sourceH,
"ro": false,
}
}
//写入
fs.writeFileSync(writePath + jsonName + ".json", JSON.stringify(obj, "", "\t"));
//例子json
// {"file":"coin.png","frames":{
// "8":{"x":0,"y":0,"w":109,"h":112,"offX":3,"offY":1,"sourceW":115,"sourceH":115},
// "4":{"x":67,"y":340,"w":65,"h":113,"offX":25,"offY":1,"sourceW":115,"sourceH":115},
// "5":{"x":222,"y":0,"w":24,"h":108,"offX":45,"offY":3,"sourceW":115,"sourceH":115},
// "7":{"x":0,"y":114,"w":94,"h":113,"offX":10,"offY":1,"sourceW":115,"sourceH":115},
// "6":{"x":0,"y":229,"w":65,"h":114,"offX":25,"offY":0,"sourceW":115,"sourceH":115},
// "2":{"x":111,"y":0,"w":109,"h":111,"offX":3,"offY":2,"sourceW":115,"sourceH":115},
// "3":{"x":96,"y":225,"w":94,"h":113,"offX":10,"offY":1,"sourceW":115,"sourceH":115},
// "1":{"x":111,"y":113,"w":109,"h":110,"offX":3,"offY":2,"sourceW":115,"sourceH":115}}}
\ No newline at end of file
This diff is collapsed.
...@@ -76,6 +76,11 @@ export enum TbNetName { ...@@ -76,6 +76,11 @@ export enum TbNetName {
* activityId * activityId
*/ */
getTaskList = "babycare.getTaskList", getTaskList = "babycare.getTaskList",
/**
* 抽奖
* activityId
*/
luckyDraw = "babycare.luckyDraw",
///////////////////前端调用接口都加个mine ///////////////////前端调用接口都加个mine
......
...@@ -69,9 +69,9 @@ export class StartPanel extends Panel { ...@@ -69,9 +69,9 @@ export class StartPanel extends Panel {
if (!success) return; if (!success) return;
Tools.gameData.power = res.data.power; Tools.gameData.power = res.data.power;
changeScene(PlayScene, { chapter: this.data.level }); changeScene(PlayScene, { chapter: this.data.level });
this.hidePanel();
} }
); );
this.hidePanel();
} }
initEvents() { initEvents() {
......
...@@ -71,9 +71,9 @@ export class StartPanelPrize extends Panel { ...@@ -71,9 +71,9 @@ export class StartPanelPrize extends Panel {
if (!success) return; if (!success) return;
Tools.gameData.power = res.data.power; Tools.gameData.power = res.data.power;
changeScene(PlayScene, {chapter: this.data.level}); changeScene(PlayScene, {chapter: this.data.level});
this.hidePanel();
} }
); );
this.hidePanel();
} }
initEvents() { initEvents() {
......
...@@ -12,6 +12,7 @@ import TextField = FYGE.TextField; ...@@ -12,6 +12,7 @@ import TextField = FYGE.TextField;
import { changeScene } from "../../module/ctrls"; import { changeScene } from "../../module/ctrls";
import { MapScene } from "../scene/map/MapScene"; import { MapScene } from "../scene/map/MapScene";
import MouseEvent = FYGE.MouseEvent; import MouseEvent = FYGE.MouseEvent;
import { LotteryScene } from "../scene/LotteryScene";
export class SuccessPrizePanel extends Panel { export class SuccessPrizePanel extends Panel {
get groupNames() { get groupNames() {
...@@ -27,8 +28,8 @@ export class SuccessPrizePanel extends Panel { ...@@ -27,8 +28,8 @@ export class SuccessPrizePanel extends Panel {
this.isShowing = true; this.isShowing = true;
this.anchor.set(375, 812); this.anchor.set(375, 812);
Tween.get(this) Tween.get(this)
.set({scaleX: 0, scaleY: 0}) .set({ scaleX: 0, scaleY: 0 })
.to({scaleX: 1, scaleY: 1}, 400, Ease.backOut) .to({ scaleX: 1, scaleY: 1 }, 400, Ease.backOut)
.call(() => { .call(() => {
this.isShowing = false; this.isShowing = false;
}); });
...@@ -100,13 +101,13 @@ export class SuccessPrizePanel extends Panel { ...@@ -100,13 +101,13 @@ export class SuccessPrizePanel extends Panel {
} }
private lightEffect() { private lightEffect() {
Tween.get(this.light1, {loop: true}) Tween.get(this.light1, { loop: true })
.set({anchorX: 219.5, anchorY: 219.5}) .set({ anchorX: 219.5, anchorY: 219.5 })
.to({rotation: 360}, 12000); .to({ rotation: 360 }, 12000);
Tween.get(this.light2, {loop: true}) Tween.get(this.light2, { loop: true })
.set({anchorX: 219.5, anchorY: 219.5}) .set({ anchorX: 219.5, anchorY: 219.5 })
.to({rotation: -360}, 12000); .to({ rotation: -360 }, 12000);
} }
start(data) { start(data) {
...@@ -117,7 +118,7 @@ export class SuccessPrizePanel extends Panel { ...@@ -117,7 +118,7 @@ export class SuccessPrizePanel extends Panel {
* 挑战满星 * 挑战满星
*/ */
private again() { private again() {
changeScene(MapScene, {level: this.data.level}); changeScene(MapScene, { level: this.data.level });
super.hidePanel(); super.hidePanel();
} }
...@@ -128,14 +129,16 @@ export class SuccessPrizePanel extends Panel { ...@@ -128,14 +129,16 @@ export class SuccessPrizePanel extends Panel {
if (this.data.level == 120) { if (this.data.level == 120) {
changeScene(MapScene); changeScene(MapScene);
} else { } else {
changeScene(MapScene, {level: this.data.level + 1}); changeScene(MapScene, { level: this.data.level + 1 });
} }
super.hidePanel(); super.hidePanel();
} }
public goPrize(){ public goPrize() {
/// TODO 去抽奖 // 去抽奖
changeScene(LotteryScene, { level: this.data.level })
super.hidePanel();
} }
......
...@@ -245,7 +245,7 @@ class CusButton extends Button { ...@@ -245,7 +245,7 @@ class CusButton extends Button {
if (this.type == TaskType.browseGoods || this.type == TaskType.member) { if (this.type == TaskType.browseGoods || this.type == TaskType.member) {
//都需要添加事件,回来时,派发事件刷任务接口 //都需要添加事件,回来时,派发事件刷任务接口
GDispatcher.once(G_EVENT.ON_SHOW, () => { GDispatcher.once(G_EVENT.ON_SHOW, () => {
GDispatcher.dispatchEvent(G_EVENT.ON_SHOW) GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK)
}, this) }, this)
} }
} }
......
...@@ -2,7 +2,7 @@ import { Scene } from "../../module/views/Scene"; ...@@ -2,7 +2,7 @@ import { Scene } from "../../module/views/Scene";
import { Tools } from "../Tools"; import { Tools } from "../Tools";
import { ProgressBarS } from "../common/ProgressBarS"; import { ProgressBarS } from "../common/ProgressBarS";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { sendTbNet, TbNetName } from "../TaoBaoNet"; import { sendTbNet, TbNetName, getTbData } from "../TaoBaoNet";
import { changeScene } from "../../module/ctrls"; import { changeScene } from "../../module/ctrls";
import { MapScene } from "./map/MapScene"; import { MapScene } from "./map/MapScene";
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
...@@ -106,10 +106,12 @@ export class LoadingScene extends Scene { ...@@ -106,10 +106,12 @@ export class LoadingScene extends Scene {
//获取首页数据 //获取首页数据
var getIndexSuccesss = await Tools.getIndex() var getIndexSuccesss = await Tools.getIndex()
//失败不进入 //失败不进入
if (!getIndexSuccesss) return; if (!getIndexSuccesss) return;
this.dispatchEvent(FYGE.Event.PROGRESS, 0.3); this.dispatchEvent(FYGE.Event.PROGRESS, 0.3);
//赋值openId,取getIndex里的数据
Tools.globalData.openId = getTbData(TbNetName.getIndex).data.openId;
// 游戏基本信息 // 游戏基本信息
const baseInfo = await sendTbNet(TbNetName.getActivityBaseInfoById); const baseInfo = await sendTbNet(TbNetName.getActivityBaseInfoById);
Tools.baseInfo = baseInfo.data; Tools.baseInfo = baseInfo.data;
......
...@@ -2,15 +2,20 @@ import { Scene } from "../../module/views/Scene"; ...@@ -2,15 +2,20 @@ import { Scene } from "../../module/views/Scene";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
import { Tools } from "../Tools"; import { Tools } from "../Tools";
import { showWaiting, wait } from "../../module/ctrls"; import { showWaiting, wait, changeScene, hideWaiting, showPanel } from "../../module/ctrls";
import { sendTbNet, TbNetName } from "../TaoBaoNet"; import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { GTool } from "../../module/tools/GTool"; import { GTool } from "../../module/tools/GTool";
import { MapScene } from "./map/MapScene";
import { PrizePanel } from "../panels/PrizePanel";
import { NoPrizePanel } from "../panels/NoPrizePanel";
/** /**
* 摇奖机弹框 * 摇奖机弹框
*/ */
export class LotteryScene extends Scene { export class LotteryScene extends Scene {
get groupNames() { return ["lotteryScene"] } get groupNames() { return ["lotteryScene"] }
lotScroll: LotteryScroll;
data: { data: {
level: number, level: number,
} }
...@@ -53,6 +58,10 @@ export class LotteryScene extends Scene { ...@@ -53,6 +58,10 @@ export class LotteryScene extends Scene {
this.addChild(new FYGE.Button(RES.getRes("lotteryBtn.png"))) this.addChild(new FYGE.Button(RES.getRes("lotteryBtn.png")))
.addEventListener(FYGE.MouseEvent.CLICK, this.lottery, this) .addEventListener(FYGE.MouseEvent.CLICK, this.lottery, this)
.position.set((750 - RES.getRes("lotteryBtn.png").width) / 2, 797); .position.set((750 - RES.getRes("lotteryBtn.png").width) / 2, 797);
//返回按钮,回到地图页
this.addChild(new FYGE.Button(RES.getRes("lotteryReturnBtn.png")))
.addEventListener(FYGE.MouseEvent.CLICK, () => { changeScene(MapScene) }, this)
.position.set(0, 300)
//刷新奖品列表和摇奖列表 //刷新奖品列表和摇奖列表
this.updatePrizes(); this.updatePrizes();
} }
...@@ -60,24 +69,31 @@ export class LotteryScene extends Scene { ...@@ -60,24 +69,31 @@ export class LotteryScene extends Scene {
showWaiting(); showWaiting();
const { data: prizeList } = await sendTbNet(TbNetName.getPrizesByLevel, { level: this.data.level }); const { data: prizeList } = await sendTbNet(TbNetName.getPrizesByLevel, { level: this.data.level });
//滚动列表 //滚动列表
console.log(prizeList) // console.log(prizeList)
var scroll = this.addChild(new FYGE.ScrollList(PrizeItem, 122, 140, 345, 152, false)) var scroll = this.addChild(new FYGE.ScrollList(PrizeItem, 122, 140, 345, 152, false))
scroll.position.set(195, 1013); scroll.position.set(195, 1013);
scroll.updateData(prizeList || []) scroll.updateData(prizeList || [])
//摇奖部分 //摇奖部分
var p = [201, 620] var p = [201, 620]
var lotScroll = this.addChild(new LotteryScroll(prizeList)) this.lotScroll = this.addChild(new LotteryScroll(prizeList))
lotScroll.position.set(p[0], p[1]); this.lotScroll.position.set(p[0], p[1]);
// console.log(lotScroll);
window["aa"] = function (id) {
lotScroll.lot(id, () => {
console.log(123123)
})
}
} }
lottery() { lottery() {
showWaiting()
sendTbNet(TbNetName.luckyDraw)
.then((res) => {
hideWaiting();
//如果是失败
if (!res.success) return;
let id;
if (res.data && res.data._id) id = res.data._id;
this.enableMouseEvt(false);
this.lotScroll.lot(id, () => {
this.enableMouseEvt(true)
//弹框
showPanel(id ? PrizePanel : NoPrizePanel, id ? res.data : null)
})
})
} }
} }
interface PrizeInt { interface PrizeInt {
......
...@@ -50,7 +50,7 @@ export class MapScene extends Scene { ...@@ -50,7 +50,7 @@ export class MapScene extends Scene {
888, true, true 888, true, true
)); ));
this.mapContainer = this.scrollPage.view.addChild(new Container()); this.mapContainer = this.scrollPage.view.addChild(new Container());
this.uiLayer = this.addChild(new MapUI()); // this.uiLayer = this.addChild(new MapUI());//待测试,在下面updateMapCheck里再初始化
this.initMap(); this.initMap();
this.updateMapCheck(); this.updateMapCheck();
...@@ -69,13 +69,15 @@ export class MapScene extends Scene { ...@@ -69,13 +69,15 @@ export class MapScene extends Scene {
private updateMapCheck() { private updateMapCheck() {
if (this.data && this.data.from == 'loading') { if (this.data && this.data.from == 'loading') {
this.uiLayer = this.addChild(new MapUI());
this.initMapByData(Tools.gameData); this.initMapByData(Tools.gameData);
if (Tools.gameData.isFristLogin) { if (Tools.gameData.isFristLogin) {
this.initGuide(); this.initGuide();
} }
} else { } else {
Tools.getGameInfo().then((success) => { Tools.getGameInfo().then((success) => {
if (success) { if (success) {//不考虑失败的情况
this.uiLayer = this.addChild(new MapUI());
this.initMapByData(Tools.gameData); this.initMapByData(Tools.gameData);
} }
}); });
...@@ -91,7 +93,7 @@ export class MapScene extends Scene { ...@@ -91,7 +93,7 @@ export class MapScene extends Scene {
g.beginFill(0, 0.6); g.beginFill(0, 0.6);
g.drawRect(0, 0, layers.stageWidth, layers.stageHeight); g.drawRect(0, 0, layers.stageWidth, layers.stageHeight);
g.endFill(); g.endFill();
const guide_check = guide.addChild(new CheckBtn({check: 1})); const guide_check = guide.addChild(new CheckBtn({ check: 1 }));
guide_check.enabled = true; guide_check.enabled = true;
guide_check.type = CHECK_TYPE.CUR; guide_check.type = CHECK_TYPE.CUR;
guide_check.position.set(MapScene.checkArr[1].x, layers.stageHeight - 162); guide_check.position.set(MapScene.checkArr[1].x, layers.stageHeight - 162);
...@@ -118,15 +120,15 @@ export class MapScene extends Scene { ...@@ -118,15 +120,15 @@ export class MapScene extends Scene {
guide.alpha = 0; guide.alpha = 0;
Tween.get(guide) Tween.get(guide)
.to({alpha: 1}, 600, Ease.quadInOut); .to({ alpha: 1 }, 600, Ease.quadInOut);
Tween.get(guide_fox) Tween.get(guide_fox)
.wait(300) .wait(300)
.to({y: guide_check.y - 345, alpha: 1}, 300, Ease.quadInOut) .to({ y: guide_check.y - 345, alpha: 1 }, 300, Ease.quadInOut)
.wait(100) .wait(100)
.call(() => { .call(() => {
Tween.get(guide_tip) Tween.get(guide_tip)
.to({scaleX: 1, scaleY: 1}, 300, Ease.quadInOut); .to({ scaleX: 1, scaleY: 1 }, 300, Ease.quadInOut);
}); });
} }
......
...@@ -6,12 +6,13 @@ import TEXT_ALIGN = FYGE.TEXT_ALIGN; ...@@ -6,12 +6,13 @@ import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import { RES } from "../../../module/RES"; import { RES } from "../../../module/RES";
import { Tools } from "../../Tools"; import { Tools } from "../../Tools";
import MouseEvent = FYGE.MouseEvent; import MouseEvent = FYGE.MouseEvent;
import { showPanel } from "../../../module/ctrls"; import { showPanel, changeScene, showToast } 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 { sendTbNet, TbNetName } from "../../TaoBaoNet";
import Texture = FYGE.Texture; import Texture = FYGE.Texture;
import { LotteryScene } from "../LotteryScene";
export default class MapUI extends Container { export default class MapUI extends Container {
public energyBox: EnergyBox = null; public energyBox: EnergyBox = null;
...@@ -61,7 +62,7 @@ export default class MapUI extends Container { ...@@ -61,7 +62,7 @@ export default class MapUI extends Container {
break; break;
case this.prizeBox: case this.prizeBox:
/// TODO 奖励盒子,有条件的吧 /// TODO 奖励盒子,有条件的吧,放在类里了prizeBox
console.log('奖励盒子'); console.log('奖励盒子');
break; break;
...@@ -247,11 +248,18 @@ class PrizeBox extends Button { ...@@ -247,11 +248,18 @@ class PrizeBox extends Button {
this.tip.text = ''; this.tip.text = '';
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${upLevel}`]); this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${upLevel}`]);
this.prizeImg.y -= 20; this.prizeImg.y -= 20;
this.addEventListener(FYGE.MouseEvent.CLICK, () => {
//有需要,到时再改
showToast(this.checkTip.text + "才可以抽奖哦")
}, this)
} else if (prizes.length == 1 && +prizes[0].level == 120) { } else if (prizes.length == 1 && +prizes[0].level == 120) {
this.checkTip.text = `等待开奖`; this.checkTip.text = `等待开奖`;
this.tip.text = `8月28日10点\n开启大奖`; this.tip.text = `8月28日10点\n开启大奖`;
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize['level_120']); this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize['level_120']);
this.addEventListener(FYGE.MouseEvent.CLICK, () => {
//有需要,到时再改
showToast(this.tip.text)
}, this)
} else { } else {
let lowerLevel = 120; let lowerLevel = 120;
prizes.forEach((value) => { prizes.forEach((value) => {
...@@ -263,11 +271,12 @@ class PrizeBox extends Button { ...@@ -263,11 +271,12 @@ class PrizeBox extends Button {
this.tip.text = `抽取${lowerLevel}关奖励`; this.tip.text = `抽取${lowerLevel}关奖励`;
this.tip.y += 10; this.tip.y += 10;
this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${lowerLevel}`]); this.prizeImg.texture = Texture.fromUrl(Tools.baseInfo.levelPrize[`level_${lowerLevel}`]);
this.addEventListener(FYGE.MouseEvent.CLICK, () => {
changeScene(LotteryScene, { level: lowerLevel })
}, this)
} }
} }
initEvent() { initEvent() {
} }
} }
...@@ -38,7 +38,7 @@ export class PropGuide extends FYGE.Container { ...@@ -38,7 +38,7 @@ export class PropGuide extends FYGE.Container {
text.fillColor = "#ffffff"; text.fillColor = "#ffffff";
text.size = 20; text.size = 20;
text.x = (750 - 500) / 2; text.x = (750 - 500) / 2;
text.y = offsetY - 92; text.y = offsetY - 30;
text.textAlign = FYGE.TEXT_ALIGN.CENTER; text.textAlign = FYGE.TEXT_ALIGN.CENTER;
text.textWidth = 500; text.textWidth = 500;
this.addChild(text); this.addChild(text);
...@@ -75,7 +75,7 @@ export class PropGuide extends FYGE.Container { ...@@ -75,7 +75,7 @@ export class PropGuide extends FYGE.Container {
this.bg.moveTo(stepPosition[0] + 50, stepPosition[1]) this.bg.moveTo(stepPosition[0] + 50, stepPosition[1])
this.bg.drawCircle(stepPosition[0], stepPosition[1], 50, false) this.bg.drawCircle(stepPosition[0], stepPosition[1], 50, false)
this.bg.endFill(); this.bg.endFill();
this.msgTxt.text = "点击上方步数,可为闯关时增加额外5次步数"; this.msgTxt.text = "点击上方步数,可为闯关时增加额外5次步数";
// this.msgTxt.x = 320; // this.msgTxt.x = 320;
} }
} }
......
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