Commit 54102687 authored by wildfirecode's avatar wildfirecode

1

parents b18f63e5 4e4f00de
......@@ -132,11 +132,13 @@
{nums: '0.36元', type: 'quan36'}
];
// localStorage.clear();
window['imgver'] = '11112';
window['total_level'] = 14 + 13 * 17; /// TODO 14 不能变 总数必须大于总的关卡数
window['last_level'] = 225;//必须大于等于total_level ///TODO 标记最后一关,等于最后一关即可
// window['imgver'] = '11112';
// window['total_level'] = 14 + 13 * 17; /// TODO 14 不能变 总数必须大于总的关卡数
// window['last_level'] = 225;//必须大于等于total_level ///TODO 标记最后一关,等于最后一关即可
window['imgver'] = '11112'
window['total_level'] = 18 + 13 * 18;
window['last_level'] = 250;//必须大于等于total_level
// localStorage.clear();
var sharePic = document.getElementById('pic');
sharePic.onclick = function () {
......
......@@ -250,6 +250,12 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync(`inviterulepanel_json`);
}
else {
RES.getResAsync('common_block_bg_yellow_png');
RES.getResAsync('common_block_bg_blue_png');
RES.getResAsync('common_block_bg_red_png');
RES.getResAsync('common_block_png');
RES.getResAsync('common_block_front_png');
RES.getResAsync('mapredbagicom_png');
RES.getResAsync('mapredbagicom2_png');
RES.getResAsync('maplight2_png');
......
......@@ -81,7 +81,7 @@
"name": "signprize"
},
{
"keys": "turnnoprize再来一次2_png,toast_png,sharenums_png,sharenums_fnt,share_btn2_png,share_btn1_png,prizePanelbg_png,nums3_png,nums3_fnt,nums2_png,nums2_fnt,nums_png,nums_fnt,lightani_png,exchangebtn_png,cutTimeFont_png,cutTimeFont_fnt,common_yuanbao_png,common_prop3_png,common_prop2_png,common_prop1_png,common_prizelight_png,common_money_png,common_blood_png,common_adbg_png,commmon_okbtn1_png,closeCommonBtn_png,btn_png,alertbg_png,朋友圈中间分享蒙层1_jpg,按钮 副本 4_png,按钮 副本 3_png",
"keys": "turnnoprize再来一次2_png,toast_png,sharenums_png,sharenums_fnt,share_btn2_png,share_btn1_png,prizePanelbg_png,nums3_png,nums3_fnt,nums2_png,nums2_fnt,nums_png,nums_fnt,lightani_png,exchangebtn_png,cutTimeFont_png,cutTimeFont_fnt,common_yuanbao_png,common_prop3_png,common_prop2_png,common_prop1_png,common_prizelight_png,common_money_png,common_blood_png,common_adbg_png,commmon_okbtn1_png,closeCommonBtn_png,btn_png,alertbg_png,朋友圈中间分享蒙层1_jpg,按钮 副本 4_png,按钮 副本 3_png,common_block_png,common_block_front_png,common_block_bg_yellow_png,common_block_bg_red_png,common_block_bg_blue_png",
"name": "common"
},
{
......@@ -3946,6 +3946,31 @@
"url": "assets/redrainbg.jpg",
"type": "image",
"name": "redrainbg_jpg"
},
{
"url": "assets/common/common_block_front.png",
"type": "image",
"name": "common_block_front_png"
},
{
"url": "assets/common/common_block_bg_yellow.png",
"type": "image",
"name": "common_block_bg_yellow_png"
},
{
"url": "assets/common/common_block_bg_red.png",
"type": "image",
"name": "common_block_bg_red_png"
},
{
"url": "assets/common/common_block_bg_blue.png",
"type": "image",
"name": "common_block_bg_blue_png"
},
{
"url": "assets/common/common_block.png",
"type": "image",
"name": "common_block_png"
}
]
}
\ No newline at end of file
This diff is collapsed.
## 概念
- lattices 地图背景格子
- elements 元素配置
- generateLats 能生成元素的格子
- baseElements 默认填入的元素
- baseElementTypes 基础元素类型
## Lattice
# 主类
- initLattices();
# 数据
- index 索引 0-80。最多一共81个地图格子
# 控制器
## class Lattice
## Element 元素
## class Element
\ No newline at end of file
# 地图
- 需要居中,比如最多9列表,8列的需要水平居中
# lattices 地图背景配置
- 0无格子
- 1普通格子
- 2浅冰块
- 3深冰块
- 4石门
- 5石门+浅冰块
- 6石门+深冰块
# elements
# 包
- egret/src/something/chapters
# main scene 视图
- exchangeElementAni() 播放交换动画动画。只要交换就会播放,不管是否可以消除。
- simpleMatch() 判断是否可以消除
# main scene 数据
- exchangeData() 视图交换之后需要交换数据
# mainscene 控制
- eliminate() 消除方法。
\ No newline at end of file
......@@ -272,6 +272,7 @@ export class Tool {
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋,或者大节日元素
else if (lat.element.type == ElementType.ROCK ||
lat.element.hasState(StateType.LOCK) ||
lat.element.hasState(StateType.BLOCK_LOCK) ||
lat.element.type == ElementType.JELLY ||
lat.element.type == ElementType.CHICKEN_EGG ||
lat.element.type == ElementType.FESTIVALELE_BIG //||
......@@ -295,6 +296,7 @@ export class Tool {
!lat.element.hasState(StateType.HAIRBALLBLACK) &&
!lat.element.hasState(StateType.HAIRBALLGREY) &&
!lat.element.hasState(StateType.HAIRBALLBROWN)&&
!lat.element.hasState(StateType.BLOCK_LOCK) &&
lat.element.type != ElementType.FESTIVALELE_SMALL
) {
return true
......@@ -313,6 +315,7 @@ export class Tool {
lat.element.effectType != EffectType.MAGICLION && //特效不为魔力鸟
!lat.element.hasState(StateType.HAIRBALLGREY) && //不带毛球, 下同
!lat.element.hasState(StateType.HAIRBALLBLACK) &&
!lat.element.hasState(StateType.BLOCK_LOCK) &&
!lat.element.hasState(StateType.HAIRBALLBROWN)
) {
return true
......@@ -361,6 +364,7 @@ export class Tool {
public static judgeUpsetMove(lat: Lattice) {
if (Tool.judgeBaseEle(lat) && //基础元素
!lat.element.hasState(StateType.LOCK) && //不带锁
!lat.element.hasState(StateType.BLOCK_LOCK) &&
!lat.element.hasState(StateType.HAIRBALLGREY) && //不带毛球,下同
!lat.element.hasState(StateType.HAIRBALLBLACK) &&
!lat.element.hasState(StateType.HAIRBALLBROWN)
......@@ -380,6 +384,7 @@ export class Tool {
public static judgeSetFesEle(lat: Lattice) {
if (Tool.judgeBaseEle(lat) && //基础元素
!lat.element.hasState(StateType.HAIRBALLGREY) && //不带毛球,下同
!lat.element.hasState(StateType.BLOCK_LOCK) &&
!lat.element.hasState(StateType.HAIRBALLBLACK) &&
!lat.element.hasState(StateType.HAIRBALLBROWN)
) {
......@@ -399,6 +404,7 @@ export class Tool {
if (!ele ||
ele.type == ElementType.ROCK ||
ele.hasState(StateType.LOCK) ||
ele.hasState(StateType.BLOCK_LOCK) || //石门盖住
ele.hasState(StateType.HAIRBALLGREY) ||
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN) ||
......@@ -427,6 +433,7 @@ export class Tool {
ele.type == ElementType.FESTIVALELE_SMALL ||
ele.hasState(StateType.LOCK) ||
ele.hasState(StateType.HAIRBALLGREY) ||
ele.hasState(StateType.BLOCK_LOCK) ||
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN)
) {
......@@ -444,6 +451,7 @@ export class Tool {
ele.effectType != null ||
ele.hasState(StateType.LOCK) ||
ele.hasState(StateType.HAIRBALLGREY) ||
ele.hasState(StateType.BLOCK_LOCK) ||
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN)
) {
......@@ -712,6 +720,7 @@ export class Tool {
!lattices[i].element.hasState(StateType.LOCK) &&
!lattices[i].element.hasState(StateType.HAIRBALLGREY) &&
!lattices[i].element.hasState(StateType.HAIRBALLBLACK) &&
!lattices[i].element.hasState(StateType.BLOCK_LOCK) &&
!lattices[i].element.hasState(StateType.HAIRBALLGREY)
) {
var type = lattices[i].element.type;
......
import centerAnchor from "./centerAnchor";
import { Element } from "../class/Element";
import { StateType } from "../enum/StateType";
export default class BaseBlock extends egret.DisplayObjectContainer {
constructor(state) {
super();
this._state = state;
this.initUI();
}
initUI() {
this._block = new egret.Bitmap(RES.getRes('common_block_png'));
this._blockBgFront = new egret.Bitmap(RES.getRes('common_block_front_png'));
this._blockBgBlue = new egret.Bitmap(RES.getRes('common_block_bg_blue_png'));
this._blockBgRed = new egret.Bitmap(RES.getRes('common_block_bg_red_png'));
this._blockBgYellow = new egret.Bitmap(RES.getRes('common_block_bg_yellow_png'));
this.addChild(this._blockBgBlue);
this.addChild(this._blockBgRed);
this.addChild(this._blockBgYellow);
this.addChild(this._block);
this.addChild(this._blockBgFront);
centerAnchor(this._block);
centerAnchor(this._blockBgFront);
centerAnchor(this._blockBgBlue);
centerAnchor(this._blockBgRed);
centerAnchor(this._blockBgYellow);
this._blockBgRed.scaleX = this._blockBgRed.scaleY = 1.1;
this._blockBgBlue.scaleX = this._blockBgBlue.scaleY = 1.1;
this._blockBgYellow.scaleX = this._blockBgYellow.scaleY = 1.1;
this.nextState(true);
}
private _element: Element;
set element(val: Element) {
if (this._element) {
this._element.setState(StateType.BLOCK_LOCK, false);
this._element = null;
}
if (val) {
this._element = val;
this.updateElementState(); //刚刚设置元素的时候
}
};
iceCountNum?: number;
ice: egret.Bitmap;
/**
* 石门反转了可以消除了
*/
get canIceBroken() {
return this._state >= 3;
}
isLock() {
return this._state <= 2;
}
//状态0红门 1蓝门 2黄门 3红 4黄 5蓝
private _state = -1;
private _changing = false;
async nextState(first = false) {
//先改数据再改视图
this._state++;
if (this._state > 5)
this._state = 0;
await this.changeState(first);
}
private updateElementState() {
if (!this._element) return;
if (this._state <= 2) {
this._element.scaleX = 0;
this._element.setState(StateType.BLOCK_LOCK, true);
} else {
this._element.scaleX = 1;
this._element.setState(StateType.BLOCK_LOCK, false);
}
}
playToFrontAni() {
return new Promise((r) => {
const dur = 300;
this._block.visible = true;
this._block.scaleX = 1;
egret.Tween.get(this._block).to({ scaleX: 0 }, dur).call(() => {
this._blockBgFront.visible = true;
this._blockBgFront.scaleX = 0;
if (this.ice) {
this.ice.visible = true;
this.ice.scaleX = 0;
egret.Tween.get(this.ice).to({ scaleX: 1 }, dur);
}
if (this._element) {
this._element.scaleX = 0;
egret.Tween.get(this._element).to({ scaleX: 1 }, dur);
}
egret.Tween.get(this._blockBgFront).to({ scaleX: 1 }, dur).call(() => {
r();
})
})
})
}
playToBackAni() {
return new Promise((r) => {
const dur = 300;
this._blockBgFront.visible = true;
this._blockBgFront.scaleX = 1;
egret.Tween.get(this._blockBgFront).to({ scaleX: 0 }, dur).call(() => {
this._block.visible = true;
this._block.scaleX = 0;
egret.Tween.get(this._block).to({ scaleX: 1 }, dur).call(() => {
r();
})
});
if (this.ice) {
this.ice.visible = true;
this.ice.scaleX = 1;
egret.Tween.get(this.ice).to({ scaleX: 0 }, dur);
}
if (this._element) {
this._element.scaleX = 1;
egret.Tween.get(this._element).to({ scaleX: 0 }, dur);
}
})
}
async changeState(first) {
if (this._changing) {
throw new Error('正在更改状态中')
}
this._changing = true;
this._block.visible = false;
this._blockBgFront.visible = false;
this._blockBgBlue.visible = false;
this._blockBgRed.visible = false;
this._blockBgYellow.visible = false;
switch (this._state) {
case 0:
if (!first) {
await this.playToBackAni();
this.updateElementState();
this._blockBgFront.visible = false;
this._blockBgFront.scaleX = 1;
} else {
this._block.visible = true;
}
this._blockBgRed.visible = true;
this.addAni(this._blockBgRed);
break;
case 1:
this._block.visible = true;
this._blockBgYellow.visible = true;
this.addAni(this._blockBgYellow);
break;
case 2:
this._block.visible = true;
this._blockBgBlue.visible = true;
this.addAni(this._blockBgBlue);
break;
case 3://翻转了
await this.playToFrontAni();
this.updateElementState();
this._block.visible = false;
this._block.scaleX = 1;
this._blockBgRed.visible = true;
this.addAni(this._blockBgRed);
break;
case 4://翻转了
this._blockBgFront.visible = true;
this._blockBgYellow.visible = true;
this.addAni(this._blockBgYellow);
break;
case 5://翻转了
this._blockBgFront.visible = true;
this._blockBgBlue.visible = true;
this.addAni(this._blockBgBlue);
break;
default:
break;
}
this._changing = false;
}
_blockBgYellow: egret.Bitmap;
_blockBgRed: egret.Bitmap;
_blockBgBlue: egret.Bitmap;
/**
* 未反转过来的背面
*/
_block: egret.Bitmap;
/**
* 反转过来的正面
*/
_blockBgFront: egret.Bitmap;
addAni(obj) {
egret.Tween.removeTweens(obj);
const dur = 600;
egret.Tween.get(obj, { loop: true }).set({ alpha: 0 })
.to({ alpha: 1 }, dur).to({ alpha: 0 }, dur)
.to({ alpha: 1 }, dur).to({ alpha: 0 }, dur)
}
}
\ No newline at end of file
import BaseBlock from "./BaseBlock";
import centerAnchor from "./centerAnchor";
export default class Block extends BaseBlock {
initUI() {
super.initUI();
}
}
\ No newline at end of file
import { ElementType } from "../enum/ElementType";
import BaseBlock from "./BaseBlock";
import centerAnchor from "./centerAnchor";
export default class BlockDarkIce extends BaseBlock {
initUI() {
super.initUI();
this.ice = new egret.Bitmap(RES.getRes("ele" + ElementType.ICE + "_png"));
this.ice.alpha = 1;
this.addChild(this.ice);
centerAnchor(this.ice);
this.ice.visible = false;
}
iceCountNum = 2;
}
\ No newline at end of file
import { ElementType } from "../enum/ElementType";
import BaseBlock from "./BaseBlock";
import centerAnchor from "./centerAnchor";
export default class BlockIce extends BaseBlock {
initUI() {
super.initUI();
this.ice = new egret.Bitmap(RES.getRes("ele" + ElementType.ICE + "_png"));
this.ice.alpha = 0.6;
this.addChild(this.ice);
centerAnchor(this.ice);
this.ice.visible = false;
}
iceCountNum = 1;
}
\ No newline at end of file
export default (d: egret.DisplayObject) => {
d.anchorOffsetX = d.width / 2;
d.anchorOffsetY = d.height / 2;
}
\ No newline at end of file
import { LatticeType } from "../enum/LatticeType";
import Block from "./Block";
import BlockDarkIce from "./BlockDarkIce";
import BlockIce from "./BlockIce";
export default (type: LatticeType) => {
const typestr = type + '';
let _state = -1;
if(typestr.length == 2) { //是门开
const arr = typestr.split('');
type = parseInt(arr[0]);
// _state=-1;
_state=2;
}
switch (type) {
case LatticeType.BlOCK:
return new Block(_state);
case LatticeType.BLOCK_AND_ICE:
return new BlockIce(_state);
case LatticeType.BLOCK_AND_DARK_ICE:
return new BlockDarkIce(_state);
default:
break;
}
return null
}
This diff is collapsed.
This diff is collapsed.
......@@ -14,6 +14,7 @@ import { PassTargetData } from "../interface/PassTargetData";
import { PassType } from "../enum/PassType";
import { submitTran } from "../enum/ElementType";
import { Chapters12 } from "./Chapter12";
import { Chapters13 } from "./Chapter13";
//所有的关卡
const chapters: ChapterData[] = [].concat(
......@@ -29,6 +30,7 @@ const chapters: ChapterData[] = [].concat(
Chapters10,
Chapters11,
Chapters12,
Chapters13,
)
/**
* 获取关卡数据,返回关卡数据
......
import { ElementType } from "../enum/ElementType";
import ILattice from "../lattice/ILattice";
export class Ice extends egret.Bitmap {
export class Ice extends egret.Bitmap {
/**
* 消除次数
*/
......
import BaseBlock from "../block/BaseBlock";
import { Tool } from "../Tool";
import { Element } from "./Element";
import { Ice } from "./Ice";
import { Tool } from "../Tool";
/**
* 位置信息直接用一个二维数组记录,然后用row,col取
......@@ -12,6 +13,11 @@ export class Lattice {
* 上面的冰块,是加在背景图上的
*/
ice: Ice;
/**
* 石门,冰石门,深冰石门
*/
block: BaseBlock;
/**
* 上面的元素(null,消除元素,石头,冰激凌等),
*/
......@@ -29,6 +35,9 @@ export class Lattice {
value.column = this.column;
}
this._element = value
if(this.block) {
this.block.element = this._element;
}
}
/**
* 索引
......@@ -67,6 +76,7 @@ export class Lattice {
this.column = rc[1];
//重置属性,后面自行赋值
this.ice = null;
this.block = null;
this.element = null;
this.up = null;
this.down = null;
......
/**
* 元素格子配置,需要和地图格子做区分
*/
export enum ElementConfigType {
/**
* 空元素格
*/
EMPTY=0,
/**
* 基础元素
*/
BASE=1,
/**
* 石头
*/
ROCK=2,
/**
* 棒棒糖
*/
LOLLIPOP=3,
/**
* 枷锁
*/
LOCK=4,
/**
* JELLY
*/
JELLY=5,
/**
* CHICKEN_EGG
*/
CHICKEN_EGG=6,
/**
* 气泡
*/
BUBBLE=7,
/**
* 灰色毛球
*/
HAIRBALLGREY=8,
/**
* 褐色毛球
*/
HAIRBALLBROWN=9,
/**
* 黑色毛球
*/
HAIRBALLBLACK=10,
// /**
// * 石门。石门正面的时候,无法消除。不是锁,锁可以被打破。
// */
// BLOCK_LOCK=11,
}
\ No newline at end of file
/**
* 地图格子配置,需要和元素格子做区分
*/
export enum LatticeType {
EMPTY = 0,
NORMAL = 1,
ICE = 2,
DARK_ICE = 3,
BlOCK = 4, //会持续存在,无法像冰块一样被消除,但是上方可以存在元素。只是展示的时候
BLOCK_AND_ICE = 5,
BLOCK_AND_DARK_ICE = 6
}
// * 0无格子
// * 1普通格子
// * 2浅冰块
// * 3深冰块
// * 4石门
// * 5石门+浅冰块
// * 6石门+深冰块
export const isSpecialLattice = (type: LatticeType) => {
return type != LatticeType.EMPTY && type != LatticeType.NORMAL;
}
export const isIce = (type: LatticeType) => {
return type == LatticeType.ICE || type == LatticeType.DARK_ICE
}
\ No newline at end of file
......@@ -66,5 +66,7 @@ export enum RecoverName {
HAIRBALLGREY_STATE = "HairballGreyState",
HAIRBALLBLACK_STATE = "HairballBlackState",
HAIRBALLBROWN_STATE = "HairballBrownState",
BLOCK_STATE = "BLOCK_STATE",
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import { LockState } from "../states/LockState";
import { HairballGreyState } from "../states/HairballGreyState";
import { HairballBrownState } from "../states/HairballBrownState";
import { HairballBlackState } from "../states/HairballBlackState";
import { BlockLockState } from "../states/BlockLockState";
/**
* 状态类型
......@@ -14,6 +15,7 @@ export enum StateType {
HAIRBALLGREY,//灰色毛球 ,一次就消除
HAIRBALLBROWN,//褐色毛球 ,只能特效消除
HAIRBALLBLACK,//黑色毛球 ,两次消除,一次闭眼
BLOCK_LOCK,//石门盖住状态
}
......@@ -24,4 +26,5 @@ export const stateDatas: { recoverName: RecoverName, className: any }[] = [
{ recoverName: RecoverName.HAIRBALLGREY_STATE, className: HairballGreyState },
{ recoverName: RecoverName.HAIRBALLBROWN_STATE, className: HairballBrownState },
{ recoverName: RecoverName.HAIRBALLBLACK_STATE, className: HairballBlackState },
{ recoverName: RecoverName.BLOCK_STATE, className: BlockLockState },
]
\ No newline at end of file
import { GenerateLatData } from "./GenerateLatData";
import { LatticeType } from "../enum/LatticeType";
/**
* 地图数据接口
......@@ -13,8 +14,11 @@ export interface MapData {
* 1普通格子
* 2浅冰块
* 3深冰块
* 4石门
* 5石门+浅冰块
* 6石门+深冰块
*/
lattices: number[];
lattices: LatticeType[];
/**
* 能生成元素的格子索引
*
......
export default interface ILattice {
reset(n:number);
}
\ No newline at end of file
......@@ -382,7 +382,7 @@ export class AiControl {
for (var i = 0; i < thisObj.lattices.length; i++) {
var lat = thisObj.lattices[i];
//是基础元素,有气泡状态
if (Tool.judgeBaseEle(lat) && lat.element.hasState(StateType.BUBBLE)) {
if (Tool.judgeBaseEle(lat) && lat.element.hasState(StateType.BUBBLE) && (!lat.block || !lat.block.isLock())) {
indexs.push(i);
}
}
......
import { State } from "../class/State";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
/**
* 石门锁住的状态比较特殊,他没有视图,是无形的
* 和lock有区别的,lock可以用消除来解除,石门锁不行
*/
export class BlockLockState extends State {
// private showImage: egret.Bitmap;
constructor() {
super();
// var texture: egret.Texture = RES.getRes("lockVine_png")
// this.showImage = new egret.Bitmap(texture);
// this.addChild(this.showImage);
// this.showImage.x = -texture.textureWidth / 2;
// this.showImage.y = -texture.textureHeight / 2
}
reset() {
// this.alpha = 1;
}
//要不要把动画放在这里,这种移除动效最好统一外面,常驻动效才
recover() {
// egret.Tween.get(this)
// .to({ alpha: 0 }, 750)
// .call(() => {
// if (this.parent) this.parent.removeChild(this);
// Pool.recover(RecoverName.LOCK_STATE, this);
// })
}
}
......@@ -4,7 +4,7 @@
"desc": "OK",
"timestamp": 1566885811031,
"data": {
"wealth": 0,
"wealth": 7960,
"totalStars": 145,
"levels": [
{
......@@ -1131,6 +1131,11 @@
"levelNum": 225,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 226,
"maxScore": 47440,
"stars": 1
}
],
"remainProp": [
......
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