Commit da5f9a1f authored by wjf's avatar wjf

l

parent cd51465b
......@@ -31,7 +31,7 @@
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main"
data-orientation="auto" data-scale-mode="showAll" data-frame-rate="60" data-content-width="750"
data-content-height="1624" data-multi-fingered="2" data-show-fps="true" data-show-log="false"
data-content-height="1624" data-multi-fingered="2" data-show-fps="false" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
......@@ -46,6 +46,8 @@
<script src="libs/svga.egret.min.js"></script>
<script src="libs/aes.js"></script>
<script src="libs/pad-zeropadding.js"></script>
<!-- //线上不需要 -->
<script src="libs/fileSave.js"></script>
<img id="pic" style="width:100%;position: absolute;z-index: 999;display: none;" />
<script>
window['plugs']=[1,2,3]
......
/*
* FileSaver.js
* A saveAs() FileSaver implementation.
*
* By Eli Grey, http://eligrey.com
*
* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)
* source : http://purl.eligrey.com/github/FileSaver.js
*/
// The one and only way of getting global scope in all environments
// https://stackoverflow.com/q/3277182/1008999
var _global = typeof window === 'object' && window.window === window
? window : typeof self === 'object' && self.self === self
? self : typeof global === 'object' && global.global === global
? global
: this
function bom (blob, opts) {
if (typeof opts === 'undefined') opts = { autoBom: false }
else if (typeof opts !== 'object') {
console.warn('Deprecated: Expected third argument to be a object')
opts = { autoBom: !opts }
}
// prepend BOM for UTF-8 XML and text/* types (including HTML)
// note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type })
}
return blob
}
function download (url, name, opts) {
var xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.responseType = 'blob'
xhr.onload = function () {
saveAs(xhr.response, name, opts)
}
xhr.onerror = function () {
console.error('could not download file')
}
xhr.send()
}
function corsEnabled (url) {
var xhr = new XMLHttpRequest()
// use sync to avoid popup blocker
xhr.open('HEAD', url, false)
try {
xhr.send()
} catch (e) {}
return xhr.status >= 200 && xhr.status <= 299
}
// `a.click()` doesn't work for all browsers (#465)
function click (node) {
try {
node.dispatchEvent(new MouseEvent('click'))
} catch (e) {
var evt = document.createEvent('MouseEvents')
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,
20, false, false, false, false, 0, null)
node.dispatchEvent(evt)
}
}
var saveAs = _global.saveAs || (
// probably in some web worker
(typeof window !== 'object' || window !== _global)
? function saveAs () { /* noop */ }
// Use download attribute first if possible (#193 Lumia mobile)
: 'download' in HTMLAnchorElement.prototype
? function saveAs (blob, name, opts) {
var URL = _global.URL || _global.webkitURL
var a = document.createElement('a')
name = name || blob.name || 'download'
a.download = name
a.rel = 'noopener' // tabnabbing
// TODO: detect chrome extensions & packaged apps
// a.target = '_blank'
if (typeof blob === 'string') {
// Support regular links
a.href = blob
if (a.origin !== location.origin) {
corsEnabled(a.href)
? download(blob, name, opts)
: click(a, a.target = '_blank')
} else {
click(a)
}
} else {
// Support blobs
a.href = URL.createObjectURL(blob)
setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s
setTimeout(function () { click(a) }, 0)
}
}
// Use msSaveOrOpenBlob as a second approach
: 'msSaveOrOpenBlob' in navigator
? function saveAs (blob, name, opts) {
name = name || blob.name || 'download'
if (typeof blob === 'string') {
if (corsEnabled(blob)) {
download(blob, name, opts)
} else {
var a = document.createElement('a')
a.href = blob
a.target = '_blank'
setTimeout(function () { click(a) })
}
} else {
navigator.msSaveOrOpenBlob(bom(blob, opts), name)
}
}
// Fallback to using FileReader and a popup
: function saveAs (blob, name, opts, popup) {
// Open a popup immediately do go around popup blocker
// Mostly only available on user interaction and the fileReader is async so...
popup = popup || open('', '_blank')
if (popup) {
popup.document.title =
popup.document.body.innerText = 'downloading...'
}
if (typeof blob === 'string') return download(blob, name, opts)
var force = blob.type === 'application/octet-stream'
var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari
var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent)
if ((isChromeIOS || (force && isSafari)) && typeof FileReader !== 'undefined') {
// Safari doesn't allow downloading of blob URLs
var reader = new FileReader()
reader.onloadend = function () {
var url = reader.result
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')
if (popup) popup.location.href = url
else location = url
popup = null // reverse-tabnabbing #460
}
reader.readAsDataURL(blob)
} else {
var URL = _global.URL || _global.webkitURL
var url = URL.createObjectURL(blob)
if (popup) popup.location = url
else location.href = url
popup = null // reverse-tabnabbing #460
setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s
}
}
)
_global.saveAs = saveAs.saveAs = saveAs
if (typeof module !== 'undefined') {
module.exports = saveAs;
}
\ No newline at end of file
......@@ -67,10 +67,10 @@ export class GameGuide extends egret.DisplayObjectContainer {
var p1 = Tool.getPositionByIndex(handIndexs[0]);
var p2 = Tool.getPositionByIndex(handIndexs[1]);
this.msg.y = Math.max(p1[1], p2[1]) + 135;
//定制修改,魔力鸟第九关第一步时
// if (this.thisObj.chapter == 9 && step == 0) {
// this.msg.y += 80;
// }
//定制修改,101关毛球引导,
if (this.thisObj.chapter == 101 && step == 0) {
this.msg.y += 80;
}
this.stepCount--;
}
......@@ -324,6 +324,22 @@ const chapterFuns = {
"小心!会蔓延的果冻!\n消除果冻旁边的动物\n就能消除果冻~"
]
},
//灰毛球
101: {
stepCount: 1,
showIndexs: [
[13, 22, 21, 23, 31, 40],
],
hideIndexs: [
[21, 23, 31, 40],
],
handIndexs: [
[13, 22]
],
msg: [
"灰毛球每步会随机选择\n相邻的格子跳动~\n移动一步试试吧"
]
}
}
/**
......
......@@ -534,12 +534,13 @@ export default class MainScene extends Scene {
case 0:
this.emptys.push(i);
break;
//基础元素,枷锁,一级毛球,二级毛球
//基础元素,枷锁,气泡,灰色毛球,褐色毛球,黑色毛球
case 1:
case 4:
case 7:
case 8:
case 9:
case 10:
var type = Tool.returnType(i, this.lattices, this.chapterData.baseElementTypes);
let ele: Element = Pool.takeOut(RecoverName.ELEMENT);
if (!ele) {
......@@ -554,16 +555,24 @@ export default class MainScene extends Scene {
if (elements[i] == 4) {
ele.setState(StateType.LOCK, true)
}
//气泡
else if (elements[i] == 7) {
//气泡要设定type
ele.setState(StateType.BUBBLE, true, type)
}
//灰色毛球
else if (elements[i] == 8) {
ele.setState(StateType.BUBBLE, true, 1)
ele.setState(StateType.HAIRBALLGREY, true)
}
//褐色毛球
else if (elements[i] == 9) {
ele.setState(StateType.BUBBLE, true, 2)
ele.setState(StateType.HAIRBALLBROWN, true)
}
//黑色毛球
else if (elements[i] == 10) {
ele.setState(StateType.HAIRBALLBLACK, true)
}
break;
//棒棒糖
case 3:
......@@ -642,7 +651,7 @@ export default class MainScene extends Scene {
//初始化引导,游戏和道具
initGuide() {
//游戏引导
const gameGuideChapterNum = [1, 2, 3, 5, 8, 9, 10, 12, 17, 25, 41]
const gameGuideChapterNum = [1, 2, 3, 5, 8, 9, 10, 12, 17, 25, 41,101]
if (gameGuideChapterNum.indexOf(this.chapter >> 0) > -1) {
if (!readCache(getCacheKey() + this.chapter)) {
this.gameGuide = new GameGuide(this);
......@@ -1505,8 +1514,9 @@ export default class MainScene extends Scene {
let ele = Tool.getElement(type);
//如果未通关,有特效的话可以加
if (!this.hasPassed) ele.effectType = effectType;
//没有特效的时候,考虑加气泡
if (effectType == null &&
//不是棒棒糖,且没有特效的时候,考虑加气泡
if (type != ElementType.LOLLIPOP &&
effectType == null &&
this.chapterData.bubbleProbability &&
Math.random() < this.chapterData.bubbleProbability) {
ele.setState(StateType.BUBBLE, true, type)
......
......@@ -69,6 +69,7 @@ export class Tool {
private static indexPositions10: number[][] = [];
/**
* 初始化数据
* 提前的缓存数据,千万别修改,因为给出的数据都没有深拷贝过
*/
public static init(isTwo: boolean = false) {
var ooox = isTwo ? 55 : 15;// 49 : 8.25
......@@ -234,7 +235,6 @@ export class Tool {
}
/**
* 判断格子是否能掉落,
* 是否能移动
* @param lat
*/
public static judgeFall(lat: Lattice): boolean {
......@@ -255,6 +255,22 @@ export class Tool {
}
}
/**
* 格子允许手动移动
* 在允许掉落的基础上去掉,带毛球的,因为毛球能掉落,但是不能移动
* @param lat
*/
public static judgeMove(lat: Lattice): boolean {
if (this.judgeFall(lat) &&
!lat.element.hasState(StateType.HAIRBALLBLACK) &&
!lat.element.hasState(StateType.HAIRBALLGREY) &&
!lat.element.hasState(StateType.HAIRBALLBROWN)
) {
return true
}
return false
}
/**
* 判断格子是否可进行匹配,
* 不包括魔力鸟,不包括头毛球的
......@@ -400,7 +416,6 @@ export class Tool {
* 有返回证明不是死图,
*/
public static dieMapCheck(lattices: Lattice[]): Element[] {
var judgeFall = Tool.judgeFall;
var judgeMatch = Tool.judgeMatch;
//记录有特效的元素,下面特效检测用
var effectElements = []
......@@ -412,14 +427,14 @@ export class Tool {
var col = rc[1];
var lat = lattices[i];
//如果自身格子空或不能交换,跳入下一个
if (!judgeFall(lat)) continue
if (!this.judgeMove(lat)) continue
if (lat.element.effectType != null) {
effectElements.push(lat.element);
}
//与下交换
var latDown = lattices[i + Tool.colNum];
//能交换,并且类型不一致
if (judgeFall(latDown) && lat.element.type != latDown.element.type) {
if (this.judgeMove(latDown) && lat.element.type != latDown.element.type) {
//判断向下,+2,+3 lat
lat2 = lattices[i + Tool.colNum * 2];
lat3 = lattices[i + Tool.colNum * 3];
......@@ -510,7 +525,7 @@ export class Tool {
if (col != Tool.colNum - 1) {
var latRight = lattices[i + 1];
//能交换,并且类型不一致,并未判断latRight是否judgeMatch,也就是未判断是否魔力鸟,但是不影响
if (judgeFall(latRight) && lat.element.type != latRight.element.type) {
if (this.judgeMove(latRight) && lat.element.type != latRight.element.type) {
//判断向右,+2,+3 lat 先确定col<Tool.colNum - 3
if (col < Tool.colNum - 3) {
lat2 = lattices[i + 2];
......@@ -599,38 +614,38 @@ export class Tool {
if (effectElement.effectType == EffectType.MAGICLION) {
//上格子
var up = lattices[effectElement.index - Tool.colNum];
if (judgeFall(up) && up.element.type != ElementType.LOLLIPOP) return [effectElement, up.element];
if (this.judgeMove(up) && up.element.type != ElementType.LOLLIPOP) return [effectElement, up.element];
//下格子
var down = lattices[effectElement.index + Tool.colNum];
if (judgeFall(down) && down.element.type != ElementType.LOLLIPOP) return [effectElement, down.element];
if (this.judgeMove(down) && down.element.type != ElementType.LOLLIPOP) return [effectElement, down.element];
//左格子
var col = Tool.indexToRc(effectElement.index)[1];//列数
if (col != 0) {
var left = lattices[effectElement.index - 1];
if (judgeFall(left) && left.element.type != ElementType.LOLLIPOP) return [effectElement, left.element];
if (this.judgeMove(left) && left.element.type != ElementType.LOLLIPOP) return [effectElement, left.element];
}
if (col != Tool.colNum - 1) {
var right = lattices[effectElement.index + 1];
if (judgeFall(right) && right.element.type != ElementType.LOLLIPOP) return [effectElement, right.element];
if (this.judgeMove(right) && right.element.type != ElementType.LOLLIPOP) return [effectElement, right.element];
}
continue
}
//是普通特效,找周围是特效的
//上格子
var up = lattices[effectElement.index - Tool.colNum];
if (judgeFall(up) && up.element.effectType != null) return [effectElement, up.element];
if (this.judgeMove(up) && up.element.effectType != null) return [effectElement, up.element];
//下格子
var down = lattices[effectElement.index + Tool.colNum];
if (judgeFall(down) && down.element.effectType != null) return [effectElement, down.element];
if (this.judgeMove(down) && down.element.effectType != null) return [effectElement, down.element];
//左格子
var col = Tool.indexToRc(effectElement.index)[1];//列数
if (col != 0) {
var left = lattices[effectElement.index - 1];
if (judgeFall(left) && left.element.effectType != null) return [effectElement, left.element];
if (this.judgeMove(left) && left.element.effectType != null) return [effectElement, left.element];
}
if (col != Tool.colNum) {
var right = lattices[effectElement.index + 1];
if (judgeFall(right) && right.element.effectType != null) return [effectElement, right.element];
if (this.judgeMove(right) && right.element.effectType != null) return [effectElement, right.element];
}
}
return null
......@@ -676,15 +691,15 @@ export class Tool {
//右1
if (rc[1] < Tool.colNum - 1) {
var latRight1 = lattices[i + 1];
if (Tool.judgeFall(latRight1) && latRight1.element.type != ElementType.LOLLIPOP) {
if (Tool.judgeMove(latRight1) && latRight1.element.type != ElementType.LOLLIPOP) {
hasTwo = true;
}
//右2
if (rc[1] < Tool.colNum - 2) {
var latRight2 = lattices[i + 2];
if (Tool.judgeFall(latRight1) &&
if (Tool.judgeMove(latRight1) &&
latRight1.element.type != ElementType.LOLLIPOP &&
Tool.judgeFall(latRight2) &&
Tool.judgeMove(latRight2) &&
latRight2.element.type != ElementType.LOLLIPOP) {
hasThree = true;
}
......@@ -692,7 +707,7 @@ export class Tool {
}
//下1
var latDown1 = lattices[i + Tool.colNum];
if (Tool.judgeFall(latDown1) && latDown1.element.type != ElementType.LOLLIPOP) {
if (Tool.judgeMove(latDown1) && latDown1.element.type != ElementType.LOLLIPOP) {
hasTwo = true;
}
//提前判断下
......@@ -700,9 +715,9 @@ export class Tool {
//下2
var latDown2 = lattices[i + Tool.colNum * 2];
if (Tool.judgeFall(latDown1) &&
if (Tool.judgeMove(latDown1) &&
latDown1.element.type != ElementType.LOLLIPOP &&
Tool.judgeFall(latDown2) &&
Tool.judgeMove(latDown2) &&
latDown2.element.type != ElementType.LOLLIPOP) {
hasThree = true;
}
......
......@@ -4,33 +4,30 @@ import { Pool } from "../Pool";
import { Element } from "../class/Element";
import { Ice } from "../class/Ice";
import { ElementType } from "../enum/ElementType";
import { BitmapRecycle } from "../class/BitmapRecycle";
export function FlyTargetAni(
type: ElementType,
fromP: number[],
targetP: number[],
con: egret.DisplayObjectContainer
) {
//弄一个替代的
let eleC: egret.Bitmap = Pool.takeOut(RecoverName.FLYIMAGE);
if (!eleC) eleC = new egret.Bitmap();
var texture: egret.Texture = RES.getRes("ele" + type + "_png");
eleC.texture = texture;
//都按格子的中心点
eleC.anchorOffsetX = texture.textureWidth / 2;
eleC.anchorOffsetY = texture.textureHeight / 2;
//重置缩放
eleC.scaleX = 1;
eleC.scaleY = 1;
//弄一个替代的
let eleC: BitmapRecycle = Pool.takeOut(RecoverName.BITMAPRECYCLE);
if (!eleC) {
eleC = new BitmapRecycle(texture);
}else{
eleC.reset(texture);
}
eleC.x = fromP[0];
eleC.y = fromP[1];
con.addChild(eleC);
var a = { t: 0 };
egret.Tween.get(eleC)
.to({ x: targetP[0], y: targetP[1], scaleX: 0.3, scaleY: 0.3 }, 500 + (Math.random() * 100) >> 0)
.call(() => {
//回收
con.removeChild(eleC);
Pool.recover(RecoverName.FLYIMAGE, eleC);
Pool.recover(RecoverName.BITMAPRECYCLE, eleC);
con["elementTargets"].targets[type].count--;
})
}
\ No newline at end of file
import { ImageAni } from "../class/ImageAni";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { playSound, SoundType } from "../../soundCtrl";
import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType";
import { Element } from "../class/Element";
import { StateType } from "../enum/StateType";
/**
* 需要回调的
*
*/
export class HairballJumpAni extends egret.Bitmap {
constructor() {
super()
}
play(type: StateType, startP: number[], endP: number[], callback: Function) {
var source: string;
switch (type) {
case StateType.HAIRBALLBLACK:
source = "ele" + ElementType.HAIRBALLBLACK + "_png";
break;
case StateType.HAIRBALLGREY:
source = "ele" + ElementType.HAIRBALLGREY + "_png";
break;
case StateType.HAIRBALLBROWN:
source = "ele" + ElementType.HAIRBALLBROWN + "_png";
break;
default:
source = "ele" + ElementType.HAIRBALLGREY + "_png";
break
}
var texture: egret.Texture = RES.getRes(source)
this.texture = texture;
this.anchorOffsetX = texture.textureWidth / 2;
this.anchorOffsetY = texture.textureHeight;
this.x = startP[0];
this.y = startP[1] + texture.textureHeight / 2;
egret.Tween.get(this)
.to({ scaleX: 1.2, scaleY: 0.8 }, 50)
.to({ scaleX: 0.8, scaleY: 1.2 }, 50)
.to({ scaleX: 1, scaleY: 1 }, 50)
.to({ scaleX: 1.2, scaleY: 0.8 }, 50)
.to({ scaleX: 0.8, scaleY: 1.2 }, 50)
.to({ scaleX: 1, scaleY: 1 }, 50)
.call(() => {
//回收元素
if (this.parent) this.parent.removeChild(this);
Pool.recover(RecoverName.HAIRBALLJUMP_ANI, this)
//回调
callback();
})
egret.Tween.get(this)
.to({ x: endP[0], y: endP[1]+texture.textureHeight / 2 }, 300, egret.Ease.sineInOut)
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import { Ice } from "../class/Ice";
import { ElementType } from "../enum/ElementType";
import { Tool } from "../Tool";
import MainScene from "../../mainScene/MainScene";
import { BitmapRecycle } from "../class/BitmapRecycle";
/**
* 孵蛋的动效
......@@ -17,15 +18,22 @@ export function HatchAni(startIndex: number, endIndexs: number[], thisObj: MainS
for (let i = 0; i < endIndexs.length; i++) {
let endIndex = endIndexs[i];
let endP = Tool.getPositionByIndex(endIndex);
let eleC: Element = Tool.getElement(ElementType.CHICKEN);
var texture: egret.Texture = RES.getRes("ele" + ElementType.CHICKEN + "_png");
let eleC: BitmapRecycle = Pool.takeOut(RecoverName.BITMAPRECYCLE);
if (!eleC) {
eleC = new BitmapRecycle(texture);
}else{
eleC.reset(texture);
}
eleC.x = startP[0];
eleC.y = startP[1];
eleC.scaleX = eleC.scaleY = 0.7;
thisObj.addChild(eleC);
paraCurveAni(eleC, startP, endP, () => {
//回收
thisObj.removeChild(eleC);
Pool.recover(RecoverName.ELEMENT, eleC);
Pool.recover(RecoverName.BITMAPRECYCLE, eleC);
//对应的索引的类型变成鸡,抛物线动画时间都一致,其实可以在统一回调里执行数据更新,这里的数据更新迟早改掉
thisObj.lattices[endIndex].element.reset(ElementType.CHICKEN);
//动画,和bonusTime的效果一样,暂时没加
......@@ -44,7 +52,7 @@ const gravity = 0.003
* @param endP
* @param callback
*/
function paraCurveAni(ele: Element, startP: number[], endP: number[], callback: Function) {
function paraCurveAni(ele: BitmapRecycle, startP: number[], endP: number[], callback: Function) {
//x方向匀速,线性
var deltaX = endP[0] - startP[0]
//y方向,自由落体,y向下为正,加速度向下为正,初速度根据情况而定
......
import { Element } from "../class/Element";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { BitmapRecycle } from "../class/BitmapRecycle";
const pi = Math.PI;
const pi2 = pi * 2;
......@@ -13,12 +14,14 @@ const pi2 = pi * 2;
*/
export function MagicRotateAni(ele: Element, p: number[], con: egret.DisplayObjectContainer) {
//弄一个替代的
let eleC: Element = Pool.takeOut(RecoverName.ELEMENT);
let eleC: BitmapRecycle = Pool.takeOut(RecoverName.BITMAPRECYCLE);
var texture: egret.Texture = RES.getRes("ele" + ele.type + "_png");
if (!eleC) {
eleC = new Element(ele.type)
eleC = new BitmapRecycle(texture)
} else {
eleC.reset(ele.type)
eleC.reset(texture)
}
eleC.x = ele.x;
eleC.y = ele.y;
con.addChild(eleC);
......@@ -49,11 +52,11 @@ export function MagicRotateAni(ele: Element, p: number[], con: egret.DisplayObje
eleC.alpha = eleC.scaleX = eleC.scaleY = 1 - a.t / tAll;
}
})
.to({ t: 60 }, 800,egret.Ease.quadIn)
.to({ t: 60 }, 800, egret.Ease.quadIn)
.call(() => {
//回收
con.removeChild(eleC);
Pool.recover(RecoverName.ELEMENT, eleC);
Pool.recover(RecoverName.BITMAPRECYCLE, eleC);
})
}
......
......@@ -108,7 +108,15 @@ export const Chapters4: ChapterData[] = [
},
//77
{
baseElementTypes: [0, 1, 3, 2], bubbleProbability: 20, stepCount: 20, passTarget: { type: 1, elements: [{ type: 6, count: 3 }] }, starScores: [5000, 12000, 18000], map: { lattices: [1, 0, 1, 0, 1, 0, 1, 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, 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], connectedLats: [[45, 2], [53, 6]], elements: [1, 0, 1, 0, 1, 0, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [55, 61, 65, 69, 75, 76, 77], generateLats: [{ index: 0, type: null }, { index: 4, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 12, type: null }, { index: 14, type: null }, { index: 16, type: null }] }
baseElementTypes: [0, 1, 3, 2],
bubbleProbability: 20,
stepCount: 20,
passTarget: { type: 1, elements: [{ type: 6, count: 3 }] },
starScores: [5000, 12000, 18000],
map: {
lattices: [1, 0, 1, 0, 1, 0, 1, 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, 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],
connectedLats: [[45, 2], [53, 6]],
elements: [1, 0, 1, 0, 1, 0, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [55, 61, 65, 69, 75, 76, 77], generateLats: [{ index: 0, type: null }, { index: 4, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 12, type: null }, { index: 14, type: null }, { index: 16, type: null }] }
},
//78
{
......@@ -120,6 +128,38 @@ export const Chapters4: ChapterData[] = [
},
//80
{
baseElementTypes: [0, 2, 1, 3, 4], bubbleProbability: 50, stepCount: 23, passTarget: { type: 1, elements: [{ type: 1, count: 50 }, { type: 5, count: 24 }] }, starScores: [5000, 11000, 19000], map: { lattices: [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], connectedLats: [], elements: [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 7, 2, 7, 2, 7, 2, 7, 0, 7, 7, 2, 7, 2, 7, 2, 7, 0, 2, 7, 2, 7, 2, 7, 2, 7, 7, 2, 7, 6, 7, 6, 7, 6, 7, 2, 2, 7, 2, 7, 2, 7, 2, 7, 2, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 7, 2, 7, 2, 7, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [], generateLats: [{ index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 18, type: null }, { index: 26, type: null }] }
baseElementTypes: [0, 2, 1, 3, 4],
bubbleProbability: 0,
stepCount: 23,
passTarget: { type: 1, elements: [{ type: 1, count: 50 }, { type: 5, count: 26 }] },
starScores: [5000, 11000, 19000],
map: {
lattices: [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
connectedLats: [],
elements: [
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 7, 2, 7, 2, 7, 2, 7, 0,
7, 7, 2, 7, 2, 7, 2, 7, 7,
2, 7, 2, 7, 2, 7, 2, 7, 2,
2, 7, 6, 7, 6, 7, 6, 7, 2,
2, 7, 2, 7, 2, 7, 2, 7, 2,
2, 7, 2, 7, 2, 7, 2, 7, 2,
7, 7, 2, 7, 2, 7, 2, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7
],
baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
recycles: [],
generateLats: [
{ index: 1, type: null },
{ index: 2, type: null },
{ index: 3, type: null },
{ index: 4, type: null },
{ index: 5, type: null },
{ index: 6, type: null },
{ index: 7, type: null },
{ index: 18, type: null },
{ index: 26, type: null }
]
}
}
]
\ No newline at end of file
This diff is collapsed.
......@@ -8,54 +8,57 @@ import { ElementType } from "../enum/ElementType";
export const Chapters6: ChapterData[] = [
//101
{
baseElementTypes: [0, 1, 2, 3, 4],
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 20,
passTarget: { type: 1, elements: [{ type: 9, count: 27 }] },
starScores: [5000, 12000, 25000],
stepCount: 27,
passTarget: { type: 1, elements: [{ type: 10, count: 13 }] },
starScores: [6000, 12000, 18000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 1, 2, 2, 2, 2, 2, 1, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0
0, 1, 1, 1, 1, 1, 1, 1, 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
],
connectedLats: [],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 2, 2, 5, 2, 2, 0, 0,
0, 0, 5, 1, 1, 1, 5, 0, 0,
0, 2, 2, 2, 5, 2, 2, 2, 0
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 1, 1, 1, 2, 1, 1,
1, 8, 2, 2, 1, 2, 2, 8, 1,
2, 2, 2, 2, 8, 2, 2, 2, 2,
1, 1, 1, 2, 2, 2, 1, 1, 1,
8, 2, 2, 2, 2, 2, 2, 2, 8,
8, 2, 2, 2, 2, 2, 2, 2, 8,
8, 8, 8, 1, 1, 1, 8, 8, 8
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 40, 20, 40, 0, 0, 0,
0, 0, 20, 20, 30, 40, 20, 0, 0,
0, 20, 40, 30, 20, 30, 30, 10, 0,
0, 0, 10, 20, 10, 20, 30, 0, 0,
0, 0, 0, 10, 20, 30, 0, 0, 0,
0, 0, 0, 20, 30, 20, 0, 0, 0,
0, 0, 0, 0, 40, 0, 0, 0, 0,
0, 0, 0, 0, 40, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 40, 40, 20, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
20, 0, 0, 0, 0, 0, 0, 0, 20,
20, 0, 0, 0, 0, 0, 0, 0, 20,
30, 20, 20, 0, 0, 0, 20, 20, 30
],
recycles: [],
generateLats: [
{ index: 13, type: 0 },
{ index: 21, type: 0 },
{ index: 23, type: 0 },
{ index: 29, type: 0 },
{ index: 33, type: 0 },
{ index: 37, type: 0 },
{ index: 43, type: 0 }
{ index: 12, type: null },
{ index: 13, type: null },
{ index: 14, type: null },
{ index: 20, type: null },
{ index: 24, type: null },
{ index: 28, type: null },
{ index: 34, type: null },
{ index: 36, type: null },
{ index: 44, type: null }
]
}
}
......
......@@ -3,13 +3,20 @@ import { Chapters1 } from "./Chapter1";
import { Chapters2 } from "./Chapter2";
import { Chapters3 } from "./Chapter3";
import { Chapters4 } from "./Chapter4";
import { Chapters5 } from "./Chapter5";
import { PassTargetData } from "../interface/PassTargetData";
import { PassType } from "../enum/PassType";
import { submitTran } from "../enum/ElementType";
import { Chapters6 } from "./Chapter6";
//所有的关卡
const chapters: ChapterData[] = [].concat(
Chapters1,
Chapters2,
Chapters3,
Chapters4
Chapters4,
Chapters5,
Chapters6,
)
/**
* 获取关卡数据,返回关卡数据
......@@ -19,4 +26,40 @@ const chapters: ChapterData[] = [].concat(
export function getChapterData(index: number): ChapterData {
//没有数据就返回第一关数据
return chapters[index] || chapters[1];
}
\ No newline at end of file
}
var a = {
"levelNum": 102,
"levelTarget": [
{ "targetType": 5, "targetNum": 40 }
],
"oneStarScore": 6000,
"twoStarScore": 15000,
"threeStarScore": 32000
};
(function exportFile(chapters: ChapterData[]) {
var obj = []
for (var i = 1; i < chapters.length; i++) {
var chapter: ChapterData = chapters[i]
var target: PassTargetData = chapter.passTarget
var a: any = {};
a["levelNum"] = i;
a["levelTarget"] = [];
if (target.type == PassType.SCORE_TARGET) {
a["levelTarget"].push({ "targetType": 1, "targetNum": target.score })
} else {
for (var j = 0; j < target.elements.length; j++) {
var element = target.elements[j];
a["levelTarget"].push({ "targetType": submitTran[element.type], "targetNum": element.count })
}
}
a["oneStarScore"] = chapter.starScores[0];
a["twoStarScore"] = chapter.starScores[1];
a["threeStarScore"] = chapter.starScores[2];
obj.push(a)
}
// var file = new File([JSON.stringify(obj)], "cfg.json", { type: "text/plain;charset=utf-8" });
// window["saveAs"](file);
})(chapters)
\ No newline at end of file
/**
* 供重复利用的位图类
* 锚点都移到中心点的
*/
export class BitmapRecycle extends egret.Bitmap {
constructor(texture: egret.Texture) {
super();
this.anchorOffsetX = texture.textureWidth / 2;
this.anchorOffsetY = texture.textureHeight / 2;
}
/**
* 重复利用时重置用
* 其他属性自己设置
*/
reset(texture: egret.Texture) {
this.texture = texture;
this.anchorOffsetX = texture.textureWidth / 2;
this.anchorOffsetY = texture.textureHeight / 2;
this.alpha = this.scaleX = this.scaleY = 1;
this.rotation = 0;
}
}
\ No newline at end of file
......@@ -12,15 +12,16 @@ export enum RecoverName {
SCORE_ANI = "ScoreAni",
//目标飞入的图片,没有相应的类,直接用egret.Bitmap
FLYIMAGE = "flyImage",
//所有单图的Bitmap都用
BITMAPRECYCLE = "BitmapRecycle",
//带回调的动画,和不带的合并不了,因为可能还有其他参数
BONUSSHOOT_ANI = "BonusShootAni",
JELLYSPREAD_ANI = "JellySpreadAni",
PIECETOEGG_ANI = "PieceToEggAni",
BUBBLE_ANI = "BubbleAni",
HAIRBALLBROWNDIVIDE = "HairballBrownDivide",
HAIRBALLBROWNDIVIDE_ANI = "HairballBrownDivideAni",
HAIRBALLJUMP_ANI = "HairballJumpAni", //三种毛球是一样的动画
......
/**
* 通关类型
* 状态类型
*/
export enum StateType {
LOCK = 0,//锁
BUBBLE,//变色气泡
BUBBLE = 0,//变色气泡
LOCK,//锁
HAIRBALLGREY,//灰色毛球 ,一次就消除
HAIRBALLBROWN,//褐色毛球 ,只能特效消除
HAIRBALLBLACK,//黑色毛球 ,两次消除,一次闭眼
......
......@@ -12,6 +12,7 @@ import { StateType } from "../enum/StateType";
import { BubbleAni } from "../anis/BubbleAni";
import { Element } from "../class/Element";
import { HairballBrownState } from "../states/HairballBrownState";
import { HairballJumpAni } from "../anis/HairballJumpAni";
//孵鸡的数量
const chickenNum: number = 4
......@@ -413,11 +414,24 @@ export class AiControl {
let elementEnd = thisObj.lattices[indexEnd].element;
//变成毛球
elementEnd.setState(stateType, true);
//动画
setTimeout(() => {
//先隐藏
elementEnd.getState(stateType).visible = false;
//跳动动画
let jumpAni: HairballJumpAni = Pool.takeOut(RecoverName.HAIRBALLJUMP_ANI)
if (!jumpAni) jumpAni = new HairballJumpAni()
thisObj.addChild(jumpAni);
jumpAni.play(stateType, Tool.getPositionByIndex(indexFrom), Tool.getPositionByIndex(indexEnd), () => {
//显示
elementEnd.getState(stateType).visible = true;
//都执行了
if (++countJump == countJumpAll) callbackOperation();
}, 200);
})
// setTimeout(()=>{
// //都执行了
// if (++countJump == countJumpAll) callbackOperation();
// },200)
}
//没有则计数
else {
......
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