Commit 48b2c0e6 authored by wildfirecode's avatar wildfirecode

1

parent a9cf7d61
......@@ -67,7 +67,7 @@
"BallItemPrefab": "res|8ebdfe78-ea44-445d-8bbe-02a22874e896",
"RedFirePrefab": "res|83d50df9-266c-478f-bf01-21d478abe049",
"BlueRocketPrefab": "res|9a8fe57a-ff20-44e7-89bf-cdc95e80e1ea",
"car": "entity|a5b807ba-098f-4b6e-b0da-e42b6324f62a"
"car": "entity|ebfde024-e9b9-40cb-a866-c0b194446b35"
}
}
],
......@@ -214,21 +214,40 @@
"children": []
},
{
"name": "car",
"name": "carWrapper",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -48.452380952380956,
"y": 420.7142857142857
"x": 2.5,
"y": 340,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/other/RelativeLayout",
"script": "components/renderer/RectRenderer",
"properties": {
"top": 1200
"width": 120,
"height": 110
},
"disabled": false
}
],
"uuid": "ebfde024-e9b9-40cb-a866-c0b194446b35",
"children": [
{
"name": "car",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -52,
"y": 50.5,
"_type_": "scilla/support/Vector2D"
}
}
}
],
......@@ -344,6 +363,8 @@
]
}
]
}
]
},
{
"name": "SceneStart",
......@@ -692,7 +713,7 @@
"entity-cache": [
"f02aa1f7-3255-405e-a537-7ba4ef503aa7",
"70838016-4fab-4a0f-90aa-61c4303a4ecc",
"a5b807ba-098f-4b6e-b0da-e42b6324f62a",
"ebfde024-e9b9-40cb-a866-c0b194446b35",
"91e550e7-aba1-4eaf-bb74-04c7e7789102",
"3b5cb573-bb7b-46f2-af0b-8e6ca7380dcc",
"adf5cdd6-0cff-47a1-b3ae-8a28fc11b29c",
......
......@@ -25,12 +25,12 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
bodys: Entity[];
onGlobalTouchBegin(e): any {
this.car.getComponent(Transform).position.x=e.x-375;
this.car.getComponent(Transform).position.x = e.x - 375;
return super.onGlobalTouchBegin(e);
}
onGlobalTouchMove(e: { x, y }) {
this.car.getComponent(Transform).position.x=e.x-375;
this.car.getComponent(Transform).position.x = e.x - 375;
return super.onGlobalTouchMove(e);
}
......@@ -68,13 +68,13 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
for (const body of this.bodys) {
const { position } = body.getComponent(Transform);
const pic = body.getChildrenByName('pic')[0];
const { height } = pic.getComponent(Transform);
const r = height / 2;
const { height, width } = pic.getComponent(Transform);
const r = height / 2;//刚体的半径
// console.log(position.x);
// console.log(position.y + r)
if (position.y + r > GROUND_Y) {
position.y = GROUND_Y - r;
body.getComponent(Body).revertY();
}
if (position.x + r > 375) {
......@@ -86,7 +86,34 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
position.x = -375 + r;
body.getComponent(Body).revertX();
}
const { x: carX, y: carY } = this.car.getComponent(Transform).position;
//判断car与body的碰撞
const x0 = Math.abs(position.x - carX);
const y0 = Math.abs(position.y - carY);
const x1 = r + 120 / 2;
const y1 = r + 110 / 2;
if (x0 < x1 && y0 < y1) {
console.log('碰撞了');
this.onCarCollideDrops(body);
}
}
}
async onCarCollideDrops(body: Entity) {
const index = this.bodys.indexOf(body);
if (index == -1) return;
this.bodys.splice(index, 1);
body.removeComponent(body.getComponent(Body));
await this.playCollexctDropsAni();
this.entity.removeChild(body);
}
async playCollexctDropsAni() {
return new Promise((r) => {
setTimeout(() => {
r();
}, 1000);
})
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
......
......@@ -4249,123 +4249,7 @@
return Renderer;
}(ScillaComponent));
var dirtyFieldTrigger$2 = dirtyFieldTrigger;
var InteractComponent = (function (_super) {
__extends(InteractComponent, _super);
function InteractComponent() {
var _this = _super.call(this) || this;
_this.interactable = true;
_this.touchInterrupt = false;
_this.invertMatrix = Matrix.create();
_this.localPos = {};
_this.isOut = true;
return _this;
}
InteractComponent.prototype._dealGlobalTouchBegin = function (e) {
var interrupt = _super.prototype._dealGlobalTouchBegin.call(this, e);
var hitOn = this.hitTest(e);
if (hitOn) {
this._touchBeginFlag = true;
this.onTouchBegin(e);
this._dealTouchOver(e);
}
return hitOn && (interrupt || this.touchInterrupt);
};
InteractComponent.prototype._dealGlobalTouchMove = function (e) {
var interrupt = _super.prototype._dealGlobalTouchMove.call(this, e);
var hitOn = this.hitTest(e);
if (hitOn) {
this._dealTouchOver(e);
this.onTouchMove(e);
}
else {
this._dealTouchOut(e);
}
return hitOn && (interrupt || this.touchInterrupt);
};
InteractComponent.prototype._dealGlobalTouchEnd = function (e) {
var interrupt = _super.prototype._dealGlobalTouchEnd.call(this, e);
var hitOn = this.hitTest(e);
if (hitOn) {
this.onTouchEnd(e);
if (this._touchBeginFlag) {
this.onTouchTap(e);
this._touchBeginFlag = false;
}
}
this.isOut = true;
return hitOn && (interrupt || this.touchInterrupt);
};
InteractComponent.prototype._dealTouchOver = function (e) {
if (this.isOut) {
this.isOut = false;
this.onTouchOver(e);
}
};
InteractComponent.prototype._dealTouchOut = function (e) {
if (!this.isOut) {
this.isOut = true;
this.onTouchOut(e);
}
};
InteractComponent.prototype.onTouchBegin = function (e) {
};
InteractComponent.prototype.onTouchMove = function (e) {
};
InteractComponent.prototype.onTouchOver = function (e) {
};
InteractComponent.prototype.onTouchOut = function (e) {
};
InteractComponent.prototype.onTouchEnd = function (e) {
};
InteractComponent.prototype.onTouchTap = function (e) {
};
InteractComponent.prototype.hitTest = function (e) {
var e_1, _a;
var matrix = this.transform.getMatrix(true, true, true);
matrix.transformPoint(e.x, e.y, this.localPos);
var result = false;
var renderers = this.entity.getComponents(Renderer);
try {
for (var renderers_1 = __values(renderers), renderers_1_1 = renderers_1.next(); !renderers_1_1.done; renderers_1_1 = renderers_1.next()) {
var renderer = renderers_1_1.value;
if (renderer.hitTest(this.localPos.x, this.localPos.y)) {
if (!renderer['isUsedToMask']) {
result = true;
break;
}
}
else if (renderer['isUsedToMask']) {
return false;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (renderers_1_1 && !renderers_1_1.done && (_a = renderers_1.return)) _a.call(renderers_1);
}
finally { if (e_1) throw e_1.error; }
}
return result;
};
__decorate([
dirtyFieldTrigger$2
], InteractComponent.prototype, "interactable", void 0);
return InteractComponent;
}(ScillaComponent));
var TouchInterrupt = (function (_super) {
__extends(TouchInterrupt, _super);
function TouchInterrupt() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.touchInterrupt = true;
return _this;
}
return TouchInterrupt;
}(InteractComponent));
var dirtyFieldDetector$1 = dirtyFieldDetector, dirtyFieldTrigger$3 = dirtyFieldTrigger;
var dirtyFieldDetector$1 = dirtyFieldDetector, dirtyFieldTrigger$2 = dirtyFieldTrigger;
var MATRIX_ORDER;
(function (MATRIX_ORDER) {
MATRIX_ORDER[MATRIX_ORDER["SCALE_ROTATE"] = 0] = "SCALE_ROTATE";
......@@ -4556,19 +4440,19 @@
this.onUpdate(t);
};
__decorate([
dirtyFieldTrigger$3
dirtyFieldTrigger$2
], Transform.prototype, "position", void 0);
__decorate([
dirtyFieldTrigger$3
dirtyFieldTrigger$2
], Transform.prototype, "alpha", void 0);
__decorate([
dirtyFieldTrigger$3
dirtyFieldTrigger$2
], Transform.prototype, "affectChildren", void 0);
__decorate([
dirtyFieldTrigger$3
dirtyFieldTrigger$2
], Transform.prototype, "scale", void 0);
__decorate([
dirtyFieldTrigger$3
dirtyFieldTrigger$2
], Transform.prototype, "pivot", void 0);
__decorate([
dirtyFieldDetector$1
......@@ -4576,252 +4460,93 @@
return Transform;
}(ScillaComponent));
var TouchZoom = (function (_super) {
__extends(TouchZoom, _super);
function TouchZoom() {
var FullStageSize = (function (_super) {
__extends(FullStageSize, _super);
function FullStageSize() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.scaleOffset = createVector2D(0.1, 0.1);
_this.duration = 200;
_this.easeName = Ease.backOut;
_this.once = true;
_this.applyWidth = true;
_this.applyHeight = true;
return _this;
}
TouchZoom.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
if (!this._zoomIn) {
var _a = this, scaleOffset = _a.scaleOffset, duration = _a.duration, transform = _a.transform;
var easeFunc = ease[this.easeName];
var scaleFrom = transform.scale.clone();
var scaleTo = transform.scale.clone().add(scaleOffset);
this._zoomIn = createTween(this, transform, false, { autoPlay: false, fields: ['x', 'y'] })
.to({ scale: scaleTo }, duration, easeFunc);
this._zoomOut = createTween(this, transform, false, { autoPlay: false, fields: ['x', 'y'] })
.to({ scale: scaleFrom }, duration, easeFunc);
Object.defineProperty(FullStageSize.prototype, "stageSize", {
get: function () {
if (!this._stageSize) {
this._stageSize = getRenderContext().getStageSize();
}
return this._stageSize;
},
enumerable: true,
configurable: true
});
FullStageSize.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
};
TouchZoom.prototype.onTouchBegin = function (e) {
_super.prototype.onTouchOver.call(this, e);
if (this.interactable) {
this._touchBegin = true;
this._zoomIn.play(true);
FullStageSize.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
this.execute();
};
FullStageSize.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
if (!this.once) {
this.execute();
}
};
TouchZoom.prototype.onGlobalTouchEnd = function (e) {
_super.prototype.onGlobalTouchEnd.call(this, e);
if (this._touchBegin) {
this._touchBegin = false;
this._zoomOut.play(true);
FullStageSize.prototype.onEditorUpdate = function (t) {
_super.prototype.onEditorUpdate.call(this, t);
this.execute();
};
FullStageSize.prototype.execute = function () {
var _a = this.stageSize, width = _a.width, height = _a.height;
if (this.applyWidth) {
this.transform.width = width;
}
if (this.applyHeight) {
this.transform.height = height;
}
return false;
};
return TouchZoom;
}(InteractComponent));
return FullStageSize;
}(ScillaComponent));
var GraphicRenderer = (function (_super) {
__extends(GraphicRenderer, _super);
function GraphicRenderer() {
var dirtyFieldDetector$2 = dirtyFieldDetector;
var FillMode;
(function (FillMode) {
FillMode[FillMode["NORMAL"] = 0] = "NORMAL";
FillMode[FillMode["SLICED"] = 1] = "SLICED";
FillMode[FillMode["TILED"] = 2] = "TILED";
})(FillMode || (FillMode = {}));
var TextureRenderer = (function (_super) {
__extends(TextureRenderer, _super);
function TextureRenderer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.fillColor = '#42bce4';
_this.borderColor = '#0899d0';
_this.borderWidth = 0;
_this.isMask = false;
_this.maskVisible = false;
_this.fillMode = FillMode.NORMAL;
_this.filters = [];
return _this;
}
GraphicRenderer.prototype.getUseCacheMode = function () {
return this._useCacheMode && !this.isMask;
};
GraphicRenderer.prototype.getRenderSize = function () {
return { width: 0, height: 0 };
};
GraphicRenderer.prototype.beforeDraw = function () {
_super.prototype.beforeDraw.call(this);
this.applyStyle();
this.context.beginPath();
};
GraphicRenderer.prototype.draw = function () {
_super.prototype.draw.call(this);
if (this.isMask) {
this._context.clip();
this.maskVisible && this.fillAndStoke();
}
else {
this.fillAndStoke();
Object.defineProperty(TextureRenderer.prototype, "hasFilters", {
get: function () {
return this.filters && this.filters.length > 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TextureRenderer.prototype, "async_texture", {
set: function (promise) {
var _this = this;
if (!promise) {
return;
}
};
GraphicRenderer.prototype.applyStyle = function () {
var _a = this, context = _a.context, fillColor = _a.fillColor, borderColor = _a.borderColor, borderWidth = _a.borderWidth;
context.fillStyle = fillColor;
if (borderWidth > 0) {
context.strokeStyle = borderColor;
context.lineWidth = borderWidth;
}
};
GraphicRenderer.prototype.fillAndStoke = function () {
var _a = this, context = _a.context, borderWidth = _a.borderWidth;
context.fill();
if (borderWidth > 0) {
context.stroke();
}
};
GraphicRenderer.prototype.drawClip = function () {
this.isMask && this.context.save();
};
GraphicRenderer.prototype.afterUpdate = function () {
this.isMask && this.context.restore();
};
GraphicRenderer.prototype.afterEditorUpdate = function () {
this.afterUpdate();
};
GraphicRenderer.prototype.measureBounds = function () {
if (this.entity.name == 'content') {
console.log();
}
if (!this.dirty) {
return;
}
this._margin = this.borderWidth;
var _a = this, bounds = _a.bounds, _b = _a.transform, tWidth = _b.explicitWidth, tHeight = _b.explicitHeight;
var _c = this.getRenderSize(), sWidth = _c.width, sHeight = _c.height;
bounds.width = isNaN(tWidth) ? sWidth : tWidth;
bounds.height = isNaN(tHeight) ? sHeight : tHeight;
_super.prototype.measureBounds.call(this);
};
return GraphicRenderer;
}(Renderer));
var dirtyFieldDetector$2 = dirtyFieldDetector;
var RectRenderer = (function (_super) {
__extends(RectRenderer, _super);
function RectRenderer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.width = 100;
_this.height = 100;
_this.cornerRadius = 0;
return _this;
}
RectRenderer.prototype.getRenderSize = function () {
var _a = this, width = _a.width, height = _a.height;
return { width: width, height: height };
};
RectRenderer.prototype.draw = function () {
var PI = Math.PI;
var _a = this, context = _a.context, r = _a.cornerRadius, _b = _a.bounds, width = _b.width, height = _b.height, _margin = _a._margin, _useCacheMode = _a._useCacheMode;
var offset = _useCacheMode ? _margin : 0;
if (r) {
context.moveTo(offset + r, offset + 0);
context.lineTo(offset + width - r, offset + 0);
context.arc(offset + width - r, offset + r, r, PI * 3 / 2, PI * 2);
context.lineTo(offset + width, offset + height - r);
context.arc(offset + width - r, offset + height - r, r, 0, PI / 2);
context.lineTo(offset + r, offset + height);
context.arc(offset + r, offset + height - r, r, PI / 2, PI);
context.lineTo(offset + 0, offset + r);
context.arc(offset + r, offset + r, r, PI, PI * 3 / 2);
}
else {
context.rect(offset, offset, width, height);
}
_super.prototype.draw.call(this);
};
__decorate([
dirtyFieldDetector$2
], RectRenderer.prototype, "width", void 0);
__decorate([
dirtyFieldDetector$2
], RectRenderer.prototype, "height", void 0);
__decorate([
dirtyFieldDetector$2
], RectRenderer.prototype, "cornerRadius", void 0);
return RectRenderer;
}(GraphicRenderer));
var FullStageSize = (function (_super) {
__extends(FullStageSize, _super);
function FullStageSize() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.once = true;
_this.applyWidth = true;
_this.applyHeight = true;
return _this;
}
Object.defineProperty(FullStageSize.prototype, "stageSize", {
get: function () {
if (!this._stageSize) {
this._stageSize = getRenderContext().getStageSize();
}
return this._stageSize;
},
enumerable: true,
configurable: true
});
FullStageSize.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
};
FullStageSize.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
this.execute();
};
FullStageSize.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
if (!this.once) {
this.execute();
}
};
FullStageSize.prototype.onEditorUpdate = function (t) {
_super.prototype.onEditorUpdate.call(this, t);
this.execute();
};
FullStageSize.prototype.execute = function () {
var _a = this.stageSize, width = _a.width, height = _a.height;
if (this.applyWidth) {
this.transform.width = width;
}
if (this.applyHeight) {
this.transform.height = height;
}
};
return FullStageSize;
}(ScillaComponent));
var dirtyFieldDetector$3 = dirtyFieldDetector;
var FillMode;
(function (FillMode) {
FillMode[FillMode["NORMAL"] = 0] = "NORMAL";
FillMode[FillMode["SLICED"] = 1] = "SLICED";
FillMode[FillMode["TILED"] = 2] = "TILED";
})(FillMode || (FillMode = {}));
var TextureRenderer = (function (_super) {
__extends(TextureRenderer, _super);
function TextureRenderer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.fillMode = FillMode.NORMAL;
_this.filters = [];
return _this;
}
Object.defineProperty(TextureRenderer.prototype, "hasFilters", {
get: function () {
return this.filters && this.filters.length > 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TextureRenderer.prototype, "async_texture", {
set: function (promise) {
var _this = this;
if (!promise) {
return;
}
promise.then(function (texture) {
_this.texture = texture;
});
},
enumerable: true,
configurable: true
});
TextureRenderer.prototype.draw = function () {
_super.prototype.draw.call(this);
this.drawImage();
this.applyFilters();
promise.then(function (texture) {
_this.texture = texture;
});
},
enumerable: true,
configurable: true
});
TextureRenderer.prototype.draw = function () {
_super.prototype.draw.call(this);
this.drawImage();
this.applyFilters();
};
TextureRenderer.prototype.applyFilters = function () {
var e_1, _a;
......@@ -4883,13 +4608,13 @@
_super.prototype.measureBounds.call(this);
};
__decorate([
dirtyFieldDetector$3
dirtyFieldDetector$2
], TextureRenderer.prototype, "texture", void 0);
__decorate([
dirtyFieldDetector$3
dirtyFieldDetector$2
], TextureRenderer.prototype, "fillMode", void 0);
__decorate([
dirtyFieldDetector$3
dirtyFieldDetector$2
], TextureRenderer.prototype, "filters", void 0);
return TextureRenderer;
}(Renderer));
......@@ -5042,7 +4767,80 @@
return RelativeLayout;
}(ScillaComponent));
var dirtyFieldDetector$4 = dirtyFieldDetector, dirtyFieldTrigger$4 = dirtyFieldTrigger;
var GraphicRenderer = (function (_super) {
__extends(GraphicRenderer, _super);
function GraphicRenderer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.fillColor = '#42bce4';
_this.borderColor = '#0899d0';
_this.borderWidth = 0;
_this.isMask = false;
_this.maskVisible = false;
return _this;
}
GraphicRenderer.prototype.getUseCacheMode = function () {
return this._useCacheMode && !this.isMask;
};
GraphicRenderer.prototype.getRenderSize = function () {
return { width: 0, height: 0 };
};
GraphicRenderer.prototype.beforeDraw = function () {
_super.prototype.beforeDraw.call(this);
this.applyStyle();
this.context.beginPath();
};
GraphicRenderer.prototype.draw = function () {
_super.prototype.draw.call(this);
if (this.isMask) {
this._context.clip();
this.maskVisible && this.fillAndStoke();
}
else {
this.fillAndStoke();
}
};
GraphicRenderer.prototype.applyStyle = function () {
var _a = this, context = _a.context, fillColor = _a.fillColor, borderColor = _a.borderColor, borderWidth = _a.borderWidth;
context.fillStyle = fillColor;
if (borderWidth > 0) {
context.strokeStyle = borderColor;
context.lineWidth = borderWidth;
}
};
GraphicRenderer.prototype.fillAndStoke = function () {
var _a = this, context = _a.context, borderWidth = _a.borderWidth;
context.fill();
if (borderWidth > 0) {
context.stroke();
}
};
GraphicRenderer.prototype.drawClip = function () {
this.isMask && this.context.save();
};
GraphicRenderer.prototype.afterUpdate = function () {
this.isMask && this.context.restore();
};
GraphicRenderer.prototype.afterEditorUpdate = function () {
this.afterUpdate();
};
GraphicRenderer.prototype.measureBounds = function () {
if (this.entity.name == 'content') {
console.log();
}
if (!this.dirty) {
return;
}
this._margin = this.borderWidth;
var _a = this, bounds = _a.bounds, _b = _a.transform, tWidth = _b.explicitWidth, tHeight = _b.explicitHeight;
var _c = this.getRenderSize(), sWidth = _c.width, sHeight = _c.height;
bounds.width = isNaN(tWidth) ? sWidth : tWidth;
bounds.height = isNaN(tHeight) ? sHeight : tHeight;
_super.prototype.measureBounds.call(this);
};
return GraphicRenderer;
}(Renderer));
var dirtyFieldDetector$3 = dirtyFieldDetector, dirtyFieldTrigger$3 = dirtyFieldTrigger;
var TextAlign;
(function (TextAlign) {
TextAlign["LEFT"] = "left";
......@@ -5395,91 +5193,352 @@
lineWidth = 0;
index = 0;
}
else {
measureResult = this.measureText(char);
if (measureResult.width == 0) {
continue;
else {
measureResult = this.measureText(char);
if (measureResult.width == 0) {
continue;
}
charWidth = measureResult.width;
var mh = measureResult.height;
if (mh > maxHeight) {
maxHeight = mh;
}
if (index > 0 && lineWidth + charWidth + (index == 0 ? 0 : letterSpacing) > explicitWidth) {
rows.push({
text: line,
lineWidth: lineWidth,
});
line = '';
lineWidth = 0;
index = 0;
}
line += char;
lineWidth += charWidth + (index == 0 ? 0 : letterSpacing);
index++;
}
}
this._bmpLineHeight = maxHeight;
rows.push({
text: line,
lineWidth: lineWidth,
});
textWidth = explicitWidth;
}
textHeight = isNaN(explicitHeight) ? (maxHeight * rows.length + lineSpacing * (rows.length - 1)) : explicitHeight;
}
else {
textWidth = isNaN(explicitWidth) ? 0 : explicitWidth;
textHeight = isNaN(explicitHeight) ? 0 : explicitHeight;
}
this.rows = rows;
this._textWidth = textWidth;
this._textHeight = textHeight;
return {
rows: rows,
textWidth: textWidth,
textHeight: textHeight,
};
};
TextRenderer.prototype.measureBounds = function () {
if (!this.dirty) {
return;
}
if (!this.isBmpMode) {
this.applyTextStyle();
}
this.splitText();
_super.prototype.measureBounds.call(this);
};
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "text", void 0);
__decorate([
dirtyFieldTrigger$3
], TextRenderer.prototype, "textFlow", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "textAlign", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "verticalAlign", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "lineSpacing", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "letterSpacing", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "fontRes", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "textStyle", void 0);
__decorate([
dirtyFieldDetector$3
], TextRenderer.prototype, "useCacheMode", void 0);
return TextRenderer;
}(GraphicRenderer));
var dirtyFieldDetector$4 = dirtyFieldDetector;
var RectRenderer = (function (_super) {
__extends(RectRenderer, _super);
function RectRenderer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.width = 100;
_this.height = 100;
_this.cornerRadius = 0;
return _this;
}
RectRenderer.prototype.getRenderSize = function () {
var _a = this, width = _a.width, height = _a.height;
return { width: width, height: height };
};
RectRenderer.prototype.draw = function () {
var PI = Math.PI;
var _a = this, context = _a.context, r = _a.cornerRadius, _b = _a.bounds, width = _b.width, height = _b.height, _margin = _a._margin, _useCacheMode = _a._useCacheMode;
var offset = _useCacheMode ? _margin : 0;
if (r) {
context.moveTo(offset + r, offset + 0);
context.lineTo(offset + width - r, offset + 0);
context.arc(offset + width - r, offset + r, r, PI * 3 / 2, PI * 2);
context.lineTo(offset + width, offset + height - r);
context.arc(offset + width - r, offset + height - r, r, 0, PI / 2);
context.lineTo(offset + r, offset + height);
context.arc(offset + r, offset + height - r, r, PI / 2, PI);
context.lineTo(offset + 0, offset + r);
context.arc(offset + r, offset + r, r, PI, PI * 3 / 2);
}
else {
context.rect(offset, offset, width, height);
}
_super.prototype.draw.call(this);
};
__decorate([
dirtyFieldDetector$4
], RectRenderer.prototype, "width", void 0);
__decorate([
dirtyFieldDetector$4
], RectRenderer.prototype, "height", void 0);
__decorate([
dirtyFieldDetector$4
], RectRenderer.prototype, "cornerRadius", void 0);
return RectRenderer;
}(GraphicRenderer));
var CameraController = (function (_super) {
__extends(CameraController, _super);
function CameraController() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.viewportAnchor = createVector2D(0.5, 0.5);
_this.maxScale = 1.2;
_this.once = true;
return _this;
}
CameraController.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
var target = this.target;
if (target) {
this.targetPosition = target.getComponent(Transform).position;
}
this.followPosition = createVector2D();
if (this.once) {
this.updateViewport();
}
};
Object.defineProperty(CameraController.prototype, "stageSize", {
get: function () {
if (!this._stageSize) {
this._stageSize = getRenderContext().getStageSize();
}
return this._stageSize;
},
enumerable: true,
configurable: true
});
CameraController.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
if (!this.once) {
this.updateViewport();
}
this.followTarget();
};
CameraController.prototype.onEditorUpdate = function (t) {
this.updateViewport();
};
CameraController.prototype.updateViewport = function () {
if (this.viewportAnchor) {
var _a = this.stageSize, width = _a.width, height = _a.height;
var _b = this.viewportAnchor, x_1 = _b.x, y = _b.y;
this.transform.position.setXY(width * x_1, height * y);
}
};
CameraController.prototype.followTarget = function () {
if (!this.targetPosition) {
return;
}
var _a = this, _b = _a.transform, scale = _b.scale, position = _b.position, _c = _a.stageSize, width = _c.width, height = _c.height, _d = _a.targetPosition, x = _d.x, y = _d.y, length = _d.length, maxScale = _a.maxScale;
var newScale = maxScale - length * maxScale / 2048;
scale.setXY(newScale, newScale);
this.followPosition.setXY(width / 2, height / 2).subtract(this.targetPosition);
};
return CameraController;
}(ScillaComponent));
var dirtyFieldTrigger$4 = dirtyFieldTrigger;
var InteractComponent = (function (_super) {
__extends(InteractComponent, _super);
function InteractComponent() {
var _this = _super.call(this) || this;
_this.interactable = true;
_this.touchInterrupt = false;
_this.invertMatrix = Matrix.create();
_this.localPos = {};
_this.isOut = true;
return _this;
}
InteractComponent.prototype._dealGlobalTouchBegin = function (e) {
var interrupt = _super.prototype._dealGlobalTouchBegin.call(this, e);
var hitOn = this.hitTest(e);
if (hitOn) {
this._touchBeginFlag = true;
this.onTouchBegin(e);
this._dealTouchOver(e);
}
return hitOn && (interrupt || this.touchInterrupt);
};
InteractComponent.prototype._dealGlobalTouchMove = function (e) {
var interrupt = _super.prototype._dealGlobalTouchMove.call(this, e);
var hitOn = this.hitTest(e);
if (hitOn) {
this._dealTouchOver(e);
this.onTouchMove(e);
}
else {
this._dealTouchOut(e);
}
return hitOn && (interrupt || this.touchInterrupt);
};
InteractComponent.prototype._dealGlobalTouchEnd = function (e) {
var interrupt = _super.prototype._dealGlobalTouchEnd.call(this, e);
var hitOn = this.hitTest(e);
if (hitOn) {
this.onTouchEnd(e);
if (this._touchBeginFlag) {
this.onTouchTap(e);
this._touchBeginFlag = false;
}
}
this.isOut = true;
return hitOn && (interrupt || this.touchInterrupt);
};
InteractComponent.prototype._dealTouchOver = function (e) {
if (this.isOut) {
this.isOut = false;
this.onTouchOver(e);
}
};
InteractComponent.prototype._dealTouchOut = function (e) {
if (!this.isOut) {
this.isOut = true;
this.onTouchOut(e);
}
};
InteractComponent.prototype.onTouchBegin = function (e) {
};
InteractComponent.prototype.onTouchMove = function (e) {
};
InteractComponent.prototype.onTouchOver = function (e) {
};
InteractComponent.prototype.onTouchOut = function (e) {
};
InteractComponent.prototype.onTouchEnd = function (e) {
};
InteractComponent.prototype.onTouchTap = function (e) {
};
InteractComponent.prototype.hitTest = function (e) {
var e_1, _a;
var matrix = this.transform.getMatrix(true, true, true);
matrix.transformPoint(e.x, e.y, this.localPos);
var result = false;
var renderers = this.entity.getComponents(Renderer);
try {
for (var renderers_1 = __values(renderers), renderers_1_1 = renderers_1.next(); !renderers_1_1.done; renderers_1_1 = renderers_1.next()) {
var renderer = renderers_1_1.value;
if (renderer.hitTest(this.localPos.x, this.localPos.y)) {
if (!renderer['isUsedToMask']) {
result = true;
break;
}
}
charWidth = measureResult.width;
var mh = measureResult.height;
if (mh > maxHeight) {
maxHeight = mh;
else if (renderer['isUsedToMask']) {
return false;
}
if (index > 0 && lineWidth + charWidth + (index == 0 ? 0 : letterSpacing) > explicitWidth) {
rows.push({
text: line,
lineWidth: lineWidth,
});
line = '';
lineWidth = 0;
index = 0;
}
line += char;
lineWidth += charWidth + (index == 0 ? 0 : letterSpacing);
index++;
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (renderers_1_1 && !renderers_1_1.done && (_a = renderers_1.return)) _a.call(renderers_1);
}
this._bmpLineHeight = maxHeight;
rows.push({
text: line,
lineWidth: lineWidth,
});
textWidth = explicitWidth;
finally { if (e_1) throw e_1.error; }
}
textHeight = isNaN(explicitHeight) ? (maxHeight * rows.length + lineSpacing * (rows.length - 1)) : explicitHeight;
return result;
};
__decorate([
dirtyFieldTrigger$4
], InteractComponent.prototype, "interactable", void 0);
return InteractComponent;
}(ScillaComponent));
var TouchInterrupt = (function (_super) {
__extends(TouchInterrupt, _super);
function TouchInterrupt() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.touchInterrupt = true;
return _this;
}
else {
textWidth = isNaN(explicitWidth) ? 0 : explicitWidth;
textHeight = isNaN(explicitHeight) ? 0 : explicitHeight;
return TouchInterrupt;
}(InteractComponent));
var TouchZoom = (function (_super) {
__extends(TouchZoom, _super);
function TouchZoom() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.scaleOffset = createVector2D(0.1, 0.1);
_this.duration = 200;
_this.easeName = Ease.backOut;
return _this;
}
TouchZoom.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
if (!this._zoomIn) {
var _a = this, scaleOffset = _a.scaleOffset, duration = _a.duration, transform = _a.transform;
var easeFunc = ease[this.easeName];
var scaleFrom = transform.scale.clone();
var scaleTo = transform.scale.clone().add(scaleOffset);
this._zoomIn = createTween(this, transform, false, { autoPlay: false, fields: ['x', 'y'] })
.to({ scale: scaleTo }, duration, easeFunc);
this._zoomOut = createTween(this, transform, false, { autoPlay: false, fields: ['x', 'y'] })
.to({ scale: scaleFrom }, duration, easeFunc);
}
this.rows = rows;
this._textWidth = textWidth;
this._textHeight = textHeight;
return {
rows: rows,
textWidth: textWidth,
textHeight: textHeight,
};
};
TextRenderer.prototype.measureBounds = function () {
if (!this.dirty) {
return;
TouchZoom.prototype.onTouchBegin = function (e) {
_super.prototype.onTouchOver.call(this, e);
if (this.interactable) {
this._touchBegin = true;
this._zoomIn.play(true);
}
if (!this.isBmpMode) {
this.applyTextStyle();
};
TouchZoom.prototype.onGlobalTouchEnd = function (e) {
_super.prototype.onGlobalTouchEnd.call(this, e);
if (this._touchBegin) {
this._touchBegin = false;
this._zoomOut.play(true);
}
this.splitText();
_super.prototype.measureBounds.call(this);
return false;
};
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "text", void 0);
__decorate([
dirtyFieldTrigger$4
], TextRenderer.prototype, "textFlow", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "textAlign", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "verticalAlign", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "lineSpacing", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "letterSpacing", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "fontRes", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "textStyle", void 0);
__decorate([
dirtyFieldDetector$4
], TextRenderer.prototype, "useCacheMode", void 0);
return TextRenderer;
}(GraphicRenderer));
return TouchZoom;
}(InteractComponent));
var dirtyFieldDetector$5 = dirtyFieldDetector;
var CircleRenderer = (function (_super) {
......@@ -5731,65 +5790,6 @@
return Button;
}(InteractComponent));
var CameraController = (function (_super) {
__extends(CameraController, _super);
function CameraController() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.viewportAnchor = createVector2D(0.5, 0.5);
_this.maxScale = 1.2;
_this.once = true;
return _this;
}
CameraController.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
var target = this.target;
if (target) {
this.targetPosition = target.getComponent(Transform).position;
}
this.followPosition = createVector2D();
if (this.once) {
this.updateViewport();
}
};
Object.defineProperty(CameraController.prototype, "stageSize", {
get: function () {
if (!this._stageSize) {
this._stageSize = getRenderContext().getStageSize();
}
return this._stageSize;
},
enumerable: true,
configurable: true
});
CameraController.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
if (!this.once) {
this.updateViewport();
}
this.followTarget();
};
CameraController.prototype.onEditorUpdate = function (t) {
this.updateViewport();
};
CameraController.prototype.updateViewport = function () {
if (this.viewportAnchor) {
var _a = this.stageSize, width = _a.width, height = _a.height;
var _b = this.viewportAnchor, x_1 = _b.x, y = _b.y;
this.transform.position.setXY(width * x_1, height * y);
}
};
CameraController.prototype.followTarget = function () {
if (!this.targetPosition) {
return;
}
var _a = this, _b = _a.transform, scale = _b.scale, position = _b.position, _c = _a.stageSize, width = _c.width, height = _c.height, _d = _a.targetPosition, x = _d.x, y = _d.y, length = _d.length, maxScale = _a.maxScale;
var newScale = maxScale - length * maxScale / 2048;
scale.setXY(newScale, newScale);
this.followPosition.setXY(width / 2, height / 2).subtract(this.targetPosition);
};
return CameraController;
}(ScillaComponent));
var originScale = createVector2D(1, 1);
var BounceZoom = (function (_super) {
__extends(BounceZoom, _super);
......@@ -6929,159 +6929,34 @@
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
injectProp(this.params, { duibaId: this.duibaId, throughId: this.throughId });
_super.prototype.execute.call(this);
return [2];
});
});
};
return AjaxThroughInfoComponent;
}(SampleApi));
var ThroughSubmitComponent = (function (_super) {
__extends(ThroughSubmitComponent, _super);
function ThroughSubmitComponent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.name = 'throughSubmit';
_this.uri = '/hdtool/recon/throughSubmit';
_this.method = 'GET';
return _this;
}
ThroughSubmitComponent.prototype.execute = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
injectProp(this.params, { orderId: this.orderId });
_super.prototype.execute.call(this);
return [2];
});
});
};
return ThroughSubmitComponent;
}(SampleApi));
var eventEmitter = new EventEmitter();
var SceneStart = (function (_super) {
__extends(SceneStart, _super);
function SceneStart() {
return _super !== null && _super.apply(this, arguments) || this;
}
SceneStart.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
};
SceneStart.prototype.onClick_startbtn = function () {
console.log('onClick_startbtn');
eventEmitter.emit('popup', { name: 'RulePanel', params: {} }, this.onAlertClose);
};
SceneStart.prototype.onAlertClose = function () {
console.log('onAlertClose');
};
SceneStart.prototype.onClick_rankbtn = function () {
alert('onClick_rankbtn');
};
SceneStart.prototype.onDidEnter = function (last, action, parameters) {
this.entity.getComponent(Transform).alpha = 1;
};
SceneStart.prototype.onDidLeave = function (next, action, parameters) {
this.entity.getComponent(Transform).alpha = 0;
};
SceneStart.prototype.onWillEnter = function (last, action, parameters) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2];
});
});
};
SceneStart.prototype.onWillLeave = function (next, action, parameters) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
_super.prototype.execute.call(this);
return [2];
});
});
};
SceneStart.prototype.onWillMount = function (last, action, parameters) {
return undefined;
};
SceneStart.prototype.onWillUnMount = function (next, action, parameters) {
return undefined;
};
return SceneStart;
}(Component));
var DialogContent = (function (_super) {
__extends(DialogContent, _super);
function DialogContent() {
return _super !== null && _super.apply(this, arguments) || this;
}
DialogContent.prototype.setup = function (data) {
};
return DialogContent;
}(ScillaComponent));
return AjaxThroughInfoComponent;
}(SampleApi));
var Popup = (function (_super) {
__extends(Popup, _super);
function Popup() {
var ThroughSubmitComponent = (function (_super) {
__extends(ThroughSubmitComponent, _super);
function ThroughSubmitComponent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.showDuration = 300;
_this.hideDuration = 200;
_this.name = 'throughSubmit';
_this.uri = '/hdtool/recon/throughSubmit';
_this.method = 'GET';
return _this;
}
Popup.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
this._stageSize = getRenderContext().getStageSize();
this._touchInterrupt = this.entity.getComponent(TouchInterrupt);
this._touchInterrupt.enabled = false;
var bgRenderer = this._bgRenderer = this.entity.getComponent(RectRenderer);
bgRenderer.enabled = false;
eventEmitter.on('popup', this.onShowAlert, this);
};
Popup.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
Popup.prototype.onSleep = function () {
_super.prototype.onSleep.call(this);
};
Popup.prototype.onDestroy = function () {
_super.prototype.onDestroy.call(this);
};
Popup.prototype.setBgVisible = function (visible) {
this._bgRenderer.enabled = visible;
this._touchInterrupt.enabled = visible;
};
Popup.prototype.setupDialog = function (dialog, data) {
dialog.enabled = true;
var content = dialog.getComponent(DialogContent);
content.setup(data);
};
Popup.prototype.showDialog = function (name, params, callback) {
var dialog = this.entity.getChildrenByName(name)[0];
var parent = dialog.parent;
parent.removeChild(dialog);
parent.addChildAt(dialog, parent.children.length);
this._callback = callback;
this.setBgVisible(true);
this.setupDialog(dialog, params);
var transform = dialog.getComponent(Transform);
transform.position.setXY(0, -this._stageSize.height);
createTween(this, transform.position)
.to({ x: 0, y: 0 }, this.showDuration, backOut);
};
Popup.prototype.hideDialog = function (name) {
var dialog = this.entity.getChildrenByName(name)[0];
this.setBgVisible(false);
var transform = dialog.getComponent(Transform);
createTween(this, transform.position)
.to({ y: -this._stageSize.height }, this.hideDuration, backIn)
.call(function () {
this._callback && this._callback();
this._callback = null;
}, this);
};
Popup.prototype.onShowAlert = function (data, callback) {
var name = data.name, params = data.params;
this.showDialog(name, params, callback);
ThroughSubmitComponent.prototype.execute = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
injectProp(this.params, { orderId: this.orderId });
_super.prototype.execute.call(this);
return [2];
});
});
};
return Popup;
}(Component));
return ThroughSubmitComponent;
}(SampleApi));
var gravityY = 1.5;
......@@ -7177,7 +7052,7 @@
var body = _c.value;
var position = body.getComponent(Transform).position;
var pic = body.getChildrenByName('pic')[0];
var height = pic.getComponent(Transform).height;
var _d = pic.getComponent(Transform), height = _d.height, width = _d.width;
var r = height / 2;
if (position.y + r > GROUND_Y) {
position.y = GROUND_Y - r;
......@@ -7191,6 +7066,15 @@
position.x = -375 + r;
body.getComponent(Body).revertX();
}
var _e = this.car.getComponent(Transform).position, carX = _e.x, carY = _e.y;
var x0 = Math.abs(position.x - carX);
var y0 = Math.abs(position.y - carY);
var x1 = r + 120 / 2;
var y1 = r + 110 / 2;
if (x0 < x1 && y0 < y1) {
console.log('碰撞了');
this.onCarCollideDrops(body);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
......@@ -7201,6 +7085,37 @@
finally { if (e_1) throw e_1.error; }
}
};
ScenePlay.prototype.onCarCollideDrops = function (body) {
return __awaiter(this, void 0, void 0, function () {
var index;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
index = this.bodys.indexOf(body);
if (index == -1)
return [2];
this.bodys.splice(index, 1);
body.removeComponent(body.getComponent(Body));
return [4, this.playCollexctDropsAni()];
case 1:
_a.sent();
this.entity.removeChild(body);
return [2];
}
});
});
};
ScenePlay.prototype.playCollexctDropsAni = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2, new Promise(function (r) {
setTimeout(function () {
r();
}, 1000);
})];
});
});
};
ScenePlay.prototype.onDidEnter = function (last, action, parameters) {
this.entity.getComponent(Transform).alpha = 1;
this.getRedFireItem();
......@@ -7231,6 +7146,55 @@
return ScenePlay;
}(InteractComponent));
var eventEmitter = new EventEmitter();
var SceneStart = (function (_super) {
__extends(SceneStart, _super);
function SceneStart() {
return _super !== null && _super.apply(this, arguments) || this;
}
SceneStart.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
};
SceneStart.prototype.onClick_startbtn = function () {
console.log('onClick_startbtn');
eventEmitter.emit('popup', { name: 'RulePanel', params: {} }, this.onAlertClose);
};
SceneStart.prototype.onAlertClose = function () {
console.log('onAlertClose');
};
SceneStart.prototype.onClick_rankbtn = function () {
alert('onClick_rankbtn');
};
SceneStart.prototype.onDidEnter = function (last, action, parameters) {
this.entity.getComponent(Transform).alpha = 1;
};
SceneStart.prototype.onDidLeave = function (next, action, parameters) {
this.entity.getComponent(Transform).alpha = 0;
};
SceneStart.prototype.onWillEnter = function (last, action, parameters) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2];
});
});
};
SceneStart.prototype.onWillLeave = function (next, action, parameters) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2];
});
});
};
SceneStart.prototype.onWillMount = function (last, action, parameters) {
return undefined;
};
SceneStart.prototype.onWillUnMount = function (next, action, parameters) {
return undefined;
};
return SceneStart;
}(Component));
var alien;
(function (alien) {
var NavigatorAction;
......@@ -7465,6 +7429,82 @@
return SingleSceneNavigator;
}(Component));
var DialogContent = (function (_super) {
__extends(DialogContent, _super);
function DialogContent() {
return _super !== null && _super.apply(this, arguments) || this;
}
DialogContent.prototype.setup = function (data) {
};
return DialogContent;
}(ScillaComponent));
var Popup = (function (_super) {
__extends(Popup, _super);
function Popup() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.showDuration = 300;
_this.hideDuration = 200;
return _this;
}
Popup.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
this._stageSize = getRenderContext().getStageSize();
this._touchInterrupt = this.entity.getComponent(TouchInterrupt);
this._touchInterrupt.enabled = false;
var bgRenderer = this._bgRenderer = this.entity.getComponent(RectRenderer);
bgRenderer.enabled = false;
eventEmitter.on('popup', this.onShowAlert, this);
};
Popup.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
Popup.prototype.onSleep = function () {
_super.prototype.onSleep.call(this);
};
Popup.prototype.onDestroy = function () {
_super.prototype.onDestroy.call(this);
};
Popup.prototype.setBgVisible = function (visible) {
this._bgRenderer.enabled = visible;
this._touchInterrupt.enabled = visible;
};
Popup.prototype.setupDialog = function (dialog, data) {
dialog.enabled = true;
var content = dialog.getComponent(DialogContent);
content.setup(data);
};
Popup.prototype.showDialog = function (name, params, callback) {
var dialog = this.entity.getChildrenByName(name)[0];
var parent = dialog.parent;
parent.removeChild(dialog);
parent.addChildAt(dialog, parent.children.length);
this._callback = callback;
this.setBgVisible(true);
this.setupDialog(dialog, params);
var transform = dialog.getComponent(Transform);
transform.position.setXY(0, -this._stageSize.height);
createTween(this, transform.position)
.to({ x: 0, y: 0 }, this.showDuration, backOut);
};
Popup.prototype.hideDialog = function (name) {
var dialog = this.entity.getChildrenByName(name)[0];
this.setBgVisible(false);
var transform = dialog.getComponent(Transform);
createTween(this, transform.position)
.to({ y: -this._stageSize.height }, this.hideDuration, backIn)
.call(function () {
this._callback && this._callback();
this._callback = null;
}, this);
};
Popup.prototype.onShowAlert = function (data, callback) {
var name = data.name, params = data.params;
this.showDialog(name, params, callback);
};
return Popup;
}(Component));
var RulePanel = (function (_super) {
__extends(RulePanel, _super);
function RulePanel() {
......@@ -7485,24 +7525,24 @@
return BallItem;
}(Body));
registerDef('components/animation/TouchZoom', TouchZoom);
registerDef('components/base/Transform', Transform);
registerDef('components/renderer/RectRenderer', RectRenderer);
registerDef('components/other/FullStageSize', FullStageSize);
registerDef('components/base/TouchInterrupt', TouchInterrupt);
registerDef('components/renderer/TextureRenderer', TextureRenderer);
registerDef('components/other/RelativeLayout', RelativeLayout);
registerDef('components/renderer/TextRenderer', TextRenderer);
registerDef('components/ui/Button', Button);
registerDef('components/renderer/RectRenderer', RectRenderer);
registerDef('components/other/CameraController', CameraController);
registerDef('./scripts/scenes/SceneStart', SceneStart);
registerDef('./scripts/popup/Popup', Popup);
registerDef('components/animation/TouchZoom', TouchZoom);
registerDef('components/ui/Button', Button);
registerDef('components/base/TouchInterrupt', TouchInterrupt);
registerDef('./scripts/scenes/ScenePlay', ScenePlay);
registerDef('./scripts/navigator/SingleSceneNavigator', SingleSceneNavigator);
registerDef('./scripts/popup/Popup', Popup);
registerDef('./scripts/scenes/RedFireItem', RedFireItem);
registerDef('./scripts/dialogs/RulePanel', RulePanel);
registerDef('./scripts/scenes/BallItem', BallItem);
registerDef('./scripts/scenes/BlueRocketItem', BlueRocketItem);
registerDef('./scripts/scenes/RedFireItem', RedFireItem);
registerDef('./scripts/scenes/SceneStart', SceneStart);
modifyEngineConfig({
lineHeightRatio: 1.2,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,47 +5,47 @@
import {registerDef} from 'scilla'
import component0 from 'components/animation/TouchZoom';
registerDef('components/animation/TouchZoom', component0);
import component0 from 'components/base/Transform';
registerDef('components/base/Transform', component0);
import component1 from 'components/base/Transform';
registerDef('components/base/Transform', component1);
import component1 from 'components/other/FullStageSize';
registerDef('components/other/FullStageSize', component1);
import component2 from 'components/renderer/RectRenderer';
registerDef('components/renderer/RectRenderer', component2);
import component2 from 'components/renderer/TextureRenderer';
registerDef('components/renderer/TextureRenderer', component2);
import component3 from 'components/other/FullStageSize';
registerDef('components/other/FullStageSize', component3);
import component3 from 'components/other/RelativeLayout';
registerDef('components/other/RelativeLayout', component3);
import component4 from 'components/base/TouchInterrupt';
registerDef('components/base/TouchInterrupt', component4);
import component4 from 'components/renderer/TextRenderer';
registerDef('components/renderer/TextRenderer', component4);
import component5 from 'components/renderer/TextureRenderer';
registerDef('components/renderer/TextureRenderer', component5);
import component5 from 'components/renderer/RectRenderer';
registerDef('components/renderer/RectRenderer', component5);
import component6 from 'components/other/RelativeLayout';
registerDef('components/other/RelativeLayout', component6);
import component6 from 'components/other/CameraController';
registerDef('components/other/CameraController', component6);
import component7 from 'components/renderer/TextRenderer';
registerDef('components/renderer/TextRenderer', component7);
import component7 from 'components/animation/TouchZoom';
registerDef('components/animation/TouchZoom', component7);
import component8 from 'components/ui/Button';
registerDef('components/ui/Button', component8);
import component9 from 'components/other/CameraController';
registerDef('components/other/CameraController', component9);
import component9 from 'components/base/TouchInterrupt';
registerDef('components/base/TouchInterrupt', component9);
import component10 from '../../assets/scripts/scenes/SceneStart';
registerDef('./scripts/scenes/SceneStart', component10);
import component10 from '../../assets/scripts/scenes/ScenePlay';
registerDef('./scripts/scenes/ScenePlay', component10);
import component11 from '../../assets/scripts/popup/Popup';
registerDef('./scripts/popup/Popup', component11);
import component11 from '../../assets/scripts/navigator/SingleSceneNavigator';
registerDef('./scripts/navigator/SingleSceneNavigator', component11);
import component12 from '../../assets/scripts/scenes/ScenePlay';
registerDef('./scripts/scenes/ScenePlay', component12);
import component12 from '../../assets/scripts/popup/Popup';
registerDef('./scripts/popup/Popup', component12);
import component13 from '../../assets/scripts/navigator/SingleSceneNavigator';
registerDef('./scripts/navigator/SingleSceneNavigator', component13);
import component13 from '../../assets/scripts/scenes/RedFireItem';
registerDef('./scripts/scenes/RedFireItem', component13);
import component14 from '../../assets/scripts/dialogs/RulePanel';
registerDef('./scripts/dialogs/RulePanel', component14);
......@@ -53,9 +53,8 @@ registerDef('./scripts/dialogs/RulePanel', component14);
import component15 from '../../assets/scripts/scenes/BallItem';
registerDef('./scripts/scenes/BallItem', component15);
import component16 from '../../assets/scripts/scenes/BlueRocketItem';
registerDef('./scripts/scenes/BlueRocketItem', component16);
import component17 from '../../assets/scripts/scenes/BlueRocketItem';
registerDef('./scripts/scenes/BlueRocketItem', component17);
import component18 from '../../assets/scripts/scenes/RedFireItem';
registerDef('./scripts/scenes/RedFireItem', component18);
import component17 from '../../assets/scripts/scenes/SceneStart';
registerDef('./scripts/scenes/SceneStart', component17);
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