Commit 7f8e3a65 authored by wjf's avatar wjf

l

parent 02610ea8
This diff is collapsed.
...@@ -13,12 +13,12 @@ import { iswx } from "../iswx"; ...@@ -13,12 +13,12 @@ import { iswx } from "../iswx";
import PropType from "../PropType"; import PropType from "../PropType";
import setGlow from "../setGlow"; import setGlow from "../setGlow";
import { showShare } from "../shareCtrl"; import { showShare } from "../shareCtrl";
import { Chapters } from "../something/Chapters";
import { ElementType } from "../something/enum/ElementType"; import { ElementType } from "../something/enum/ElementType";
import { PassType } from "../something/enum/PassType"; import { PassType } from "../something/enum/PassType";
import TargetItemRenderer from "./TargetItemRenderer"; import TargetItemRenderer from "./TargetItemRenderer";
import { addRankFriendList } from "../mapScene/RankFriendList"; import { addRankFriendList } from "../mapScene/RankFriendList";
import { addAdComp } from "./BoxPanel"; import { addAdComp } from "./BoxPanel";
import { getChapterData } from "../something/chapters/getChapter";
export default class StartPanel extends Panel { export default class StartPanel extends Panel {
static currlevel; static currlevel;
...@@ -39,28 +39,24 @@ export default class StartPanel extends Panel { ...@@ -39,28 +39,24 @@ export default class StartPanel extends Panel {
this['levelTxt'].text = `第${data}关`; this['levelTxt'].text = `第${data}关`;
this._level = data; this._level = data;
let mapDataIndex = data; let mapDataIndex = data;
if (data >= 56 && data <= 70) {
//循环36到50
mapDataIndex = data - 20
}
this['targetGroup'].visible = false; this['targetGroup'].visible = false;
this['scoreGroup'].visible = false; this['scoreGroup'].visible = false;
const levelType = Chapters[mapDataIndex].passTarget.type; const levelType = getChapterData(mapDataIndex).passTarget.type;
if (levelType == PassType.ELEMENT_TARGET) { if (levelType == PassType.ELEMENT_TARGET) {
this['targetGroup'].visible = true; this['targetGroup'].visible = true;
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标'; // this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
this.list.itemRenderer = TargetItemRenderer; this.list.itemRenderer = TargetItemRenderer;
const ac = new eui.ArrayCollection(Chapters[mapDataIndex].passTarget.elements); const ac = new eui.ArrayCollection(getChapterData(mapDataIndex).passTarget.elements);
this.list.dataProvider = ac; this.list.dataProvider = ac;
const elements = Chapters[mapDataIndex].passTarget.elements; const elements = getChapterData(mapDataIndex).passTarget.elements;
if (elements.length == 1 && elements[0].type == ElementType.LOLLIPOP) if (elements.length == 1 && elements[0].type == ElementType.LOLLIPOP)
this['tips'].text = '在指定步数内将目标元素移至最底部'; this['tips'].text = '在指定步数内将目标元素移至最底部';
} }
else if (levelType == PassType.SCORE_TARGET) { else if (levelType == PassType.SCORE_TARGET) {
this['scoreGroup'].visible = true; this['scoreGroup'].visible = true;
this['targetScoreTxt'].text = `${Chapters[mapDataIndex].passTarget.score}`; this['targetScoreTxt'].text = `${getChapterData(mapDataIndex).passTarget.score}`;
// this['targetTxt'].text = `在规定步数内\n分数达到${Chapters[mapDataIndex].passTarget.score}分`; // this['targetTxt'].text = `在规定步数内\n分数达到${getChapterData(mapDataIndex).passTarget.score}分`;
} }
const prop2Nums = getPropNums(PropType.BOOM); const prop2Nums = getPropNums(PropType.BOOM);
......
...@@ -8,9 +8,10 @@ import { ElementType } from "./enum/ElementType"; ...@@ -8,9 +8,10 @@ import { ElementType } from "./enum/ElementType";
// const Vigenere = CipherJS.Vigenere; // const Vigenere = CipherJS.Vigenere;
// Vigenere.encrypt('MY SECRET MESSAGE', 'MY SECRET KEY') // Vigenere.encrypt('MY SECRET MESSAGE', 'MY SECRET KEY')
/**
* 副本,备用120关数据
export const Chapters: ChapterData[] = [ */
export const ChaptersOri: any[] = [
//第0关为空吧, //第0关为空吧,
null, null,
//第一关 //第一关
...@@ -28,20 +29,6 @@ export const Chapters: ChapterData[] = [ ...@@ -28,20 +29,6 @@ export const Chapters: ChapterData[] = [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
], ],
generateLats: [1, 1, 1, 1, 1, 1, 1, 1, 1], generateLats: [1, 1, 1, 1, 1, 1, 1, 1, 1],
paths: [
{
indexs: ["0_l_u", "8_r_u", "80_r_d", "72_l_d", "63_l_u", "63_r_u", "54_r_u", "54_l_u"],
holes: [
{
indexs: ["50_l_u", "50_l_d", "50_r_d", "50_r_u"],
},
{
indexs: ["48_l_u", "48_l_d", "48_r_d", "48_r_u"],
}
]
}
],
// connectedLats: [[27, 45], [28, 46], [29, 47]]
}, },
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1, effectInitProbability: 0.1,
......
...@@ -8,6 +8,7 @@ import { Pool } from "./Pool"; ...@@ -8,6 +8,7 @@ import { Pool } from "./Pool";
import { RecoverName } from "./enum/RecoverName"; import { RecoverName } from "./enum/RecoverName";
import { RectMask } from "./class/RectMask"; import { RectMask } from "./class/RectMask";
import { FallType } from "./interface/FallAniData"; import { FallType } from "./interface/FallAniData";
import { GenerateLatData } from "./interface/GenerateLatData";
export class Tool { export class Tool {
/** /**
...@@ -685,25 +686,39 @@ export class Tool { ...@@ -685,25 +686,39 @@ export class Tool {
/** /**
* 根据关卡的地图数据generateLats * 根据关卡的地图数据generateLats
* 设置每列最上面的格子为生成口, *
* @param lattices * @param lattices
* @param generateLats [0,1,1,1,1,1,1,1,0] * @param generateLats
*/ * @return 数组,索引就是列数,每个元素是该列的生成口数据
public static setGenerateLats(lattices: Lattice[], generateLats: number[]) { */
var indexs = [] public static setGenerateLats(lattices: Lattice[], generateLats: GenerateLatData[]): GenerateLatData[][] {
for (var m = 0; m < Tool.colNum; m++) { var arr: GenerateLatData[][] = [];
//找每列第一个元素 for (var i = 0; i < generateLats.length; i++) {
for (var g = 0; g < Tool.rowNum; g++) { var generateLat: GenerateLatData = generateLats[i];
var index = Tool.colNum * g + m; var index = generateLat.index;
//如果格子存在,并且该列g的数据为1; if(!lattices[index])continue
if (lattices[index] && generateLats[m]) {
lattices[index].isGenerate = true; lattices[index].isGenerate = true;
indexs[m] = index; var rc = this.indexToRc(index);
break //确实属于哪一列
} var col = rc[1];
} if (!arr[col]) arr[col] = [];
arr[col].push(generateLat);
} }
return indexs return arr
// var indexs = [];
// for (var m = 0; m < Tool.colNum; m++) {
// //找每列第一个元素
// for (var g = 0; g < Tool.rowNum; g++) {
// var index = Tool.colNum * g + m;
// //如果格子存在,并且该列g的数据为1;
// if (lattices[index] && generateLats[m]) {
// lattices[index].isGenerate = true;
// indexs[m] = index;
// break
// }
// }
// }
// return indexs
} }
/** /**
* 将9*9都转化成01格子 * 将9*9都转化成01格子
...@@ -821,6 +836,23 @@ export class Tool { ...@@ -821,6 +836,23 @@ export class Tool {
} }
return false; return false;
} }
/**
* 十位是基础元素类型,对应数字减1就是基础元素类型
* 个位是特效类型(0表示无特效),对应数字减1就是特效类型
* @param num
* @return [] 0下标是元素类型,1下标是特效类型
*/
public static praseEleNumber(num) {
//解析num;
var arr: number[] = this.returnTO(num);
//基础类型,没有就是null,有就-1,对ElementType对应
var baseType = arr[1] ? arr[1] - 1 : null;
//不是基础类型
if (baseType > 4) baseType = null;
//特效类型
var effectType = arr[0] ? arr[0] - 1 : null;
return [baseType, effectType];
}
/** /**
* 从数组移除一个元素 * 从数组移除一个元素
...@@ -879,7 +911,7 @@ export class Tool { ...@@ -879,7 +911,7 @@ export class Tool {
} }
/** /**
* 返回个十百等,0是个位 * 返回个十百等,0是个位 ,1是十位,依次
* 78[ 8, 7] * 78[ 8, 7]
* 789[ 9, 8, 7] * 789[ 9, 8, 7]
* @param num 整数 * @param num 整数
......
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
/**
* 1到20关数据
*/
export const Chapters1: ChapterData[] = [
//第0关为空吧,
null,
//1
{
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0,
stepCount: 25,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 45,
},
],
},
starScores: [4000, 8000, 12000],
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]
},
},
//2
{
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0,
stepCount: 6,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 26,
},
],
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 0, 0, 1, 1, 0,
2, 2, 2, 2, 0, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 2, 0, 0, 0, 1, 1, 0,
1, 2, 2, 1, 0, 1, 2, 2, 1,
0, 2, 2, 0, 0, 0, 2, 2, 0,
2, 2, 2, 2, 0, 2, 2, 2, 2,
0, 0, 0, 0, 0, 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, 1, 1, 0, 0, 0, 1, 1, 0,
1, 1, 1, 1, 0, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 0, 0, 1, 1, 0,
1, 1, 1, 1, 0, 1, 1, 1, 1,
0, 1, 1, 0, 0, 0, 1, 1, 0,
1, 1, 1, 1, 0, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 10, 10, 0, 0, 0, 10, 20, 0,
20, 20, 10, 20, 0, 10, 20, 10, 20,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 40, 30, 0, 0, 0, 10, 30, 0,
10, 30, 40, 20, 0, 20, 30, 40, 10,
0, 40, 30, 0, 0, 0, 40, 30, 0,
20, 20, 10, 10, 0, 20, 40, 20, 10,
0, 0, 0, 0, 0, 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";
/**
* 21到40关数据
*/
export const Chapters2: ChapterData[] = [
//21
{
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
// generateLats: ,
connectedLats: [],
elements: [
]
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1,
stepCount: 30,
passTarget: {
type: PassType.SCORE_TARGET,
score: 6000,
},
starScores: [2000, 4000, 6000]
},
]
\ No newline at end of file
import { Chapters1 } from "./Chapter1";
import { Chapters2 } from "./Chapter2";
import { ChapterData } from "../interface/ChapterData";
//所有的关卡
const chapters: ChapterData[] = [].concat(
Chapters1,
// Chapters2,
)
/**
* 获取关卡数据,返回关卡数据
* 以后每添加20关,添加一个文件,上面concat一个文件
* @param index 关数 从1开始
*/
export function getChapterData(index: number) {
//没有数据就返回第一关数据
return chapters[index] || chapters[1];
}
\ No newline at end of file
/**
* 掉落元素类型
*/
export enum FallEleType {
RANELE = 0,//随机元素无特效
RANEFF,//随机元素加随机特效
RABBIT,//兔子 下面的顺序和ElementType前5保持一致,不要随便修改
CHICKEN,//鸡
CATTLE,//牛
LION,//狮子
PIG,//猪
}
\ No newline at end of file
import { FallEleType } from "../enum/FallELeType";
/**
* 格子生成口数据格式
*/
export interface GenerateLatData{
/**
* 生成口的索引
*/
index: number;
/**
* 掉落元素类型
*/
type:FallEleType
/**
* 自定义掉落元素
* 十位是基础元素类型,对应数字减1就是基础元素类型
* 个位是特效类型(0表示无特效),对应数字减1就是特效类型
* 10
* 11
* 12
* 13
* 14
*/
cus: number[];
}
\ No newline at end of file
import { PathData } from "./PathData"; import { GenerateLatData } from "./GenerateLatData";
/** /**
* 地图数据接口 * 地图数据接口
...@@ -17,11 +17,9 @@ export interface MapData { ...@@ -17,11 +17,9 @@ export interface MapData {
lattices: number[]; lattices: number[];
/** /**
* 能生成元素的格子索引 * 能生成元素的格子索引
* 代表每列的第一个格子是否是生成口 *
* 长度9,
* 例子[0,0,0,1,1,1,0,0,0];
*/ */
generateLats: number[]; generateLats?: GenerateLatData[];
/** /**
* 一维格子数组,步长9, * 一维格子数组,步长9,
* 9*9 * 9*9
...@@ -34,7 +32,7 @@ export interface MapData { ...@@ -34,7 +32,7 @@ export interface MapData {
* 5果冻 * 5果冻
* 6鸡蛋 * 6鸡蛋
*/ */
elements?:number[]; elements?: number[];
/** /**
* 9*9的格子 * 9*9的格子
* 十位是基础元素类型,对应数字减1就是基础元素类型 * 十位是基础元素类型,对应数字减1就是基础元素类型
...@@ -45,12 +43,7 @@ export interface MapData { ...@@ -45,12 +43,7 @@ export interface MapData {
* 13 * 13
* 14 * 14
*/ */
baseElements?:number[]; baseElements?: number[];
/**
* 路径的索引
* 暂时不需要了
*/
paths?:PathData[]
/** /**
* 再考虑 * 再考虑
* 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down * 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down
...@@ -58,4 +51,9 @@ export interface MapData { ...@@ -58,4 +51,9 @@ export interface MapData {
*/ */
connectedLats?: any[]; connectedLats?: any[];
/**
* 棒棒糖回收口
*
*/
recycles?: number[];
} }
\ No newline at end of file
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