Commit 29b14f01 authored by zjz1994's avatar zjz1994

代码暂存

parent 4efdedb5
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -479,6 +479,7 @@ ...@@ -479,6 +479,7 @@
}; };
return Player; return Player;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=Player.js.map
var Strut = (function (_super) { var Strut = (function (_super) {
tslib.__extends(Strut, _super); tslib.__extends(Strut, _super);
...@@ -488,11 +489,9 @@ ...@@ -488,11 +489,9 @@
return _this; return _this;
} }
Strut.prototype.init = function () { Strut.prototype.init = function () {
this._strut = new engine.Rect(); this._strut = new engine.Image(getTextureByName("ganzi"));
this.addChild(this._strut); this.addChild(this._strut);
this._strut.width = props.strutWidth;
this._strut.y = this.gany; this._strut.y = this.gany;
this._strut.fillColor = props.strutColor;
this._strut.rotation = 180; this._strut.rotation = 180;
}; };
Strut.prototype.onMouseDown = function (pierWidth, distance, callBack) { Strut.prototype.onMouseDown = function (pierWidth, distance, callBack) {
...@@ -565,9 +564,7 @@ ...@@ -565,9 +564,7 @@
} }
}; };
Strut.prototype.rest = function () { Strut.prototype.rest = function () {
this._strut.width = props.strutWidth;
this._strut.y = this.gany; this._strut.y = this.gany;
this._strut.fillColor = props.strutColor;
this._strut.rotation = 180; this._strut.rotation = 180;
this._strut.height = 0; this._strut.height = 0;
this._strut.visible = false; this._strut.visible = false;
...@@ -661,6 +658,9 @@ ...@@ -661,6 +658,9 @@
this.initTouch(); this.initTouch();
this.registerEvent(); this.registerEvent();
} }
engine.globalEvent.dispatchEvent("bjxd-game-inmove", {
"canstop": true
});
return [2]; return [2];
}); });
}); });
...@@ -685,12 +685,18 @@ ...@@ -685,12 +685,18 @@
this.closeStrut(); this.closeStrut();
this.changeBg(GameView.bgIndex); this.changeBg(GameView.bgIndex);
this.startAnm(); this.startAnm();
engine.globalEvent.dispatchEvent("bjxd-game-inmove", {
"canstop": true
});
}; };
GameView.prototype.revive = function () { GameView.prototype.revive = function () {
this._player.revive(); this._player.revive();
this.startAnm(); this.startAnm();
this._isTouchLayer = true; this._isTouchLayer = true;
this.closeStrut(); this.closeStrut();
engine.globalEvent.dispatchEvent("bjxd-game-inmove", {
"canstop": true
});
}; };
GameView.prototype.setGuide = function () { GameView.prototype.setGuide = function () {
var _this = this; var _this = this;
...@@ -722,6 +728,9 @@ ...@@ -722,6 +728,9 @@
}; };
GameView.prototype.onMouseDown = function () { GameView.prototype.onMouseDown = function () {
if (this._isTouchLayer && !this.inani) { if (this._isTouchLayer && !this.inani) {
engine.globalEvent.dispatchEvent("bjxd-game-inmove", {
"canstop": false
});
this._isMouseDown = true; this._isMouseDown = true;
this._strut.onMouseDown(this._road.getFristPier(), this._road.getDistance(), this.goCallBcak.bind(this)); this._strut.onMouseDown(this._road.getFristPier(), this._road.getDistance(), this.goCallBcak.bind(this));
} }
...@@ -768,6 +777,9 @@ ...@@ -768,6 +777,9 @@
x: carx x: carx
}, props.pierMoveTime); }, props.pierMoveTime);
} }
engine.globalEvent.dispatchEvent("bjxd-game-inmove", {
"canstop": true
});
this.closeStrut(); this.closeStrut();
}; };
GameView.prototype.closeStrut = function () { GameView.prototype.closeStrut = function () {
...@@ -793,7 +805,7 @@ ...@@ -793,7 +805,7 @@
} }
}; };
GameView.bgIndex = 0; GameView.bgIndex = 0;
GameView.speed = 10; GameView.speed = 20;
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map //# sourceMappingURL=GameView.js.map
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -178,6 +178,12 @@ ...@@ -178,6 +178,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/57ad75aa036c04e13abcf32c464ff5ae37419495", "url": "//yun.duiba.com.cn/aurora/assets/57ad75aa036c04e13abcf32c464ff5ae37419495",
"uuid": "xiache", "uuid": "xiache",
"ext": ".svga" "ext": ".svga"
},
{
"name": "ganzi",
"url": "//yun.duiba.com.cn/aurora/assets/501972d5960c29b7db1e476422e6fd3cb3a92c8f.png",
"uuid": "ganzi",
"ext": ".png"
} }
], ],
"events": { "events": {
...@@ -222,6 +228,12 @@ ...@@ -222,6 +228,12 @@
"data": { "data": {
"score":0 "score":0
} }
},
"bjxd-game-inmove": {
"alias": "游戏进行状态",
"data": {
"canstop":false
}
} }
} }
} }
......
...@@ -131,6 +131,9 @@ export default class GameView extends engine.Container { ...@@ -131,6 +131,9 @@ export default class GameView extends engine.Container {
this.initTouch(); this.initTouch();
this.registerEvent(); this.registerEvent();
} }
engine.globalEvent.dispatchEvent("bjxd-game-inmove",{
"canstop":true
});
} }
startAnm(){ startAnm(){
this.inani = true; this.inani = true;
...@@ -153,6 +156,9 @@ export default class GameView extends engine.Container { ...@@ -153,6 +156,9 @@ export default class GameView extends engine.Container {
this.closeStrut(); this.closeStrut();
this.changeBg(GameView.bgIndex); this.changeBg(GameView.bgIndex);
this.startAnm(); this.startAnm();
engine.globalEvent.dispatchEvent("bjxd-game-inmove",{
"canstop":true
});
} }
//复活 //复活
revive(){ revive(){
...@@ -161,6 +167,9 @@ export default class GameView extends engine.Container { ...@@ -161,6 +167,9 @@ export default class GameView extends engine.Container {
this.startAnm(); this.startAnm();
this._isTouchLayer = true; this._isTouchLayer = true;
this.closeStrut(); this.closeStrut();
engine.globalEvent.dispatchEvent("bjxd-game-inmove",{
"canstop":true
});
} }
//新手引导 //新手引导
setGuide(){ setGuide(){
...@@ -243,6 +252,9 @@ export default class GameView extends engine.Container { ...@@ -243,6 +252,9 @@ export default class GameView extends engine.Container {
//鼠标事件 //鼠标事件
onMouseDown(){ onMouseDown(){
if(this._isTouchLayer&&!this.inani){ if(this._isTouchLayer&&!this.inani){
engine.globalEvent.dispatchEvent("bjxd-game-inmove",{
"canstop":false
});
this._isMouseDown = true; this._isMouseDown = true;
this._strut.onMouseDown(this._road.getFristPier(),this._road.getDistance(),this.goCallBcak.bind(this)); this._strut.onMouseDown(this._road.getFristPier(),this._road.getDistance(),this.goCallBcak.bind(this));
} }
...@@ -294,9 +306,11 @@ export default class GameView extends engine.Container { ...@@ -294,9 +306,11 @@ export default class GameView extends engine.Container {
engine.Tween.get(this.xiacheNode,{loop:false}) engine.Tween.get(this.xiacheNode,{loop:false})
.to({ .to({
x:carx x:carx
},props.pierMoveTime); },props.pierMoveTime)
} }
engine.globalEvent.dispatchEvent("bjxd-game-inmove",{
"canstop":true
});
this.closeStrut(); this.closeStrut();
} }
...@@ -331,7 +345,7 @@ export default class GameView extends engine.Container { ...@@ -331,7 +345,7 @@ export default class GameView extends engine.Container {
this._road.changeBg(); this._road.changeBg();
} }
} }
static speed = 10; static speed = 20;
changeSpeed(speed){ changeSpeed(speed){
if(GameView.speed!=speed){ if(GameView.speed!=speed){
GameView.speed = speed; GameView.speed = speed;
......
import { props } from "../props"; import { props } from "../props";
import GameView from "./GameView"; import GameView from "./GameView";
import {getTextureByName} from "./utils";
export class Strut extends engine.Container{ export class Strut extends engine.Container{
_strut: engine.Rect; _strut: engine.Image;
_distance; _distance;
_callBack; _callBack;
gany = 1005; gany = 1005;
init(){ init(){
this._strut = new engine.Rect(); this._strut = new engine.Image(getTextureByName("ganzi"));
this.addChild(this._strut); this.addChild(this._strut);
this._strut.width = props.strutWidth; // this._strut.width = props.strutWidth;
this._strut.y = this.gany; this._strut.y = this.gany;
this._strut.fillColor = props.strutColor; // this._strut.fillColor = props.strutColor;
this._strut.rotation = 180; this._strut.rotation = 180;
} }
onMouseDown(pierWidth,distance,callBack){ onMouseDown(pierWidth,distance,callBack){
...@@ -99,9 +99,9 @@ export class Strut extends engine.Container{ ...@@ -99,9 +99,9 @@ export class Strut extends engine.Container{
} }
} }
rest(){ rest(){
this._strut.width = props.strutWidth; // this._strut.width = props.strutWidth;
this._strut.y = this.gany; this._strut.y = this.gany;
this._strut.fillColor = props.strutColor; // this._strut.fillColor = props.strutColor;
this._strut.rotation = 180; this._strut.rotation = 180;
this._strut.height = 0; this._strut.height = 0;
this._strut.visible = false; this._strut.visible = false;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
var qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () { var qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () {
var t, setimgwid, mwid1, mhei1, mwid, mhei, picarr, picnames, chax, chay, startlix, addlix, startliy, addliy, r, startx, endx, c, starty, endy, uvs, isprite, ispritename, e_1; var t, setimgwid, mwid1, mhei1, mwid, mhei, picarr, picnames, chax, chay, startlix, addlix, startliy, addliy, txt1, r, startx, endx, c, starty, endy, uvs, isprite, ispritename, e_1;
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
})]; })];
case 4: case 4:
_a.sent(); _a.sent();
return [2, qietu(t, 1, rows, cols)]; return [2, qietu(t, 1, rows, cols, parent)];
case 5: case 5:
console.log('图片', t); console.log('图片', t);
console.log("图片获取尺寸", mwid, mhei); console.log("图片获取尺寸", mwid, mhei);
...@@ -107,6 +107,13 @@ ...@@ -107,6 +107,13 @@
startliy = chay / mhei; startliy = chay / mhei;
addliy = (mwid / rows) / mhei; addliy = (mwid / rows) / mhei;
} }
console.log("切图准备", startlix, addlix, startliy, addliy, mwid, mhei);
txt1 = new engine.Label();
txt1.fillColor = "red";
txt1.size = 24;
txt1.text = startlix.toFixed(2) + ";" + addlix.toFixed(2) + ";" + startliy.toFixed(2) + ";" + addliy.toFixed(2) + ";" + mwid.toFixed(2) + ";" + mhei.toFixed(2) + ";";
parent.addChild(txt1);
txt1.y = -100;
for (r = 0; r < rows; r++) { for (r = 0; r < rows; r++) {
startx = startlix + addlix * r; startx = startlix + addlix * r;
endx = startx + addlix; endx = startx + addlix;
...@@ -151,7 +158,6 @@ ...@@ -151,7 +158,6 @@
} }
}); });
}); }); }); });
//# sourceMappingURL=qietu.js.map
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
...@@ -543,6 +549,7 @@ ...@@ -543,6 +549,7 @@
}; };
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
...@@ -68,6 +68,14 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -68,6 +68,14 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
startliy = chay/mhei; startliy = chay/mhei;
addliy = (mwid/rows)/mhei; addliy = (mwid/rows)/mhei;
} }
console.log("切图准备",startlix,addlix,startliy,addliy,mwid,mhei);
let txt1 = new engine.Label();
txt1.fillColor = "red";
txt1.size = 24;
txt1.text = startlix.toFixed(2)+";"+addlix.toFixed(2)+";"+startliy.toFixed(2)+";"+addliy.toFixed(2)+";"+mwid.toFixed(2)+";"+mhei.toFixed(2)+";"
parent.addChild(txt1);
txt1.y = -100;
for(let r=0;r<rows;r++){ for(let r=0;r<rows;r++){
let startx = startlix+addlix*r; let startx = startlix+addlix*r;
let endx = startx + addlix; let endx = startx + addlix;
...@@ -86,6 +94,7 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -86,6 +94,7 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
endx endx
]) ])
let isprite = new engine.Sprite(t); let isprite = new engine.Sprite(t);
isprite.uvs = uvs; isprite.uvs = uvs;
isprite.width = mwid1; isprite.width = mwid1;
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
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