Commit b1e98e06 authored by wildfirecode's avatar wildfirecode

1

parents e84672cf 1a096253
......@@ -32,11 +32,13 @@ import FailedPanel from "../../src/panels/FailedPanel";
import QuitPanel from "../../src/panels/QuitPanel";
import BoxPanel from "../../src/panels/BoxPanel";
import MainScene from "../../src/mainScene/MainScene";
import { Loading2 } from "../../src/something/uis/Loading2";
export default class MainBase extends eui.UILayer {
constructor() {
super();
Loading.instace.loadImage();
Loading2.instace.loadImage();
DataManager.ins.customCfgData = window['CFG'];
this.getData();
}
......@@ -103,6 +105,7 @@ export default class MainBase extends eui.UILayer {
layers.init(this);
Loading.init(layers.topLayer);
Loading2.init(layers.topLayer);
Loading.instace.show();
PanelCtrl.instance.init(layers.popupLayer);
......
......@@ -38,7 +38,6 @@ import { Chapters } from '../something/Chapters';
import { FlyTargetAni } from '../something/anis/FlyTargetAni';
import { BonusShootAni, stepPosition } from '../something/anis/BonusShootAni';
import { GuideMsg } from '../something/uis/GuideMsg';
import Loading from '../../libs/new_wx/components/Loading';
import { getlogItem } from '../Main';
import getHomeData, { getPropNums } from '../getHomeData';
import PropType from '../PropType';
......@@ -46,6 +45,7 @@ import { PropNumShow } from '../something/uis/PropNumShow';
import SceneCtrl from '../../libs/new_wx/ctrls/sceneCtrl';
import { PropGuide } from '../something/uis/PropGuide';
import { createData } from '../startScene/StartScene';
import { Loading2 } from '../something/uis/Loading2';
const aniClass = {
"BoomAni": BoomAni,
......@@ -58,6 +58,7 @@ const aniClass = {
"EleDisAni": EleDisAni,
"MagicLionAni": MagicLionAni,
}
const baseScore=20;
/**
* 直线特效(4) 1.5倍
* 爆炸特效(L) 2.0倍
......@@ -189,14 +190,14 @@ export default class MainScene extends Scene {
//道具使用引导
propGuide: PropGuide;
//步数道具引导时的圆
stepCircle:egret.Shape;
stepCircle: egret.Shape;
start(data) {
super.start();
//初始化索引信息
Tool.init();
//第几关
// this.chapter = (data && data.chapter) ? data.chapter : 1;
this.chapter = 20;
this.chapter = (data && data.chapter) ? data.chapter : 1;
// this.chapter = 19;
this.chapterTxt.text = "第" + this.chapter + "关";
//关卡数据
this.chapterData = Chapters[this.chapter];
......@@ -240,10 +241,10 @@ export default class MainScene extends Scene {
//引导提示
if (this.chapter <= 5) {
Loading.instace.show()
Loading2.instace.show()
let g = new GuideMsg();
g.init(this.chapter, () => {
Loading.instace.hide()
Loading2.instace.hide()
this.addChild(g);
this.enableMouseEvt(true);
})
......@@ -519,7 +520,7 @@ export default class MainScene extends Scene {
}
// 侦听事件
//侦听事件
initEvents() {
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.settingBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this)
......@@ -681,19 +682,52 @@ export default class MainScene extends Scene {
if (this.SELECTED && this.choosed.parent) {
this.choosed.parent.removeChild(this.choosed)
}
let fun: Function;
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, fun = function () {
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, fun, this);
this.sendPropUse(prop);
}, this)
} else {
if(!this.stepCircle){
if (!this.stepCircle) {
this.stepCircle = new egret.Shape();
this.stepCircle.graphics.beginFill(0xff0000, 0.5);
this.stepCircle.touchEnabled = true;
this.stepCircle.graphics.beginFill(0xff0000, 0);
this.stepCircle.graphics.drawCircle(123, 98, 72);
this.stepCircle.graphics.endFill();
// this.stepCircle.addEventListener()
this.stepCircle.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this.sendPropUse(PropType.CHANCE_NUM)
}, this)
}
this.addChild(this.stepCircle)
}
}
sendPropUse(prop){
sendPropUse(prop: PropType) {
Loading2.instace.show();
this.removeChild(this.propGuide);
NetManager.ins.hc_useProp((s) => {
Loading2.instace.hide();
//还原事件
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
if (prop == PropType.BOOM || prop == PropType.HAMMER) {
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
} else {
this.removeChild(this.stepCircle)
showToast("步数增加成功")
}
if (!s) return
switch (prop) {
case PropType.BOOM:
break;
case PropType.HAMMER:
break;
case PropType.CHANCE_NUM:
this.steps += 5;
break;
}
}, prop)
}
mouseDownE(e: egret.TextEvent) {
// if (!this.enableTouch) return
......@@ -1362,7 +1396,7 @@ export default class MainScene extends Scene {
for (var aa = 0; aa < this.eliminatedElements.length; aa++) {
var index = this.eliminatedElements[aa];
if (!this.lattices[index].element.isLock) {
this.pushScoreAni(10 * this.commonContinuityTimes, Tool.getPositionByIndex(index))
this.pushScoreAni(baseScore * this.commonContinuityTimes, Tool.getPositionByIndex(index))
}
}
return this.eliminatedElements.length > 0;
......@@ -1522,7 +1556,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(i);
//5倍
if (!lat.element.isLock/*&&lat.element.effectType==null*/) {
this.pushScoreAni(10 * this.effectContinuityTimes * 5, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 5, Tool.getPositionByIndex(i))
}
}
}
......@@ -1572,7 +1606,7 @@ export default class MainScene extends Scene {
}
if (!lat.element.isLock) {
//2.5倍
this.pushScoreAni(10 * this.effectContinuityTimes * 2.5, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 2.5, Tool.getPositionByIndex(i))
}
}
}
......@@ -1594,7 +1628,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(i);
if (!lat.element.isLock) {
//3倍
this.pushScoreAni(10 * this.effectContinuityTimes * 3, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 3, Tool.getPositionByIndex(i))
}
}
}
......@@ -1618,7 +1652,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(i);
if (!lat.element.isLock) {
//3.5倍
this.pushScoreAni(10 * this.effectContinuityTimes * 3.5, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 3.5, Tool.getPositionByIndex(i))
}
}
}
......@@ -1643,7 +1677,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(i);
if (!lat.element.isLock) {
//4倍
this.pushScoreAni(10 * this.effectContinuityTimes * 4, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 4, Tool.getPositionByIndex(i))
}
}
}
......@@ -1752,7 +1786,7 @@ export default class MainScene extends Scene {
}
//2.5倍
if (!this.lattices[i].element.isLock) {
this.pushScoreAni(10 * this.effectContinuityTimes * 2.5, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 2.5, Tool.getPositionByIndex(i))
}
}
}
......@@ -1772,7 +1806,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(i);
//2倍
if (!this.lattices[i].element.isLock) {
this.pushScoreAni(10 * this.effectContinuityTimes * 2, Tool.getPositionByIndex(i))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 2, Tool.getPositionByIndex(i))
}
}
}
......@@ -1791,7 +1825,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(ein);
//1.5倍
if (!this.lattices[ein].element.isLock) {
this.pushScoreAni(10 * this.effectContinuityTimes * 1.5, Tool.getPositionByIndex(ein))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 1.5, Tool.getPositionByIndex(ein))
}
}
}
......@@ -1810,7 +1844,7 @@ export default class MainScene extends Scene {
this.eliminatedElements.push(ein);
//1.5倍
if (!this.lattices[ein].element.isLock) {
this.pushScoreAni(10 * this.effectContinuityTimes * 1.5, Tool.getPositionByIndex(ein))
this.pushScoreAni(baseScore * this.effectContinuityTimes * 1.5, Tool.getPositionByIndex(ein))
}
}
}
......@@ -2056,12 +2090,12 @@ export default class MainScene extends Scene {
* @param callback
*/
submit(json: string) {
Loading.instace.show();
Loading2.instace.show();
NetManager.ins.hc_submit((s, data) => {
if (s) {
//提交成功后捞结果
NetManager.ins.getOrderStatus((s) => {
Loading.instace.hide();
Loading2.instace.hide();
playSound(SoundType.sucess);
if (s) {
//区分奖品
......@@ -2078,7 +2112,7 @@ export default class MainScene extends Scene {
DataManager.ins.getData("hc_doJoin").data,
() => { return DataManager.ins.getCustomOrderStatusData.code == "C000000001"; })
} else {
Loading.instace.hide();
Loading2.instace.hide();
if (!data) {
//错误弹框,网络错误
//提交失败
......
......@@ -9,12 +9,12 @@ export const Chapters: ChapterData[] = [
{
map: {
lattices: [
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 2, 1, 1, 1, 1,
1, 1, 1, 0, 1, 3, 1, 1, 1,
1, 1, 1, 0, 1, 1, 4, 1, 1,
0, 0, 0, 0, 1, 1, 1, 5, 1,
1, 1, 1, 1, 1, 1, 1, 1, 6,
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,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
......@@ -33,33 +33,16 @@ export const Chapters: ChapterData[] = [
]
}
],
connectedLats: [[27, 45], [28, 46], [29, 47]]
// connectedLats: [[27, 45], [28, 46], [29, 47]]
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.15,
stepCount: 30,
// passTarget: {
// type: PassType.SCORE_TARGET,
// score: 10000,
// },
effectInitProbability: 0.1,
stepCount: 50,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
// {
// type: ElementType.ICE,
// count: 100,
// },
{
type: ElementType.RABBIT,
count: 56,
},
{
type: ElementType.LOLLIPOP,
count: 4,
}
],
type: PassType.SCORE_TARGET,
score: 2000,
},
starScores: [3000, 5000, 10000]
starScores: [1200, 1500, 2500]
},
//第二关
{
......@@ -574,14 +557,14 @@ export const Chapters: ChapterData[] = [
generateLats: [0, 1, 2, 4, 5, 6, 7, 8],
connectedLats: [[27, 45], [28, 46], [29, 47]]
},
baseElementTypes: [0, 1, 2, 3],
baseElementTypes: [0, 1, 2, 4],
effectInitProbability: 0.05,
stepCount: 15,
passTarget: {
type: PassType.SCORE_TARGET,
score: 22000
score: 18000
},
starScores: [8000, 16000, 22000]
starScores: [8000, 12000, 18000]
},
//第二十关
{
......
export class Loading2 extends egret.Sprite {
private static _parent: egret.Sprite;
private static _instance: Loading2;
private static bg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAC0CAYAAAATiCegAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0Y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cE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6M0JDNjIyNjhBNzY0MTFFODlBNTNGNTZGRDdEMENDOEMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MkZEMzQyMDRBNzg0MTFFODlBNTNGNTZGRDdEMENDOEMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4SQhovAAABqUlEQVR42uyavW6EMAzHSQbEgrqxlQWpU5+m6ov0SfoifZxOlVArurFVLIAEbS0ViUbJ5ds57vxbDhhs/xMfJI6zDIllWd6//4BrLL8MyxEI++f4Fwy/PLtwSCAJJIFnLrBt25thGO7h91yCtomJ6QzVdf203Y/j+FKW5WvKzwQIK4ricbvvuu65aZovpxmsqup2fw+GwUGqmRPFyWK0Etj3/af4LJVImThVjFYrGZVh23T1SVGfGLQvGTAAhlLNpO8AG30mQohc1/VDdh07exjmaKbwxVI5xvJhvZJRpWue53ehZk9my3UAnZZqMpHzPL+FEijaivEXME6laZoeYrxNY9omCIIgiI19xdkUzMq0b5xM3KcZL2KRKtOq/WTUpdqR4KZ7M9XeDoujxEkQBEFcD0coWTCfAPalvZhlQx/bPEQAQMyyoc8xAQ8hDohZNvQRefGle47l0LbTKdSpFsMaTdfzwejHZ5hpGWMmTwqEJoSU4kxE6jotrJoQUojTiQzahJDslOeESF0TgpZQjUBixQsrJuoXPTokkASSwCsR6NLpFIIfAQYAmaA+/cC+3MAAAAAASUVORK5CYII=';
getBitmap(base64: string, callback: (bitmap) => void): void {
const img = new Image();
img["avaliable"] = true;
img.src = base64;
img.onload = () => {
const texture = new egret.Texture();
const bitmapdata = new egret.BitmapData(img);
texture._setBitmapData(bitmapdata);
callback(new egret.Bitmap(texture));
}
}
_bg: egret.Bitmap;
_progress: egret.Bitmap;
loadImage() {
var bg: egret.Shape = new egret.Shape();
bg.graphics.beginFill(0x000000, 0);
bg.graphics.drawRect(0, 0, 750, 1624);
bg.graphics.endFill();
bg.touchEnabled = true;
this.addChild(bg);
this.getBitmap(Loading2.bg, (bitmap: egret.Bitmap) => {
const t = Date.now() - window['__startTime__'];
console.log(`首屏loading显示时间:${t}ms`);
this._bg = bitmap;
this._bg.x = 295;
this._bg.y = 288;
this.addChild(this._bg);
})
this.getBitmap(Loading2.progress, (bitmap: egret.Bitmap) => {
this._progress = bitmap;
this._progress.x = 375;
this._progress.y = 380;
this._progress.anchorOffsetX = this._progress.anchorOffsetY = 28;
this.addChild(this._progress);
})
}
static get instace(): Loading2 {
return Loading2._instance || (Loading2._instance = new Loading2());
}
show() {
Loading2._parent.addChild(this);
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
hide() {
if (this.parent)
Loading2._parent.removeChild(this);
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
static init(parent: egret.Sprite) {
Loading2._parent = parent;
}
onEnterFrame() {
if (this._progress)
this._progress.rotation += 5;
}
}
......@@ -12,7 +12,6 @@ export class PropGuide extends egret.DisplayObjectContainer {
hammerBtn: egret.Bitmap;
stepBtn: egret.Bitmap;
msgTxt: egret.TextField;
stepCircle: egret.Shape;
constructor() {
super()
this.bg = new egret.Shape();
......@@ -40,12 +39,6 @@ export class PropGuide extends egret.DisplayObjectContainer {
text.width = 500;
this.addChild(text);
this.msgTxt = text;
//步数的圆
this.stepCircle = new egret.Shape();
this.stepCircle.graphics.beginFill(0xff0000, 0.5);
this.stepCircle.graphics.drawCircle(123, 98, 72);
this.stepCircle.graphics.endFill();
this.addChild(this.stepCircle);
this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (this.parent) this.parent.removeChild(this)
}, this)
......
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