Commit 932e03cd authored by wildfirecode's avatar wildfirecode

1

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