Commit b2ec1d54 authored by 邱旭's avatar 邱旭

斐乐消消乐init

parent 477b5530
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,6 @@
"levelPrize": {
"level_90": "https://img.alicdn.com/imgextra/i4/2275046294/O1CN01rG9iDU1wMhRtEnjA8_!!2275046294-2-miniprogram.png",
"level_60": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01Sytynw1wMhRuqjy5V_!!2275046294-2-miniprogram.png",
"level_120": "https://img.alicdn.com/imgextra/i2/2275046294/O1CN01Jh6dtM1wMhRxULetP_!!2275046294-2-miniprogram.png",
"level_30": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN019uAoYk1wMhRsoAgag_!!2275046294-2-miniprogram.png",
"level_10": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01FwiFBB1wMhRybF1V4_!!2275046294-2-miniprogram.png"
},
......
This diff is collapsed.
......@@ -119,12 +119,13 @@ export namespace RES {
resData = res;
resPath = res.path;
}
/**
* 根据组名加载一组资源,通常用于加载一个视图的的所有资源
* 里的promise的resolve并没有返回值
* @param name
*/
export function loadGroup(name: string): Promise<any> {
export function loadGroup(name: string): Promise<void> {
//已经加载完成的直接返回
if (groupsCompleteHash[name]) {
return new Promise((resolve) => {
......@@ -146,7 +147,7 @@ export namespace RES {
})
}
// 建一个promise
let p = new Promise((resolve, reject) => {
let p: Promise<void> = new Promise((resolve, reject) => {
loadResList((s) => {
//移除
delete groupsPromiseHash[name];
......@@ -453,6 +454,7 @@ export namespace RES {
if (child.type == "container") initSkinDisplay(dis, child, root);
}
}
/**
* 遍历根据名字找节点数据,只会是container的
* @param skinName
......
......@@ -32,7 +32,7 @@ export class Module extends FYGE.Container {
* 提前加载的资源
*/
protected preLoadRes() {
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
if (this.groupNames && this.groupNames.length) {
var arr: Promise<any>[] = [];
for (var i = 0; i < this.groupNames.length; i++) {
......@@ -40,7 +40,7 @@ export class Module extends FYGE.Container {
}
Promise.all(arr).then(resolve, reject)
} else {
resolve()
resolve(null)
}
})
}
......
{
"type": "activity",
"name": "babycare_xiaoxiao"
"name": "feile_xiaoxiao"
}
resource/map/map_bg1.jpg

598 KB | W: | H:

resource/map/map_bg1.jpg

388 KB | W: | H:

resource/map/map_bg1.jpg
resource/map/map_bg1.jpg
resource/map/map_bg1.jpg
resource/map/map_bg1.jpg
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_bg3.jpg

191 KB | W: | H:

resource/map/map_bg3.jpg

486 KB | W: | H:

resource/map/map_bg3.jpg
resource/map/map_bg3.jpg
resource/map/map_bg3.jpg
resource/map/map_bg3.jpg
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_check_disable.png

14.1 KB | W: | H:

resource/map/map_check_disable.png

20.7 KB | W: | H:

resource/map/map_check_disable.png
resource/map/map_check_disable.png
resource/map/map_check_disable.png
resource/map/map_check_disable.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_check_enable.png

8.37 KB | W: | H:

resource/map/map_check_enable.png

14.9 KB | W: | H:

resource/map/map_check_enable.png
resource/map/map_check_enable.png
resource/map/map_check_enable.png
resource/map/map_check_enable.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_check_enable_cur.png

11.3 KB | W: | H:

resource/map/map_check_enable_cur.png

14.9 KB | W: | H:

resource/map/map_check_enable_cur.png
resource/map/map_check_enable_cur.png
resource/map/map_check_enable_cur.png
resource/map/map_check_enable_cur.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_energyBg.png

11.8 KB | W: | H:

resource/map/map_energyBg.png

29.8 KB | W: | H:

resource/map/map_energyBg.png
resource/map/map_energyBg.png
resource/map/map_energyBg.png
resource/map/map_energyBg.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_prizeBtn.png

9.03 KB | W: | H:

resource/map/map_prizeBtn.png

13.1 KB | W: | H:

resource/map/map_prizeBtn.png
resource/map/map_prizeBtn.png
resource/map/map_prizeBtn.png
resource/map/map_prizeBtn.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_ruleBtn.png

9.01 KB | W: | H:

resource/map/map_ruleBtn.png

14.5 KB | W: | H:

resource/map/map_ruleBtn.png
resource/map/map_ruleBtn.png
resource/map/map_ruleBtn.png
resource/map/map_ruleBtn.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_star_disable.png

1.07 KB | W: | H:

resource/map/map_star_disable.png

3.6 KB | W: | H:

resource/map/map_star_disable.png
resource/map/map_star_disable.png
resource/map/map_star_disable.png
resource/map/map_star_disable.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_star_enable.png

1.48 KB | W: | H:

resource/map/map_star_enable.png

3.5 KB | W: | H:

resource/map/map_star_enable.png
resource/map/map_star_enable.png
resource/map/map_star_enable.png
resource/map/map_star_enable.png
  • 2-up
  • Swipe
  • Onion skin
resource/map/map_taskBtn.png

20.2 KB | W: | H:

resource/map/map_taskBtn.png

23 KB | W: | H:

resource/map/map_taskBtn.png
resource/map/map_taskBtn.png
resource/map/map_taskBtn.png
resource/map/map_taskBtn.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
......@@ -137,6 +137,7 @@ export class Lottie extends FYGE.Container {
}
private initState(con = this.children) {
for (var i = 0; i < con.length; i++) {
// @ts-ignore
var c: FYGE.Sprite = con[i];
if (c["layerData"]) {
//取第一个数据
......@@ -181,6 +182,7 @@ export class Lottie extends FYGE.Container {
private addTweens(con = this.children) {
for (var i = 0; i < con.length; i++) {
// @ts-ignore
let c: FYGE.Sprite = con[i];
if (c["layerData"]) {
//取第一个数据
......
This diff is collapsed.
......@@ -199,6 +199,7 @@ class LotteryScrollItem extends FYGE.Container {
//找出目标图
let child, curIndex;
for (var i = 0; i < this.children.length; i++) {
// @ts-ignore
if (this.children[i].id == id) {
child = this.children[i];
curIndex = i;
......
......@@ -10,7 +10,6 @@ import MouseEvent = FYGE.MouseEvent;
import Point = FYGE.Point;
import FrameAni = FYGE.FrameAni;
import Tween = FYGE.Tween;
import { Panel } from "../../../module/views/Panel";
import { showPanel } from "../../../module/ctrls";
import { StartPanel } from "../../panels/StartPanel";
import { StartPanelPrize } from "../../panels/StartPanelPrize";
......@@ -148,7 +147,7 @@ export default class CheckBtn extends Container {
super.update();
let up = this.localToGlobal(new Point(), new Point());
let bp = this.localToGlobal(new Point(0, 120), new Point());
this.alpha = this.stage.viewRect.isPointIn(up) || this.stage.viewRect.isPointIn(bp);
this.alpha = +(this.stage.viewRect.isPointIn(up) || this.stage.viewRect.isPointIn(bp));
}
constructor(data) {
......
This diff is collapsed.
import MapPart from "./MapPart";
import { RES } from "../../../module/RES";
import Point = FYGE.Point;
import FrameAni = FYGE.FrameAni;
import Texture = FYGE.Texture;
export default class MapBottom extends MapPart {
public static HEIGHT = 1092;
public static HEIGHT = 630;
protected totalCount = 8;
private crabAni: FrameAni = null;
public static totalCount = 2;
protected btnPos = [
[370, 930],
[437, 761],
[313, 669],
[408, 522],
[455, 375],
[364, 216],
[326, 62],
[491, 3],
[43, 436],
[208, 187],
];
constructor(data) {
......@@ -33,15 +23,7 @@ export default class MapBottom extends MapPart {
}
private initEffect() {
// 螃蟹
const crabTextures: Texture[] = new Array(31);
for (let i = 0; i < 16; i++) {
crabTextures[31 - i] = crabTextures[i] = RES.getRes(`map_crab_${i}.png`);
}
this.crabAni = this.addChild(new FrameAni(crabTextures));
this.crabAni.position.set(220, 50);
this.crabAni.play(-1);
}
public update() {
......@@ -50,10 +32,10 @@ export default class MapBottom extends MapPart {
let bp = this.localToGlobal(new Point(0, MapBottom.HEIGHT + 10), new Point());
let ucp = this.localToGlobal(new Point(0, MapBottom.HEIGHT / 4), new Point());
let bcp = this.localToGlobal(new Point(0, MapBottom.HEIGHT / 4 * 3), new Point());
this.alpha = this.stage.viewRect.isPointIn(up)
this.alpha = +(this.stage.viewRect.isPointIn(up)
|| this.stage.viewRect.isPointIn(bp)
|| this.stage.viewRect.isPointIn(ucp)
|| this.stage.viewRect.isPointIn(bcp);
|| this.stage.viewRect.isPointIn(bcp));
}
public destroy() {
......
import MapPart from "./MapPart";
import { RES } from "../../../module/RES";
import Point = FYGE.Point;
import Sprite = FYGE.Sprite;
import { Tools } from "../../Tools";
import Tween = FYGE.Tween;
import Texture = FYGE.Texture;
import FrameAni = FYGE.FrameAni;
export default class MapMid extends MapPart {
public static HEIGHT = 1635;
public static HEIGHT = 1763;
protected totalCount = 10;
private balloon: Sprite = null;
private water: Sprite = null;
private water1: Texture = null;
private water2: Texture = null;
private whaleAni: FrameAni = null;
private owlAni: FrameAni = null;
public static totalCount = 6;
protected btnPos = [
[267, 1519],
[211, 1325],
[338, 1154],
[237, 911],
[145, 755],
[225, 591],
[349, 480],
[214, 342],
[193, 188],
[392, 8],
[502, 1591],
[510, 1263],
[357, 1053],
[146, 652],
[287, 281],
[63, 412],
];
constructor(data) {
......@@ -39,49 +23,13 @@ export default class MapMid extends MapPart {
this.bg.texture = RES.getRes('map_bg2.jpg');
// 流水
this.water1 = RES.getRes('water1.png');
this.water2 = RES.getRes('water2.png');
this.initIcon();
this.initEffect();
}
private initEffect() {
// 热气球
this.balloon = this.addChild(Tools.getSprite('map_狐狸气球.png', -216, 750));
Tween.get(this.balloon, {loop: true})
.set({x: -216, y: 1170})
.to({x: 750 + 100, y: 765}, 20006);
this.balloon.mouseEnable = this.balloon.mouseChildren = false;
// 流水
this.water = this.addChild(new Sprite(this.water1));
this.water.position.set(544, 687);
// 鲸鱼
const whaleTextures: Texture[] = new Array(25);
for (let i = 0; i < 13; i++) {
whaleTextures[25 - i] = whaleTextures[i] = RES.getRes(`map_whale_${i}.png`);
}
this.whaleAni = this.addChild(new FrameAni(whaleTextures));
this.whaleAni.position.set(645, 575);
this.whaleAni.play(-1);
// 猫头鹰
const owlTextures: Texture[] = new Array(31);
for (let i = 0; i < 16; i++) {
owlTextures[31 - i] = owlTextures[i] = RES.getRes(`map_owl_${i}.png`);
}
this.owlAni = this.addChild(new FrameAni(owlTextures));
this.owlAni.position.set(538, 1548);
this.owlAni.play(-1);
}
private waterIndex1: boolean = true;
private waterIndex: number = 0;
public update() {
super.update();
......@@ -89,17 +37,10 @@ export default class MapMid extends MapPart {
let bp = this.localToGlobal(new Point(0, MapMid.HEIGHT + 10), new Point());
let ucp = this.localToGlobal(new Point(0, MapMid.HEIGHT / 4), new Point());
let bcp = this.localToGlobal(new Point(0, MapMid.HEIGHT / 4 * 3), new Point());
this.alpha = this.stage.viewRect.isPointIn(up)
this.alpha = +(this.stage.viewRect.isPointIn(up)
|| this.stage.viewRect.isPointIn(bp)
|| this.stage.viewRect.isPointIn(ucp)
|| this.stage.viewRect.isPointIn(bcp);
// 流水动画
if (this.waterIndex++ > 6) {
this.waterIndex1 = !this.waterIndex1;
this.water.texture = this.waterIndex1 ? this.water1 : this.water2;
this.waterIndex = 0;
}
|| this.stage.viewRect.isPointIn(bcp));
}
......
......@@ -5,9 +5,10 @@ import Container = FYGE.Container;
export default class MapPart extends Container {
protected data: any = null;
protected totalCount: number = 0;
public static totalCount: number = 0;
protected btnPos: number[][] = [];
......@@ -19,6 +20,10 @@ export default class MapPart extends Container {
this.data = data;
}
update() {
super.update();
}
protected initIcon() {
// 坑爹的头像,所以倒着加,可以解决层级问题
for (let i = this.data.length - 1; i >= 0; i--) {
......
......@@ -33,14 +33,11 @@ export class MapScene extends Scene {
private uiLayer: MapUI = null;
private mapAvatar: MapAvatar = null;
// private mapAvatar: MapAvatar = null;
public get groupNames(): string[] {
return [
'map',
'mapCrabEffect',
'mapOwlEffect',
'mapWhaleEffect',
'mapCheckPrizeEffect'
];
}
......@@ -71,27 +68,6 @@ export class MapScene extends Scene {
}
Tools.gameData.topAward = null;
}
// if (Tools.gameData.topAward && Tools.gameData.topAward.prize._id && openPrize !== 'true') {
// GTool.writeCache('openPrize', 'true');
// showPanel(PrizePanel, JSON.parse(JSON.stringify(Tools.gameData.topAward)));
// Tools.gameData.topAward = null;
// }
//微信渠道抽奖
if (Tools.gameData.wxOriginPrize) {
//有奖品
if (
Tools.gameData.wxOriginPrize.type &&//类型存在
Tools.gameData.wxOriginPrize.type != 5 //不为谢谢参与
) {
showPanel(WxPrizePanel, Tools.gameData.wxOriginPrize)
}
//超出限制了
else if (Tools.gameData.wxOriginPrize.defaultMsg) {
showToast(Tools.gameData.wxOriginPrize.defaultMsg)
}
//置空数据
Tools.gameData.wxOriginPrize = null;
}
}
private updateMapCheck() {
......@@ -124,7 +100,7 @@ export class MapScene extends Scene {
guide_check.enabled = true;
guide_check.type = CHECK_TYPE.CUR;
guide_check.position.set(MapScene.checkArr[1].x, layers.stageHeight - 162);
guide_check.addChild(new MapAvatar());
// guide_check.addChild(new MapAvatar());
const guide_hand = guide.addChild(Tools.getSprite('guide_hand.png'));
guide_hand.position.set(guide_check.x + 90, guide_check.y + 40);
......@@ -172,16 +148,16 @@ export class MapScene extends Scene {
}
// 当前关卡
if (currentLevel < 121 && currentLevel > 0) {
if (currentLevel < 100 && currentLevel > 0) {
MapScene.checkArr[currentLevel].type = CHECK_TYPE.CUR;
MapScene.checkArr[currentLevel].enabled = true;
!this.mapAvatar && (this.mapAvatar = this.addChild(new MapAvatar()));
this.mapAvatar.parent && this.mapAvatar.parent.removeChild(this.mapAvatar);
MapScene.checkArr[currentLevel].addChild(this.mapAvatar);
// !this.mapAvatar && (this.mapAvatar = this.addChild(new MapAvatar()));
// this.mapAvatar.parent && this.mapAvatar.parent.removeChild(this.mapAvatar);
// MapScene.checkArr[currentLevel].addChild(this.mapAvatar);
}
// 未通关的
for (let i = currentLevel + 1; i < 121; i++) {
for (let i = currentLevel + 1; i < 100; i++) {
MapScene.checkArr[i].type = CHECK_TYPE.COM;
MapScene.checkArr[i].enabled = false;
}
......@@ -205,25 +181,24 @@ export class MapScene extends Scene {
}
public initMap() {
const arr = new Array(120);
const arr = new Array(99);
for (let i = 0; i < 120; i++) {
for (let i = 0; i < 99; i++) {
arr[i] = {
check: i + 1
};
}
arr.reverse();
const topData = arr.splice(118, 2); // 得到顶部的数据
const bottomData = arr.splice(0, 8); // 得到尾部的数据
const topData = arr.splice(98, MapTop.totalCount); // 得到顶部的数据
const bottomData = arr.splice(0, MapBottom.totalCount); // 得到尾部的数据
const midData = arr; // 剩下的是中间的数据
let maxHeight = MapTop.HEIGHT;
this.mapContainer.addChild(new MapTop(topData)); // 最后加,因为有个层级问题
this.mapContainer.addChild(new MapTop(topData));
for (let i = midData.length / 10 - 1; i >= 0; i--) {
const data = midData.splice(i * 10, 10);
for (let i = midData.length / MapMid.totalCount - 1; i >= 0; i--) {
const data = midData.splice(i * MapMid.totalCount, MapMid.totalCount);
const nMid = new MapMid(data);
this.mapContainer.addChild(nMid);
nMid.y = maxHeight;
......@@ -235,20 +210,16 @@ export class MapScene extends Scene {
bottom.y = maxHeight;
maxHeight += MapBottom.HEIGHT;
// this.mapContainer.addChild(new MapTop(topData)); // 最后加,因为有个层级问题
this.scrollPage.maxDistance = maxHeight;
this.scrollPage.scrollTo(maxHeight, 0);
this.scrollToCheck(1);
}
private scrollToCheck(checkNum: number, time = 0) {
if (checkNum < 1) {
checkNum = 1;
} else if (checkNum > 120) {
checkNum = 120;
} else if (checkNum > 99) {
checkNum = 99;
}
const check = MapScene.checkArr[checkNum];
const checkY = check.y + check.parent.y - layers.stageHeight / 2 + 50;
......
......@@ -4,17 +4,12 @@ import Point = FYGE.Point;
export default class MapTop extends MapPart {
public static HEIGHT = 521;
public static HEIGHT = 852;
protected totalCount = 2;
public static totalCount = 1;
// public btnPos = [
// [207, 418],
// [149, 282],
// ];
public btnPos = [
[207, 400],
[149, 272],
[225, 694],
];
constructor(data) {
......@@ -32,10 +27,10 @@ export default class MapTop extends MapPart {
let bp = this.localToGlobal(new Point(0, MapTop.HEIGHT + 10), new Point());
let ucp = this.localToGlobal(new Point(0, MapTop.HEIGHT / 4), new Point());
let bcp = this.localToGlobal(new Point(0, MapTop.HEIGHT / 4 * 3), new Point());
this.alpha = this.stage.viewRect.isPointIn(up)
this.alpha = +(this.stage.viewRect.isPointIn(up)
|| this.stage.viewRect.isPointIn(bp)
|| this.stage.viewRect.isPointIn(ucp)
|| this.stage.viewRect.isPointIn(bcp);
|| this.stage.viewRect.isPointIn(bcp));
}
public destroy() {
......
This diff is collapsed.
......@@ -3,6 +3,7 @@
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"noImplicitThis": false,
"sourceMap": true,
"removeComments": true,
"noEmitOnError":true,
......
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