Commit 09c0d0e2 authored by rockyl's avatar rockyl

增加部分注释

parent a89dec7a
......@@ -4,7 +4,8 @@
* 弹动缩放
*/
import {ScillaComponent, createTween, Tween, Vector2D, createVector2D} from "scilla";
import {createTween, Tween, Vector2D, createVector2D} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
const originScale: Vector2D = createVector2D(1, 1);
......
......@@ -4,7 +4,8 @@
* 渐变组件
*/
import {math, ScillaComponent} from "scilla";
import {math} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
export default class Fade extends ScillaComponent {
fromAlpha: number = 0;
......
......@@ -4,7 +4,8 @@
* 自转组件
*/
import {createTween, ScillaComponent, ScillaEvent, Tween} from "scilla";
import {createTween, ScillaEvent, Tween} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
export default class Rotation extends ScillaComponent {
duration: number = 10000;
......
/**
* Created by rockyl on 2018/11/5.
*/
import {ScillaComponent} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
export default class RoundLoop extends ScillaComponent {
transform;
......
......@@ -4,7 +4,7 @@
* 摇摆组件
*/
import {ScillaComponent} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
export default class Swing extends ScillaComponent {
duration: number = 10000;
......
......@@ -4,7 +4,8 @@
* 波动组件
*/
import {ScillaComponent, raw, ScillaEvent} from "scilla";
import {raw, ScillaEvent} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
const PI2 = Math.PI * 2;
......
......@@ -2,7 +2,7 @@
* Created by rockyl on 2018/11/5.
*/
import {ScillaComponent} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
export default class ZoomLoop extends ScillaComponent{
......
......@@ -2,8 +2,9 @@
* Created by rockyl on 2018/11/7.
*/
import {Matrix, ScillaComponent, decorators} from "scilla";
import {Matrix, decorators} from "scilla";
import Renderer from "../renderer/Renderer";
import ScillaComponent from "./ScillaComponent";
const {dirtyFieldTrigger} = decorators;
......@@ -127,13 +128,11 @@ export default class InteractComponent extends ScillaComponent {
const renderers = this.entity.getComponents(Renderer);
for (let renderer of renderers) {
if (renderer.hitTest(this.localPos.x, this.localPos.y)) {
if (renderer.isUsedToMask) {
continue
} else {
if (!renderer['isUsedToMask']) {
result = true;
break
}
} else if (renderer.isUsedToMask) {
} else if (renderer['isUsedToMask']) {
return false
}
}
......
/**
* Created by rockyl on 2019-04-17.
*/
import {Component} from 'scilla'
import Transform from "./Transform";
export default class ScillaComponent extends Component{
get transform():Transform {
return this.entity.getComponentByName('components/base/Transform');
}
}
......@@ -2,8 +2,9 @@
* Created by rockyl on 2018/11/5.
*/
import {ScillaComponent, Vector2D, Matrix, decorators} from "scilla";
import {Vector2D, Matrix, decorators} from "scilla";
import Renderer from "../renderer/Renderer";
import ScillaComponent from "./ScillaComponent";
const {dirtyFieldDetector, dirtyFieldTrigger} = decorators;
......@@ -206,7 +207,7 @@ export default class Transform extends ScillaComponent {
_globalMatrix.copyFrom(_localMatrix);
if (entity.parent) {
const parentTransform: Transform = entity.parent.getComponent(Transform);
const parentTransform: Transform = <Transform>entity.parent.getComponent(Transform);
if (parentTransform) {
this._renderAlpha = parentTransform._renderAlpha * this.alpha;
_globalMatrix.concat(parentTransform.getMatrix(true, false));
......@@ -217,9 +218,10 @@ export default class Transform extends ScillaComponent {
this._renderAlpha = this.alpha;
}
_globalPivotMatrix.copyFrom(_globalMatrix);
const {a, d} = _globalMatrix;
_globalPivotMatrix.translate(
-(px - 0.5) * width,
-(py - 0.5) * height,
-(px - 0.5) * width * a,
-(py - 0.5) * height * d,
);
}
......
......@@ -4,7 +4,8 @@
* Api接口组件基类
*/
import {ScillaComponent, ScillaEvent} from "scilla";
import {ScillaEvent} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
export default class ApiComponent extends ScillaComponent {
onResponse: ScillaEvent = new ScillaEvent();
......
......@@ -3,8 +3,9 @@
*
*/
import {Entity, ScillaComponent, createVector2D, Vector2D, math, getRenderContext} from "scilla";
import {Entity, createVector2D, Vector2D, math, getRenderContext} from "scilla";
import Transform from "../base/Transform";
import ScillaComponent from "../base/ScillaComponent";
/**
* 相机控制组件
......
......@@ -4,8 +4,9 @@
* 内容组件尺寸自适应组件
*/
import {ScillaComponent, Size} from "scilla";
import {Size} from "scilla";
import Transform from "../base/Transform";
import ScillaComponent from "../base/ScillaComponent";
export default class ContentSizeFitter extends ScillaComponent {
private _measureSize: Size = new Size();
......
......@@ -3,7 +3,8 @@
*
*/
import {getRenderContext, ScillaComponent, } from "scilla";
import {getRenderContext, } from "scilla";
import ScillaComponent from "../base/ScillaComponent";
/**
* 全舞台尺寸组件
......
......@@ -3,9 +3,10 @@
*
*/
import {ScillaComponent} from "scilla";
import Renderer from "../renderer/Renderer";
import Transform from "../base/Transform";
import ScillaComponent from "../base/ScillaComponent";
/**
* 相对布局组件
......
......@@ -2,7 +2,8 @@
* Created by rockyl on 2018/11/6.
*/
import {createCanvas, getRenderContext, ScillaComponent, Bounds, Vector2D, math, decorators, EngineConfig} from "scilla";
import {createCanvas, getRenderContext, Bounds, Vector2D, math, decorators, EngineConfig} from "scilla";
import ScillaComponent from "../base/ScillaComponent";
const {dirtyFieldTrigger} = decorators;
......@@ -36,7 +37,7 @@ export default class Renderer extends ScillaComponent {
/**
* 边界
*/
protected bounds = new Bounds();
bounds = new Bounds();
protected cacheCanvas = null;
......@@ -243,7 +244,7 @@ export default class Renderer extends ScillaComponent {
/**
* 测量边界
*/
protected measureBounds() {
measureBounds() {
const {anchor: {x, y}, bounds, bounds: {width, height}} = this;
const anchorOffsetX = this._anchorOffset.x = width * x;
......
......@@ -4,10 +4,11 @@
* 进度条
*/
import {Entity, ScillaComponent, decorators, createTween, ease} from "scilla";
import {Entity, decorators, createTween, ease} from "scilla";
import RectRenderer from "../renderer/RectRenderer";
import Transform from "../base/Transform";
import TextRenderer from "../renderer/TextRenderer";
import ScillaComponent from "../base/ScillaComponent";
const {dirtyFieldTrigger} = decorators;
......
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