Commit 2b3b204c authored by zjz1994's avatar zjz1994

代码暂存

parent 95f8ecd9
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -37,7 +37,8 @@
_this.eimage = new engine.Image();
_this.addChild(_this.eimage);
_this.touch = true;
_this.addEventListener(engine.MouseEvent.CLICK, _this.selectele, _this);
_this.addEventListener(engine.MouseEvent.MOUSE_DOWN, _this.selectele, _this);
_this.addEventListener(engine.MouseEvent.MOUSE_MOVE, _this.changemove, _this);
return _this;
}
Object.defineProperty(Element.prototype, "touch", {
......@@ -67,7 +68,15 @@
Element.prototype.selectele = function (e) {
engine.globalEvent.dispatchEvent(GameEvent.SelectEle, {
r: this.inrow,
c: this.incol
c: this.incol,
type: "mouse_down"
});
};
Element.prototype.changemove = function (e) {
engine.globalEvent.dispatchEvent(GameEvent.SelectEle, {
r: this.inrow,
c: this.incol,
type: "mouse_move"
});
};
Object.defineProperty(Element.prototype, "factor", {
......@@ -384,6 +393,7 @@
_this.sptime = Date.now();
_this._score = 0;
_this.inEliminate = false;
_this.newSelect = false;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
......@@ -748,7 +758,34 @@
var data = e.data;
var sr = data.r;
var sc = data.c;
var type = data.type;
var sname = sr + "_" + sc;
var lnewSelect = this.newSelect;
var newCanSel = false;
if (this.selectArr.length == 0) {
newCanSel = true;
}
else if (this.selectArr.length == 1) {
var nname = this.selectArr[0];
if (sname == nname) {
newCanSel = false;
}
else {
newCanSel = true;
}
}
if (type == "mouse_down") {
this.newSelect = true;
}
else if (type == "mouse_move") {
if (newCanSel) {
this.newSelect = false;
}
}
if ((lnewSelect || this.newSelect) && newCanSel) ;
else {
return;
}
this.unShowEleAttion();
if (this.selectArr.length == 0) {
this.sptime = Date.now();
......@@ -1206,6 +1243,10 @@
GameView.prototype.solveDieMap = function (type) {
if (type === void 0) { type = "normal"; }
if (this.gamestat != 1) {
if (this.ingameover) {
this.inEliminate = false;
this.checkGameOver("changeToFuHuoPos222");
}
return;
}
this.changeEnable(false);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -477,12 +477,48 @@ export default class GameView extends engine.Container {
this.anicontainer.removeChild(this.jiantoucont);
}
}
newSelect:boolean = false;
//选择元素
selectele(e:engine.Event){
let data = e.data;
let sr = data.r;
let sc = data.c;
let type = data.type;
let sname = sr+"_"+sc;
//新增滑动操作
let lnewSelect = this.newSelect;
let newCanSel = false;
if(this.selectArr.length==0){
newCanSel = true;
}else if(this.selectArr.length==1){
let nname = this.selectArr[0];
if(sname==nname){
newCanSel = false
}else{
newCanSel = true;
}
}
if(type=="mouse_down"){
this.newSelect = true;
}else if(type=="mouse_move"){
if(newCanSel){
this.newSelect = false;
}
}
// console.log(lnewSelect,this.newSelect,newCanSel,type,this.selectArr.length,sname);
if((lnewSelect||this.newSelect)&&newCanSel){
}else{
return;
}
// console.log("continue");
this.unShowEleAttion();
if(this.selectArr.length==0){
......@@ -992,6 +1028,10 @@ export default class GameView extends engine.Container {
//死图调整
solveDieMap(type="normal"){
if(this.gamestat!=1){
if(this.ingameover){
this.inEliminate = false;
this.checkGameOver("changeToFuHuoPos222");
}
return;
}
this.changeEnable(false);
......
......@@ -22,7 +22,9 @@ export default class Element extends engine.Container{
this.eimage = new engine.Image();
this.addChild(this.eimage);
this.touch = true;
this.addEventListener(engine.MouseEvent.CLICK,this.selectele,this);
// this.addEventListener(engine.MouseEvent.CLICK,this.selectele,this);
this.addEventListener(engine.MouseEvent.MOUSE_DOWN,this.selectele,this);
this.addEventListener(engine.MouseEvent.MOUSE_MOVE,this.changemove,this);
}
init(type:ElementType){
this.anchorY = MapData.itemsize;
......@@ -48,7 +50,16 @@ export default class Element extends engine.Container{
selectele(e:engine.MouseEvent){
engine.globalEvent.dispatchEvent(GameEvent.SelectEle,{
r:this.inrow,
c:this.incol
c:this.incol,
type:"mouse_down"
})
}
changemove(e:engine.MouseEvent){
// console.log(this.inrow+":"+this.incol);
engine.globalEvent.dispatchEvent(GameEvent.SelectEle,{
r:this.inrow,
c:this.incol,
type:"mouse_move"
})
}
......
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