Commit 932e03cd authored by wildfirecode's avatar wildfirecode

1

parent f2ccbab3
......@@ -61,7 +61,7 @@ import { Ice } from '../something/class/Ice';
import { Lattice } from '../something/class/Lattice';
import { EffectType } from '../something/enum/EffectType';
import { ElementConfigType } from '../something/enum/ElementConfigType';
import { codeMsgs, ElementType, FiveBaseElementTypes, submitTran, CandyBaseElementType, randonCandyBaseElement, convertCandyBaseElementType } from '../something/enum/ElementType';
import { CandyBaseElementType, codeMsgs, convertBaseElementType, ElementType, FiveBaseElementTypes, submitTran } from '../something/enum/ElementType';
import { isIce, isSpecialLattice } from '../something/enum/LatticeType';
import { PassType } from '../something/enum/PassType';
import { RecoverName } from '../something/enum/RecoverName';
......@@ -673,6 +673,7 @@ export default class MainScene extends Scene {
break;
//基础元素,枷锁,气泡,灰色毛球,褐色毛球,黑色毛球 && 石门锁,有条件的锁
case ElementConfigType.BASE:
case ElementConfigType.CANDY:
case ElementConfigType.LOCK:
case ElementConfigType.BUBBLE:
case ElementConfigType.HAIRBALLGREY:
......@@ -764,23 +765,27 @@ export default class MainScene extends Scene {
//重置基础元素及特效类型
initBaseElement() {
var elementConfigs = this.chapterData.map.elements;
var elements = this.chapterData.map.baseElements;
if (!elements || !elements.length) return;
for (var i = 0; i < elements.length; i++) {
const baseElement: CandyBaseElementType = elements[i];
const elementConfig = elementConfigs[i];//对应的element
const baseElement = elements[i];
const isCandyEle = elementConfig == ElementConfigType.CANDY;
//不是基础元素,跳过,
if (!Tool.judgeBaseEle(this.lattices[i])) continue;
if (!Tool.judgeBaseEle(this.lattices[i]) && !isCandyEle) continue;
//是0,跳过
if (!baseElement) continue
if (!baseElement && !isCandyEle) continue
const ele: Element = this.lattices[i].element;
if (baseElement > CandyBaseElementType.START) { //糖果元素
let resultBaseElement = baseElement;
if (baseElement == CandyBaseElementType.RANDOM) {
resultBaseElement = randonCandyBaseElement();
}
const baseType = convertCandyBaseElementType(resultBaseElement);
ele.resetType(baseType);//先重置ele类型
ele.resetToCandyView(resultBaseElement);//切换成糖果视图
if (isCandyEle) { //糖果元素
if (baseElement == CandyBaseElementType.RANDOM) {//如果是随机糖果,目前只有随机糖果
ele.resetToCandyView(convertBaseElementType(ele.type));//切换成糖果视图
}else {
// const baseType = convertCandyBaseElementType(resultBaseElement);
// ele.resetType(baseType);//先重置ele类型
// ele.resetToCandyView(resultBaseElement);//切换成糖果视图
}
} else {
//解析elements[i];
var arr: number[] = Tool.returnTO(elements[i]);
......
This diff is collapsed.
......@@ -36,7 +36,6 @@ export enum ElementConfigType {
* 气泡
*/
BUBBLE = 7,
/**
* 灰色毛球
*/
......@@ -46,21 +45,13 @@ export enum ElementConfigType {
*/
HAIRBALLBROWN = 9,
/**
* 黑色毛球
* 黑色毛球,废弃
*/
HAIRBALLBLACK = 10,
// /**
// * 随机糖果
// */
// CANDY_RANDOM = 11,
// /**
// * 糖果1 2 3 4 5号
// */
// CANDY_1 = 111,
// CANDY_2 = 112,
// CANDY_3 = 113,
// CANDY_4 = 114,
// CANDY_5 = 115,
/**
* 糖果
*/
CANDY = 11,
}
// export const isCandy = (t: ElementConfigType) => {
......
......@@ -38,13 +38,13 @@ export enum ElementType {
}
export enum CandyBaseElementType {
START = 100,
RANDOM = 0,//随机
RABBIT = 106,//兔子
CHICKEN = 107,//鸟
CATTLE = 108,//牛
LION = 109,//狮子
PIG = 110,//猪
RANDOM = 111,//随机
}
export const convertCandyBaseElementType = (t:CandyBaseElementType) => {
......@@ -60,6 +60,19 @@ export const convertCandyBaseElementType = (t:CandyBaseElementType) => {
return ElementType.PIG;
return null;
}
export const convertBaseElementType = (t:ElementType) => {
if(t==ElementType.RABBIT)
return CandyBaseElementType.RABBIT;
if(t==ElementType.CHICKEN)
return CandyBaseElementType.CHICKEN;
if(t==ElementType.CATTLE)
return CandyBaseElementType.CATTLE;
if(t==ElementType.LION)
return CandyBaseElementType.LION;
if(t==ElementType.PIG)
return CandyBaseElementType.PIG;
return null;
}
export const randonCandyBaseElement = () => {
const order = Math.ceil(Math.random() * 5);
......
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