Commit 6431ca54 authored by wildfirecode's avatar wildfirecode

1

parents 70a96abf edc2166b
This diff is collapsed.
...@@ -51,8 +51,12 @@ import { GuideMsg } from '../something/uis/GuideMsg'; ...@@ -51,8 +51,12 @@ import { GuideMsg } from '../something/uis/GuideMsg';
import { readCache, getCacheKey } from '../mapScene/GuideCon'; import { readCache, getCacheKey } from '../mapScene/GuideCon';
import { PropGuideInt } from './PropGuide'; import { PropGuideInt } from './PropGuide';
import { StepAni } from '../something/anis/StepAni'; import { StepAni } from '../something/anis/StepAni';
<<<<<<< HEAD
import { updateMainTimerAfterGetData } from '../../libs/new_wx/MainBase'; import { updateMainTimerAfterGetData } from '../../libs/new_wx/MainBase';
import wait from '../../libs/new_tc/wait'; import wait from '../../libs/new_tc/wait';
=======
import { GameGuide } from './GameGuide';
>>>>>>> edc2166bb8da76159df10a9a2edcbcb0c9506091
// tslint:disable: no-var-keyword // tslint:disable: no-var-keyword
// tslint:disable: prefer-const // tslint:disable: prefer-const
// tslint:disable: cyclomatic-complexity // tslint:disable: cyclomatic-complexity
...@@ -206,11 +210,10 @@ export default class MainScene extends Scene { ...@@ -206,11 +210,10 @@ export default class MainScene extends Scene {
stepCircle: egret.Shape; stepCircle: egret.Shape;
//bonus Time 提示 //bonus Time 提示
bonusTime: BonusTime; bonusTime: BonusTime;
//游戏操作引导
gameGuide: GameGuide;
start(data) { start(data) {
super.start(); super.start();
//初始化索引信息
Tool.init();
//第几关 //第几关
this.chapter = (data && data.chapter) ? data.chapter : 1; this.chapter = (data && data.chapter) ? data.chapter : 1;
// this.chapter = 24; // this.chapter = 24;
...@@ -222,6 +225,8 @@ export default class MainScene extends Scene { ...@@ -222,6 +225,8 @@ export default class MainScene extends Scene {
mapDataIndex = this.chapter - 20 mapDataIndex = this.chapter - 20
} }
this.chapterData = Chapters[mapDataIndex]; this.chapterData = Chapters[mapDataIndex];
//初始化索引信息,暂时不做判断列数的奇偶,如需,要修改的地方再考虑,还有道具使用的蒙层是否要改
Tool.init(/*Tool.getColOddEven(this.chapterData.map.lattices)*/);
this.initUi(); this.initUi();
this.initSvgas(); this.initSvgas();
//先禁掉事件 //先禁掉事件
...@@ -278,7 +283,7 @@ export default class MainScene extends Scene { ...@@ -278,7 +283,7 @@ export default class MainScene extends Scene {
//引导提示 //引导提示
var guideImageNum: number; var guideImageNum: number;
// 15678是操作引导 // 15678是操作引导
const chapterToGuideNum = { /*const chapterToGuideNum = {
1: 1, 1: 1,
5: 2, 5: 2,
6: 3, 6: 3,
...@@ -301,9 +306,18 @@ export default class MainScene extends Scene { ...@@ -301,9 +306,18 @@ export default class MainScene extends Scene {
() => { () => {
Loading2.instace.hide() Loading2.instace.hide()
}) })
}*/
//游戏引导
const gameGuideChapterNum = [1, 5, 6, 7, 8, 9, 10, 19, 24]
if (gameGuideChapterNum.indexOf(this.chapter >> 0) > -1) {
if (!readCache(getCacheKey() + this.chapter)) {
this.gameGuide = new GameGuide(this);
this.addChild(this.gameGuide);
this.gameGuide.show();
}
} }
// 234是道具引导 // 234是道具引导
if (this.chapter == 2 || this.chapter == 3 || this.chapter == 4) { else if (this.chapter == 2 || this.chapter == 3 || this.chapter == 4) {
if (!readCache(getCacheKey() + this.chapter + "prop")) { if (!readCache(getCacheKey() + this.chapter + "prop")) {
this.enableMouseEvt(false); this.enableMouseEvt(false);
var pgi = new PropGuideInt(this) var pgi = new PropGuideInt(this)
...@@ -347,12 +361,12 @@ export default class MainScene extends Scene { ...@@ -347,12 +361,12 @@ export default class MainScene extends Scene {
const texture: egret.Texture = RES.getRes('main_mapbottom_png'); const texture: egret.Texture = RES.getRes('main_mapbottom_png');
const imgs = new egret.DisplayObjectContainer; const imgs = new egret.DisplayObjectContainer;
for (const key in this.endRowNumHash) { for (const key in this.endRowNumHash) {
const {index,row} = this.endRowNumHash[key]; const { index, row } = this.endRowNumHash[key];
if(this.endRowNum == row) { if (this.endRowNum == row) {
const img = new eui.Image(texture); const img = new eui.Image(texture);
const[x,y]=Tool.getPositionByIndex(index); const [x, y] = Tool.getPositionByIndex(index);
img.x=x; img.x = x;
img.y=y; img.y = y;
imgs.addChild(img); imgs.addChild(img);
} }
} }
...@@ -702,7 +716,15 @@ export default class MainScene extends Scene { ...@@ -702,7 +716,15 @@ export default class MainScene extends Scene {
} }
// this.lattices[11].element.effectType=EffectType.MAGICLION; // this.lattices[11].element.effectType=EffectType.MAGICLION;
// this.lattices[20].element.effectType=EffectType.MAGICLION; // this.lattices[20].element.effectType=EffectType.MAGICLION;
var aa = []
for (var i = 0; i < this.lattices.length; i++) {
if (!this.lattices[i] || !this.lattices[i].element) {
aa.push(0)
} else {
aa.push(this.lattices[i].element.type)
}
}
console.log(aa)
//初始化完先检测死图 //初始化完先检测死图
this.warningCop = Tool.dieMapCheck(this.lattices); this.warningCop = Tool.dieMapCheck(this.lattices);
if (!this.warningCop) { if (!this.warningCop) {
...@@ -766,7 +788,7 @@ export default class MainScene extends Scene { ...@@ -766,7 +788,7 @@ export default class MainScene extends Scene {
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this); this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
} }
onEnterFrame() { onEnterFrame() {
if (this.enableTouch) { if (this.enableTouch && !this.gameGuide) {
this.noActionCount++; this.noActionCount++;
} else { } else {
this.noActionCount = 0; this.noActionCount = 0;
...@@ -1043,6 +1065,8 @@ export default class MainScene extends Scene { ...@@ -1043,6 +1065,8 @@ export default class MainScene extends Scene {
private callbackEx(s, o) { private callbackEx(s, o) {
this.exchangeData(s, o); this.exchangeData(s, o);
if (this.simpleMatch(s, o)) { if (this.simpleMatch(s, o)) {
//有游戏引导时去掉
if (this.gameGuide) this.gameGuide.hideSelf();
//次数减1; //次数减1;
this.steps--; this.steps--;
this.oneStepScore = 0; this.oneStepScore = 0;
...@@ -1762,6 +1786,11 @@ export default class MainScene extends Scene { ...@@ -1762,6 +1786,11 @@ export default class MainScene extends Scene {
this.upsetElement() this.upsetElement()
}, 1000) }, 1000)
} else { } else {
//如果还有游戏引导
if (this.gameGuide) {
this.addChild(this.gameGuide)
this.gameGuide.show()
};
//允许移动 //允许移动
this.enableMouseEvt(true) this.enableMouseEvt(true)
} }
......
...@@ -51,7 +51,8 @@ export class Tool { ...@@ -51,7 +51,8 @@ export class Tool {
/** /**
* 初始化数据 * 初始化数据
*/ */
public static init() { public static init(isTwo: boolean = false) {
this.offsetX = isTwo ? 55 : 15
//都是9*9 //都是9*9
//位置信息 //位置信息
var spaceX = this.width, var spaceX = this.width,
...@@ -109,6 +110,49 @@ export class Tool { ...@@ -109,6 +110,49 @@ export class Tool {
return this.indexPositions[index] return this.indexPositions[index]
} }
/**
* 根据9*9格子得到中间列数的奇偶性
* 其实只是要知道左右两边空的列数
* @param lattices
* @returns true为偶数,false为奇数
*/
public static getColOddEven(lattices: number[]): boolean {
var left: number = 0;
for (var i = 0; i < Tool.colNum; i++) {
//判断该列是否有格子,没有就加1,有就直接over
var mark = false;
for (var j = 0; j < Tool.rowNum; j++) {
if (lattices[j * this.colNum + i]) {
mark = true;
break
}
}
if (mark) {
break
} else {
left++
}
}
var right: number = 0;
for (var i = Tool.colNum - 1; i >= 0; i--) {
//判断该列是否有格子,没有就加1,有就直接over
var mark = false;
for (var j = 0; j < Tool.rowNum; j++) {
if (lattices[j * this.colNum + i]) {
mark = true;
break
}
}
if (mark) {
break
} else {
right++
}
}
return (left + right) % 2 != 0
}
/** /**
* 判断相邻 * 判断相邻
* @param a * @param a
......
...@@ -44,7 +44,7 @@ export function drawShape(paths: PathData[]): egret.Shape { ...@@ -44,7 +44,7 @@ export function drawShape(paths: PathData[]): egret.Shape {
return shape return shape
} }
//画多边形路径 //画多边形路径
function drawPoly(shape: egret.Shape, path: PathData) { export function drawPoly(shape: egret.Shape, path: PathData) {
var firstFrom; var firstFrom;
for (var j = 0; j < path.points.length; j += 2) { for (var j = 0; j < path.points.length; j += 2) {
//当前点 //当前点
...@@ -149,9 +149,11 @@ function calVet(index: string): number[] { ...@@ -149,9 +149,11 @@ function calVet(index: string): number[] {
} }
//给出10*10 //给出10*10
let indexToRcMap10: number[][] = []; let indexToRcMap10: number[][];
let indexPositions10: number[][] = []; let indexPositions10: number[][];
(function () { function get10DataUp() {
indexToRcMap10 = [];
indexPositions10 = [];
var rowNum = Tool.rowNum + 1; var rowNum = Tool.rowNum + 1;
var colNum = Tool.colNum + 1; var colNum = Tool.colNum + 1;
var offsetX = Tool.offsetX var offsetX = Tool.offsetX
...@@ -163,13 +165,15 @@ let indexPositions10: number[][] = []; ...@@ -163,13 +165,15 @@ let indexPositions10: number[][] = [];
indexPositions10[i * colNum + j] = [offsetX + j * Tool.width, offsetY + i * Tool.height]; indexPositions10[i * colNum + j] = [offsetX + j * Tool.width, offsetY + i * Tool.height];
} }
} }
})() }
//返回10的索引 //返回10的索引
function indexToRc10(index: number): number[] { function indexToRc10(index: number): number[] {
if (!indexToRcMap10) get10DataUp();
return indexToRcMap10[index] return indexToRcMap10[index]
} }
// //
function getPositionByIndex10(index: number): number[] { function getPositionByIndex10(index: number): number[] {
if (!indexPositions10) get10DataUp();
return indexPositions10[index] return indexPositions10[index]
} }
......
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