Commit 343dd45f authored by wildfirecode's avatar wildfirecode

Merge branch 'dev'

parents 6f4024f8 3d1bfd2b
...@@ -127,8 +127,8 @@ ...@@ -127,8 +127,8 @@
// localStorage.clear(); // localStorage.clear();
window['imgver'] = '11112'; window['imgver'] = '11112';
//top 8 ,repeat 22 , bottom 3 //top 8 ,repeat 22 , bottom 3
window['total_level'] = 8 + 3 + 22 * 23; window['total_level'] = 8 + 3 + 22 * 24;
window['last_level'] = 500; window['last_level'] = 525;
var sharePic = document.getElementById('pic'); var sharePic = document.getElementById('pic');
......
...@@ -426,6 +426,7 @@ export default class MainBase extends eui.UILayer { ...@@ -426,6 +426,7 @@ export default class MainBase extends eui.UILayer {
"monster_shoot", "monster_shoot",
"ele33_1", "ele33_1",
"ele33_0", "ele33_0",
"arrowbg",
] ]
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
RES.getResAsync(arr[i] + "_png") RES.getResAsync(arr[i] + "_png")
...@@ -478,6 +479,21 @@ export default class MainBase extends eui.UILayer { ...@@ -478,6 +479,21 @@ export default class MainBase extends eui.UILayer {
}) })
} }
getInviteInfo() {
return new Promise((r) => {
NetManager.ins.getInviteInfo(() => {
r();
})
});
}
getSignConfig() {
return new Promise((r) => {
NetManager.ins.getSignConfig(() => {
r();
})
});
}
getAd() { getAd() {
return new Promise((r) => { return new Promise((r) => {
...@@ -510,6 +526,14 @@ export default class MainBase extends eui.UILayer { ...@@ -510,6 +526,14 @@ export default class MainBase extends eui.UILayer {
}); });
} }
hbRainBaseInfo() {
return new Promise((r) => {
NetManager.ins.hbRainBaseInfo(async () => {
r();
});
});
}
hcHome() { hcHome() {
return new Promise((r) => { return new Promise((r) => {
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
...@@ -536,6 +560,9 @@ export default class MainBase extends eui.UILayer { ...@@ -536,6 +560,9 @@ export default class MainBase extends eui.UILayer {
this.hc_userInfo(), this.hc_userInfo(),
this.getBackReward(), this.getBackReward(),
this.hcRedBoobBaseInfo(), this.hcRedBoobBaseInfo(),
this.getSignConfig(),
this.getInviteInfo(),
this.hbRainBaseInfo(),
]); ]);
//获取分享加体力的shareCode,不影响初始化场景,不进await //获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager.ins.getUserShareCode(() => { }) NetManager.ins.getUserShareCode(() => { })
......
...@@ -2210,6 +2210,21 @@ export class NetManager extends ABNetManager { ...@@ -2210,6 +2210,21 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public getSignConfig(callback: Function): void {
const net: INetData = {
name: 'getSignConfig',
uri: window['duiba'] + '/customActivity/happyclear/getSignConfig',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId
},
callback: callback
};
this.send(net);
}
/** /**
* 获取邀请码 * 获取邀请码
* @param callback * @param callback
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"common","version":5,"files":["../assets/common/turnnoprize再来一次.png","../assets/common/toast.png","../assets/common/share_btn2.png","../assets/common/share_btn1.png","../assets/common/prizePanelbg.png","../assets/common/lightani.png","../assets/common/exchangebtn.png","../assets/common/common_yuanbao.png","../assets/common/common_prop3.png","../assets/common/common_prop2.png","../assets/common/common_prop1.png","../assets/common/common_prizelight.png","../assets/common/common_money.png","../assets/common/common_blood.png","../assets/common/common_adbg.png","../assets/common/commmon_okbtn1.png","../assets/common/closeCommonBtn.png","../assets/common/btn.png","../assets/common/alertbg.png","../assets/common/按钮 副本 4.png","../assets/common/按钮 副本 3.png","../assets/common/common_block.png","../assets/common/common_block_front.png","../assets/common/common_block_bg_yellow.png","../assets/common/common_block_bg_red.png","../assets/common/common_block_bg_blue.png","../assets/common/chocolate3.png","../assets/common/chocolate1.png","../assets/common/chocolate0.png","../assets/common/chocolate2.png"]} {"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"common","version":5,"files":["../assets/common/turnnoprize再来一次.png","../assets/common/toast.png","../assets/common/share_btn2.png","../assets/common/share_btn1.png","../assets/common/prizePanelbg.png","../assets/common/lightani.png","../assets/common/exchangebtn.png","../assets/common/common_yuanbao.png","../assets/common/common_prop3.png","../assets/common/common_prop2.png","../assets/common/common_prop1.png","../assets/common/common_prizelight.png","../assets/common/common_money.png","../assets/common/common_blood.png","../assets/common/common_adbg.png","../assets/common/commmon_okbtn1.png","../assets/common/closeCommonBtn.png","../assets/common/btn.png","../assets/common/alertbg.png","../assets/common/按钮 副本 4.png","../assets/common/按钮 副本 3.png","../assets/common/common_block.png","../assets/common/common_block_front.png","../assets/common/common_block_bg_yellow.png","../assets/common/common_block_bg_red.png","../assets/common/common_block_bg_blue.png","../assets/common/chocolate3.png","../assets/common/chocolate1.png","../assets/common/chocolate0.png","../assets/common/chocolate2.png","../assets/common/arrowbg.png"]}
\ No newline at end of file \ No newline at end of file
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
"name": "signprize" "name": "signprize"
}, },
{ {
"keys": "turnnoprize再来一次2_png,toast_png,sharenums_png,sharenums_fnt,share_btn2_png,share_btn1_png,prizePanelbg_png,nums3_png,nums3_fnt,nums2_png,nums2_fnt,nums_png,nums_fnt,lightani_png,exchangebtn_png,cutTimeFont_png,cutTimeFont_fnt,common_yuanbao_png,common_prop3_png,common_prop2_png,common_prop1_png,common_prizelight_png,common_money_png,common_blood_png,common_adbg_png,commmon_okbtn1_png,closeCommonBtn_png,btn_png,alertbg_png,朋友圈中间分享蒙层1_jpg,按钮 副本 4_png,按钮 副本 3_png,common_block_png,common_block_front_png,common_block_bg_yellow_png,common_block_bg_red_png,common_block_bg_blue_png,chocolate3_png,chocolate1_png,chocolate0_png,chocolate2_png", "keys": "turnnoprize再来一次2_png,toast_png,sharenums_png,sharenums_fnt,share_btn2_png,share_btn1_png,prizePanelbg_png,nums3_png,nums3_fnt,nums2_png,nums2_fnt,nums_png,nums_fnt,lightani_png,exchangebtn_png,cutTimeFont_png,cutTimeFont_fnt,common_yuanbao_png,common_prop3_png,common_prop2_png,common_prop1_png,common_prizelight_png,common_money_png,common_blood_png,common_adbg_png,commmon_okbtn1_png,closeCommonBtn_png,btn_png,alertbg_png,朋友圈中间分享蒙层1_jpg,按钮 副本 4_png,按钮 副本 3_png,common_block_png,common_block_front_png,common_block_bg_yellow_png,common_block_bg_red_png,common_block_bg_blue_png,chocolate3_png,chocolate1_png,chocolate0_png,chocolate2_png,arrowbg_png",
"name": "common" "name": "common"
}, },
{ {
...@@ -4937,6 +4937,16 @@ ...@@ -4937,6 +4937,16 @@
"url": "assets/eleDisNew/eleDisNew4_14.png", "url": "assets/eleDisNew/eleDisNew4_14.png",
"type": "image", "type": "image",
"name": "eleDisNew4_14_png" "name": "eleDisNew4_14_png"
},
{
"url": "assets/common/arrowbg.png",
"type": "image",
"name": "arrowbg_png"
},
{
"url": "assets/sounds/haha.mp3",
"type": "sound",
"name": "haha_mp3"
} }
] ]
} }
\ No newline at end of file
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<e:Label id="title" text="第1天" x="77" y="15.33" textColor="0x955200" size="24" fontFamily="FZY3JW"/> <e:Label id="title" text="第1天" x="77" y="15.33" textColor="0x955200" size="24" fontFamily="FZY3JW"/>
<e:Label id="amount" text="1" x="186" y="81.56" textColor="0x955200" size="24" fontFamily="FZY3JW"/> <e:Label id="amount" text="1" x="186" y="81.56" textColor="0x955200" size="24" fontFamily="FZY3JW"/>
<e:Image id="light" source="sign_light_png" x="3.65" y="1.34"/> <e:Image id="light" source="sign_light_png" x="3.65" y="1.34"/>
<e:Image id="object" source="sign_icon1_png" x="96" y="46.73" visible="false"/> <e:Image id="object" source="sign_icon1_png" x="96" y="51.73" visible="false"/>
<e:Image id="money" source="signicon2_png" x="90" y="67.5" visible="false"/> <e:Image id="money" source="signicon2_png" x="90" y="67.5" visible="false"/>
<e:Image id="hammer" source="signicon3_png" x="96" y="53.23" visible="false"/> <e:Image id="hammer" source="signicon3_png" x="96" y="53.23" visible="false"/>
<e:Image id="boom" source="signicon4_png" x="103" y="55" visible="false"/> <e:Image id="boom" source="signicon4_png" x="103" y="55" visible="false"/>
<e:Image id="steps" source="signicon5_png" x="104" y="57" visible="false"/> <e:Image id="steps" source="signicon5_png" x="104" y="57" visible="false"/>
<e:Image id="blood" x="98.04" y="60.35" source="signicon_blood_png" visible="false"/> <e:Image id="blood" x="98.04" y="60.35" source="signicon_blood_png" visible="false"/>
<e:Image id="random" x="98.73" y="50.4" source="signicon6_png" visible="false"/> <e:Image id="random" x="98.73" y="50.4" source="signicon6_png" visible="false"/>
<e:Image id="quan15" x="95.42" y="56.76" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan15_png" visible="false"/> <e:Image id="quan" x="95.42" y="53.76" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="" width="76"/>
<e:Image id="quan10" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan10_png" visible="false"/> <e:Image id="quan10" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan10_png" visible="false"/>
<e:Image id="quan23" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan23_png" visible="false"/> <e:Image id="quan23" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan23_png" visible="false"/>
<e:Image id="quan36" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan36_png" visible="false"/> <e:Image id="quan36" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan36_png" visible="false"/>
......
...@@ -4,8 +4,8 @@ import { loadSvga } from "../loadSvga"; ...@@ -4,8 +4,8 @@ import { loadSvga } from "../loadSvga";
export const createSandDisAni = async (x, y, p) => { export const createSandDisAni = async (x, y, p) => {
const movieclip: any = await loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga'); const movieclip: any = await loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga');
p.addChild(movieclip); p.addChild(movieclip);
movieclip.anchorOffsetX= 100; movieclip.anchorOffsetX = 100;
movieclip.anchorOffsetY= 100; movieclip.anchorOffsetY = 100;
// movieclip.scaleX=movieclip.scaleY=0.5; // movieclip.scaleX=movieclip.scaleY=0.5;
movieclip.x = x; movieclip.x = x;
movieclip.y = y; movieclip.y = y;
......
...@@ -102,6 +102,9 @@ import Sand, { getSandDisplayBlock } from '../something/Sand'; ...@@ -102,6 +102,9 @@ import Sand, { getSandDisplayBlock } from '../something/Sand';
import { SandAni } from '../something/anis/SandAni'; import { SandAni } from '../something/anis/SandAni';
import doSandAI from './doSandAI'; import doSandAI from './doSandAI';
import { createSandDisAni } from '../effect/createSandDisAni'; import { createSandDisAni } from '../effect/createSandDisAni';
import { getArrowDir, getArrowRotation, fillConveyor, getOneConveyorMask } from '../something/conveyor/conveyorTool';
import createArrowBg from '../something/conveyor/createArrowBg';
import doConveyorAI from './doConveyorAI';
const aniClass = { const aniClass = {
"BoomAni": BoomAni, "BoomAni": BoomAni,
...@@ -160,6 +163,7 @@ for (let i = 1; i < 999; i++) { /// TODO 测试 ...@@ -160,6 +163,7 @@ for (let i = 1; i < 999; i++) { /// TODO 测试
const festivalIndex: number = 40; const festivalIndex: number = 40;
export default class MainScene extends Scene { export default class MainScene extends Scene {
private _converyorTag;
get skinKey() { get skinKey() {
return 'Main2' return 'Main2'
} }
...@@ -198,6 +202,8 @@ export default class MainScene extends Scene { ...@@ -198,6 +202,8 @@ export default class MainScene extends Scene {
eliminatedElements: number[] = []; eliminatedElements: number[] = [];
//棒棒糖生成标志 //棒棒糖生成标志
lollipopMark: boolean; lollipopMark: boolean;
private conveyorLayer: egret.DisplayObjectContainer;
conveyorMap: any;
//地图背景容器 //地图背景容器
map: egret.DisplayObjectContainer; map: egret.DisplayObjectContainer;
//是否手动触发特效,用于两个组合后的特效 //是否手动触发特效,用于两个组合后的特效
...@@ -322,6 +328,7 @@ export default class MainScene extends Scene { ...@@ -322,6 +328,7 @@ export default class MainScene extends Scene {
NetManager.ins.showLog(getlogItem(10)) NetManager.ins.showLog(getlogItem(10))
NetManager.ins.showLog(getlogItem(13)) NetManager.ins.showLog(getlogItem(13))
this.initConveyor();
//初始话地图格子数据 //初始话地图格子数据
this.initLattices(); this.initLattices();
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,用到map //初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,用到map
...@@ -453,7 +460,11 @@ export default class MainScene extends Scene { ...@@ -453,7 +460,11 @@ export default class MainScene extends Scene {
var path = generateMapBg(this.chapterData.map.lattices); var path = generateMapBg(this.chapterData.map.lattices);
var bg = drawBg(path, this.chapterData.map.lattices) var bg = drawBg(path, this.chapterData.map.lattices)
this.addChild(bg); this.addChild(bg);
const conveyor = new egret.Sprite();
this.conveyorLayer = conveyor;
this.conveyorMap = {};
this.map = bg; this.map = bg;
this.map.addChild(conveyor);
//容器 //容器
this.elementContainer = new egret.DisplayObjectContainer(); this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer); this.addChild(this.elementContainer);
...@@ -598,6 +609,40 @@ export default class MainScene extends Scene { ...@@ -598,6 +609,40 @@ export default class MainScene extends Scene {
} }
} }
initConveyor() {
const conveyorList = this.chapterData.map.conveyor;
if (!conveyorList) return;
const tex = RES.getRes('arrowbg_png');
for (const conveyor of conveyorList) {
const dir = getArrowDir(conveyor);
const list = fillConveyor(conveyor);
const conveyorContainer = new egret.Sprite();
this.conveyorLayer.addChild(conveyorContainer);
const mask = new egret.Sprite();
conveyorContainer.mask = mask;
conveyorContainer.addChild(mask);
const oneMask = getOneConveyorMask(list, dir);
const maskP = Tool.getPositionByIndex(list[0]);
oneMask.x = maskP[0];
oneMask.y = maskP[1];
mask.addChild(oneMask);
list.forEach(i => {
const arrow = createArrowBg(tex);
arrow.rotation = getArrowRotation(dir);
conveyorContainer.addChild(arrow);
const p = Tool.getPositionByIndex(i);
this.conveyorMap[i] = arrow;
arrow.x = p[0];
arrow.y = p[1];
});
}
}
//初始化地图格子数据,包括生成口,联通口 //初始化地图格子数据,包括生成口,联通口
initLattices() { initLattices() {
var latticesD = this.chapterData.map.lattices; var latticesD = this.chapterData.map.lattices;
...@@ -643,7 +688,6 @@ export default class MainScene extends Scene { ...@@ -643,7 +688,6 @@ export default class MainScene extends Scene {
//设置生成口, //设置生成口,
this.generateIndexs = Tool.setGenerateLats(this.lattices, genLatDatas) this.generateIndexs = Tool.setGenerateLats(this.lattices, genLatDatas)
var downMax: number = 0; var downMax: number = 0;
var upMax: number = 0; var upMax: number = 0;
var hasSmallToBig: boolean; var hasSmallToBig: boolean;
...@@ -655,7 +699,7 @@ export default class MainScene extends Scene { ...@@ -655,7 +699,7 @@ export default class MainScene extends Scene {
var connectedLat = connectedLats[i]; var connectedLat = connectedLats[i];
if (!connectedLat || !connectedLat.length) continue; if (!connectedLat || !connectedLat.length) continue;
if (!this.lattices[connectedLat[0]]) { if (!this.lattices[connectedLat[0]]) {
throw new Error('联通干了个空的@沈豪洲(牛奶) ') throw new Error('联通干了个空的@沈豪洲(牛奶) ' + JSON.stringify(connectedLat))
} }
try { try {
this.lattices[connectedLat[0]].down = connectedLat[1]; this.lattices[connectedLat[0]].down = connectedLat[1];
...@@ -1216,6 +1260,7 @@ export default class MainScene extends Scene { ...@@ -1216,6 +1260,7 @@ export default class MainScene extends Scene {
} }
} }
setTimeout(() => { setTimeout(() => {
this._converyorTag = true;
this.eliminate(); this.eliminate();
}, 200) }, 200)
break; break;
...@@ -1227,6 +1272,7 @@ export default class MainScene extends Scene { ...@@ -1227,6 +1272,7 @@ export default class MainScene extends Scene {
Tool.getPositionByIndex(index) Tool.getPositionByIndex(index)
) )
} }
this._converyorTag = true;
this.eliminate(); this.eliminate();
break; break;
case PropType.CHANCE_NUM: case PropType.CHANCE_NUM:
...@@ -1253,6 +1299,7 @@ export default class MainScene extends Scene { ...@@ -1253,6 +1299,7 @@ export default class MainScene extends Scene {
mouseDownE(e: egret.TextEvent) { mouseDownE(e: egret.TextEvent) {
// if (!this.enableTouch) return // if (!this.enableTouch) return
this._converyorTag=true;
var self = this; var self = this;
if (e.target.parent instanceof Element) { if (e.target.parent instanceof Element) {
//去掉提示动画 //去掉提示动画
...@@ -1278,6 +1325,7 @@ export default class MainScene extends Scene { ...@@ -1278,6 +1325,7 @@ export default class MainScene extends Scene {
} }
mouseMoveE(e) { mouseMoveE(e) {
this._converyorTag=true;
if (this.SELECTED && e.target.parent instanceof Element) { if (this.SELECTED && e.target.parent instanceof Element) {
if (!Tool.judgeChosen(e.target.parent)) return if (!Tool.judgeChosen(e.target.parent)) return
if (Tool.checkNeb(e.target.parent, this.SELECTED)) { if (Tool.checkNeb(e.target.parent, this.SELECTED)) {
...@@ -2026,6 +2074,10 @@ export default class MainScene extends Scene { ...@@ -2026,6 +2074,10 @@ export default class MainScene extends Scene {
this.eliminate(); this.eliminate();
return return
} }
if (this._converyorTag) {
await doConveyorAI(this);
this._converyorTag = false;
}
await doSandAI(this); await doSandAI(this);
const doHoneyPotAIResult = await doHoneyPotAI(this); const doHoneyPotAIResult = await doHoneyPotAI(this);
if (doHoneyPotAIResult.length > 0) {//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步 if (doHoneyPotAIResult.length > 0) {//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
...@@ -2107,6 +2159,7 @@ export default class MainScene extends Scene { ...@@ -2107,6 +2159,7 @@ export default class MainScene extends Scene {
this.commonContinuityTimes = 1; this.commonContinuityTimes = 1;
this.effectContinuityTimes = 1; this.effectContinuityTimes = 1;
if (movieClips["bonusTime"]) { if (movieClips["bonusTime"]) {
playSound(SoundType.bonusTime);
this.addChild(movieClips["bonusTime"]) this.addChild(movieClips["bonusTime"])
movieClips["bonusTime"].gotoAndPlay(1, true) movieClips["bonusTime"].gotoAndPlay(1, true)
setTimeout(() => { setTimeout(() => {
......
import { Lattice } from "../something/class/Lattice";
import ConveyorAni, { getConveyorAni } from "../something/conveyor/ConveyorAni";
import { ARROW_DIR, fillConveyor, findTarget, getArrowDir, getOneConveyorMask, getElementMask } from "../something/conveyor/conveyorTool";
import { Tool } from "../something/Tool";
import MainScene from "./MainScene";
import wait from "../../libs/new_tc/wait";
import cloneElement from "../something/cloneElement";
export const CONVERYOR_ANI_DUR = 500;
const getTargetIndexs = (conveyor: number[]) => {
const dir = getArrowDir(conveyor);
let list = fillConveyor(conveyor);
if (dir == ARROW_DIR.DOWN || dir == ARROW_DIR.RIGHT) {
list.push(list.shift());
} else if (dir == ARROW_DIR.LEFT || dir == ARROW_DIR.UP) {
list.unshift(list.pop());
}
return list;
}
const getLastListIndex = (conveyor) => {
const dir = getArrowDir(conveyor);
const list = fillConveyor(conveyor);
switch (dir) {
case ARROW_DIR.DOWN:
case ARROW_DIR.RIGHT:
return list.length - 1
case ARROW_DIR.UP:
case ARROW_DIR.LEFT:
return 0;
}
};
const getLastPosition = (conveyor, p) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.DOWN:
p[1] += Tool.height;
break;
case ARROW_DIR.RIGHT:
p[0] += Tool.height;
break;
case ARROW_DIR.UP:
p[1] -= Tool.height;
break;
case ARROW_DIR.LEFT:
p[0] -= Tool.height;
break;
};
return p;
}
const getFirstPosition = (conveyor, p) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.DOWN:
p[1] -= Tool.height;
break;
case ARROW_DIR.RIGHT:
p[0] -= Tool.height;
break;
case ARROW_DIR.UP:
p[1] += Tool.height;
break;
case ARROW_DIR.LEFT:
p[0] += Tool.height;
break;
};
return p;
}
const getTargetConveyor = (thisObj: MainScene, targetIndex: number) => {
const conveyors = thisObj.chapterData.map.conveyor;
for (const conveyor of conveyors) {
if (targetIndex == conveyor[0] || targetIndex == conveyor[1])
return conveyor;
}
};
export default async (thisObj: MainScene) => {
const { elementContainer } = thisObj;
const conveyorList = thisObj.chapterData.map.conveyor;
if (!conveyorList) return;
const elementsList = []; //所有轨道元素组的列表
const targetLatticesList: Lattice[][] = []; //所有轨道目标地图组的列表
const latticesList:Lattice[][] = []; //所有轨道当前地图组的列表
const targetIndexsList = [];
let listItems = [];
if (!thisObj['conveyorAniList']) thisObj['conveyorAniList'] = {};
for (const conveyor of conveyorList) {
const list = fillConveyor(conveyor);
listItems = listItems.concat(list);
const targetIndexs = getTargetIndexs(conveyor);
if (!thisObj['conveyorAniList'][conveyor.toString()])
thisObj['conveyorAniList'][conveyor.toString()] = getConveyorAni(conveyor, thisObj);
const dir = getArrowDir(conveyor);
let foundTarget: number;
if (dir == ARROW_DIR.RIGHT || dir == ARROW_DIR.DOWN) {//如果是右or下,最后一个的目标去找下
foundTarget = findTarget(list[list.length - 1], thisObj.chapterData.map.conveyorConnectedLats);
targetIndexs[targetIndexs.length - 1] = foundTarget;
} else {
foundTarget = findTarget(list[0], thisObj.chapterData.map.conveyorConnectedLats);
targetIndexs[0] = foundTarget;
}
// console.log(list, targetIndexs);
const elements = list.map(index =>
thisObj.lattices[index].element
);//当前传送带元素
const lattices = list.map(index => thisObj.lattices[index]);//当前的lattices
const targetLattices = targetIndexs.map(index => thisObj.lattices[index]);
elementsList.push(elements);
targetLatticesList.push(targetLattices);
latticesList.push(lattices);
targetIndexsList.push(targetIndexs);
}
listItems.forEach(item => thisObj.conveyorMap[item] = null);
latticesList.forEach(lattices => {
lattices.forEach(lat => lat.element = null);
});
const promiseList: Promise<any>[] = [];
elementsList.forEach((elements, i) => {
const conveyor = conveyorList[i];
const targetLattices = targetLatticesList[i];
const targetIndexs = targetIndexsList[i];
const lattices = latticesList[i];
const lastListIndex = getLastListIndex(conveyor);
elements.forEach((ele, eleIndex) => {
targetLattices[eleIndex].element = ele;
if (!ele) {
const currentEleIndex = lattices[eleIndex].index;
const targetEleIndex = targetLattices[eleIndex].index;
const emptyIndex = thisObj.emptys.indexOf(currentEleIndex);
thisObj.emptys[emptyIndex]=targetEleIndex;
return;
}
const targetP = Tool.getPositionByIndex(targetIndexs[eleIndex]);
const promise = new Promise((r) => {
//这里判断哪个是尾部的元素.
//移动尾部的真实的元素,clone一个尾部元素作为头部动画,头部动画播放完成后用真实的元素替换掉
if (lastListIndex == eleIndex) { //轨道最后一个需要用遮罩动画,如果底部没有地图了,那么可以不遮罩
const lastItemTargetP = getLastPosition(conveyor, [ele.x, ele.y]);
const mask = getElementMask(ele.x, ele.y);
elementContainer.addChild(mask);
ele.mask = mask;
egret.Tween.get(ele).to({ x: lastItemTargetP[0], y: lastItemTargetP[1] }, CONVERYOR_ANI_DUR).call(() => {
ele.x = targetP[0];
ele.y = targetP[1];
elementContainer.removeChild(mask);
ele.mask = null;
r();
});
//clone元素的动画
const targetIndex = targetIndexs[eleIndex];
const targetConveyor = getTargetConveyor(thisObj, targetIndex)
const firstItemTargetP = getFirstPosition(targetConveyor, [targetP[0], targetP[1]]);
const clonedElement = cloneElement(ele);
clonedElement.x = firstItemTargetP[0];
clonedElement.y = firstItemTargetP[1];
const mask2 = getElementMask(targetP[0], targetP[1]);
elementContainer.addChild(mask2);
clonedElement.mask = mask2;
elementContainer.addChild(clonedElement);
egret.Tween.get(clonedElement).to({ x: targetP[0], y: targetP[1] }, CONVERYOR_ANI_DUR).call(() => {
elementContainer.removeChild(mask2);
elementContainer.removeChild(clonedElement);
clonedElement.mask = null;
});
} else {
egret.Tween.get(ele).to({ x: targetP[0], y: targetP[1] }, CONVERYOR_ANI_DUR).call(r);
}
});
promiseList.push(promise)
});
});
for (const key in thisObj['conveyorAniList']) {
if (thisObj['conveyorAniList'].hasOwnProperty(key)) {
const ani: ConveyorAni = thisObj['conveyorAniList'][key];
ani.play();
}
}
await Promise.all(promiseList);
}
\ No newline at end of file
...@@ -42,7 +42,7 @@ export default async (thisObj: MainScene) => { ...@@ -42,7 +42,7 @@ export default async (thisObj: MainScene) => {
sandMoveAni = new SandMoveAni(); sandMoveAni = new SandMoveAni();
} }
thisObj.map.addChild(sandMoveAni); thisObj.map.addChild(sandMoveAni);
promiseList.push(sandMoveAni.play(from, p,sand)); promiseList.push(sandMoveAni.play(from, p, sand));
// sands.push(sand); // sands.push(sand);
} }
} }
......
...@@ -17,10 +17,10 @@ export default (thisobj: MainScene, from: number[], to: number[]) => { ...@@ -17,10 +17,10 @@ export default (thisobj: MainScene, from: number[], to: number[]) => {
.to({ scaleX: 1, scaleY: 1 }, 100) .to({ scaleX: 1, scaleY: 1 }, 100)
.wait(300) .wait(300)
.set({ anchorOffsetY: tex.textureHeight / 2, y: from[1] + 20 - tex.textureHeight / 2 }) .set({ anchorOffsetY: tex.textureHeight / 2, y: from[1] + 20 - tex.textureHeight / 2 })
.to({x:to[0],y:to[1]},500) .to({ x: to[0], y: to[1] }, 500)
.to({ scaleX: 0.9, scaleY: 1.1 }, 100) .to({ scaleX: 0.9, scaleY: 1.1 }, 100)
.to({ scaleX: 1.05, scaleY: 0.95 }, 100) .to({ scaleX: 1.05, scaleY: 0.95 }, 100)
.to({ scaleX: 1, scaleY: 1 }, 100).call(()=>{ .to({ scaleX: 1, scaleY: 1 }, 100).call(() => {
thisobj.removeChild(pic); thisobj.removeChild(pic);
}); });
setTimeout(() => { setTimeout(() => {
......
...@@ -33,6 +33,10 @@ import TaskCenterIcon from "./icon/TaskCenterIcon"; ...@@ -33,6 +33,10 @@ import TaskCenterIcon from "./icon/TaskCenterIcon";
import HbBombIcon from "./icon/HbBombIcon"; import HbBombIcon from "./icon/HbBombIcon";
import { createEffect1MovieClip } from "../effect/createEffect1"; import { createEffect1MovieClip } from "../effect/createEffect1";
import { CodeChannels } from "../panels/ShareCodePanel"; import { CodeChannels } from "../panels/ShareCodePanel";
import getIconGroup from "./getIconGroup";
import getSignBtn from "./getSignBtn";
import getAdBtn from "./getAdBtn";
import getInviteBtn from "./getInviteBtn";
let doHelpFlag = false; let doHelpFlag = false;
// let doScratchHelpFlag = false; // let doScratchHelpFlag = false;
...@@ -179,10 +183,12 @@ export default class MapScene extends Scene { ...@@ -179,10 +183,12 @@ export default class MapScene extends Scene {
this.sendInvite(); this.sendInvite();
this.hcRedBoobBaseInfo(); this.hcRedBoobBaseInfo();
this.updateSignBtn();
this.updateMyInfo(); this.updateMyInfo();
this.updateAdData(); this.updateAdData();
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标 GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
this.updateIconLayout();
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
if (getBgOn() && MapScene['firstPlayBgTag'] == true) { if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
...@@ -223,7 +229,7 @@ export default class MapScene extends Scene { ...@@ -223,7 +229,7 @@ export default class MapScene extends Scene {
const { signInfoVO } = DataManager.ins.getData('getSignInfo'); const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if (signInfoVO && signInfoVO.continueDay < 7) { //表示明天还可以签到 if (signInfoVO && signInfoVO.continueDay < 7) { //表示明天还可以签到
if (signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) { if (signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr && getSignBtn()) {
panels.push('sign'); panels.push('sign');
localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr); localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr);
} }
...@@ -804,6 +810,7 @@ export default class MapScene extends Scene { ...@@ -804,6 +810,7 @@ export default class MapScene extends Scene {
if (!success || !res.data) { if (!success || !res.data) {
return; return;
} }
const flag = res.data.completeFlag; const flag = res.data.completeFlag;
switch (true) { switch (true) {
case (flag == 0): // 未完成 case (flag == 0): // 未完成
...@@ -871,7 +878,19 @@ export default class MapScene extends Scene { ...@@ -871,7 +878,19 @@ export default class MapScene extends Scene {
PanelCtrl.instance.show('invite', res.data); PanelCtrl.instance.show('invite', res.data);
}) })
} }
//1234变化的情况
updateIconLayout() {
const btnList = [];
if (getSignBtn()) btnList.push('signGroup');
if (getInviteBtn()) btnList.push('inviteGroup');
if (getAdBtn()) btnList.push('adBtn');
if (getIconGroup()) btnList.push('activitys');//0不显示,否则显示
btnList.forEach((btnName, index) => {
const btn = this[btnName];
btn.y = 172.57 + index * 150;
});
this['guideInner'].y = this['activitys'].y - 273;
}
//////////////////////////////////////// 邀请有礼角标 ////////////////////////////////////////////// //////////////////////////////////////// 邀请有礼角标 //////////////////////////////////////////////
/** /**
* 查询邀请信息 * 查询邀请信息
...@@ -884,6 +903,7 @@ export default class MapScene extends Scene { ...@@ -884,6 +903,7 @@ export default class MapScene extends Scene {
if (!success || !res.data) { if (!success || !res.data) {
return; return;
} }
this.updateIconLayout();
const flag = res.data.completeFlag; const flag = res.data.completeFlag;
if (this.inviteTimer) { if (this.inviteTimer) {
this.inviteTimer.stop(); this.inviteTimer.stop();
...@@ -893,8 +913,8 @@ export default class MapScene extends Scene { ...@@ -893,8 +913,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true; this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) { if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458; // this['activitys'].y = 458;
this['guideInner'].y = 185; // this['guideInner'].y = 185;
} }
NetManager.ins.showLog(getlogItem(33)); NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = true; this["inviteTipsBg"].visible = true;
...@@ -910,8 +930,8 @@ export default class MapScene extends Scene { ...@@ -910,8 +930,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true; this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) { if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458; // this['activitys'].y = 458;
this['guideInner'].y = 185; // this['guideInner'].y = 185;
} }
this["inviteTipsBg"].visible = true; this["inviteTipsBg"].visible = true;
this["inviteTips"].visible = true; this["inviteTips"].visible = true;
...@@ -922,8 +942,8 @@ export default class MapScene extends Scene { ...@@ -922,8 +942,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true; this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) { if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458; // this['activitys'].y = 458;
this['guideInner'].y = 185; // this['guideInner'].y = 185;
} }
NetManager.ins.showLog(getlogItem(33)); NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = false; this["inviteTipsBg"].visible = false;
...@@ -933,8 +953,8 @@ export default class MapScene extends Scene { ...@@ -933,8 +953,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true; this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) { if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458; // this['activitys'].y = 458;
this['guideInner'].y = 185; // this['guideInner'].y = 185;
} }
NetManager.ins.showLog(getlogItem(33)); NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = true; this["inviteTipsBg"].visible = true;
...@@ -945,8 +965,8 @@ export default class MapScene extends Scene { ...@@ -945,8 +965,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true; this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) { if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458; // this['activitys'].y = 458;
this['guideInner'].y = 185; // this['guideInner'].y = 185;
} }
NetManager.ins.showLog(getlogItem(33)); NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = false; this["inviteTipsBg"].visible = false;
...@@ -955,13 +975,13 @@ export default class MapScene extends Scene { ...@@ -955,13 +975,13 @@ export default class MapScene extends Scene {
case (flag == 6): // 无入口 case (flag == 6): // 无入口
this["inviteGroup"].visible = false; this["inviteGroup"].visible = false;
this["inviteGroup"].touchEnabled = false; this["inviteGroup"].touchEnabled = false;
this['adBtn'].y = 323.76; // this['adBtn'].y = 323.76;
if (mapAdvert && mapAdvert.enable) { if (mapAdvert && mapAdvert.enable) {
this['guideInner'].y = 185; // this['guideInner'].y = 185;
this['activitys'].y = 458; // this['activitys'].y = 458;
} else { } else {
this['guideInner'].y = 30; // this['guideInner'].y = 30;
this['activitys'].y = 303.76; // this['activitys'].y = 303.76;
} }
break; break;
default: default:
...@@ -1237,6 +1257,15 @@ export default class MapScene extends Scene { ...@@ -1237,6 +1257,15 @@ export default class MapScene extends Scene {
}); });
}) })
} }
updateSignBtn() {
this['signGroup'].visible = false;
const getSignConfig = DataManager.ins.getData('getSignConfig');
if (getSignConfig && getSignConfig.data && getSignConfig.data.closeStatus) {
this['signGroup'].visible = true;
}
}
} }
export const getNick = (nickname, max = 4) => { export const getNick = (nickname, max = 4) => {
if (!nickname) return nickname; if (!nickname) return nickname;
......
import { DataManager } from "../../libs/tw/manager/DataManager";
export default () => {
const hc_advert:any = DataManager.ins.getData('hc_advert').data || {};
let { mapAdvert } = hc_advert;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
return mapAdvert.enable;
}
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
export default () => {
let count = 0;
let hc_redBombBaseInfo = DataManager.ins.getData('hc_redBombBaseInfo');
if (hc_redBombBaseInfo.success && hc_redBombBaseInfo.data) {
count++;
}
let hbrain = DataManager.ins.getData(NetName.HBRAIN_BASEINFO);
if (hbrain.success && hbrain.data) {
const data = hbrain.data
if (data.currentSession) {
count++;
} else if (data.nextSession) {
count++;
}
}
return count;
}
\ No newline at end of file
import { NetName } from "../../libs/tw/enum/NetName";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default () => {
const inviteInfo = DataManager.ins.getData(NetName.GET_INVATE_INFO);
if (inviteInfo && inviteInfo.success && inviteInfo.data) {
const flag = inviteInfo.data.completeFlag;
if (flag >= 0 && flag <= 5) return 1
if (flag == 6) return 0;
}
return 0;
}
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
export default () => {
const getSignConfig = DataManager.ins.getData('getSignConfig');
if (getSignConfig && getSignConfig.data)
return getSignConfig.data.closeStatus;
return false;
}
\ No newline at end of file
...@@ -9,51 +9,52 @@ export default class SignItem extends eui.ItemRenderer { ...@@ -9,51 +9,52 @@ export default class SignItem extends eui.ItemRenderer {
this.skinName = getSkinPath('SignItem'); this.skinName = getSkinPath('SignItem');
} }
dataChanged(){ dataChanged() {
this['object'].visible=false; this['object'].visible = false;
this['money'].visible=false; this['money'].visible = false;
this['hammer'].visible=false; this['hammer'].visible = false;
this['boom'].visible=false; this['boom'].visible = false;
this['steps'].visible=false; this['steps'].visible = false;
this['blood'].visible=false; this['blood'].visible = false;
this['random'].visible=false; this['random'].visible = false;
this['quan15'].visible=false;
this['quan58'].visible=false;
this['quan38'].visible=false; this['btn1'].visible = false;
this['btn2'].visible = false;
this['btn1'].visible=false; this['btn3'].visible = false;
this['btn2'].visible=false; this['btn4'].visible = false;
this['btn3'].visible=false;
this['btn4'].visible=false; this['line1'].visible = this.data.index != 6;
this['line2'].visible = !this['line1'].visible;
this['line1'].visible=this.data.index!=6; this['light'].visible = this.data.signed;
this['line2'].visible=!this['line1'].visible; this['title'].text = `连续签到${this.data.index + 1}天`;
this['light'].visible=this.data.signed;
this['title'].text = `连续签到${this.data.index+1}天`;
this['amount'].text = this.data.config.nums; this['amount'].text = this.data.config.nums;
if(this.data.config.nums<=0) if (this.data.config.nums <= 0)
this['amount'].text = ''; this['amount'].text = '';
this[this.data.config.type].visible=true; this[this.data.config.type].visible = true;
this['btn'+this.data.btn].visible=true; if (this.data.config.type == 'quan')
if(this.data.btn ==1) { this['quan'].source = this.data.config.imgurl;
this['btn' + this.data.btn].visible = true;
if (this.data.btn == 1) {
NetManager.ins.showLog(getlogItem(22)); NetManager.ins.showLog(getlogItem(22));
} }
console.log(this.data); console.log(this.data);
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{ this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this.data.func(this.data.index,this) this.data.func(this.data.index, this)
},this); }, this);
} }
setSinged(){ setSinged() {
this['btn1'].visible=false; this['btn1'].visible = false;
this['btn2'].visible=false; this['btn2'].visible = false;
this['btn3'].visible=false; this['btn3'].visible = false;
this['btn4'].visible=false; this['btn4'].visible = false;
this['light'].visible=true; this['light'].visible = true;
this['btn2'].visible=true; this['btn2'].visible = true;
} }
} }
\ No newline at end of file
...@@ -24,36 +24,36 @@ export default class SignPanel extends Panel { ...@@ -24,36 +24,36 @@ export default class SignPanel extends Panel {
} }
this.scroll.viewport.scrollV = todayIndex * 162; this.scroll.viewport.scrollV = todayIndex * 162;
if(todayIndex >=4) { if (todayIndex >= 4) {
this.scroll.viewport.scrollV = 4 * 162; this.scroll.viewport.scrollV = 4 * 162;
} }
const tomorrowIndex = todayIndex + 1; const tomorrowIndex = todayIndex + 1;
this.list.itemRenderer = SignItem; this.list.itemRenderer = SignItem;
const configs = window['signconfigs']; const configs = this.getConfigs();
const func = (data,item:SignItem) => { const func = (data, item: SignItem) => {
try { try {
if (window['getRST']) window['getRST'](); if (window['getRST']) window['getRST']();
} catch (error) { } catch (error) {
console.warn(error) console.warn(error)
} }
item['btn1'].enabled=false; item['btn1'].enabled = false;
NetManager.ins.doSign((s)=>{ NetManager.ins.doSign((s) => {
NetManager.ins.clickLog(getlogItem(22)); NetManager.ins.clickLog(getlogItem(22));
item['btn1'].enabled=true; item['btn1'].enabled = true;
wait(300).then(()=>{ wait(300).then(() => {
NetManager.ins.getSignInfo(() => { NetManager.ins.getSignInfo(() => {
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['signActivityId']); }, window['signActivityId']);
}); });
if(s) { if (s) {
const {customInfo,success} =DataManager.ins.getData('dosign'); const { customInfo, success } = DataManager.ins.getData('dosign');
if(!success || !customInfo.success || customInfo.prizeType =='none') { if (!success || !customInfo.success || customInfo.prizeType == 'none') {
if(customInfo.code==100004) { if (customInfo.code == 100004) {
showToast('哎呀,奖励擦肩而过!明天再来试试吧!'); showToast('哎呀,奖励擦肩而过!明天再来试试吧!');
}else { } else {
showToast('哎呀,奖励擦肩而过!'); showToast('哎呀,奖励擦肩而过!');
} }
return; return;
...@@ -63,14 +63,14 @@ export default class SignPanel extends Panel { ...@@ -63,14 +63,14 @@ export default class SignPanel extends Panel {
// showToast('签到成功!快去闯关吧~'); // showToast('签到成功!快去闯关吧~');
// PanelCtrl.instance.show('signPrize'); // PanelCtrl.instance.show('signPrize');
PanelCtrl.instance.addToShowPanels('signPrize'); PanelCtrl.instance.addToShowPanels('signPrize');
wait(200).then(()=>{ wait(200).then(() => {
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
updateMainTimer(); updateMainTimer();
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
}); });
}else { } else {
showToast('哎呀,奖励擦肩而过!'); showToast('哎呀,奖励擦肩而过!');
} }
...@@ -112,6 +112,92 @@ export default class SignPanel extends Panel { ...@@ -112,6 +112,92 @@ export default class SignPanel extends Panel {
// this.showlog(); // this.showlog();
// this.data.img = DataManager.ins.getData('getPlugOrderStatus').lottery.imgurl; // this.data.img = DataManager.ins.getData('getPlugOrderStatus').lottery.imgurl;
} }
// { nums: '10元宝', type: 'money' },
// { nums: '*1', type: 'hammer' },
// { nums: '30元宝', type: 'money' },
// { nums: '*1', type: 'boom' },
// { nums: '50元宝', type: 'money' },
// { nums: '*1', type: 'steps' },
// { nums: '0.3元', type: 'quan30' }
private getConfigs() {
const getSignConfig = DataManager.ins.getData('getSignConfig');
if (getSignConfig && getSignConfig.data && getSignConfig.data.sixDaysBeforeOptions && getSignConfig.data.theSeventhDayOptions) {
const { sixDaysBeforeOptions, theSeventhDayOptions } = getSignConfig.data;
const result = [];
sixDaysBeforeOptions.forEach(option => { //todo假设按天数排序
//类型 2 次数,3 道具,4 元宝,5其他
const resultItem = this.getResultItem(option);
result.push(resultItem);
});
const notGiftResult = this.isNotGift(theSeventhDayOptions);
if (notGiftResult) {
result.push(this.getResultItem(notGiftResult));
} else {
result.push({ nums: '*1', type: 'object' });
}
return result;
}
console.warn('签到静态配置错误')
}
getResultItem(option) {
const resultItem: any = {};
if (option.categoryType == 2) {
resultItem.nums = `*${option.num}`
resultItem.type = 'blood';
}
else if (option.categoryType == 3) {
resultItem.nums = `*1`;
// resultItem.nums = `*${option.num}`;
resultItem.type = this.getPropType(option.propType);
}
else if (option.categoryType == 4) {
resultItem.type = 'money';
if (option.maxValue != option.minValue)
resultItem.nums = `*?`;
else
resultItem.nums = `*${option.maxValue}`;
// if (option.maxValue != option.minValue) console.warn('元宝配置错误');
}
else if (option.categoryType >= 5) {
resultItem.nums = `*1`;
resultItem.type = 'quan';
resultItem.imgurl = option.smallImg;
}
return resultItem;
}
isNotGift(theSeventhDayOptions: any[]) {
const results = theSeventhDayOptions.filter(item => item.rate == 100);
let result;
if (results.length == 1) {
result = results[0];
return result;
} else {
console.warn('配置错误');
}
return null;
}
getPropType(type) {
const map = {
'1': 'hammer',
'2': 'steps',
'3': 'boom',
}
return map[type]
}
typeMap() {
return {
'2': 'blood',
// '3': (type2) => { return propsMap[type2] },
'4': 'money',
// '5':{}
}
}
// showlog() { // showlog() {
// NetManager.ins.showLog(getlogItem(17)); // NetManager.ins.showLog(getlogItem(17));
// } // }
......
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//451-471
export const Chapters18: ChapterData[] = [
{
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 100,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 45,
},
],
},
starScores: [1000, 5000, 10000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
generateLats: [
{ index: 11, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
],
// connectedLats: [[0, 18], [1, 19], [2, 20]],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 20, 0, 0, 0, 20, 0, 0,
0, 20, 10, 20, 0, 20, 10, 20, 0,
20, 10, 20, 10, 20, 10, 20, 10, 20,
20, 10, 20, 20, 10, 20, 20, 10, 20,
0, 20, 10, 20, 10, 20, 10, 20, 0,
0, 0, 20, 10, 20, 10, 20, 0, 0,
0, 0, 0, 20, 10, 20, 0, 0, 0,
0, 0, 0, 0, 20, 0, 0, 0, 0,
],
// recycles: [70, 71, 72, 73]
},
}
]
\ No newline at end of file
import { ChapterData } from "../interface/ChapterData";
//501-525
export const Chapters20: ChapterData[] = [
{
baseElementTypes: [0, 1, 2, 3], bubbleProbability: 0, stepCount: 27, passTarget: { type: 1, elements: [{ type: 3, count: 98 }] }, starScores: [15000, 20000, 25000], map: {
lattices: [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1], connectedLats: [],
conveyor: [[2, 65]],
conveyorConnectedLats: [[65, 2]], elements: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1, 1, 1, 1, 1, 1, 12, 1, 12, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 4
, 1, 2, 1, 2, 1, 4, 1, 1, 4,
12, 2, 12, 2, 12, 4, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [], generateLats: [{ index: 0, type: null }, { index: 2, type: null }, { index: 4, type: null }, { index: 6, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 12, type: null }, { index: 14, type: null }, { index: 16, type: null }]
}
}
]
\ No newline at end of file
This diff is collapsed.
...@@ -21,6 +21,7 @@ import { Chapters16 } from "./Chapter16"; ...@@ -21,6 +21,7 @@ import { Chapters16 } from "./Chapter16";
import { Chapters17 } from "./Chapter17"; import { Chapters17 } from "./Chapter17";
import { Chapters18 } from "./Chapter18"; import { Chapters18 } from "./Chapter18";
import { Chapters19 } from "./Chapter19"; import { Chapters19 } from "./Chapter19";
import { Chapters20 } from "./Chapter20";
//所有的关卡 //所有的关卡
const chapters: ChapterData[] = [].concat( const chapters: ChapterData[] = [].concat(
...@@ -43,6 +44,7 @@ const chapters: ChapterData[] = [].concat( ...@@ -43,6 +44,7 @@ const chapters: ChapterData[] = [].concat(
Chapters17, Chapters17,
Chapters18, Chapters18,
Chapters19, Chapters19,
Chapters20,
) )
// console.log(chapters) // console.log(chapters)
chapters.forEach((chapter,index) => { chapters.forEach((chapter,index) => {
......
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//451-471
export const Chapters18: ChapterData[] = [
{
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 25,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 45,
},
],
},
starScores: [1000, 5000, 10000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
generateLats: [
{ index: 11, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
],
// connectedLats: [[0, 18], [1, 19], [2, 20]],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 20, 0, 0, 0, 20, 0, 0,
0, 20, 10, 20, 0, 20, 10, 20, 0,
20, 10, 20, 10, 20, 10, 20, 10, 20,
20, 10, 20, 20, 10, 20, 20, 10, 20,
0, 20, 10, 20, 10, 20, 10, 20, 0,
0, 0, 20, 10, 20, 10, 20, 0, 0,
0, 0, 0, 20, 10, 20, 0, 0, 0,
0, 0, 0, 0, 20, 0, 0, 0, 0,
],
// recycles: [70, 71, 72, 73]
},
}
]
\ No newline at end of file
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//501-525
export const Chapters20: ChapterData[] = [
{
baseElementTypes: [0, 1, 2, 3, 4],
bubbleProbability: 0,
stepCount: 999,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 995,
},
],
},
starScores: [1000, 5000, 10000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
conveyor: [
// [29,56],
// [51, 33],
[29,56],
[57,60],
[51, 33],
[32, 30],
// [57,60],
// [32, 30],
],
conveyorConnectedLats: [
// [56,51],
// [33,29],
[56,57],
[60,51],
[33, 32],
[30, 29],
// [60,32],
// [30,57],
],
generateLats: [
{ index: 11, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
],
// connectedLats: [[76, 11]],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
// recycles: [70, 71, 72, 73]
},
}
]
\ No newline at end of file
...@@ -2,6 +2,10 @@ import { CandyBaseElementType } from "../enum/ElementType"; ...@@ -2,6 +2,10 @@ import { CandyBaseElementType } from "../enum/ElementType";
import { Element } from "./Element"; import { Element } from "./Element";
export class Candy extends egret.Sprite { export class Candy extends egret.Sprite {
resetStep(step: number) {
this._step=step;
this.changeText();
}
ele: Element; ele: Element;
nextState(): any { nextState(): any {
return new Promise(async (r) => { return new Promise(async (r) => {
......
...@@ -155,16 +155,17 @@ export class Element extends eui.Component { ...@@ -155,16 +155,17 @@ export class Element extends eui.Component {
}); });
} }
resetToMonsterView(res: ElementType) { resetToMonsterView(res: ElementType,statusNum = 0) {
this.changeSource("ele" + res + "_png"); this.changeSource("ele" + res + "_png");
this.monster = new Monster(res, this.type); this.monster = new Monster(res, this.type, statusNum);
this.addChild(this.monster); this.addChild(this.monster);
this.showImage.alpha = 0; this.showImage.alpha = 0;
} }
resetToFishView() {
resetToFishView(s='toStandBy') {
this._fishState = 0; this._fishState = 0;
this._isNeb = false; this._isNeb = false;
this['fish'] = new Fish(); this['fish'] = new Fish(s);
this.addChild(this['fish']); this.addChild(this['fish']);
this.changeSource("ele33_0_png"); this.changeSource("ele33_0_png");
this.showImage.alpha = 0; this.showImage.alpha = 0;
...@@ -418,6 +419,7 @@ export class Element extends eui.Component { ...@@ -418,6 +419,7 @@ export class Element extends eui.Component {
* @param type 只应该是基础元素和特殊元素 * @param type 只应该是基础元素和特殊元素
*/ */
reset(type: ElementType) { reset(type: ElementType) {
this._isMonsterJelly=false;
this._isNeb = false; this._isNeb = false;
this.alpha = this.scaleX = this.scaleY = 1; this.alpha = this.scaleX = this.scaleY = 1;
this.showImage.anchorOffsetX = 0; this.showImage.anchorOffsetX = 0;
...@@ -488,6 +490,7 @@ export class Element extends eui.Component { ...@@ -488,6 +490,7 @@ export class Element extends eui.Component {
resetType(type: ElementType) { resetType(type: ElementType) {
//如果类型一致,return //如果类型一致,return
if (this._type == type) return if (this._type == type) return
this._isMonsterJelly=false;
//如果目标类型不是基础元素 或者原先不是基础元素 //如果目标类型不是基础元素 或者原先不是基础元素
if (FiveBaseElementTypes.indexOf(type) == -1 || if (FiveBaseElementTypes.indexOf(type) == -1 ||
FiveBaseElementTypes.indexOf(this._type) == -1 FiveBaseElementTypes.indexOf(this._type) == -1
...@@ -644,6 +647,10 @@ export class Element extends eui.Component { ...@@ -644,6 +647,10 @@ export class Element extends eui.Component {
return this.states[state] return this.states[state]
} }
getStates(): any {
return this.states;
}
/** /**
* 克隆一个 * 克隆一个
* 类型 * 类型
......
...@@ -10,31 +10,40 @@ const frames = [ ...@@ -10,31 +10,40 @@ const frames = [
]; ];
export class Fish extends eui.Component { export class Fish extends eui.Component {
_mv; _mv;
constructor() { state;
constructor(s = 'toStandBy') {
super(); super();
this.initSvga(); this.initSvga(s);
} }
async initSvga() { async initSvga(s) {
const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/fish.svga'); const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/fish.svga');
this._mv = mv; this._mv = mv;
this.addChild(mv); this.addChild(mv);
mv.anchorOffsetX = 80 / 2; mv.anchorOffsetX = 80 / 2;
mv.anchorOffsetY = 80 / 2; mv.anchorOffsetY = 80 / 2;
this.addEvents(); this.addEvents();
if (s == 'toStandBy')
this.toStandBy(); this.toStandBy();
if (s == 'toActive')
this.toActive();
if (s == 'toExplose')
this.toExplose();
} }
toStandBy() { toStandBy() {
this.state = 'toStandBy';
this._mv.gotoAndPlay(1); this._mv.gotoAndPlay(1);
this._start = 1 this._start = 1
this._end = 180 this._end = 180
} }
toActive() { toActive() {
this.state = 'toActive';
this._mv.gotoAndPlay(181); this._mv.gotoAndPlay(181);
this._start = -1 this._start = -1
this._end = -1 this._end = -1
} }
toExplose() { toExplose() {
this.state = 'toExplose';
this._mv.stop(); this._mv.stop();
// this._mv.gotoAndPlay(361); // this._mv.gotoAndPlay(361);
// this._start = -1 // this._start = -1
...@@ -52,7 +61,7 @@ export class Fish extends eui.Component { ...@@ -52,7 +61,7 @@ export class Fish extends eui.Component {
this._start = 241; this._start = 241;
this._end = 360; this._end = 360;
} }
if (this._mv.currentFrame == (361+1)) { if (this._mv.currentFrame == (361 + 1)) {
this._start = -1; this._start = -1;
this._end = -1; this._end = -1;
this._mv.stop(); this._mv.stop();
......
...@@ -27,6 +27,11 @@ export class Lattice { ...@@ -27,6 +27,11 @@ export class Lattice {
get element(): Element { get element(): Element {
return this._element return this._element
} }
private _conveyor;
get conveyor() {
return this._conveyor
}
/** /**
* value为null或元素 * value为null或元素
*/ */
......
...@@ -6,9 +6,22 @@ const frames = [ ...@@ -6,9 +6,22 @@ const frames = [
[1, 120], [1, 120],
[121, 360], [121, 360],
[361, 600], [361, 600],
[601, 960], [601, 841],
]; ];
export class Monster extends eui.Component { export class Monster extends eui.Component {
resetStatusNum(statusNum) {
this._statusNum=statusNum;
if (this._statusNum > 4) {
this._statusNum = 4;
this.removeEvents();
}
//播放动画,动画时间要短200ms以内
if (this._statusNum <= 3) {
this.changeSource();
}
}
async nextStatus() { async nextStatus() {
this._statusNum++; this._statusNum++;
if (this._statusNum > 4) { if (this._statusNum > 4) {
...@@ -43,6 +56,7 @@ export class Monster extends eui.Component { ...@@ -43,6 +56,7 @@ export class Monster extends eui.Component {
* 状态变化 0,1,2,3 * 状态变化 0,1,2,3
*/ */
private _statusNum: number; private _statusNum: number;
get statusNum(){return this._statusNum}
res: ElementType; res: ElementType;
_mv; _mv;
...@@ -82,7 +96,7 @@ export class Monster extends eui.Component { ...@@ -82,7 +96,7 @@ export class Monster extends eui.Component {
} }
changeSource() { changeSource() {
if (this._mv) if (this._mv && frames[this._statusNum])
this._mv.gotoAndPlay(frames[this._statusNum][0]); this._mv.gotoAndPlay(frames[this._statusNum][0]);
} }
} }
\ No newline at end of file
import { Tool } from "./Tool";
import { Element } from "./class/Element";
import { ElementType } from "./enum/ElementType";
export default (fromElement: Element) => {
let ele = Tool.getElement(fromElement.type);
//特效加上
ele.effectType = fromElement.effectType;
//状态加上
for (var i = 0; i < fromElement.getStates().length; i++) {
let state = fromElement.getStates()[i];
if (!state) continue;
ele.setState(i, true, fromElement.type)
}
//位置信息
ele.x = fromElement.x;
ele.y = fromElement.y;
if (fromElement.isMonsterJelly) {
ele.isMonsterJelly = true;
}
if (fromElement.candy) {
ele.resetToCandyView(fromElement.candy.baseElement);
ele.candy.resetStep(fromElement.candy.step);
}
if (fromElement.type == ElementType.JELLY_MONSTER) {
ele.resetMonster();
}
if (fromElement.monster) {
ele.resetToMonsterView(fromElement.monster.res, fromElement.monster.statusNum);
// ele.monster.resetStatusNum(fromElement.monster.statusNum);
}
if (fromElement.type == ElementType.FISH) {
ele.resetToFishView(fromElement['fish'].state);
}
return ele;
}
\ No newline at end of file
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
import MainScene from "../../mainScene/MainScene";
import { Tool } from "../Tool";
import { ARROW_DIR, fillConveyor, getArrowDir, getArrowRotation } from "./conveyorTool";
import createArrowBg from "./createArrowBg";
//单个皮带转动动效
export default class ConveyorAni {
protected views: any[] = []
protected _dir;
protected thisobj;
constructor(conveyor, thisobj: MainScene) {
this.thisobj = thisobj;
const list = fillConveyor(conveyor);
this.views = list.map(index => thisobj.conveyorMap[index]);
this._dir = getArrowDir(conveyor);
this.extendView();
}
play() { }
extendView() { }
}
class ConveyorDownAni extends ConveyorAni {
async play() {
const firstY = this.views[0].y;
await Promise.all(this.views.map(view => {
return new Promise((r) => {
egret.Tween.get(view).to({ y: view.y + Tool.height }, CONVERYOR_ANI_DUR).call(r);
})
}))
const last = this.views.pop();
last.y = firstY;
this.views.unshift(last);
}
extendView() { //顶部增加一个
const arrow = createArrowBg();
this.views[0].parent.addChild(arrow);
arrow.x = this.views[0].x;
arrow.y = this.views[0].y - Tool.width;
this.views.unshift(arrow);
arrow.rotation = getArrowRotation(this._dir);
}
}
class ConveyorUpAni extends ConveyorAni {
async play() {
const lastY = this.views[this.views.length - 1].y;
await Promise.all(this.views.map(view => {
return new Promise((r) => {
egret.Tween.get(view).to({ y: view.y - Tool.height }, CONVERYOR_ANI_DUR).call(r);
})
}))
const first = this.views.shift();
first.y = lastY;
this.views.push(first);
}
extendView() {
const arrow = createArrowBg();
this.views[0].parent.addChild(arrow);
arrow.x = this.views[0].x;
arrow.y = this.views[this.views.length - 1].y + Tool.width;
this.views.push(arrow);
arrow.rotation = getArrowRotation(this._dir);
}
}
class ConveyorLeftAni extends ConveyorAni {
async play() {
const lastX = this.views[this.views.length - 1].x;
await Promise.all(this.views.map(view => {
return new Promise((r) => {
egret.Tween.get(view).to({ x: view.x - Tool.width }, CONVERYOR_ANI_DUR).call(r);
})
}))
const first = this.views.shift();
first.x = lastX;
this.views.push(first);
}
extendView() {
const arrow = createArrowBg();
this.views[0].parent.addChild(arrow);
arrow.x = this.views[this.views.length - 1].x + Tool.width;
arrow.y = this.views[0].y;
this.views.push(arrow);
arrow.rotation = getArrowRotation(this._dir);
}
}
class ConveyorRightAni extends ConveyorAni {
async play() {
const firstX = this.views[0].x;
await Promise.all(this.views.map(view => {
return new Promise((r) => {
egret.Tween.get(view).to({ x: view.x + Tool.width }, CONVERYOR_ANI_DUR).call(r);
})
}))
const last = this.views.pop();
last.x = firstX;
this.views.unshift(last);
}
extendView() {
const arrow = createArrowBg();
this.views[0].parent.addChild(arrow);
arrow.x = this.views[0].x - Tool.width;
arrow.y = this.views[0].y;
this.views.unshift(arrow);
arrow.rotation = getArrowRotation(this._dir);
}
}
export const getConveyorAni = (conveyor, thisobj: MainScene) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.LEFT:
return new ConveyorLeftAni(conveyor, thisobj)
case ARROW_DIR.RIGHT:
return new ConveyorRightAni(conveyor, thisobj)
case ARROW_DIR.UP:
return new ConveyorUpAni(conveyor, thisobj)
case ARROW_DIR.DOWN:
return new ConveyorDownAni(conveyor, thisobj)
}
}
\ No newline at end of file
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
import { Tool } from "../Tool";
import ConveyorAni from "./ConveyorAni";
//单个皮带转动动效
export default class ConveyorDownAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ y: view.y + Tool.height }, CONVERYOR_ANI_DUR);
})
}
}
import ConveyorAni from "./ConveyorAni";
import { Tool } from "../Tool";
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
//单个皮带转动动效
export class ConveyorLeftAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ x: view.x - Tool.width }, CONVERYOR_ANI_DUR);
})
}
}
import ConveyorAni from "./ConveyorAni";
import { Tool } from "../Tool";
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
//单个皮带转动动效
export default class ConveyorRightAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ x: view.x + Tool.width }, CONVERYOR_ANI_DUR);
})
}
}
import ConveyorAni from "./ConveyorAni";
import { Tool } from "../Tool";
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
//单个皮带转动动效
export default class ConveyorUpAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ y: view.y - Tool.height }, CONVERYOR_ANI_DUR);
})
}
}
import { Tool } from "../Tool";
export const getArrowDir = (conveyor: number[]) => {
const [conveyor1, conveyor2] = conveyor;
if (conveyor1 == conveyor2) throw new Error('配置错误:conveyor1 == conveyor2');
let r;
if (conveyor2 > conveyor1) { //向右或者下
const [r1, c1] = Tool.indexToRc(conveyor1);
const [r2, c2] = Tool.indexToRc(conveyor2);
if (c1 == c2)//向下
r = ARROW_DIR.DOWN;
else if (r1 == r2) //向右
r = ARROW_DIR.RIGHT
else
throw new Error('配置错误:conveyor1和conveyor2必须在一行或者一列');
} else { //向左或者上
const [r1, c1] = Tool.indexToRc(conveyor1);
const [r2, c2] = Tool.indexToRc(conveyor2);
if (c1 == c2)//向上
r = ARROW_DIR.UP;
else if (r1 == r2) //向左
r = ARROW_DIR.LEFT
else
throw new Error('配置错误:conveyor1和conveyor2必须在一行或者一列');
}
return r;
}
export const ARROW_DIR = {
LEFT: 'LEFT',
RIGHT: 'RIGHT',
UP: 'UP',
DOWN: 'DOWN'
}
export const getArrowRotation = (dir) => {
switch (dir) {
case ARROW_DIR.LEFT:
return 180
case ARROW_DIR.RIGHT:
return 0
case ARROW_DIR.UP:
return -90
case ARROW_DIR.DOWN:
return 90
}
return null
}
const fillConveyor1 = (conveyor: number[]) => {
const [conveyor1, conveyor2] = conveyor;
const result = [];
for (let index = conveyor2; index <= conveyor1; index++) {
result.push(index);
}
return result;
}
const fillConveyor2 = (conveyor: number[]) => {
const [conveyor1, conveyor2] = conveyor;
const result = [];
for (let index = conveyor1; index <= conveyor2; index++) {
result.push(index);
}
return result;
}
const fillConveyor3 = (conveyor: number[]) => {
const [conveyor1, conveyor2] = conveyor;//up
const [r1, c1] = Tool.indexToRc(conveyor1);
const [r2, c2] = Tool.indexToRc(conveyor2);
const result = [];
for (let index = r2; index <= r1; index++) {
result.push(Tool.rcToIndex(index, c1));
}
return result;
}
const fillConveyor4 = (conveyor: number[]) => {
const [conveyor1, conveyor2] = conveyor;//down
const [r1, c1] = Tool.indexToRc(conveyor1);
const [r2, c2] = Tool.indexToRc(conveyor2);
const result = [];
for (let index = r1; index <= r2; index++) {
result.push(Tool.rcToIndex(index, c1));
}
return result;
}
export const fillConveyor = (conveyor: number[]) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.LEFT:
return fillConveyor1(conveyor)
case ARROW_DIR.RIGHT:
return fillConveyor2(conveyor)
case ARROW_DIR.UP:
return fillConveyor3(conveyor)
case ARROW_DIR.DOWN:
return fillConveyor4(conveyor)
}
return null;
}
export const findTarget = (start: number, conveyorConnectedLats: number[][]) => {
for (const c of conveyorConnectedLats) {
const [s, e] = c;
if (start == s)
return e
}
throw new Error('配置错误')
}
export const getOneConveyorMask = (list: number[], dir) => {
const s = new egret.Sprite();
if (dir == ARROW_DIR.LEFT || dir == ARROW_DIR.RIGHT) {
s.graphics.beginFill(0, 1);
s.graphics.drawRect(-Tool.width / 2, -Tool.width / 2, list.length * Tool.width, Tool.width);
s.graphics.endFill();
} else {
s.graphics.beginFill(0, 1);
s.graphics.drawRect(-Tool.width / 2, -Tool.width / 2, Tool.width, list.length * Tool.width);
s.graphics.endFill();
}
return s;
}
export const getElementMask = (x,y) => {
const shape = new egret.Shape();
shape.x=x;
shape.y=y;
shape.graphics.beginFill(0, 1);
shape.graphics.drawRect(-Tool.width / 2, -Tool.width / 2, Tool.width, Tool.height);
shape.graphics.endFill();
return shape;
}
\ No newline at end of file
export default (tex = RES.getRes('arrowbg_png')) => {
const container = new egret.Sprite();
const arrow = new egret.Bitmap(tex);
arrow.anchorOffsetX = arrow.width / 2;
arrow.anchorOffsetY = arrow.height / 2;
container.addChild(arrow);
return container;
}
\ No newline at end of file
...@@ -33,5 +33,4 @@ export interface ChapterData { ...@@ -33,5 +33,4 @@ export interface ChapterData {
* 星数对应的分数,数组长度为3 * 星数对应的分数,数组长度为3
*/ */
starScores: number[]; starScores: number[];
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ import { LatticeType } from "../enum/LatticeType"; ...@@ -6,6 +6,8 @@ import { LatticeType } from "../enum/LatticeType";
* 包括地图格子,和地图上的特殊元素,生成口,联通口 * 包括地图格子,和地图上的特殊元素,生成口,联通口
*/ */
export interface MapData { export interface MapData {
conveyor?:number[][];
conveyorConnectedLats?:number[][];
/** /**
* 一维格子数组,步长9 * 一维格子数组,步长9
* *
......
...@@ -78,6 +78,10 @@ export class AiControl { ...@@ -78,6 +78,10 @@ export class AiControl {
this.hasFesEleBig = judgeFesEleBigExist(lattices) this.hasFesEleBig = judgeFesEleBigExist(lattices)
} }
updateEggs(lattices: Lattice[]) {
this.eggs = getEggs(lattices);
}
fesEleMotion(thisObj: MainScene, callback: Function) { fesEleMotion(thisObj: MainScene, callback: Function) {
//无节日大红包,直接回调, //无节日大红包,直接回调,
if (!this.hasFesEleBig) { if (!this.hasFesEleBig) {
...@@ -300,6 +304,7 @@ export class AiControl { ...@@ -300,6 +304,7 @@ export class AiControl {
* @param callback * @param callback
*/ */
eggMotion(thisObj: MainScene, callback: Function) { eggMotion(thisObj: MainScene, callback: Function) {
this.updateEggs(thisObj.lattices);
//无蛋,直接回调 //无蛋,直接回调
if (!this.eggs.length) { if (!this.eggs.length) {
callback(); callback();
......
...@@ -82,6 +82,7 @@ export enum SoundType { ...@@ -82,6 +82,7 @@ export enum SoundType {
playBg = 'playBg', playBg = 'playBg',
line = 'line', line = 'line',
bonusShoot = 'bonusShoot', bonusShoot = 'bonusShoot',
bonusTime = 'haha',
} }
export const playSound = (type: SoundType) => { export const playSound = (type: SoundType) => {
......
...@@ -6,6 +6,9 @@ const config = { ...@@ -6,6 +6,9 @@ const config = {
'/crecord/getrecord': { '/crecord/getrecord': {
data: './happyclear/getrecord.json' data: './happyclear/getrecord.json'
}, },
'/customActivity/happyclear/getSignConfig': {
data: './happyclear/getSignConfig.json'
},
'/customActivity/happyclear/hasBackReward': { '/customActivity/happyclear/hasBackReward': {
data: './happyclear/hasBackReward.json' data: './happyclear/hasBackReward.json'
}, },
......
{
"success": true,
"code": "0000000000",
"desc": "OK",
"timestamp": 1583390774876,
"data": {
"closeStatus": true,
"sixDaysBeforeOptions": [
{
"id": null,
"day": 1,
"categoryType": 7,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": null,
"img": "//yun.dui88.com/images/202003/n3exi2tenh.png",
"smallImg": "//yun.dui88.com/images/202003/cfay38i1rl.jpg",
"appItemId": 10361,
"name": "111",
"value": "963"
},
{
"id": null,
"day": 2,
"categoryType": 2,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": 2,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 3,
"categoryType": 4,
"title": null,
"rate": null,
"minValue": 10,
"maxValue": 10,
"coinType": 1,
"realValue": null,
"propType": null,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 4,
"categoryType": 3,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": 2,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 5,
"categoryType": 4,
"title": null,
"rate": null,
"minValue": 0,
"maxValue": 20,
"coinType": 2,
"realValue": null,
"propType": null,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 6,
"categoryType": 3,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": 2,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
}
],
"theSeventhDayOptions": [
{
"id": "",
"day": null,
"categoryType": 2,
"title": "1",
"rate": "11",
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": 1,
"img": "",
"smallImg": null,
"appItemId": null,
"name": "",
"value": ""
},
{
"id": "",
"day": null,
"categoryType": 7,
"title": "1122",
"rate": "11",
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": null,
"img": "//yun.dui88.com/images/202003/cjusviko1v.png",
"smallImg": "//yun.dui88.com/images/202003/1fcggjz048.jpg",
"appItemId": 10000,
"name": "虚拟",
"value": "fe"
}
]
}
}
\ No newline at end of file
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
"timestamp": 1573210800000, "timestamp": 1573210800000,
"data": { "data": {
"currentRemainTimes": 0, "currentRemainTimes": 0,
"currentSession1": { "currentSession": {
"sessionIndex": 6, "sessionIndex": 6,
"startTime": 1573210800000, "startTime": 1573210800000,
"endTime": 1573299903000, "endTime": 1573299903000,
"limitScore": 10 "limitScore": 10
}, },
"nextSession1": { "nextSession": {
"sessionIndex": 10, "sessionIndex": 10,
"startTime": 1573440915952, "startTime": 1573440915952,
"endTime": 1573299903000, "endTime": 1573299903000,
"limitScore": 10 "limitScore": 10
}, },
"canJoin1": true "canJoin": true
} }
} }
...@@ -2513,6 +2513,131 @@ ...@@ -2513,6 +2513,131 @@
"levelNum": 500, "levelNum": 500,
"maxScore": 47440, "maxScore": 47440,
"stars": 1 "stars": 1
},
{
"levelNum": 501,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 502,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 503,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 504,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 505,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 506,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 507,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 508,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 509,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 510,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 511,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 512,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 513,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 514,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 515,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 516,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 517,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 518,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 519,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 520,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 521,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 522,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 523,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 524,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 525,
"maxScore": 47440,
"stars": 1
} }
], ],
......
...@@ -2513,6 +2513,131 @@ ...@@ -2513,6 +2513,131 @@
"levelNum": 500, "levelNum": 500,
"maxScore": 47440, "maxScore": 47440,
"stars": 1 "stars": 1
},
{
"levelNum": 501,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 502,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 503,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 504,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 505,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 506,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 507,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 508,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 509,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 510,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 511,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 512,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 513,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 514,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 515,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 516,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 517,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 518,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 519,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 520,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 521,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 522,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 523,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 524,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 525,
"maxScore": 47440,
"stars": 1
} }
], ],
......
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