Commit 555fbe04 authored by wildfirecode's avatar wildfirecode

1

parent 8fdbc2ee
......@@ -426,6 +426,7 @@ export default class MainBase extends eui.UILayer {
"monster_shoot",
"ele33_1",
"ele33_0",
"arrowbg",
]
for (var i = 0; i < arr.length; i++) {
RES.getResAsync(arr[i] + "_png")
......
......@@ -239,6 +239,10 @@
{
"keys": "eleDisNew4_9_png,eleDisNew4_8_png,eleDisNew4_7_png,eleDisNew4_6_png,eleDisNew4_5_png,eleDisNew4_4_png,eleDisNew4_3_png,eleDisNew4_2_png,eleDisNew4_14_png,eleDisNew4_13_png,eleDisNew4_12_png,eleDisNew4_11_png,eleDisNew4_10_png,eleDisNew4_1_png,eleDisNew4_0_png,eleDisNew3_9_png,eleDisNew3_8_png,eleDisNew3_7_png,eleDisNew3_6_png,eleDisNew3_5_png,eleDisNew3_4_png,eleDisNew3_3_png,eleDisNew3_2_png,eleDisNew3_14_png,eleDisNew3_13_png,eleDisNew3_12_png,eleDisNew3_11_png,eleDisNew3_10_png,eleDisNew3_1_png,eleDisNew3_0_png,eleDisNew2_9_png,eleDisNew2_8_png,eleDisNew2_7_png,eleDisNew2_6_png,eleDisNew2_5_png,eleDisNew2_4_png,eleDisNew2_3_png,eleDisNew2_2_png,eleDisNew2_14_png,eleDisNew2_13_png,eleDisNew2_12_png,eleDisNew2_11_png,eleDisNew2_10_png,eleDisNew2_1_png,eleDisNew2_0_png,eleDisNew1_9_png,eleDisNew1_8_png,eleDisNew1_7_png,eleDisNew1_6_png,eleDisNew1_5_png,eleDisNew1_4_png,eleDisNew1_3_png,eleDisNew1_2_png,eleDisNew1_14_png,eleDisNew1_13_png,eleDisNew1_12_png,eleDisNew1_11_png,eleDisNew1_10_png,eleDisNew1_1_png,eleDisNew1_0_png,eleDisNew0_9_png,eleDisNew0_8_png,eleDisNew0_7_png,eleDisNew0_6_png,eleDisNew0_5_png,eleDisNew0_4_png,eleDisNew0_3_png,eleDisNew0_2_png,eleDisNew0_14_png,eleDisNew0_13_png,eleDisNew0_12_png,eleDisNew0_11_png,eleDisNew0_10_png,eleDisNew0_1_png,eleDisNew0_0_png",
"name": "eleDisNew"
},
{
"name": "preload",
"keys": "arrowbg_png"
}
],
"resources": [
......@@ -4937,6 +4941,11 @@
"url": "assets/eleDisNew/eleDisNew4_14.png",
"type": "image",
"name": "eleDisNew4_14_png"
},
{
"name": "arrowbg_png",
"type": "image",
"url": "assets/mainScene/arrowbg.png"
}
]
}
\ No newline at end of file
......@@ -102,6 +102,8 @@ import Sand, { getSandDisplayBlock } from '../something/Sand';
import { SandAni } from '../something/anis/SandAni';
import doSandAI from './doSandAI';
import { createSandDisAni } from '../effect/createSandDisAni';
import { getArrowDir, getArrowRotation, fillConveyor } from '../something/conveyor/conveyorTool';
import createArrowBg from '../something/conveyor/createArrowBg';
const aniClass = {
"BoomAni": BoomAni,
......@@ -198,6 +200,7 @@ export default class MainScene extends Scene {
eliminatedElements: number[] = [];
//棒棒糖生成标志
lollipopMark: boolean;
conveyor: egret.DisplayObjectContainer;
//地图背景容器
map: egret.DisplayObjectContainer;
//是否手动触发特效,用于两个组合后的特效
......@@ -322,6 +325,7 @@ export default class MainScene extends Scene {
NetManager.ins.showLog(getlogItem(10))
NetManager.ins.showLog(getlogItem(13))
this.initConveyor();
//初始话地图格子数据
this.initLattices();
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,用到map
......@@ -453,7 +457,10 @@ export default class MainScene extends Scene {
var path = generateMapBg(this.chapterData.map.lattices);
var bg = drawBg(path, this.chapterData.map.lattices)
this.addChild(bg);
const conveyor = new egret.Sprite();
this.conveyor = conveyor;
this.map = bg;
this.map.addChild(conveyor);
//容器
this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer);
......@@ -598,6 +605,25 @@ 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);
list.forEach(i => {
const arrow = createArrowBg(tex);
arrow.rotation = getArrowRotation(dir);
this.conveyor.addChild(arrow);
const p = Tool.getPositionByIndex(i);
arrow.x = p[0];
arrow.y = p[1];
// egret.Tween.get(arrow).to({y:p[1]+500},7000)
});
}
}
//初始化地图格子数据,包括生成口,联通口
initLattices() {
var latticesD = this.chapterData.map.lattices;
......
......@@ -10,15 +10,15 @@ export const Chapters1: ChapterData[] = [
null,
//1引导基本消除
{
baseElementTypes: [0, 1, 2, 3],
baseElementTypes: [0, 1, 2, 3,4],
bubbleProbability: 0,
stepCount: 25,
stepCount: 999,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 45,
count: 995,
},
],
},
......@@ -35,11 +35,20 @@ export const Chapters1: ChapterData[] = [
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
conveyor:[
[20,56],
[57,60],
[51,24],
// [23,20],
],
conveyorConnectedLats:[
[76,29]
],
generateLats: [
{ index: 11, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
],
// connectedLats: [[0, 18], [1, 19], [2, 20]],
connectedLats: [[76, 11]],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
......@@ -53,14 +62,14 @@ export const Chapters1: ChapterData[] = [
],
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,
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]
},
......
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;
}
\ No newline at end of file
export default (tex) => {
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 {
* 星数对应的分数,数组长度为3
*/
starScores: number[];
}
\ No newline at end of file
......@@ -6,6 +6,8 @@ import { LatticeType } from "../enum/LatticeType";
* 包括地图格子,和地图上的特殊元素,生成口,联通口
*/
export interface MapData {
conveyor?:number[][];
conveyorConnectedLats?:number[][];
/**
* 一维格子数组,步长9
*
......
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