Commit ae642359 authored by wildfirecode's avatar wildfirecode

1

parent de5e684d
......@@ -6,8 +6,29 @@ import SceneCtrl from '../../libs/new_wx/ctrls/sceneCtrl';
import { showToast } from '../../libs/new_wx/ctrls/toastCtrl';
import { updateMainTimerAfterGetData } from '../../libs/new_wx/MainBase';
import { ModuleTypes } from '../../libs/new_wx/types/sceneTypes';
import { createCLBottom1 } from '../effect/createCLBottom1';
import { createCLBottom10 } from '../effect/createCLBottom10';
import { createCLBottom2 } from '../effect/createCLBottom2';
import { createCLBottom3 } from '../effect/createCLBottom3';
import { createCLBottom4 } from '../effect/createCLBottom4';
import { createCLBottom5 } from '../effect/createCLBottom5';
import { createCLBottom6 } from '../effect/createCLBottom6';
import { createCLBottom7 } from '../effect/createCLBottom7';
import { createCLBottom8 } from '../effect/createCLBottom8';
import { createCLBottom9 } from '../effect/createCLBottom9';
import { createCLTop1 } from '../effect/createCLTop1';
import { createCLTop10 } from '../effect/createCLTop10';
import { createCLTop2 } from '../effect/createCLTop2';
import { createCLTop3 } from '../effect/createCLTop3';
import { createCLTop4 } from '../effect/createCLTop4';
import { createCLTop5 } from '../effect/createCLTop5';
import { createCLTop6 } from '../effect/createCLTop6';
import { createCLTop7 } from '../effect/createCLTop7';
import { createCLTop8 } from '../effect/createCLTop8';
import { createCLTop9 } from '../effect/createCLTop9';
import { getPropNums } from '../getHomeData';
import { getRedBombTimes } from '../getRedBombAward';
import { loadSvga } from '../loadSvga';
import { getlogItem } from '../Main';
import { getCacheKey, readCache } from '../mapScene/GuideCon';
import PropType from '../PropType';
......@@ -39,8 +60,8 @@ import { Element } from '../something/class/Element';
import { Ice } from '../something/class/Ice';
import { Lattice } from '../something/class/Lattice';
import { EffectType } from '../something/enum/EffectType';
import { ElementConfigType, createCandy } from '../something/enum/ElementConfigType';
import { codeMsgs, ElementType, FiveBaseElementTypes, submitTran, isCandyElement } from '../something/enum/ElementType';
import { ElementConfigType } from '../something/enum/ElementConfigType';
import { codeMsgs, ElementType, FiveBaseElementTypes, submitTran, CandyBaseElementType, randonCandyBaseElement, convertCandyBaseElementType } from '../something/enum/ElementType';
import { isIce, isSpecialLattice } from '../something/enum/LatticeType';
import { PassType } from '../something/enum/PassType';
import { RecoverName } from '../something/enum/RecoverName';
......@@ -69,30 +90,9 @@ import { StepNumber } from '../something/uis/StepNumber';
import { getBgOn, getSoundOn, playSound, SoundType, stopBg, toggleSound } from '../soundCtrl';
import { playGameBg, toggleGameBg } from '../soundCtrl2';
import { createData } from '../startScene/StartScene';
import Utils from '../Utils';
import { DataManager } from './../../libs/tw/manager/DataManager';
import { NetManager } from './../../libs/tw/manager/NetManager';
import { loadSvga } from '../loadSvga';
import Utils from '../Utils';
import { createCLTop1 } from '../effect/createCLTop1';
import { createCLBottom1 } from '../effect/createCLBottom1';
import { createCLTop2 } from '../effect/createCLTop2';
import { createCLTop3 } from '../effect/createCLTop3';
import { createCLTop4 } from '../effect/createCLTop4';
import { createCLTop5 } from '../effect/createCLTop5';
import { createCLTop6 } from '../effect/createCLTop6';
import { createCLTop7 } from '../effect/createCLTop7';
import { createCLTop8 } from '../effect/createCLTop8';
import { createCLTop9 } from '../effect/createCLTop9';
import { createCLTop10 } from '../effect/createCLTop10';
import { createCLBottom2 } from '../effect/createCLBottom2';
import { createCLBottom3 } from '../effect/createCLBottom3';
import { createCLBottom4 } from '../effect/createCLBottom4';
import { createCLBottom5 } from '../effect/createCLBottom5';
import { createCLBottom6 } from '../effect/createCLBottom6';
import { createCLBottom7 } from '../effect/createCLBottom7';
import { createCLBottom8 } from '../effect/createCLBottom8';
import { createCLBottom9 } from '../effect/createCLBottom9';
import { createCLBottom10 } from '../effect/createCLBottom10';
const aniClass = {
"BoomAni": BoomAni,
......@@ -738,24 +738,6 @@ export default class MainScene extends Scene {
this.elementContainer.addChild(rock);
this.lattices[i].element = rock;
break;
case ElementConfigType.CANDY_RANDOM:
case ElementConfigType.CANDY_1:
case ElementConfigType.CANDY_2:
case ElementConfigType.CANDY_3:
case ElementConfigType.CANDY_4:
case ElementConfigType.CANDY_5:
const candyType = createCandy(elements[i])
let candy: Element = Pool.takeOut(RecoverName.ELEMENT);
if (!candy) {
candy = new Element(candyType)
} else {
candy.reset(candyType)
}
candy.x = p[0];
candy.y = p[1];
this.elementContainer.addChild(candy);
this.lattices[i].element = candy;
break;
//果冻
case ElementConfigType.JELLY:
let jelly: Element = Tool.getElement(ElementType.JELLY)
......@@ -785,24 +767,35 @@ export default class MainScene extends Scene {
var elements = this.chapterData.map.baseElements;
if (!elements || !elements.length) return;
for (var i = 0; i < elements.length; i++) {
const baseElement:CandyBaseElementType = elements[i];
//不是基础元素,跳过,
if (!Tool.judgeBaseEle(this.lattices[i])) continue;
//是0,跳过
if (!elements[i]) continue
//解析elements[i];
var arr: number[] = Tool.returnTO(elements[i]);
//基础类型,没有就是null,有就-1,对ElementType对应
var baseType = arr[1] ? arr[1] - 1 : null;
//baseType不是基础类型,且不是null,跳出
if (FiveBaseElementTypes.indexOf(baseType) == -1 && baseType != null) continue;
let ele: Element = this.lattices[i].element;
//原先元素的类型不是基础元素
if (FiveBaseElementTypes.indexOf(ele.type) == -1) continue;
//如果baseType不为null,重置类型
if (baseType != null) ele.resetType(baseType);
if (!baseElement) 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);//切换成糖果视图
} else {
//解析elements[i];
var arr: number[] = Tool.returnTO(elements[i]);
//基础类型,没有就是null,有就-1,对ElementType对应
var baseType = arr[1] ? arr[1] - 1 : null;
//baseType不是基础类型,且不是null,跳出
if (FiveBaseElementTypes.indexOf(baseType) == -1 && baseType != null) continue;
//原先元素的类型不是基础元素
if (FiveBaseElementTypes.indexOf(ele.type) == -1) continue;
//如果baseType不为null,重置类型
if (baseType != null) ele.resetType(baseType);
//特效类型,有气炮的不能加特效
if (!ele.hasState(StateType.BUBBLE)) ele.effectType = arr[0] ? arr[0] - 1 : null;
//特效类型,有气炮的不能加特效
if (!ele.hasState(StateType.BUBBLE)) ele.effectType = arr[0] ? arr[0] - 1 : null;
}
}
}
......@@ -2350,13 +2343,14 @@ export default class MainScene extends Scene {
if (FiveBaseElementTypes.indexOf(ele.type) >= 0) {
this.playAni(RecoverName.ELEDIS_ANI, p)
//这里面会去算个数
this.recoverEle(index)
}
//糖果消失特效
else if (isCandyElement(ele.type)) {
this.playAni(RecoverName.ELEDIS_ANI, p)
//这里面会去算个数
this.recoverEle(index)
this.recoverEle(index);
// //糖果消失特效
// else if (isCandyElement(ele.type)) {
// this.playAni(RecoverName.ELEDIS_ANI, p)
// //这里面会去算个数
// this.recoverEle(index)
// }
}
//石头
else if (ele.type == ElementType.ROCK) {
......
......@@ -2,7 +2,7 @@ import { Element } from "./class/Element";
import { Lattice } from "./class/Lattice";
import { RectMask } from "./class/RectMask";
import { EffectType } from "./enum/EffectType";
import { ElementType, FiveBaseElementTypes, isCandyElement, matchCandy } from "./enum/ElementType";
import { ElementType, FiveBaseElementTypes } from "./enum/ElementType";
import { RecoverName } from "./enum/RecoverName";
import { StateType } from "./enum/StateType";
import { FallType } from "./interface/FallAniData";
......@@ -312,7 +312,7 @@ export class Tool {
*/
public static judgeMatch(lat: Lattice) {
if (
(Tool.judgeBaseEle(lat) || Tool.judgeCandyEle(lat)) && //是基础元素 or 糖果
(Tool.judgeBaseEle(lat)) && //是基础元素 or 糖果
lat.element.effectType != EffectType.MAGICLION && //特效不为魔力鸟
!lat.element.hasState(StateType.HAIRBALLGREY) && //不带毛球, 下同
!lat.element.hasState(StateType.HAIRBALLBLACK) &&
......@@ -358,16 +358,6 @@ export class Tool {
return false
}
public static judgeCandyEle(lat: Lattice) {
if (lat &&
lat.element &&
isCandyElement(lat.element.type) //是糖果元素
) {
return true
}
return false
}
/**
* 判断在打乱时,格子上元素是否能移动交换
* @param lat 格子
......@@ -808,7 +798,7 @@ export class Tool {
var latC = lattices[cur];
if (Tool.judgeMatch(latP) &&
Tool.judgeMatch(latC) &&
(latP.element.type == latC.element.type || matchCandy(latP.element.type, latC.element.type))
(latP.element.type == latC.element.type)
) {
result[i].push(cur)
} else {
......
This diff is collapsed.
import { ElementType } from "../enum/ElementType";
import ILattice from "../lattice/ILattice";
export class Candy extends egret.Sprite {
/**
* 消除次数
*/
private _countNum: number;
get countNum() {
return this._countNum
}
set countNum(value: number) {
}
constructor() {
super()
}
reset() {
}
}
\ No newline at end of file
import { ElementType, FiveBaseElementTypes } from "../enum/ElementType";
import { EffectType } from "../enum/EffectType";
import { Pool } from "../Pool";
import { ElementType, FiveBaseElementTypes, CandyBaseElementType, transElementRes } from "../enum/ElementType";
import { RecoverName } from "../enum/RecoverName";
import { MagicLionBgAni } from "../periodAni/MagicLionBgAni";
import { stateDatas, StateType } from "../enum/StateType";
import { ExplosiveBgAni } from "../periodAni/ExplosiveBgAni";
import { HorizontalBgAni } from "../periodAni/HorizontalBgAni";
import { MagicLionBgAni } from "../periodAni/MagicLionBgAni";
import { VerticalBgAni } from "../periodAni/VerticalBgAni";
import { ExplosiveBgAni } from "../periodAni/ExplosiveBgAni";
import { ChickenEgg } from "./ChickenEgg";
import { State } from "./State";
import { StateType, stateDatas } from "../enum/StateType";
import { LockState } from "../states/LockState";
import { HairballBrownState } from "../states/HairballBrownState";
import { BubbleState } from "../states/BubbleState";
import { HairballGreyState } from "../states/HairballGreyState";
import { HairballBlackState } from "../states/HairballBlackState";
import { Pool } from "../Pool";
import { Tool } from "../Tool";
import { ChickenEgg } from "./ChickenEgg";
import { FestivalEle } from "./FestivalEle";
import { FestivalEle2 } from "./FestivalEle2";
import { State } from "./State";
import { Candy } from "./Candy";
/**
* 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点
* 最好到时按,底图,动效,气泡,笼子,毛球,进行分层,如果多个状态要共存时,必须分层,到时气泡的动画,要写再自己的层里
*/
export class Element extends eui.Component {
candy:Candy;
resetToCandyView(baseElement: CandyBaseElementType) {
const res = transElementRes(baseElement);
this.changeSource("ele" + res + "_png");
}
/**
* 初始类型
*/
......
......@@ -49,68 +49,68 @@ export enum ElementConfigType {
* 黑色毛球
*/
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_RANDOM = 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) => {
return t == ElementConfigType.CANDY_RANDOM ||
t == ElementConfigType.CANDY_1 ||
t == ElementConfigType.CANDY_2 ||
t == ElementConfigType.CANDY_3 ||
t == ElementConfigType.CANDY_4 ||
t == ElementConfigType.CANDY_5
}
// export const isCandy = (t: ElementConfigType) => {
// return t == ElementConfigType.CANDY_RANDOM ||
// t == ElementConfigType.CANDY_1 ||
// t == ElementConfigType.CANDY_2 ||
// t == ElementConfigType.CANDY_3 ||
// t == ElementConfigType.CANDY_4 ||
// t == ElementConfigType.CANDY_5
// }
export const createCandy = (t: ElementConfigType) => {
let type: ElementType;
if (t == ElementConfigType.CANDY_RANDOM) {
const order = Math.ceil(Math.random() * 5);
switch (order) {
case 1:
type = ElementType.CANDY_RABBIT
break;
case 2:
type = ElementType.CANDY_CHICKEN
break;
case 3:
type = ElementType.CANDY_CATTLE
break;
case 4:
type = ElementType.CANDY_LION
break;
case 5:
type = ElementType.CANDY_PIG
break;
// export const createCandy = (t: ElementConfigType) => {
// let type: ElementType;
// if (t == ElementConfigType.CANDY_RANDOM) {
// const order = Math.ceil(Math.random() * 5);
// switch (order) {
// case 1:
// type = ElementType.CANDY_RABBIT
// break;
// case 2:
// type = ElementType.CANDY_CHICKEN
// break;
// case 3:
// type = ElementType.CANDY_CATTLE
// break;
// case 4:
// type = ElementType.CANDY_LION
// break;
// case 5:
// type = ElementType.CANDY_PIG
// break;
default:
break;
}
}
else if (t == ElementConfigType.CANDY_1) {
type = ElementType.CANDY_RABBIT;
}
else if (t == ElementConfigType.CANDY_2) {
type = ElementType.CANDY_CHICKEN;
}
else if (t == ElementConfigType.CANDY_3) {
type = ElementType.CANDY_CATTLE;
}
else if (t == ElementConfigType.CANDY_4) {
type = ElementType.CANDY_LION;
}
else if (t == ElementConfigType.CANDY_5) {
type = ElementType.CANDY_PIG;
};
return type;
}
\ No newline at end of file
// default:
// break;
// }
// }
// else if (t == ElementConfigType.CANDY_1) {
// type = ElementType.CANDY_RABBIT;
// }
// else if (t == ElementConfigType.CANDY_2) {
// type = ElementType.CANDY_CHICKEN;
// }
// else if (t == ElementConfigType.CANDY_3) {
// type = ElementType.CANDY_CATTLE;
// }
// else if (t == ElementConfigType.CANDY_4) {
// type = ElementType.CANDY_LION;
// }
// else if (t == ElementConfigType.CANDY_5) {
// type = ElementType.CANDY_PIG;
// };
// return type;
// }
\ No newline at end of file
......@@ -25,11 +25,11 @@ export enum ElementType {
HAIRBALLGREY,//灰色毛球10
HAIRBALLBROWN,//褐色毛球11
HAIRBALLBLACK,//黑色毛球12
//特殊元素 ,节日元素
FESTIVALELE_BIG, //节日元素大中间一个13
FESTIVALELE_SMALL, //节日元素飞溅的小元素14
CANDY_RABBIT,//兔子
CANDY_CHICKEN,//鸟
CANDY_CATTLE,//牛
......@@ -37,21 +37,97 @@ export enum ElementType {
CANDY_PIG,//猪
}
export const isCandyElement=(t:ElementType)=>{
return t == ElementType.CANDY_RABBIT ||
t == ElementType.CANDY_CHICKEN ||
t == ElementType.CANDY_CATTLE ||
t == ElementType.CANDY_LION ||
t == ElementType.CANDY_PIG
};
export const matchCandy=(a:ElementType,b:ElementType,)=>{
return (a==ElementType.CANDY_RABBIT && b== ElementType.RABBIT) ||
(a==ElementType.CANDY_CHICKEN && b== ElementType.CHICKEN) ||
(a==ElementType.CANDY_CATTLE && b== ElementType.CATTLE) ||
(a==ElementType.CANDY_LION && b== ElementType.LION) ||
(a==ElementType.CANDY_PIG && b== ElementType.PIG)
};
export enum CandyBaseElementType {
START = 100,
RABBIT = 106,//兔子
CHICKEN = 107,//鸟
CATTLE = 108,//牛
LION = 109,//狮子
PIG = 110,//猪
RANDOM = 111,//随机
}
export const convertCandyBaseElementType = (t:CandyBaseElementType) => {
if(t==CandyBaseElementType.RABBIT)
return ElementType.RABBIT;
if(t==CandyBaseElementType.CHICKEN)
return ElementType.CHICKEN;
if(t==CandyBaseElementType.CATTLE)
return ElementType.CATTLE;
if(t==CandyBaseElementType.LION)
return ElementType.LION;
if(t==CandyBaseElementType.PIG)
return ElementType.PIG;
return null;
}
export const randonCandyBaseElement = () => {
const order = Math.ceil(Math.random() * 5);
if (order == 1)
return CandyBaseElementType.RABBIT;
if (order == 2)
return CandyBaseElementType.CHICKEN;
if (order == 3)
return CandyBaseElementType.CATTLE;
if (order == 4)
return CandyBaseElementType.LION;
if (order == 5)
return CandyBaseElementType.PIG;
return null;
}
export const transElementRes = (t: CandyBaseElementType) => {
switch (t) {
case CandyBaseElementType.RABBIT:
return ElementType.CANDY_RABBIT
case CandyBaseElementType.CHICKEN:
return ElementType.CANDY_CHICKEN
case CandyBaseElementType.CATTLE:
return ElementType.CANDY_CATTLE
case CandyBaseElementType.LION:
return ElementType.CANDY_LION
case CandyBaseElementType.PIG:
return ElementType.CANDY_PIG
// case CandyBaseElementType.RANDOM:
// const order = Math.ceil(Math.random() * 5);
// if (order == 1)
// return ElementType.CANDY_RABBIT;
// if (order == 2)
// return ElementType.CANDY_CHICKEN;
// if (order == 3)
// return ElementType.CANDY_CATTLE;
// if (order == 4)
// return ElementType.CANDY_LION;
// if (order == 5)
// return ElementType.CANDY_PIG;
default:
break;
}
return null;
}
// export const isCandyElement=(t:ElementType)=>{
// return t == ElementType.CANDY_RABBIT ||
// t == ElementType.CANDY_CHICKEN ||
// t == ElementType.CANDY_CATTLE ||
// t == ElementType.CANDY_LION ||
// t == ElementType.CANDY_PIG
// };
// export const matchCandy=(a:ElementType,b:ElementType,)=>{
// return (a==ElementType.CANDY_RABBIT && b== ElementType.RABBIT) ||
// (a==ElementType.CANDY_CHICKEN && b== ElementType.CHICKEN) ||
// (a==ElementType.CANDY_CATTLE && b== ElementType.CATTLE) ||
// (a==ElementType.CANDY_LION && b== ElementType.LION) ||
// (a==ElementType.CANDY_PIG && b== ElementType.PIG)
// };
/**
* 5种基本元素的数组,每项是ElementType的枚举值
......
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