Commit 7f8e3a65 authored by wjf's avatar wjf

l

parent 02610ea8
This diff is collapsed.
......@@ -13,12 +13,12 @@ import { iswx } from "../iswx";
import PropType from "../PropType";
import setGlow from "../setGlow";
import { showShare } from "../shareCtrl";
import { Chapters } from "../something/Chapters";
import { ElementType } from "../something/enum/ElementType";
import { PassType } from "../something/enum/PassType";
import TargetItemRenderer from "./TargetItemRenderer";
import { addRankFriendList } from "../mapScene/RankFriendList";
import { addAdComp } from "./BoxPanel";
import { getChapterData } from "../something/chapters/getChapter";
export default class StartPanel extends Panel {
static currlevel;
......@@ -39,28 +39,24 @@ export default class StartPanel extends Panel {
this['levelTxt'].text = `第${data}关`;
this._level = data;
let mapDataIndex = data;
if (data >= 56 && data <= 70) {
//循环36到50
mapDataIndex = data - 20
}
this['targetGroup'].visible = false;
this['scoreGroup'].visible = false;
const levelType = Chapters[mapDataIndex].passTarget.type;
const levelType = getChapterData(mapDataIndex).passTarget.type;
if (levelType == PassType.ELEMENT_TARGET) {
this['targetGroup'].visible = true;
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
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;
const elements = Chapters[mapDataIndex].passTarget.elements;
const elements = getChapterData(mapDataIndex).passTarget.elements;
if (elements.length == 1 && elements[0].type == ElementType.LOLLIPOP)
this['tips'].text = '在指定步数内将目标元素移至最底部';
}
else if (levelType == PassType.SCORE_TARGET) {
this['scoreGroup'].visible = true;
this['targetScoreTxt'].text = `${Chapters[mapDataIndex].passTarget.score}`;
// this['targetTxt'].text = `在规定步数内\n分数达到${Chapters[mapDataIndex].passTarget.score}分`;
this['targetScoreTxt'].text = `${getChapterData(mapDataIndex).passTarget.score}`;
// this['targetTxt'].text = `在规定步数内\n分数达到${getChapterData(mapDataIndex).passTarget.score}分`;
}
const prop2Nums = getPropNums(PropType.BOOM);
......
......@@ -8,9 +8,10 @@ import { ElementType } from "./enum/ElementType";
// const Vigenere = CipherJS.Vigenere;
// Vigenere.encrypt('MY SECRET MESSAGE', 'MY SECRET KEY')
export const Chapters: ChapterData[] = [
/**
* 副本,备用120关数据
*/
export const ChaptersOri: any[] = [
//第0关为空吧,
null,
//第一关
......@@ -28,20 +29,6 @@ export const Chapters: ChapterData[] = [
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
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],
effectInitProbability: 0.1,
......
......@@ -8,6 +8,7 @@ import { Pool } from "./Pool";
import { RecoverName } from "./enum/RecoverName";
import { RectMask } from "./class/RectMask";
import { FallType } from "./interface/FallAniData";
import { GenerateLatData } from "./interface/GenerateLatData";
export class Tool {
/**
......@@ -685,25 +686,39 @@ export class Tool {
/**
* 根据关卡的地图数据generateLats
* 设置每列最上面的格子为生成口,
*
* @param lattices
* @param generateLats [0,1,1,1,1,1,1,1,0]
*/
public static setGenerateLats(lattices: Lattice[], generateLats: number[]) {
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
}
}
* @param generateLats
* @return 数组,索引就是列数,每个元素是该列的生成口数据
*/
public static setGenerateLats(lattices: Lattice[], generateLats: GenerateLatData[]): GenerateLatData[][] {
var arr: GenerateLatData[][] = [];
for (var i = 0; i < generateLats.length; i++) {
var generateLat: GenerateLatData = generateLats[i];
var index = generateLat.index;
if(!lattices[index])continue
lattices[index].isGenerate = true;
var rc = this.indexToRc(index);
//确实属于哪一列
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格子
......@@ -821,6 +836,23 @@ export class Tool {
}
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 {
}
/**
* 返回个十百等,0是个位
* 返回个十百等,0是个位 ,1是十位,依次
* 78[ 8, 7]
* 789[ 9, 8, 7]
* @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 {
lattices: number[];
/**
* 能生成元素的格子索引
* 代表每列的第一个格子是否是生成口
* 长度9,
* 例子[0,0,0,1,1,1,0,0,0];
*
*/
generateLats: number[];
generateLats?: GenerateLatData[];
/**
* 一维格子数组,步长9,
* 9*9
......@@ -34,7 +32,7 @@ export interface MapData {
* 5果冻
* 6鸡蛋
*/
elements?:number[];
elements?: number[];
/**
* 9*9的格子
* 十位是基础元素类型,对应数字减1就是基础元素类型
......@@ -45,12 +43,7 @@ export interface MapData {
* 13
* 14
*/
baseElements?:number[];
/**
* 路径的索引
* 暂时不需要了
*/
paths?:PathData[]
baseElements?: number[];
/**
* 再考虑
* 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down
......@@ -58,4 +51,9 @@ export interface MapData {
*/
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