Commit 8986c628 authored by rockyl's avatar rockyl

脚本改为ts语言,将脚本合并到项目中

parent f4a047a4
export declare abstract class HashObject {
protected _instanceId: number;
protected _instanceType: string;
protected static _object_id: number;
constructor();
readonly instanceId: number;
readonly instanceType: string;
abstract destroy(): void;
}
import { HashObject } from "../HashObject";
import { DisplayObject } from "../display/DisplayObject";
export declare class Component extends HashObject {
entity: DisplayObject;
protected _enabled: boolean;
constructor();
enabled: boolean;
_setup(entity: DisplayObject): void;
_unSetup(): void;
onCreate(): void;
onEnable(): void;
onDisable(): void;
onUpdate(): void;
onDestroy(): void;
destroy(): void;
}
export declare const VERSION = "1.0";
export declare const devicePixelRatio: number;
export declare let StageScaleMode: {
EXACT_FIT: string;
NO_BORDER: string;
NO_SCALE: string;
SHOW_ALL: string;
FIXED_WIDTH: string;
FIXED_HEIGHT: string;
};
export declare const osType: string;
export declare function cos(angle: number): number;
export declare function sin(angle: number): number;
export declare const PI_2: number;
export declare const RAD_TO_DEG: number;
export declare const DEG_TO_RAD: number;
export declare enum RENDERER_TYPE {
UNKNOWN = 0,
WEBGL = 1,
CANVAS = 2
}
export declare enum SHAPES {
POLY = 0,
RECT = 1,
CIRC = 2,
ELIP = 3,
RREC = 4
}
export declare enum PRECISION {
LOW = "lowp",
MEDIUM = "mediump",
HIGH = "highp"
}
export declare enum TEXT_GRADIENT {
LINEAR_VERTICAL = 0,
LINEAR_HORIZONTAL = 1
}
export declare enum TEXT_ALIGN {
CENTER = "center",
LEFT = "left",
RIGHT = "right"
}
export declare enum VERTICAL_ALIGN {
MIDDLE = "middle",
UP = "up",
DOWN = "down"
}
export declare enum TEXT_lINETYPE {
SINGLE = "single",
MULTI = "multi"
}
export declare enum LINE_ALIGNMENT {
middle = 0.5,
outter = 1,
inner = 0
}
export declare enum LINE_CAP {
BUTT = "butt",
ROUND = "round",
SQUARE = "square"
}
export declare enum LINE_JOIN {
MITER = "miter",
ROUND = "round",
BEVEL = "bevel"
}
export declare enum BLEND_MODES {
NORMAL = 0,
ADD = 1,
MULTIPLY = 2,
SCREEN = 3,
OVERLAY = 4,
DARKEN = 5,
LIGHTEN = 6,
COLOR_DODGE = 7,
COLOR_BURN = 8,
HARD_LIGHT = 9,
SOFT_LIGHT = 10,
DIFFERENCE = 11,
EXCLUSION = 12,
HUE = 13,
SATURATION = 14,
COLOR = 15,
LUMINOSITY = 16,
NORMAL_NPM = 17,
ADD_NPM = 18,
SCREEN_NPM = 19
}
export declare enum DRAW_MODES {
POINTS = 0,
LINES = 1,
LINE_LOOP = 2,
LINE_STRIP = 3,
TRIANGLES = 4,
TRIANGLE_STRIP = 5,
TRIANGLE_FAN = 6
}
export declare enum SCALE_MODES {
LINEAR = 0,
NEAREST = 1
}
export declare enum WRAP_MODES {
CLAMP = 33071,
REPEAT = 10497,
MIRRORED_REPEAT = 33648
}
export declare enum GC_MODES {
AUTO = 0,
MANUAL = 1
}
export declare const URL_FILE_EXTENSION: any;
export declare const DATA_URI: any;
import { DisplayObject } from './DisplayObject';
import { Point } from '../math';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
export default class Container extends DisplayObject {
mouseChildren: boolean;
children: any[];
containerUpdateTransform: any;
constructor();
applyAutoAdjust(): void;
applyScripts(): void;
applyEvents(): void;
onChildrenChange(index: any): void;
addChild(child: DisplayObject): DisplayObject;
addChildAt(child: DisplayObject, index: number): DisplayObject;
swapChildren(child1: DisplayObject, child2: DisplayObject): boolean;
getChildIndex(child: DisplayObject): number;
setChildIndex(child: DisplayObject, index: number): void;
getChildAt(index: number): DisplayObject;
getChildByName(name: string | RegExp, isOnlyOne?: boolean, isRecursive?: boolean): any;
removeChild(child: DisplayObject): DisplayObject;
removeChildAt(index: number): DisplayObject;
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
updateTransform(): void;
calculateBounds(): void;
protected _calculateBounds(): void;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): any;
renderWebGL(renderer: WebglRenderer): void;
private renderAdvancedWebGL;
protected _renderWebGL(renderer: WebglRenderer): void;
renderCanvas(renderer: CanvasRenderer): void;
protected _renderCanvas(renderer: CanvasRenderer): void;
update(deltaTime: number): void;
_onDispatchBubbledEvent(type: string): void;
destroy(): void;
width: number;
height: number;
private static _getElementsByName;
}
import { EventDispatcher } from '../events/EventDispatcher';
import Transform from '../math/Transform';
import { Rectangle } from '../math/Rectangle';
import { Point } from "../math/Point";
import { Component } from '../component/Component';
import Graphics from '../graphics/Graphics';
export declare class DisplayObject extends EventDispatcher {
transform: Transform;
visible: boolean;
renderable: boolean;
parent: any;
stage: any;
name: string;
worldAlpha: number;
protected _localBoundsSelf: Rectangle;
protected _bounds: Rectangle;
protected _boundsID: number;
protected _lastBoundsID: number;
private _mask;
private _alpha;
destroyed: boolean;
mouseEnabled: boolean;
tempDisplayObjectParent: DisplayObject;
displayObjectUpdateTransform: any;
displayObjectHitTestPoint: any;
protected _width: number;
protected _height: number;
constructor();
private readonly _tempDisplayObjectParent;
updateTransform(): void;
static _bp: Point;
static _p1: Point;
static _p2: Point;
static _p3: Point;
static _p4: Point;
static temBounds: Rectangle;
hitTestPoint(point: Point, isMouseEvent?: boolean): DisplayObject;
private _recursivePostUpdateTransform;
getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;
getLocalBounds(rect?: Rectangle): Rectangle;
calculateBounds(): void;
globalToLocal(point: Point, bp?: Point): Point;
localToGlobal(point: Point, bp?: Point): Point;
_onDispatchBubbledEvent(type: string): void;
renderWebGL(renderer: any): void;
renderCanvas(renderer: any): void;
setParent(container: any): any;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, anchorX?: number, anchorY?: number): DisplayObject;
destroy(): void;
alpha: number;
x: number;
y: number;
readonly worldMatrix: import("../../../../../duibaGame/renderingengine/src/2d/math/Matrix").Matrix;
readonly localMatrix: import("../../../../../duibaGame/renderingengine/src/2d/math/Matrix").Matrix;
position: import("../../../../../duibaGame/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
scale: import("../../../../../duibaGame/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
scaleX: number;
scaleY: number;
anchor: import("../../../../../duibaGame/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
anchorX: number;
anchorY: number;
skew: import("../../../../../duibaGame/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
rotation: number;
readonly worldVisible: boolean;
mask: Graphics;
width: number;
height: number;
private _components;
update(deltaTime: number): void;
addComponent(component: Component): void;
addComponentAt(component: Component, index: number): void;
removeComponent(component: Component): void;
removeAllComponents(): void;
onAddComponent(component: Component): void;
onRemoveComponent(component: Component): void;
}
import { DisplayObject } from "./DisplayObject";
export declare class FloatDisplay extends DisplayObject {
htmlElement: any;
private _isAdded;
private _transformID;
constructor();
init(htmlElement: any): void;
private getStyle;
updateStyle(): void;
destroy(): void;
}
import { Point, Rectangle } from '../math';
import Texture from '../texture/Texture';
import Container from './Container';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
export default class Sprite extends Container {
private _anchorTexture;
_texture: Texture;
_width: number;
_height: number;
_transformID: number;
_textureID: number;
_transformTrimmedID: number;
_textureTrimmedID: number;
pluginName: string;
indices: Uint16Array;
start: number;
uvs: Float32Array;
vertexData: Float32Array;
vertexTrimmedData: Float32Array;
constructor(texture?: Texture);
_onTextureUpdate(): void;
_onAnchorUpdate(): void;
calculateVertices(): void;
calculateTrimmedVertices(): void;
_renderWebGL(renderer: WebglRenderer): void;
_renderCanvas(renderer: CanvasRenderer): void;
_calculateBounds(): void;
getLocalBounds(rect?: Rectangle): Rectangle;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): any;
destroy(): void;
anchorTexture: any;
texture: Texture;
static from(source: any): Sprite;
static fromFrame(frameId: string): Sprite;
static fromImage(imageId: string, crossorigin?: boolean, scaleMode?: number): Sprite;
}
import Container from "./Container";
import SystemRenderer from "../renderers/SystemRenderer";
import { Rectangle } from "../math";
import { DisplayObject } from "./DisplayObject";
export declare class Stage extends Container {
iosTouchendPreventDefault: boolean;
isPreventDefaultEvent: boolean;
rootDiv: any;
renderObj: SystemRenderer;
renderType: number;
static getStage(stageName?: string): Stage;
private static _stageList;
static pause: boolean;
private static _pause;
viewRect: Rectangle;
autoSteering: boolean;
autoResize: boolean;
desWidth: number;
desHeight: number;
divHeight: number;
divWidth: number;
private _bgColor;
bgColor: number;
scaleMode: string;
private _scaleMode;
private _flush;
private _currentFlush;
static _dragDisplay: DisplayObject;
private static _isLoadedVConsole;
private _lastDpList;
private _rid;
private _floatDisplayList;
constructor(rootDivId?: string, desW?: number, desH?: number, frameRate?: number, scaleMode?: string, renderType?: number, transparent?: boolean, bgColor?: number);
render(): void;
private _ml;
private _mp;
private _initMouseEvent;
private _mouseDownPoint;
flush(): void;
setFrameRate(fps: number): void;
getFrameRate(): number;
getRootDivWH(div: HTMLDivElement): {
w: number;
h: number;
};
kill(): void;
private _mouseEventTypes;
private onMouseEvent;
private setAlign;
resize(): void;
getBounds(): Rectangle;
private static allUpdateObjList;
static flushAll(): void;
static addUpdateObj(target: any): void;
static removeUpdateObj(target: any): void;
destroy(): void;
}
export { default as Container } from './Container';
export { DisplayObject } from './DisplayObject';
export { FloatDisplay } from "./FloatDisplay";
export { default as Sprite } from "./Sprite";
export { Stage } from "./Stage";
import { HashObject } from "../HashObject";
export declare class Event extends HashObject {
static RESIZE: string;
static ON_SCROLL_TO_HEAD: string;
static ON_SCROLL_STOP: string;
static ON_SCROLL_START: string;
static ON_SCROLL_TO_END: string;
static ON_INIT_STAGE: string;
static ADDED_TO_STAGE: string;
static REMOVED_FROM_STAGE: string;
static ENTER_FRAME: string;
static END_FRAME: string;
static CALL_FRAME: string;
static COMPLETE: string;
static PROGRESS: string;
static ERROR: string;
static ABORT: string;
static START: string;
static TIMER: string;
static TIMER_COMPLETE: string;
type: string;
target: any;
data: any;
constructor(type: string);
stopImmediatePropagation(): void;
stopPropagation(): void;
private _bpd;
private _pd;
destroy(): void;
reset(type: string, target: any): void;
}
import { HashObject } from "../HashObject";
export declare class EventDispatcher extends HashObject {
protected eventTypes: any;
protected eventTypes1: any;
constructor();
private static _MECO;
static _totalMEC: number;
static getMouseEventCount(type?: string): number;
addEventListener(type: string, listener: Function, context?: any, useCapture?: boolean): void;
once(type: string, listener: Function, context?: any, useCapture?: boolean): void;
private _changeMouseCount;
private _defaultEvent;
dispatchEvent(event: any, data?: any, useCapture?: boolean): boolean;
hasEventListener(type: string, useCapture?: boolean): boolean;
removeEventListener(type: string, listener: Function, context?: any, useCapture?: boolean): void;
removeAllEventListener(): void;
destroy(): void;
}
export declare class GDispatcher {
private static callbackPool;
private static thisObjPool;
static addEvent(name: string, callback: any, thisObj: any): void;
static removeEvent(name: string, callback: any, thisObj?: any): void;
static dispatchEvent(name: string, ...args: any[]): void;
}
import { Event } from "./Event";
import { DisplayObject } from "../display/DisplayObject";
export declare class MouseEvent extends Event {
static MOUSE_DOWN: string;
static MOUSE_UP: string;
static CLICK: string;
static MOUSE_MOVE: string;
static MOUSE_OVER: string;
static MOUSE_OUT: string;
clientX: number;
clientY: number;
stageX: number;
stageY: number;
localX: number;
localY: number;
currentTarget: DisplayObject;
identifier: any;
constructor(type: string);
updateAfterEvent(): void;
destroy(): void;
}
export * from './Event';
export * from './EventDispatcher';
export * from './GDispatcher';
export * from './MouseEvent';
import GraphicsData from './GraphicsData';
import { Matrix, Point } from '../math';
import { Polygon } from "./shapes";
import { DisplayObject } from '../display/DisplayObject';
import Texture from '../texture/Texture';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
import FillStyle from './styles/FillStyle';
import LineStyle from './styles/LineStyle';
import Container from '../display/Container';
export default class Graphics extends Container {
private _fillStyle;
private _lineStyle;
readonly fill: FillStyle;
readonly line: LineStyle;
private _tint;
tint: number;
private batchTint;
private _matrix;
matrix: Matrix;
hitTestByPixel: boolean;
private _holeMode;
private _currentPath;
graphicsData: GraphicsData[];
isUsedToMask: boolean;
boundsPadding: number;
private dirty;
private boundsDirty;
cacheAsBitmap: boolean;
private cacheDirty;
private _canvasBuffer;
_texture: Texture;
offsetX: number;
offsetY: number;
verts: any;
indices: any;
private batches;
private geoBatches;
private batchDirty;
private uvs;
private vertexData;
private shapeIndex;
private _transformID;
constructor();
clone(): Graphics;
lineStyle(lineWidth?: number, color?: number, alpha?: number, alignment?: number, native?: boolean): Graphics;
lineTextureStyle(width?: number, texture?: Texture, color?: number, alpha?: number, matrix?: any, alignment?: number, native?: boolean): this;
private startPoly;
private finishPoly;
moveTo(x: number, y: number): Graphics;
lineTo(x: number, y: number): Graphics;
private _initCurve;
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): Graphics;
beginFill(color?: number | string, alpha?: number): Graphics;
beginTextureFill(texture?: Texture, color?: number, alpha?: number, matrix?: Matrix): this;
endFill(): Graphics;
closePath(): Graphics;
beginHole(): this;
endHole(): this;
drawRect(x: number, y: number, width: number, height: number): Graphics;
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
drawCircle(x: number, y: number, radius: number): Graphics;
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
drawPolygon(path: number[] | Point[] | Polygon): Graphics;
drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation?: number): Graphics;
private drawShape;
clear(): Graphics;
isFastRect(): boolean;
_renderWebGL(renderer: WebglRenderer): void;
private updateBatch;
private calculateTints;
private calculateVertices;
private transformPoints;
_renderCanvas(renderer: CanvasRenderer): void;
_calculateBounds(): void;
hitTestPoint(point: Point, isMouseEvent?: boolean): DisplayObject;
private hitTestPointAccuratly;
updateLocalBoundsSelf(): void;
private generateCanvasTexture;
destroy(): void;
private proccessHoles;
private addUvs;
private adjustUvs;
}
import Circle from "./shapes/Circle";
import { Matrix, Rectangle } from "../math";
import Ellipse from "./shapes/Ellipse";
import Polygon from "./shapes/Polygon";
import RoundedRectangle from "./shapes/RoundedRectangle";
import { HashObject } from "../HashObject";
import LineStyle from "./styles/LineStyle";
import FillStyle from "./styles/FillStyle";
export default class GraphicsData extends HashObject {
fillStyle: FillStyle;
lineStyle: LineStyle;
matrix: Matrix;
holes: any[];
shape: any;
type: number;
points: number[];
constructor(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle, fillStyle?: FillStyle, lineStyle?: LineStyle, matrix?: Matrix);
clone(): GraphicsData;
destroy(): void;
}
import { LINE_CAP, LINE_JOIN } from "../const";
import { Point } from "../math";
import { DisplayObject } from "../display/DisplayObject";
import Sprite from "../display/Sprite";
export declare class Shape extends Sprite {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
dirty: boolean;
offsetX: number;
offsetY: number;
constructor();
private _command;
private _isBitmapStroke;
private _isBitmapFill;
hitTestByPixel: boolean;
drawRoundRect(x: number, y: number, w: number, h: number, rTL?: number, rTR?: number, rBL?: number, rBR?: number): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
quadraticCurveTo(cpX: number, cpY: number, x: number, y: number): void;
bezierCurveTo(cp1X: number, cp1Y: number, cp2X: number, cp2Y: number, x: number, y: number): void;
closePath(): void;
drawRect(x: number, y: number, w: number, h: number): void;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
drawCircle(x: number, y: number, radius: number, counterclockwise?: boolean): void;
drawEllipse(x: number, y: number, w: number, h: number): void;
clear(): void;
beginFill(color: number, alpha?: number): void;
beginLinearGradientFill(points: any, colors: any): void;
beginRadialGradientFill: (points: any, colors: any) => void;
beginBitmapFill(image: any, matrix: Array<number>): void;
private _fill;
beginStroke(color: number, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number, alpha?: number): void;
beginLinearGradientStroke(points: Array<number>, colors: any, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
beginRadialGradientStroke(points: Array<number>, colors: any, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
beginBitmapStroke(image: any, matrix: Array<number>, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
private _stroke;
endFill(): void;
endStroke(): void;
updateShape(): void;
private _drawShape;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): DisplayObject;
changeColor(infoObj: any): void;
updateTexture(): void;
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: any, graphicsGeometry: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
export default function (graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
import Graphics from "../Graphics";
import GraphicsData from "../GraphicsData";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphics: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
};
export default _default;
export declare function earcut(data: any, holeIndices: any, dim: any): any[];
import { Point, Rectangle } from '../../math';
export default class Circle {
x: number;
y: number;
radius: number;
type: number;
constructor(x?: number, y?: number, radius?: number);
clone(): Circle;
isPointIn(point: Point): boolean;
getBounds(): Rectangle;
}
import { Point, Rectangle } from '../../math';
export default class Ellipse {
x: number;
y: number;
width: number;
height: number;
type: number;
constructor(x?: number, y?: number, width?: number, height?: number);
clone(): Ellipse;
isPointIn(point: Point): boolean;
getBounds(): Rectangle;
}
import { Point } from '../../math/Point';
export default class Polygon {
closed: boolean;
points: number[];
type: number;
constructor(...points: any[]);
clone(): Polygon;
close(): void;
isPointIn(point: Point): boolean;
}
import { Point } from '../../math';
export default class RoundedRectangle {
x: number;
y: number;
width: number;
height: number;
radius: number;
type: number;
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
clone(): RoundedRectangle;
isPointIn(point: Point): boolean;
}
export { default as Circle } from './Circle';
export { default as Ellipse } from './Ellipse';
export { default as Polygon } from './Polygon';
export { default as RoundedRectangle } from './RoundedRectangle';
import Texture from "../../texture/Texture";
import { Matrix } from "../../math";
export default class FillStyle {
color: number;
alpha: number;
texture: Texture;
matrix: Matrix;
visible: boolean;
alphaBlock: boolean;
constructor();
clone(): FillStyle;
reset(): void;
destroy(): void;
}
import FillStyle from './FillStyle';
import { LINE_ALIGNMENT } from '../../const';
export default class LineStyle extends FillStyle {
native: boolean;
width: number;
alignment: LINE_ALIGNMENT;
clone(): LineStyle;
reset(): void;
}
export declare function bezierCurveControlPoint(points: any): {
A: any[];
B: any[];
};
export default function bezierCurveTo(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number, n: number, path?: number[]): number[];
export { default as bezierCurveTo } from './bezierCurveTo';
export { bezierCurveControlPoint } from "./bezierCurveControlPoint";
export declare const GRAPHICS_CURVES: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
segmentsCount: Function;
};
export declare function quadraticCurveLength(fromX: number, fromY: number, cpX: number, cpY: number, toX: number, toY: number): number;
export declare function bezierCurveLength(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): number;
import { EventDispatcher } from "../events/EventDispatcher";
export declare class Loader extends EventDispatcher {
caches: {};
_req: XMLHttpRequest;
constructor();
loadSheet(callback: Function, url: string): void;
loadRaw(callback: Function, url: string, type: 'text' | 'json'): void;
loadJson(callback: Function, url: string): void;
loadText(callback: Function, url: string): void;
loadTexture(callback: Function, url: string): void;
loadImage(callback: Function, url: string, crossOrigin?: boolean): HTMLImageElement;
cache(name: string, data: any): void;
}
export declare const globalLoader: Loader;
declare const GroupD8: {
E: number;
SE: number;
S: number;
SW: number;
W: number;
NW: number;
N: number;
NE: number;
MIRROR_VERTICAL: number;
MIRROR_HORIZONTAL: number;
uX: (ind: any) => number;
uY: (ind: any) => number;
vX: (ind: any) => number;
vY: (ind: any) => number;
inv: (rotation: any) => number;
add: (rotationSecond: any, rotationFirst: any) => any;
sub: (rotationSecond: any, rotationFirst: any) => any;
rotate180: (rotation: any) => number;
isVertical: (rotation: any) => boolean;
byDirection: (dx: any, dy: any) => number;
matrixAppendRotationInv: (matrix: any, rotation: any, tx?: number, ty?: number) => void;
};
export default GroupD8;
import { Point } from "././Point";
import { HashObject } from "../HashObject";
export declare class Matrix extends HashObject {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
array: any;
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
clone(): Matrix;
copy(matrix: Matrix | any): this;
transformPoint(x: number, y: number, bp?: Point): Point;
transformPointInverse(x: number, y: number, bp?: Point): Point;
setFrom(mtx: Matrix): void;
identity(): void;
invert(): Matrix;
createBox(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, ax: number, ay: number): void;
prepend: (mtx: Matrix) => void;
append(matrix: Matrix): void;
static isEqual(m1: Matrix, m2: Matrix): boolean;
concat(mtx: Matrix): void;
rotate(angle: number): void;
scale(sx: number, sy: number): void;
translate(dx: number, dy: number): void;
set(a: any, b: any, c: any, d: any, tx: any, ty: any): this;
getRotation(): number;
toArray(transpose?: boolean, out?: any): any;
static readonly IDENTITY: Matrix;
static readonly TEMP_MATRIX: Matrix;
destroy(): void;
}
import { Point } from "../math/Point";
import { HashObject } from "../HashObject";
export declare class ObservablePoint extends HashObject {
_x: number;
_y: number;
cb: any;
scope: any;
constructor(cb: Function, scope: any, x?: number, y?: number);
set(x?: number, y?: number): void;
copy(point: Point | ObservablePoint): void;
x: number;
y: number;
destroy(): void;
}
import { HashObject } from "../HashObject";
export declare class Point extends HashObject {
destroy(): void;
constructor(x?: number, y?: number);
x: number;
y: number;
static distance(...args: any[]): number;
set(x: number, y: number): void;
}
import { HashObject } from "../HashObject";
import { Point } from "./Point";
export declare class Rectangle extends HashObject {
type: number;
constructor(x?: number, y?: number, width?: number, height?: number);
clear(): void;
copy(rect: Rectangle): this;
clone(): Rectangle;
x: number;
y: number;
width: number;
height: number;
readonly left: number;
readonly right: number;
readonly top: number;
readonly bottom: number;
isPointIn(point: Point): boolean;
fit(rectangle: Rectangle): void;
static createFromRects(...arg: Rectangle[]): Rectangle;
static createFromPoints(rect: Rectangle, ...arg: Point[]): Rectangle;
static createFromVertexData(rect: Rectangle, vertexData: Float32Array): Rectangle;
static createRectfrom2Point(rect: Rectangle, p1: Point, p2: Point): Rectangle;
static testRectCross(ra: Rectangle, rb: Rectangle): boolean;
destroy(): void;
}
import { ObservablePoint } from './ObservablePoint';
import { Matrix } from "./Matrix";
import { HashObject } from '../HashObject';
export default class Transform extends HashObject {
worldMatrix: Matrix;
localMatrix: Matrix;
_worldID: number;
_parentID: number;
position: ObservablePoint;
scale: ObservablePoint;
anchor: ObservablePoint;
skew: ObservablePoint;
_rotation: number;
_cx: number;
_sx: number;
_cy: number;
_sy: number;
_localID: number;
_currentLocalID: number;
constructor();
onChange(): void;
updateSkew(): void;
updateLocalMatrix(): void;
updateWorldMatrix(parentTransform: Transform): void;
rotation: number;
destroy(): void;
}
export { Matrix } from './Matrix';
export { Point } from './Point';
export { ObservablePoint } from './ObservablePoint';
export { Rectangle } from './Rectangle';
export { default as Transform } from './Transform';
export { default as GroupD8 } from './GroupD8';
import SystemRenderer from './SystemRenderer';
import CanvasMaskManager from './managers/CanvasMaskManager';
import { RendererOptions } from './RendererOptions';
import { Matrix } from '../math';
import { DisplayObject } from '../display/DisplayObject';
import CanvasSpriteRenderer from './plugins/CanvasSpriteRenderer';
import { CanvasGraphicsRenderer } from './plugins/CanvasGraphicsRenderer';
export default class CanvasRenderer extends SystemRenderer {
rootContext: CanvasRenderingContext2D;
context: CanvasRenderingContext2D;
maskManager: CanvasMaskManager;
smoothProperty: string;
plugins: {
sprite: CanvasSpriteRenderer;
graphics: CanvasGraphicsRenderer;
};
renderingToScreen: boolean;
constructor(options: RendererOptions);
render(displayObject: DisplayObject, renderTexture?: any, transform?: Matrix): void;
clear(clearColor: string): void;
destroy(): void;
resize(screenWidth: number, screenHeight: number): void;
destroyPlugins(): void;
}
export interface RendererOptions {
htmlElement?: HTMLCanvasElement;
transparent?: boolean;
antialias?: boolean;
preserveDrawingBuffer?: boolean;
backgroundColor?: number;
roundPixels?: boolean;
}
import Container from '../display/Container';
import { EventDispatcher } from '../events/EventDispatcher';
import { DisplayObject } from "../display/DisplayObject";
import { RendererOptions } from "./RendererOptions";
export default class SystemRenderer extends EventDispatcher {
options: RendererOptions;
type: number;
htmlElement: HTMLCanvasElement;
transparent: boolean;
preserveDrawingBuffer: boolean;
_backgroundColor: number;
_backgroundColorRgba: number[];
_backgroundColorString: string;
_tempDisplayObjectParent: Container;
_lastObjectRendered: DisplayObject;
constructor(options: RendererOptions);
resize(width: number, height: number): void;
render(displayObject: any, renderTexture?: any, transform?: any): void;
destroy(): void;
backgroundColor: number;
}
import SystemRenderer from "./SystemRenderer";
import { RendererOptions } from "./RendererOptions";
import { GLShader, VertexArrayObject } from "../../glCore";
import RenderTarget from "./renderTarget/RenderTarget";
import TextureManager from "./managers/TextureManager";
import TextureGarbageCollector from "./managers/TextureGarbageCollector";
import { Matrix } from "../math";
import WebGLState from "./webgl/WebGLState";
import BatchManager from "./managers/BatchManager";
import MaskManager from "./managers/MaskManager";
import StencilManager from "./managers/StencilManager";
import { DisplayObject } from "../display/DisplayObject";
export declare class WebglRenderer extends SystemRenderer {
plugins: {};
gl: WebGLRenderingContext;
CONTEXT_UID: number;
maskManager: MaskManager;
stencilManager: StencilManager;
batchManager: BatchManager;
textureManager: TextureManager;
textureGC: TextureGarbageCollector;
state: WebGLState;
renderingToScreen: boolean;
_activeShader: GLShader;
_activeVao: VertexArrayObject;
_activeRenderTarget: RenderTarget;
rootRenderTarget: RenderTarget;
constructor(options: RendererOptions);
_initContext(): void;
render(displayObject: DisplayObject, renderTexture?: any, transform?: any): void;
clear(clearColor: number[]): void;
setTransform(matrix: Matrix): void;
clearRenderTexture(renderTexture: any, clearColor: any): this;
bindShader(shader: GLShader, autoProject?: boolean): WebglRenderer;
createVao(): VertexArrayObject;
bindVao(vao: VertexArrayObject): WebglRenderer;
reset(): WebglRenderer;
bindRenderTexture(renderTexture: any, transform?: Matrix): WebglRenderer;
bindRenderTarget(renderTarget: RenderTarget): WebglRenderer;
resize(screenWidth: any, screenHeight: any): void;
destroy(): void;
handleContextRestored(): void;
handleContextLost(event: WebGLContextEvent): void;
initPlugins(staticMap: any): void;
destroyPlugins(): void;
static __plugins: any;
static registerPlugin(pluginName: string, ctor: Function): void;
}
import ObjectRenderer from '../webgl/ObjectRenderer';
import { WebglRenderer } from '../WebglRenderer';
export default class BatchManager {
renderer: WebglRenderer;
emptyRenderer: ObjectRenderer;
currentRenderer: ObjectRenderer;
constructor(renderer: WebglRenderer);
setObjectRenderer(objectRenderer: ObjectRenderer): void;
flush(): void;
reset(): void;
}
import { HashObject } from '../../HashObject';
import CanvasRenderer from '../CanvasRenderer';
import Graphics from '../../graphics/Graphics';
export default class CanvasMaskManager extends HashObject {
renderer: any;
constructor(renderer: CanvasRenderer);
pushMask(maskData: Graphics): void;
renderGraphicsShape(graphics: Graphics): void;
popMask(renderer: CanvasRenderer): void;
destroy(): void;
}
import Graphics from '../../graphics/Graphics';
import { WebglRenderer } from '../WebglRenderer';
import RenderTarget from '../renderTarget/RenderTarget';
export default class MaskManager {
renderer: WebglRenderer;
scissor: boolean;
scissorData: any;
scissorRenderTarget: RenderTarget;
enableScissor: boolean;
alphaMaskPool: any[];
alphaMaskIndex: number;
constructor(renderer: WebglRenderer);
pushMask(target: any, maskData: any): void;
popMask(target: any, maskData: any): void;
pushStencilMask(maskData: Graphics): void;
popStencilMask(): void;
pushScissorMask(target: any, maskData: Graphics): void;
popScissorMask(): void;
destroy(): void;
}
import { WebglRenderer } from '../WebglRenderer';
import Graphics from '../../graphics/Graphics';
export default class StencilManager {
renderer: WebglRenderer;
stencilMaskStack: Graphics[];
constructor(renderer: WebglRenderer);
setMaskStack(stencilMaskStack: Graphics[]): void;
pushStencil(graphics: Graphics): void;
popStencil(): void;
_useCurrent(): void;
_getBitwiseMask(): number;
destroy(): void;
}
import { WebglRenderer } from '../WebglRenderer';
export default class TextureGarbageCollector {
renderer: WebglRenderer;
count: number;
checkCount: number;
maxIdle: number;
checkCountMax: number;
mode: number;
constructor(renderer: WebglRenderer);
update(): void;
run(): void;
unload(displayObject: any): void;
}
import { GLTexture } from '../../../glCore';
import { WebglRenderer } from '../WebglRenderer';
export default class TextureManager {
boundTextures: any;
renderer: WebglRenderer;
emptyTextures: any;
_nextTextureLocation: number;
currentLocation: number;
gl: WebGLRenderingContext;
_managedTextures: Array<any>;
constructor(renderer: WebglRenderer);
onContextChange(): void;
bindTexture(texture: any, location?: number, forceLocation?: boolean): number;
getTexture(): void;
updateTexture(texture: any, location?: number): GLTexture;
unbindTexture(texture: any): void;
destroyTexture(texture: any, skipRemove: any): void;
removeAll(): void;
destroy(): void;
}
import BatchDrawCall from '../webgl/BatchDrawCall';
import ObjectRenderer from '../webgl/ObjectRenderer';
import { WebglRenderer } from '../WebglRenderer';
import { GLBuffer, GLShader, VertexArrayObject } from '../../../glCore';
export default class BatchRenderer extends ObjectRenderer {
vertSize: number;
vertByteSize: number;
size: number;
currentSize: number;
currentIndexSize: number;
aBuffers: {};
iBuffers: {};
shader: GLShader;
currentIndex: number;
groups: BatchDrawCall[];
elements: any[];
vaos: VertexArrayObject[];
vaoMax: number;
vertexCount: number;
MAX_TEXTURES: number;
vertexBuffers: GLBuffer[];
indexBuffers: GLBuffer[];
constructor(renderer: WebglRenderer);
onContextChange(): void;
onPreRender(): void;
render(element: any): void;
getIndexBuffer(size: any): any;
getAttributeBuffer(size: number): any;
flush(): void;
packGeometry(element: any, float32View: any, uint32View: any, indexBuffer: any, index: any, indexCount: any): void;
start(): void;
stop(): void;
destroy(): void;
}
import CanvasRenderer from '../CanvasRenderer';
import Graphics from '../../graphics/Graphics';
import GraphicsData from '../../graphics/GraphicsData';
export declare class CanvasGraphicsRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
render(graphics: Graphics): void;
destroy(): void;
}
export declare function holePath(graphicsData: GraphicsData, context: CanvasRenderingContext2D, ccw?: boolean): void;
export declare function judgeCcw(points: number[]): boolean;
import CanvasRenderer from '../CanvasRenderer';
export default class CanvasSpriteRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
render(sprite: any): void;
destroy(): void;
}
export default class CanvasRenderTarget {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
constructor(width: number, height: number);
clear(): void;
resize(width: number, height: number): void;
destroy(): void;
width: number;
height: number;
}
import { Matrix, Rectangle } from '../../math';
import { GLBuffer, GLFramebuffer, GLTexture } from '../../../glCore';
import Graphics from '../../graphics/Graphics';
export default class RenderTarget {
gl: WebGLRenderingContext;
frameBuffer: GLFramebuffer;
texture: GLTexture;
clearColor: number[];
size: Rectangle;
projectionMatrix: Matrix;
transform: Matrix;
frame: Rectangle;
defaultFrame: Rectangle;
destinationFrame: any;
sourceFrame: any;
stencilBuffer: GLBuffer;
stencilMaskStack: Graphics[];
scaleMode: number;
root: boolean;
constructor(gl: WebGLRenderingContext, width?: number, height?: number, scaleMode?: number, root?: boolean);
clear(clearColor?: number[]): void;
attachStencilBuffer(): void;
setFrame(destinationFrame?: Rectangle, sourceFrame?: Rectangle): void;
activate(): void;
calculateProjection(destinationFrame: Rectangle, sourceFrame?: Rectangle): void;
resize(width: number, height: number): void;
destroy(): void;
}
export declare class BatchBuffer {
vertices: ArrayBuffer;
float32View: Float32Array;
uint32View: Uint32Array;
positions: any;
uvs: any;
colors: any;
constructor(size: number);
destroy(): void;
}
import BaseTexture from "../../texture/BaseTexture";
export default class BatchDrawCall {
textures: BaseTexture[];
textureCount: number;
start: number;
size: number;
type: number;
constructor();
}
import { DisplayObject } from "../../display/DisplayObject";
import { WebglRenderer } from "../WebglRenderer";
export default class ObjectRenderer {
renderer: WebglRenderer;
constructor(renderer: WebglRenderer);
onContextChange(): void;
start(): void;
stop(): void;
flush(): void;
render(object: DisplayObject): void;
destroy(): void;
}
export default class WebGLState {
blendModes: any;
activeState: Uint8Array;
defaultState: Uint8Array;
gl: any;
maxAttribs: any;
attribState: {
tempAttribState: any[];
attribState: any[];
};
nativeVaoExtension: any;
constructor(gl: WebGLRenderingContext);
setState(state: any): void;
setBlend(value: any): void;
setBlendMode(value: any): void;
setDepthTest(value: any): void;
setCullFace(value: any): void;
setFrontFace(value: any): void;
resetAttributes(): void;
resetToDefault(): void;
resetTo3D(): void;
}
export declare function createIndicesForQuads(size: number): Uint16Array;
import { GLShader } from '../../../glCore';
export declare function generateMultiTextureShader(gl: any, maxTextures: any): GLShader;
import Container from "../display/Container";
import { VideoEntity } from "./VideoEntity";
export declare class MovieClip extends Container {
lockStep: boolean;
readonly currentFrame: number;
private _curFrame;
readonly isPlaying: boolean;
private _isPlaying;
readonly isFront: boolean;
private _isFront;
totalFrames: number;
loops: number;
private textures;
private timeInterval;
private deltaFrame;
private frameCount;
constructor(mv?: VideoEntity);
init(mv: VideoEntity): void;
private initChildren;
private resetTransform;
resetTransformAll(frameIndex: number): void;
setImage(imagekey: any, imageUrl: string): void;
stop(): void;
nextFrame(): void;
prevFrame(): void;
gotoAndStop(frameIndex: number): void;
play(isFront?: boolean): void;
private _lastFrame;
readonly isInTimeFrame: boolean;
gotoAndPlay(frameIndex: number, isFront?: boolean): void;
startAniRange(beginFrame?: number, endFrame?: number, loops?: number, callback?: Function): void;
private startTime;
private startFrame;
private lastDeltaFrame;
private _endMark;
commonDeltaTime: number;
updateFrame(): void;
private getCurFrameWhenLockStep;
update(deltaTime: number): void;
destroy(): void;
}
import { SpriteEntity } from './spriteEntity';
import { HashObject } from '../HashObject';
export declare class VideoEntity extends HashObject {
version: string;
videoSize: {
width: number;
height: number;
};
FPS: number;
frames: number;
images: {};
hasBeenCached: boolean;
sprites: SpriteEntity[];
audios: any[];
constructor(spec: any, images: any);
resetSprites(spec: any): void;
destroy(): void;
}
export declare class BezierPath {
_d: any;
_transform: any;
_styles: any;
_shape: any;
constructor(d?: any, transform?: any, styles?: any);
}
import { BezierPath } from './bezierPath';
export declare class EllipsePath extends BezierPath {
_x: any;
_y: any;
_radiusX: any;
_radiusY: any;
_transform: any;
_styles: any;
constructor(x: any, y: any, radiusX: any, radiusY: any, transform: any, styles: any);
}
export declare class FrameEntity {
alpha: number;
transform: {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
};
layout: {
x: number;
y: number;
width: number;
height: number;
};
nx: number;
ny: number;
maskPath: any;
shapes: any[];
constructor(spec: any);
static lastShapes: any;
}
export { VideoEntity } from "./VideoEntity";
export { MovieClip } from "./MovieClip";
declare const _default: (data: any, cb: any, failure: any) => void;
export default _default;
declare function inflate(input: any, options: any): any;
declare const _default: {
inflate: typeof inflate;
};
export default _default;
declare function assign(obj: any, objO: any): any;
declare function shrinkBuf(buf: any, size: any): any;
export declare const utils: {
assign: typeof assign;
shrinkBuf: typeof shrinkBuf;
Buf8: any;
Buf16: any;
Buf32: any;
arraySet: any;
flattenChunks: any;
};
export {};
declare function string2buf(str: any): any;
declare function buf2binstring(buf: any, len?: any): any;
declare function binstring2buf(str: any): any;
declare function buf2string(buf: any, max: any): any;
declare function utf8border(buf: any, max: any): any;
export declare const strings: {
utf8border: typeof utf8border;
buf2string: typeof buf2string;
binstring2buf: typeof binstring2buf;
buf2binstring: typeof buf2binstring;
string2buf: typeof string2buf;
};
export {};
declare function adler32(adler: any, buf: any, len: any, pos: any): number;
export default adler32;
declare const _default: {
Z_NO_FLUSH: number;
Z_PARTIAL_FLUSH: number;
Z_SYNC_FLUSH: number;
Z_FULL_FLUSH: number;
Z_FINISH: number;
Z_BLOCK: number;
Z_TREES: number;
Z_OK: number;
Z_STREAM_END: number;
Z_NEED_DICT: number;
Z_ERRNO: number;
Z_STREAM_ERROR: number;
Z_DATA_ERROR: number;
Z_BUF_ERROR: number;
Z_NO_COMPRESSION: number;
Z_BEST_SPEED: number;
Z_BEST_COMPRESSION: number;
Z_DEFAULT_COMPRESSION: number;
Z_FILTERED: number;
Z_HUFFMAN_ONLY: number;
Z_RLE: number;
Z_FIXED: number;
Z_DEFAULT_STRATEGY: number;
Z_BINARY: number;
Z_TEXT: number;
Z_UNKNOWN: number;
Z_DEFLATED: number;
};
export default _default;
declare function crc32(crc: any, buf: any, len: any, pos: any): number;
export default crc32;
declare function deflateResetKeep(strm: any): any;
declare function deflateReset(strm: any): any;
declare function deflateSetHeader(strm: any, head: any): number;
declare function deflateInit2(strm: any, level: any, method: any, windowBits: any, memLevel: any, strategy: any): any;
declare function deflateInit(strm: any, level: any): any;
declare function deflate(strm: any, flush: any): any;
declare function deflateEnd(strm: any): any;
declare function deflateSetDictionary(strm: any, dictionary: any): number;
declare const _default: {
deflateInit: typeof deflateInit;
deflateInit2: typeof deflateInit2;
deflateReset: typeof deflateReset;
deflateResetKeep: typeof deflateResetKeep;
deflateSetHeader: typeof deflateSetHeader;
deflate: typeof deflate;
deflateEnd: typeof deflateEnd;
deflateSetDictionary: typeof deflateSetDictionary;
deflateInfo: string;
};
export default _default;
declare function GZheader(): void;
export default GZheader;
export default function inflate_fast(strm: any, start: any): void;
declare function inflateResetKeep(strm: any): number;
declare function inflateReset(strm: any): number;
declare function inflateReset2(strm: any, windowBits: any): number;
declare function inflateInit2(strm: any, windowBits: any): any;
declare function inflateInit(strm: any): any;
declare function inflate(strm: any, flush: any): any;
declare function inflateEnd(strm: any): number;
declare function inflateGetHeader(strm: any, head: any): number;
declare function inflateSetDictionary(strm: any, dictionary: any): number;
declare const _default: {
inflateReset: typeof inflateReset;
inflateReset2: typeof inflateReset2;
inflateResetKeep: typeof inflateResetKeep;
inflateInit: typeof inflateInit;
inflateInit2: typeof inflateInit2;
inflate: typeof inflate;
inflateEnd: typeof inflateEnd;
inflateGetHeader: typeof inflateGetHeader;
inflateSetDictionary: typeof inflateSetDictionary;
inflateInfo: string;
};
export default _default;
export default function inflate_table(type: any, lens: any, lens_index: any, codes: any, table: any, table_index: any, work: any, opts: any): 1 | 0 | -1;
declare const _default: {
2: string;
1: string;
0: string;
'-1': string;
'-2': string;
'-3': string;
'-4': string;
'-5': string;
'-6': string;
};
export default _default;
declare function _tr_init(s: any): void;
declare function _tr_stored_block(s: any, buf: any, stored_len: any, last: any): void;
declare function _tr_align(s: any): void;
declare function _tr_flush_block(s: any, buf: any, stored_len: any, last: any): void;
declare function _tr_tally(s: any, dist: any, lc: any): boolean;
declare const _default: {
_tr_init: typeof _tr_init;
_tr_stored_block: typeof _tr_stored_block;
_tr_flush_block: typeof _tr_flush_block;
_tr_tally: typeof _tr_tally;
_tr_align: typeof _tr_align;
};
export default _default;
declare function ZStream(): void;
export default ZStream;
export declare class Parser {
load(url: any, success: any, failure: any): void;
loadViaWorker(url: any, success: any, failure: any): void;
}
import * as protobuf from "protobufjs/light";
export declare const proto: protobuf.Root;
export declare const ProtoMovieEntity: protobuf.Type;
import { BezierPath } from './bezierPath';
export declare class RectPath extends BezierPath {
_x: any;
_y: any;
_width: any;
_height: any;
_cornerRadius: any;
_transform: any;
_styles: any;
constructor(x: any, y: any, width: any, height: any, cornerRadius: any, transform: any, styles: any);
}
export declare class SpriteEntity {
matteKey: any;
imageKey: any;
frames: any[];
constructor(spec: any);
}
import { TextField } from "./TextField";
export declare class EditableText extends TextField {
htmlElement: any;
private _prompt;
prompt: string;
private _promptColor;
promptColor: string;
private _textColor;
textColor: string;
constructor();
}
import { FloatDisplay } from "../display/FloatDisplay";
import { TextField } from "./TextField";
export declare class InputText extends FloatDisplay {
private _view;
inputType: number;
isAutoDownKeyBoard: boolean;
private static _inputTypeList;
constructor(inputType?: number);
init(htmlElement: any): void;
initInfo(text: string, color: string, align: string, size: number, font: string, showBorder: boolean, lineSpacing: number, textWidth: number): void;
lineSpacing: number;
bold: boolean;
italic: boolean;
textHeight: number;
textWidth: number;
color: string;
border: boolean;
text: string;
maxCharacters: number;
convertToTextField(textField?: TextField): TextField;
}
import { TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN } from "../const";
import Sprite from "../display/Sprite";
export declare class TextField extends Sprite {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
dirty: boolean;
offsetX: number;
offsetY: number;
constructor();
textAlpha: number;
private _textAlpha;
textAlign: TEXT_ALIGN;
private _textAlign;
verticalAlign: VERTICAL_ALIGN;
private _verticalAlign;
width: number;
height: number;
lineSpacing: number;
private _lineSpacing;
lineType: TEXT_lINETYPE;
private _lineType;
text: string;
protected _setText(value: any): void;
private _text;
font: string;
private _font;
size: number;
private _size;
fillColor: any;
private _fillColor;
strokeColor: string;
private _strokeColor;
stroke: number;
private _stroke;
italic: boolean;
private _italic;
bold: boolean;
_bold: boolean;
border: boolean;
private _border;
private _prepContext;
getTextWidth(lineIndex?: number): number;
readonly lines: number;
private _getMeasuredWidth;
private realLines;
updateText(): void;
updateTexture(): void;
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
export { TextField } from "./TextField";
export { InputText } from "./InputText";
export { EditableText } from "./EditableText";
import BaseTexture from './BaseTexture';
export default class BaseRenderTexture extends BaseTexture {
_glRenderTargets: {};
_canvasRenderTarget: any;
valid: boolean;
constructor(width?: number, height?: number, scaleMode?: number);
resize(width: number, height: number): void;
destroy(): void;
}
import { EventDispatcher } from '../events/EventDispatcher';
export default class BaseTexture extends EventDispatcher {
touched: number;
width: number;
height: number;
scaleMode: number;
hasLoaded: boolean;
isLoading: boolean;
source: HTMLImageElement | HTMLCanvasElement;
imageType: string;
premultipliedAlpha: boolean;
imageUrl: string;
isPowerOfTwo: boolean;
mipmap: boolean;
wrapMode: number;
_glTextures: {};
_enabled: number;
_destroyed: boolean;
textureCacheIds: string[];
constructor(source?: HTMLImageElement | HTMLCanvasElement, scaleMode?: number);
update(): void;
loadSource(source: any): void;
private _updateImageType;
private _sourceLoaded;
destroy(): void;
dispose(): void;
updateSourceImage(newSrc: string): void;
static fromImage(imageUrl: string, crossorigin?: any, scaleMode?: number): BaseTexture;
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: number, origin?: string): BaseTexture;
static from(source: any, scaleMode?: number): BaseTexture;
static addToCache(baseTexture: BaseTexture, id: string): void;
static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null;
}
import BaseRenderTexture from './BaseRenderTexture';
import Texture from './Texture';
import { Rectangle } from '../math';
export default class RenderTexture extends Texture {
constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle);
resize(width: number, height: number, doNotResizeBaseTexture?: boolean): void;
static create(width: number, height: number, scaleMode?: number): RenderTexture;
}
import BaseTexture from './BaseTexture';
import TextureUvs from './TextureUvs';
import { EventDispatcher } from '../events/EventDispatcher';
import { Event } from "../events/Event";
import { Point, Rectangle } from '../math';
export default class Texture extends EventDispatcher {
noFrame: boolean;
baseTexture: BaseTexture;
_frame: Rectangle;
trim: Rectangle;
valid: boolean;
_uvs: TextureUvs;
orig: Rectangle;
_rotate: number;
defaultAnchor: Point;
_updateID: number;
transform: any;
textureCacheIds: string[];
static EMPTY: Texture;
static WHITE: Texture;
constructor(baseTexture: BaseTexture | Texture, frame?: Rectangle, orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: Point);
update(): void;
onBaseTextureLoaded(e: Event): void;
onBaseTextureUpdated(e: Event): void;
destroy(): void;
clone(): Texture;
_updateUvs(): void;
frame: Rectangle;
rotate: number;
readonly width: number;
readonly height: number;
static fromImage(imageUrl: string, crossorigin?: boolean, scaleMode?: number): Texture;
static fromFrame(frameId: string): Texture;
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: number, origin?: string): Texture;
static from(source: any): Texture;
static addToCache(texture: Texture, id: string): void;
static removeFromCache(texture: any): Texture;
}
import BaseTexture from './BaseTexture';
export default class TextureSheet {
baseTexture: BaseTexture;
textures: {};
animations: {};
data: any;
_frames: any;
_frameKeys: string[];
_callback: Function;
constructor(baseTexture: BaseTexture, data: any);
parse(callback: Function): void;
_processFrames(initialFrameIndex: number): void;
_processAnimations(): void;
_parseComplete(): void;
destroy(destroyBase?: boolean): void;
}
import { Rectangle } from "../math";
import BaseTexture from "./BaseTexture";
export default class TextureUvs {
x0: number;
y0: number;
x1: number;
y1: number;
x2: number;
y2: number;
x3: number;
y3: number;
uvsUint32: Uint32Array;
uvsFloat32: Float32Array;
constructor();
set(frame: Rectangle, baseFrame: Rectangle | BaseTexture, rotate: number): void;
}
export { default as Texture } from "./Texture";
export { default as BaseTexture } from "./BaseTexture";
export { default as TextureSheet } from "./TextureSheet";
export declare function getTexture(str: string): any;
import Texture from "../texture/Texture";
import Sprite from "../display/Sprite";
export declare class BitmapNumber extends Sprite {
resName: string;
private textures;
private _num;
num: number;
constructor(textures: Texture[]);
reset(textures: Texture[]): void;
}
import Container from "../display/Container";
import { TEXT_ALIGN } from "../const";
import Texture from "../texture/Texture";
export declare class BitmapNumbers extends Container {
textures: Texture[];
align: TEXT_ALIGN;
singleWidth: number;
private _num;
num: number;
constructor(textures: Texture[]);
adaptate(): void;
}
import Sprite from "../display/Sprite";
import Texture from "../texture/Texture";
export declare class Button extends Sprite {
textureUp: any;
textureDown: any;
textureDisable: any;
constructor(tUp: Texture, tDown?: Texture, tDisable?: Texture);
private _mouseEvent;
initButton(): void;
clicked: boolean;
private _clicked;
textureStatusEnable: boolean;
destroy(): void;
}
import Texture from "../texture/Texture";
import Sprite from "../display/Sprite";
export declare class FrameAni extends Sprite {
texturesAll: Texture[];
currentFrame: number;
totalFrames: number;
isPlay: boolean;
startTime: number;
allTime: number;
callback: Function;
_frameRate: number;
frameRate: number;
constructor(texturesAll: Texture[]);
private count;
onEnterFrame(): void;
play(callback: any): void;
reset(): void;
private changeTexture;
}
import { ScrollPage } from "./ScrollPage";
import { DisplayObject } from "../display/DisplayObject";
export interface IScrollListItem extends DisplayObject {
initData(id: number, data: any): void;
id: number;
data: number;
}
export declare class ScrollList extends ScrollPage {
private _items;
private _itemW;
private _itemH;
private _itemRow;
private _itemCol;
private _itemCount;
private _itemClass;
private _isInit;
data: Array<any>;
private downL;
private _cols;
private _disParam;
private _lastFirstId;
readonly loadingView: DisplayObject;
constructor(itemClassName: any, itemWidth: number, itemHeight: number, vW: number, vH: number, isVertical?: boolean, cols?: number);
updateData(data: Array<any>, isReset?: boolean): void;
private flushData;
setViewRect(w: number, h: number, isVertical: boolean): void;
private _updateViewRect;
setLoading(downLoading: DisplayObject): void;
destroy(): void;
}
import Container from "../display/Container";
export declare class ScrollPage extends Container {
protected isVertical: boolean;
private viewWidth;
private viewHeight;
maxDistance: number;
protected distance: number;
private minDis;
private maskObj;
view: Container;
private lastValue;
protected speed: number;
private addSpeed;
isStop: boolean;
maxSpeed: number;
fSpeed: number;
protected paramXY: string;
private stopTimes;
private isMouseDownState;
private autoScroll;
isSpringBack: boolean;
constructor(vW: number, vH: number, maxDistance: number, isVertical?: boolean, isFull?: boolean);
setViewRect(w: number, h: number, isVertical: boolean): void;
private onMouseEvent;
scrollTo(dis: number, time?: number): void;
destroy(): void;
}
import { TextField } from "../text/TextField";
export declare class ShowWord extends TextField {
playWords(text: string, deltaTime?: number, callback?: Function): void;
}
export { ScrollList } from "./ScrollList";
export { ScrollPage } from "./ScrollPage";
export { Button } from "./Button";
export declare function DrawAllToCanvas(images: any, callback: any): void;
export default function determineCrossOrigin(url: string, loc?: any): string;
import { RENDERER_TYPE } from "../const";
export * from './twiddle';
export { default as toDisplayDataURL } from "./toDisplayDataURL";
export { default as determineCrossOrigin } from './determineCrossOrigin';
export declare function uid(): number;
export declare const backupCanvas: HTMLCanvasElement;
export declare function getGradientColor(points: any, colors: any): any;
export declare function getCanvasBitmapStyle(image: any): any;
export declare function hex2rgb(hex: number, out?: number[] | Float32Array): number[] | Float32Array;
export declare function hex2string(hex: any): string;
export declare function string2hex(string: string): number;
export declare function rgb2hex(rgb: number[]): number;
export declare function getRGBA(color: string, alpha: number): string;
export declare function inputFeildIosEnable(): void;
export declare function decomposeDataUri(dataUri: any): {
mediaType: any;
subType: any;
charset: any;
encoding: any;
data: any;
};
export declare function getUrlFileExtension(url: any): any;
export declare function sign(n: number): number;
export declare function premultiplyTint(tint: number, alpha: number): number;
export declare const TextureCache: any;
export declare const BaseTextureCache: any;
export declare const TextureSheetCache: any;
export declare function destroyTextureCache(): void;
export declare function clearTextureCache(): void;
export declare const GlobalPro: {
stageRenderType: RENDERER_TYPE;
dpi: number;
padding: number;
startTime: number;
};
export declare function isWebGLSupported(): boolean;
export declare function removeItems(arr: Array<any>, startIdx: number, removeCount: number): void;
export declare function mapWebGLBlendModesToPixi(gl: any, array?: any[]): any[];
import { Rectangle } from "../math";
import { DisplayObject } from "../display/DisplayObject";
export default function toDisplayDataURL(obj: DisplayObject, rect?: Rectangle, typeInfo?: any, bgColor?: number): string;
export declare const INT_BITS1 = 32;
export declare const INT_MAX = 2147483647;
export declare const INT_MIN: number;
export declare function abs(v: any): number;
export declare function min(x: any, y: any): number;
export declare function max(x: any, y: any): number;
export declare function isPow2(v: any): boolean;
export declare function log2(v: any): number;
export declare function log10(v: any): 2 | 1 | 0 | 4 | 3 | 9 | 5 | 6 | 7 | 8;
export declare function popCount(v: any): number;
export declare function countTrailingZeros(v: any): number;
export declare function nextPow2(v: any): any;
export declare function prevPow2(v: any): number;
export declare function parity(v: any): number;
export declare function reverse(v: any): number;
export declare function interleave2(x: any, y: any): number;
export declare function deinterleave2(v: any, n: any): number;
export declare function interleave3(x: any, y: any, z: any): number;
export declare function deinterleave3(v: any, n: any): number;
export declare function nextCombination(v: any): number;
export declare class GLBuffer {
gl: any;
buffer: any;
type: any;
drawType: any;
data: any;
_updateID: number;
constructor(gl: any, type?: any, data?: any, drawType?: any);
upload(data: any, offset?: number, dontBind?: boolean): void;
bind(): void;
destroy: () => void;
static createVertexBuffer(gl: any, data?: any, drawType?: any): GLBuffer;
static createIndexBuffer(gl: any, data?: any, drawType?: any): GLBuffer;
static create(gl: any, type: any, data: any, drawType: any): GLBuffer;
}
export declare class GLFramebuffer {
gl: any;
framebuffer: any;
stencil: any;
texture: any;
width: any;
height: any;
constructor(gl: any, width: any, height: any);
enableTexture(texture: any): void;
enableStencil(): void;
clear(r: any, g: any, b: any, a: any): void;
bind(): void;
unbind(): void;
resize(width: any, height: any): void;
destroy(): void;
static createRGBA(gl: any, width: any, height: any, data?: any): GLFramebuffer;
static createFloat32(gl: any, width: any, height: any, data: any): GLFramebuffer;
}
export declare class GLShader {
gl: WebGLRenderingContext;
program: WebGLProgram;
attributes: any;
uniformData: any;
uniforms: any;
constructor(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, precision?: string, attributeLocations?: any);
bind(): this;
destroy(): void;
}
export declare class GLTexture {
gl: WebGLRenderingContext;
texture: WebGLTexture;
mipmap: boolean;
premultiplyAlpha: any;
width: number;
height: number;
format: any;
type: any;
constructor(gl: WebGLRenderingContext, width?: number, height?: number, format?: any, type?: any);
upload(source: any): void;
uploadData: (data: any, width: any, height: any) => void;
bind(location?: number): void;
unbind(): void;
minFilter(linear: boolean): void;
magFilter(linear: boolean): void;
enableMipmap(): void;
enableLinearScaling(): void;
enableNearestScaling(): void;
enableWrapClamp(): void;
enableWrapRepeat(): void;
enableWrapMirrorRepeat(): void;
destroy(): void;
static fromSource(gl: WebGLRenderingContext, source: HTMLImageElement | ImageData, premultiplyAlpha?: boolean): GLTexture;
static fromData(gl: any, data: any, width: any, height: any): GLTexture;
}
export declare class VertexArrayObject {
nativeVaoExtension: any;
nativeState: any;
nativeVao: any;
gl: WebGLRenderingContext;
attributes: any[];
indexBuffer: any;
dirty: boolean;
constructor(gl: WebGLRenderingContext, state: any);
bind(): this;
unbind(): this;
activate(): this;
addAttribute(buffer: any, attribute: any, type?: any, normalized?: any, stride?: any, start?: any): this;
addIndex(buffer: any): this;
clear(): this;
draw(type: any, size?: any, start?: any): this;
destroy(): void;
getSize(): number;
static FORCE_NATIVE: boolean;
}
export declare function checkMaxIfStatementsInShader(maxIfs: number, gl: WebGLRenderingContext): number;
export declare function createContext(canvas: HTMLCanvasElement, options?: any): WebGLRenderingContext;
export { GLTexture } from './GLTexture';
export { GLBuffer } from './GLBuffer';
export { VertexArrayObject } from './VertexArrayObject';
export { GLFramebuffer } from "./GLFramebuffer";
export { GLShader } from "./GLShader";
export { createContext } from "./createContext";
export { checkMaxIfStatementsInShader } from "./checkMaxIfStatementsInShader";
export declare function setVertexAttribArrays(gl: any, attribs: any, state?: any): void;
export declare function compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, attributeLocations?: any): WebGLProgram;
export declare function defaultValue(type: string, size: number): false | any[] | 0 | Float32Array;
export declare function extractAttributes(gl: WebGLRenderingContext, program: WebGLProgram): {};
export declare function extractUniforms(gl: WebGLRenderingContext, program: WebGLProgram): {};
export declare function generateUniformAccessObject(gl: WebGLRenderingContext, uniformData: any): {
data: {};
};
export { compileProgram } from './compileProgram';
export { defaultValue } from './defaultValue';
export { extractAttributes } from './extractAttributes';
export { extractUniforms } from './extractUniforms';
export { generateUniformAccessObject } from './generateUniformAccessObject';
export { setPrecision } from './setPrecision';
export { mapSize } from './mapSize';
export { mapType } from './mapType';
export declare function mapSize(type: string): number;
export declare function mapType(gl: any, type: any): any;
export declare function setPrecision(src: string, precision: string): string;
export { Component } from "./2d/component/Component";
export * from "./2d/display";
export * from "./2d/events";
export { default as Graphics } from "./2d/graphics/Graphics";
export { Shape } from "./2d/graphics/Shape";
export { Loader } from "./2d/loader/Loader";
export { Matrix } from "./2d/math/Matrix";
export { Point } from "./2d/math/Point";
export { Rectangle } from "./2d/math/Rectangle";
export * from "./2d/text";
export * from "./2d/texture";
export * from "./2d/ui";
export { default as toDisplayDataURL } from "./2d/utils/toDisplayDataURL";
export { inputFeildIosEnable } from "./2d/utils/index";
export * from './2d/const';
export * from './zeroing';
...@@ -1860,8 +1860,8 @@ ...@@ -1860,8 +1860,8 @@
this.addEventListener(Event.REMOVED_FROM_STAGE, scriptsProxy.onRemovedFromStage, scriptsProxy); this.addEventListener(Event.REMOVED_FROM_STAGE, scriptsProxy.onRemovedFromStage, scriptsProxy);
}; };
} }
function registerScriptDef(def) { function registerScriptDef(id, def) {
scriptDefs[def.name] = def; scriptDefs[id] = def;
Object.defineProperty(def, 'disabled', { Object.defineProperty(def, 'disabled', {
get: function () { get: function () {
return !!this._disabled; return !!this._disabled;
...@@ -1881,6 +1881,15 @@ ...@@ -1881,6 +1881,15 @@
configurable: true configurable: true
}); });
} }
function registerScripts(scripts) {
for (var id in scripts) {
var code = scripts[id];
var create = new Function('exports', code);
var exports = {};
create(exports);
registerScriptDef(id, exports['default']);
}
}
var ScriptsProxy = (function () { var ScriptsProxy = (function () {
function ScriptsProxy(host) { function ScriptsProxy(host) {
this._scripts = []; this._scripts = [];
...@@ -11520,10 +11529,11 @@ ...@@ -11520,10 +11529,11 @@
}); });
}; };
GameStage.prototype.start = function () { GameStage.prototype.start = function () {
var _a = this._config, launchOptions = _a.launchOptions, dataMapping = _a.dataMapping, processes = _a.processes, globalProcesses = _a.globalProcesses; var _a = this._config, options = _a.options, dataMapping = _a.dataMapping, processes = _a.processes, builtinProcesses = _a.builtinProcesses, scripts = _a.scripts;
registerScripts(scripts);
this.dataCenter.registerDataMapping(dataMapping); this.dataCenter.registerDataMapping(dataMapping);
setProcessMetaLibs(processes, globalProcesses); setProcessMetaLibs(processes, builtinProcesses);
var entryViewName = launchOptions.entrySceneView; var entryViewName = options.entrySceneView;
var entryViewConfig = this.getViewConfigByName(entryViewName); var entryViewConfig = this.getViewConfigByName(entryViewName);
if (entryViewConfig) { if (entryViewConfig) {
var sceneEntry = instantiate(entryViewConfig); var sceneEntry = instantiate(entryViewConfig);
...@@ -11555,7 +11565,7 @@ ...@@ -11555,7 +11565,7 @@
} }
function launchWithConfig(config, onAssetsProgress, onAssetsComplete) { function launchWithConfig(config, onAssetsProgress, onAssetsComplete) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
var _a = config.launchOptions, containerID = _a.containerID, designWidth = _a.designWidth, designHeight = _a.designHeight, frameRate = _a.frameRate, scaleMode = _a.scaleMode, rendererType = _a.rendererType; var _a = config.options, containerID = _a.containerID, designWidth = _a.designWidth, designHeight = _a.designHeight, frameRate = _a.frameRate, scaleMode = _a.scaleMode, rendererType = _a.rendererType;
var stage = window['stage'] = new Stage(containerID || "game-container", designWidth || 750, designHeight || 1334, frameRate || 60, scaleMode || StageScaleMode.FIXED_WIDTH, rendererType || exports.RENDERER_TYPE.WEBGL); var stage = window['stage'] = new Stage(containerID || "game-container", designWidth || 750, designHeight || 1334, frameRate || 60, scaleMode || StageScaleMode.FIXED_WIDTH, rendererType || exports.RENDERER_TYPE.WEBGL);
Stage.flushAll(); Stage.flushAll();
var gameStage = new GameStage(stage); var gameStage = new GameStage(stage);
...@@ -11611,6 +11621,7 @@ ...@@ -11611,6 +11621,7 @@
exports.launchWithConfig = launchWithConfig; exports.launchWithConfig = launchWithConfig;
exports.osType = osType; exports.osType = osType;
exports.registerScriptDef = registerScriptDef; exports.registerScriptDef = registerScriptDef;
exports.registerScripts = registerScripts;
exports.sin = sin; exports.sin = sin;
exports.toDisplayDataURL = toDisplayDataURL; exports.toDisplayDataURL = toDisplayDataURL;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import { Container, Stage } from "../2d/display";
import { StackContainer } from "./StackContainer";
import { DataCenter } from "./data-center";
export declare class GameStage extends Container {
private _sceneContainer;
private _popupContainer;
private _stage;
private _dataCenter;
private _config;
constructor(stage: Stage);
readonly sceneContainer: StackContainer;
readonly popupContainer: StackContainer;
readonly dataCenter: DataCenter;
launch(config: any, onAssetsProgress: any, onAssetsComplete: any): void;
start(): void;
getViewConfigByName(name: any): any;
}
import { Container, DisplayObject } from "../2d/display";
export declare class StackContainer extends Container {
constructor();
push(view: DisplayObject): void;
replace(view: DisplayObject): void;
pop(): boolean;
popAll(view: DisplayObject): void;
}
export declare function loadAssets(config: any, onProgress?: any, onComplete?: any): Promise<never>;
export declare function getAssetByUUID(uuid: any): any;
export declare function getAssetByName(name: any): any;
import { EventDispatcher } from "../2d/events";
export declare class DataCenter extends EventDispatcher {
store: {};
watchers: any[];
constructor();
registerGroup(name: any, origin: any): void;
unregisterGroup(name: any): void;
getGroup(name: any): any;
getDataByPath(path: any, throwException?: any): any;
formatString(str: any, escapes: any): any;
mutate(name: any, data?: any, path?: any, dispatch?: boolean): void;
watch(name: any, path: any): void;
getWatcher(name: any): any;
registerDataMapping(dataMapping: any): void;
}
export declare const dataCenter: DataCenter;
export declare function fieldChanged(onModify: any): (target: any, key: string) => void;
export declare const dirtyFieldDetector: (target: any, key: string) => void;
export declare const deepDirtyFieldDetector: (target: any, key: string) => void;
export declare const dirtyFieldTrigger: (target: any, key: string) => void;
export declare const deepDirtyFieldTrigger: (target: any, key: string) => void;
export declare function applyAutoAdjust(ctor: Function): void;
export declare function applyEvents(ctor: Function): void;
export declare function applyScript(ctor: Function): void;
export interface IScript {
host: any;
disabled: boolean;
mounted(): any;
destroy(): any;
update(t: any): any;
awake(): any;
sleep(): any;
}
export declare function registerScriptDef(def: any): void;
export * from './GameStage';
export * from './StackContainer';
export * from './nodes';
export * from './assets-manager';
export * from './view-interpreter';
export * from './launcher';
export * from './decorators/auto-adjust';
export * from './decorators/scripts';
export * from './decorators/events';
import { GameStage } from "..";
export declare function launch(config: any, onAssetsProgress: any, onAssetsComplete: any): GameStage;
import { Sprite } from "../../2d/display";
export declare class Image extends Sprite {
private _originText;
private _escapes;
private _registeredEvents;
private _source;
source: string;
private updateSource;
private _setSourceDirect;
private _setSource;
private unregisterEvents;
private onDataMutated;
}
import { TextField } from "../../2d/text";
export declare class Label extends TextField {
private _originText;
private _escapes;
private _registeredEvents;
protected _setText(value: any): void;
private unregisterEvents;
private onDataMutated;
}
export * from './shapes';
export * from './Image';
export * from './Label';
import { Shape } from "../../";
declare class ShapeBase extends Shape {
protected __fieldDirty: boolean;
fillColor: any;
strokeColor: any;
strokeWidth: number;
constructor();
private onResize;
private onEnterFrame;
protected redraw(): void;
}
export declare class Rect extends ShapeBase {
borderRadius: number;
protected redraw(): void;
}
export declare class Circle extends ShapeBase {
protected redraw(): void;
}
export {};
export declare const ESCAPE_REG_EXP: RegExp;
export declare function arrayFind(arr: any, callback: any): any;
export declare function instantiate(config: any): any;
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
<body> <body>
<script type="text/javascript" src="../dist/index.js"></script>
<div id="game-container" style="line-height:0;font-size:0"></div> <div id="game-container" style="line-height:0;font-size:0"></div>
<script src="scripts/ScriptDemo.js"></script> <script type="text/javascript" src="../dist/index.js"></script>
<script src="scripts/ZoomButton.js"></script>
<script src="game-stage.js"></script>
<script>
engine.launch('http://10.10.94.134:4002/examples/mock/test.json');
</script>
</body> </body>
......
/**
* Created by rockyl on 2019-11-06.
*/
engine.registerScriptDef(ScriptDemo);
engine.registerScriptDef(ZoomButton);
engine.launch('http://localhost:63342/VisualEditor/renderingengine/examples/mock/test.json');
{ {"options":{"entrySceneView":"view1","containerID":"game-container","designWidth":750,"designHeight":1334,"frameRate":60,"scaleMode":"fixedWidth","rendererType":"webgl"},"views":[{"name":"view1","type":"node","properties":{},"uuid":"3a357816-5581-41ba-aa6f-4a6cc40ae396","children":[{"name":"rect","type":"rect","properties":{"width":50,"height":50,"fillColor":"rgba(105, 182, 255, 1)","strokeWidth":0,"x":10,"y":10},"uuid":"f97bbf76-6923-4669-b5a3-e6382753e49a","events":{"click":{"once":false,"behaviors":[{"uuid":"aa1","alias":"主过程","meta":"main"}]}},"scripts":[{"script":"wave","props":{"duration":500,"autoPlay":true,"type":"cubicIn"}}]}]}],"assets":[{"name":"face","ext":".png","url":"//yun.duiba.com.cn/aurora/58323a0469a7467c99b34f8933ea65b507a0c655.png","uuid":"3e496939-5fe6-42f2-b8fa-42c7a742e880"},{"name":"还以是bug","ext":".jpg","url":"//yun.duiba.com.cn/aurora/094832ace87c94bdb9e4a7821b3a3ebca0df2cd7.jpg","uuid":"ec67a8a0-8708-43a4-888e-efb0fe7c2bd6"},{"name":"嘿嘿","ext":".gif","url":"//yun.duiba.com.cn/aurora/1ad10a4cf3488ef1400af1d6f353d9c577fe1049.gif","uuid":"429803eb-0f68-4071-b68c-468980883ac4"},{"name":"1643017","ext":".jpg","url":"//yun.duiba.com.cn/aurora/2e4adf3d8646ffbd027038cb2c6627a6bca44e44.jpg","uuid":"cc1ad757-ff4c-4cb9-b629-be355119d018"},{"name":"0","ext":".gif","url":"//yun.duiba.com.cn/aurora/616a413facbd406b81daac809a52bd0b648a7f4c.gif","uuid":"0a5f2064-f5b4-41a9-8a54-2085e208d20f"},{"name":"3","ext":".gif","url":"//yun.duiba.com.cn/aurora/e052cb4a88d63330c37ecaf55ae8e7eb2246c433.gif","uuid":"e4dacdd2-064f-413e-a8f0-6425ce6dcf12"},{"name":"5","ext":".gif","url":"//yun.duiba.com.cn/aurora/881193ea1bd975c8a59f38f2d1f0d0094db6ec7a.gif","uuid":"bf822d51-a1b1-4ab6-8f49-a821863731d0"},{"name":"4","ext":".gif","url":"//yun.duiba.com.cn/aurora/2df4a5c5238f86704388517d2ba0faa6782fea1e.gif","uuid":"9c1d46b4-d2f1-4733-8b93-39b2bb4db9d1"},{"name":"1","ext":".gif","url":"//yun.duiba.com.cn/aurora/0bc24c7bb68e3691bad89c8ae096b253af874a73.gif","uuid":"db076340-e1db-4e2d-8bb2-7cc32ccdee43"},{"name":"7","ext":".gif","url":"//yun.duiba.com.cn/aurora/3e218541244d1ed1192274ad49ea70588b6cd0dc.gif","uuid":"02aa47c3-dbdf-43d2-8cdc-869cab544bcc"},{"name":"2","ext":".gif","url":"//yun.duiba.com.cn/aurora/1e1344fabf25cf2ea6f1407cd42afc1f1de0bb07.gif","uuid":"264f7a8d-475e-4fd0-ac83-96e13a7702f3"},{"name":"8","ext":".gif","url":"//yun.duiba.com.cn/aurora/90080b186e0507b70f64c2020880dd1ddd3b7cd8.gif","uuid":"ec63930b-8aff-4108-9ceb-ddf9353d4412"},{"name":"0","ext":".gif","url":"//yun.duiba.com.cn/aurora/616a413facbd406b81daac809a52bd0b648a7f4c.gif","uuid":"7c475d4d-0ae2-4b9a-81ff-76fb8264721f"},{"name":"9","ext":".gif","url":"//yun.duiba.com.cn/aurora/f41b70c1003ff703386a5a80ed7092db5fdc11f4.gif","uuid":"473b82ec-c9b9-43d7-b2e5-b5399a55d239"},{"name":"12","ext":".gif","url":"//yun.duiba.com.cn/aurora/99660ca0a9a578cd6c5eb38b1f35aee9a77849b3.gif","uuid":"84f549d3-9bb1-4066-9668-3705e94b5891"},{"name":"11","ext":".gif","url":"//yun.duiba.com.cn/aurora/f88c5de6bb6ab80f24cc56978e92cedf4af201f0.gif","uuid":"a4470420-60bd-4578-a2dc-100663ba6256"},{"name":"13","ext":".gif","url":"//yun.duiba.com.cn/aurora/c5c446eba840899d364bcdb010a2aea8d2ae02ab.gif","uuid":"7383d2db-43dd-408a-aa69-261bd39865ac"},{"name":"6","ext":".gif","url":"//yun.duiba.com.cn/aurora/881193ea1bd975c8a59f38f2d1f0d0094db6ec7a.gif","uuid":"894a28f8-a814-4c8c-a5d9-619194b3073d"},{"name":"btn-join","ext":".png","url":"//yun.duiba.com.cn/aurora/e50e0fe70f4b2c96d2deee1d93a0a2444732be6a.png","uuid":"e3301bc4-7b51-4868-a613-26298f87988b"},{"name":"bg","ext":".jpg","url":"//yun.duiba.com.cn/aurora/7dbe10dba2a92d830f0f9ff72f3d82e07a4c4649.jpg","uuid":"bab58ec1-24b1-4d5d-9c95-7014b9915cb3"},{"name":"1643017","ext":".png","uuid":"54f7916f-dc10-49f7-b3b1-0bda9d4f5bcd","url":"//yun.duiba.com.cn/aurora/4090d0acf7dbf29cd6ab0690795e0b00b715280c.png"},{"name":"bg","ext":".png","uuid":"5fe14ca0-5b86-405e-98a6-54ca733f2180","url":"//yun.duiba.com.cn/aurora/070159098034ae2cd8c8e4bf4f47b1d45b87024a.png"},{"name":"rule_button","ext":".png","uuid":"82a9d493-078a-4b7c-8352-616abc99f24a","url":"//yun.duiba.com.cn/aurora/d0c3ed2bf9abc5748c01eb88abb7e0830669b1c5.png"},{"name":"wheel_items","ext":".png","uuid":"b899e2f0-36da-42dc-a9ac-c8f4093e4457","url":"//yun.duiba.com.cn/aurora/897ee802eb89999c2019c683c084f4b7e2d7f554.png"},{"name":"wheel_bg","ext":".png","uuid":"8f531f60-b48e-4a7a-bd7a-9488a3c3dd2d","url":"//yun.duiba.com.cn/aurora/479cbb31bfdaee48893bf34f7d0c8fc702b1459a.png"},{"name":"start_bg","ext":".png","uuid":"62fe5f9b-47ec-4c1e-b508-f566501caa72","url":"//yun.duiba.com.cn/aurora/3191ba684512b9e9391ab4a9d2a2df31cad4825d.png"},{"name":"0","ext":".png","uuid":"562af6d0-6b73-4de8-bed0-ed3a4507962c","url":"//yun.duiba.com.cn/aurora/be2fa0d9e91b58d9aafcd18f7934784742069cb6.png"},{"name":"1","ext":".png","uuid":"6cf1bc08-bcc8-4cec-88d8-3e979b35dd0f","url":"//yun.duiba.com.cn/aurora/3f64f753e272d17a1f5807ddf1a8965a0e2de9d5.png"},{"name":"0","ext":".png","uuid":"378851d3-6664-4b0e-8407-342f4ffaf334","url":"//yun.duiba.com.cn/aurora/3c292a9c6c5b1a3dab684e95d1f7b7cb4f369a8a.png"},{"name":"1","ext":".png","uuid":"dee35c49-db44-4722-a412-a8b7123d20b7","url":"//yun.duiba.com.cn/aurora/b22420f2322326359e2b3e1dae66dc7e34ce6978.png"},{"name":"bg","ext":".png","uuid":"2b0cc6bd-fc10-43ee-a217-aaf1c40a0ad3","url":"//yun.duiba.com.cn/aurora/93fbb49529a3b4617f4cdc41dba7c297989baa5e.png"}],"dataMapping":[{"name":"nickname","path":"test.hello.aaa.name"},{"name":"avatar","path":"test.hello.aaa.avatar"}],"processes":[{"id":"main","name":"Main","props":{},"subEntry":"a1","sub":{"a1":{"uuid":"a1","alias":"入口","meta":"entry","output":{"success":["a2"]},"design":{"x":10,"y":10}},"a2":{"uuid":"a2","alias":"test","meta":"test","props":{"text":"Hello"},"output":{"success":[],"failed":[]},"design":{"x":20,"y":100}}}},{"id":"test","name":"Test","desc":"测试过程","props":{"text":{"alias":"文本","type":"string","default":"你好"},"num":{"alias":"数字","type":"number","default":1},"type":{"alias":"类型","type":"enum","enum":["rotate","jump","breath"],"default":"rotate"},"autoPlay":{"alias":"自动播放","type":"boolean","default":false},"color":{"alias":"颜色","type":"color","default":"#123456"},"asset":{"alias":"素材","type":"asset"},"node":{"alias":"节点","type":"node"}},"output":["success","failed"],"script":"console.log('test');resolve({type: 'success'})"}],"scripts":{"wave":"\"use strict\";\nexports.__esModule = true;\nvar Wave = (function () {\n function Wave() {\n }\n Wave.prototype.mounted = function () {\n console.log('mounted', this.duration);\n this.host.anchorX = this.host.width / 2;\n this.host.anchorY = this.host.height / 2;\n };\n Wave.prototype.destroy = function () {\n console.log('destroy');\n };\n Wave.prototype.update = function (t) {\n this.host.rotation = t * 0.1;\n };\n Wave.prototype.awake = function () {\n console.log('awake');\n };\n Wave.prototype.sleep = function () {\n console.log('sleep');\n };\n return Wave;\n}());\nexports[\"default\"] = Wave;"},"builtinProcesses":[{"id":"entry","name":"Entry","props":{},"script":"resolve({type: 'success', payload: args});","output":["success"]}]}
"launchOptions": { \ No newline at end of file
"entrySceneView": "view1",
"containerID": "game-container",
"designWidth": 750,
"designHeight": 1334,
"frameRate": 60,
"scaleMode": "fixedWidth",
"rendererType": "webgl"
},
"views": [
{
"name": "view1",
"type": "node",
"properties": {
"width": "100%",
"height": "100%",
"mouseEnabled": false
},
"uuid": "3a357816-5581-41ba-aa6f-4a6cc40ae396",
"children": [
{
"name": "bg",
"type": "rect",
"uuid": "f97bbf76-6923-4669-b5a3-e6382753e49a",
"properties": {
"width": "100%",
"height": "100%",
"fillColor": "#1E2127",
"mouseEnabled": false
}
},
{
"name": "button",
"type": "rect",
"uuid": "aaaa",
"properties": {
"y": 20,
"width": 150,
"height": 50,
"horizonCenter": 0,
"borderRadius": 10,
"fillColor": "#27ADB8",
"mouseChildren": false
},
"children": [
{
"name": "label",
"type": "label",
"uuid": "bbbb",
"properties": {
"width": "100%",
"height": "100%",
"fillColor": "white",
"text": "Button",
"size": 30,
"textAlign": "center",
"verticalAlign": "middle"
}
}
],
"events": {
"click": {
"once": false,
"behaviors": [
{
"uuid": "aa1",
"alias": "主过程",
"meta": "main",
"props": {
"text": "linked_text"
}
}
]
}
},
"scripts": [
{
"script": "ZoomButton",
"disabled": false,
"properties": {
"duration": 1000
}
}
]
}
]
},
{
"name": "view2",
"type": "node",
"properties": {
"horizonCenter": 0,
"verticalCenter": 0,
"width": "80%",
"height": 400
},
"uuid": "3a357816-5581-41ba-aa6f-4a6cc40ae396",
"children": [
{
"name": "bg",
"type": "rect",
"properties": {
"width": "100%",
"height": "100%",
"borderRadius": 10,
"fillColor": "orange"
},
"uuid": "f97bbf76-6923-4669-b5a3-e6382753e49a"
},
{
"name": "img",
"type": "image",
"properties": {
"source": "asset://0a5f2064-f5b4-41a9-8a54-2085e208d20f"
},
"uuid": "f97bbf76-6923-4669-b5a3-e6382753e49a"
}
]
}
],
"assets": [
{
"name": "face",
"ext": ".png",
"url": "//yun.duiba.com.cn/aurora/58323a0469a7467c99b34f8933ea65b507a0c655.png",
"uuid": "3e496939-5fe6-42f2-b8fa-42c7a742e880"
},
{
"name": "还以是bug",
"ext": ".jpg",
"url": "//yun.duiba.com.cn/aurora/094832ace87c94bdb9e4a7821b3a3ebca0df2cd7.jpg",
"uuid": "ec67a8a0-8708-43a4-888e-efb0fe7c2bd6"
},
{
"name": "嘿嘿",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/1ad10a4cf3488ef1400af1d6f353d9c577fe1049.gif",
"uuid": "429803eb-0f68-4071-b68c-468980883ac4"
},
{
"name": "1643017",
"ext": ".jpg",
"url": "//yun.duiba.com.cn/aurora/2e4adf3d8646ffbd027038cb2c6627a6bca44e44.jpg",
"uuid": "cc1ad757-ff4c-4cb9-b629-be355119d018"
},
{
"name": "0",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/616a413facbd406b81daac809a52bd0b648a7f4c.gif",
"uuid": "0a5f2064-f5b4-41a9-8a54-2085e208d20f"
},
{
"name": "3",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/e052cb4a88d63330c37ecaf55ae8e7eb2246c433.gif",
"uuid": "e4dacdd2-064f-413e-a8f0-6425ce6dcf12"
},
{
"name": "5",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/881193ea1bd975c8a59f38f2d1f0d0094db6ec7a.gif",
"uuid": "bf822d51-a1b1-4ab6-8f49-a821863731d0"
},
{
"name": "4",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/2df4a5c5238f86704388517d2ba0faa6782fea1e.gif",
"uuid": "9c1d46b4-d2f1-4733-8b93-39b2bb4db9d1"
},
{
"name": "1",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/0bc24c7bb68e3691bad89c8ae096b253af874a73.gif",
"uuid": "db076340-e1db-4e2d-8bb2-7cc32ccdee43"
},
{
"name": "7",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/3e218541244d1ed1192274ad49ea70588b6cd0dc.gif",
"uuid": "02aa47c3-dbdf-43d2-8cdc-869cab544bcc"
},
{
"name": "2",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/1e1344fabf25cf2ea6f1407cd42afc1f1de0bb07.gif",
"uuid": "264f7a8d-475e-4fd0-ac83-96e13a7702f3"
},
{
"name": "8",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/90080b186e0507b70f64c2020880dd1ddd3b7cd8.gif",
"uuid": "ec63930b-8aff-4108-9ceb-ddf9353d4412"
},
{
"name": "0",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/616a413facbd406b81daac809a52bd0b648a7f4c.gif",
"uuid": "7c475d4d-0ae2-4b9a-81ff-76fb8264721f"
},
{
"name": "9",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/f41b70c1003ff703386a5a80ed7092db5fdc11f4.gif",
"uuid": "473b82ec-c9b9-43d7-b2e5-b5399a55d239"
},
{
"name": "12",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/99660ca0a9a578cd6c5eb38b1f35aee9a77849b3.gif",
"uuid": "84f549d3-9bb1-4066-9668-3705e94b5891"
},
{
"name": "11",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/f88c5de6bb6ab80f24cc56978e92cedf4af201f0.gif",
"uuid": "a4470420-60bd-4578-a2dc-100663ba6256"
},
{
"name": "13",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/c5c446eba840899d364bcdb010a2aea8d2ae02ab.gif",
"uuid": "7383d2db-43dd-408a-aa69-261bd39865ac"
},
{
"name": "6",
"ext": ".gif",
"url": "//yun.duiba.com.cn/aurora/881193ea1bd975c8a59f38f2d1f0d0094db6ec7a.gif",
"uuid": "894a28f8-a814-4c8c-a5d9-619194b3073d"
},
{
"name": "btn-join",
"ext": ".png",
"url": "//yun.duiba.com.cn/aurora/e50e0fe70f4b2c96d2deee1d93a0a2444732be6a.png",
"uuid": "e3301bc4-7b51-4868-a613-26298f87988b"
},
{
"name": "bg",
"ext": ".jpg",
"url": "//yun.duiba.com.cn/aurora/7dbe10dba2a92d830f0f9ff72f3d82e07a4c4649.jpg",
"uuid": "bab58ec1-24b1-4d5d-9c95-7014b9915cb3"
},
{
"name": "1643017",
"ext": ".png",
"uuid": "54f7916f-dc10-49f7-b3b1-0bda9d4f5bcd",
"url": "//yun.duiba.com.cn/aurora/4090d0acf7dbf29cd6ab0690795e0b00b715280c.png"
},
{
"name": "bg",
"ext": ".png",
"uuid": "5fe14ca0-5b86-405e-98a6-54ca733f2180",
"url": "//yun.duiba.com.cn/aurora/070159098034ae2cd8c8e4bf4f47b1d45b87024a.png"
},
{
"name": "rule_button",
"ext": ".png",
"uuid": "82a9d493-078a-4b7c-8352-616abc99f24a",
"url": "//yun.duiba.com.cn/aurora/d0c3ed2bf9abc5748c01eb88abb7e0830669b1c5.png"
},
{
"name": "wheel_items",
"ext": ".png",
"uuid": "b899e2f0-36da-42dc-a9ac-c8f4093e4457",
"url": "//yun.duiba.com.cn/aurora/897ee802eb89999c2019c683c084f4b7e2d7f554.png"
},
{
"name": "wheel_bg",
"ext": ".png",
"uuid": "8f531f60-b48e-4a7a-bd7a-9488a3c3dd2d",
"url": "//yun.duiba.com.cn/aurora/479cbb31bfdaee48893bf34f7d0c8fc702b1459a.png"
},
{
"name": "start_bg",
"ext": ".png",
"uuid": "62fe5f9b-47ec-4c1e-b508-f566501caa72",
"url": "//yun.duiba.com.cn/aurora/3191ba684512b9e9391ab4a9d2a2df31cad4825d.png"
},
{
"name": "0",
"ext": ".png",
"uuid": "562af6d0-6b73-4de8-bed0-ed3a4507962c",
"url": "//yun.duiba.com.cn/aurora/be2fa0d9e91b58d9aafcd18f7934784742069cb6.png"
},
{
"name": "1",
"ext": ".png",
"uuid": "6cf1bc08-bcc8-4cec-88d8-3e979b35dd0f",
"url": "//yun.duiba.com.cn/aurora/3f64f753e272d17a1f5807ddf1a8965a0e2de9d5.png"
},
{
"name": "0",
"ext": ".png",
"uuid": "378851d3-6664-4b0e-8407-342f4ffaf334",
"url": "//yun.duiba.com.cn/aurora/3c292a9c6c5b1a3dab684e95d1f7b7cb4f369a8a.png"
},
{
"name": "1",
"ext": ".png",
"uuid": "dee35c49-db44-4722-a412-a8b7123d20b7",
"url": "//yun.duiba.com.cn/aurora/b22420f2322326359e2b3e1dae66dc7e34ce6978.png"
},
{
"name": "bg",
"ext": ".png",
"uuid": "2b0cc6bd-fc10-43ee-a217-aaf1c40a0ad3",
"url": "//yun.duiba.com.cn/aurora/93fbb49529a3b4617f4cdc41dba7c297989baa5e.png"
}
],
"dataMapping": [
{
"name": "nickname",
"path": "test.hello.aaa.name"
},
{
"name": "avatar",
"path": "test.hello.aaa.avatar"
}
],
"processes": [
{
"id": "main",
"name": "Main",
"props": {
"text": {
"alias": "文本",
"type": "string",
"default": "你好"
}
},
"subEntry": "a1",
"sub": {
"a1": {
"uuid": "a1",
"alias": "入口",
"meta": "entry",
"output": {
"success": [
"a2"
]
},
"design": {
"x": 10,
"y": 10
}
},
"a2": {
"uuid": "a2",
"meta": "divider1",
"output": {
"p0": [
"a3"
],
"p1": [
"a4"
]
}
},
"a3": {
"uuid": "a3",
"alias": "test",
"meta": "test",
"props": {
"text": "hello",
"node": "node://bbbb"
},
"output": {
"success": [],
"failed": []
},
"design": {
"x": 20,
"y": 100
}
},
"a4": {
"uuid": "a4",
"alias": "test2",
"meta": "test2",
"props": {
"text": "$_linked_$"
},
"output": {
"success": [],
"failed": []
},
"design": {
"x": 20,
"y": 100
}
}
}
},
{
"id": "test",
"name": "Test",
"props": {
"text": {
"alias": "文本",
"type": "string",
"default": "你好"
},
"num": {
"alias": "数字",
"type": "number",
"default": 1
},
"type": {
"alias": "类型",
"type": "enum",
"enum": [
"rotate",
"jump",
"breath"
],
"default": "rotate"
},
"autoPlay": {
"alias": "自动播放",
"type": "boolean",
"default": false
},
"color": {
"alias": "颜色",
"type": "color",
"default": "#123456"
},
"asset": {
"alias": "素材",
"type": "asset"
},
"node": {
"alias": "节点",
"type": "node"
}
},
"output": [
"success",
"failed"
],
"script": "console.log('test');resolve({type: 'success', payload: args})"
},
{
"id": "test2",
"name": "Test2",
"props": {
"text": {
"alias": "文本",
"type": "string",
"default": "你好"
}
},
"output": [
"success",
"failed"
],
"script": "console.log('test2', props);resolve({type: 'success', payload: args})"
},
{
"id": "divider1",
"name": "Divider1",
"isDivider": true,
"output": [
"p0",
"p1"
]
}
],
"globalProcesses": [
{
"id": "entry",
"name": "Entry",
"props": {},
"script": "resolve({type: 'success', payload: args});",
"output": [
"success"
]
},
{
"id": "wait",
"name": "Wait",
"props": {
"duration": {
"type": "number",
"default": 1000
}
},
"script": "setTimeout(function(){resolve({type: 'complete'})}, props.duration || 0);",
"output": [
"complete"
]
},
{
"id": "compare",
"name": "Compare",
"props": {
"left": {
"type": "any",
"default": ""
},
"right": {
"type": "any",
"default": ""
},
"operator": {
"type": "string",
"default": "=="
}
},
"script": "\nlet leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;\nlet rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;\nlet func = new Function('return '+leftValue+args.operator+rightValue);\nlet result = func();\nresolve({type: result ? 'equal' : 'unequal'});\n\t\t",
"output": [
"complete"
]
},
{
"id": "nestProc",
"name": "NestProc",
"metas": {
"print": {
"id": "print",
"name": "Print",
"props": {
"text": {
"type": "string",
"default": ""
}
},
"script": "console.log(props.text);resolve({type: 'success'});",
"output": [
"success"
]
}
},
"props": {},
"subEntry": "1",
"sub": {
"1": {
"uuid": "1",
"meta": "wait",
"alias": "等待",
"props": {
"duration": 500
},
"output": [
"2"
]
},
"2": {
"uuid": "2",
"alias": "打印",
"meta": "print",
"props": {
"text": "hello"
},
"output": []
}
}
}
]
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
var Wave = (function () {
function Wave() {
}
Wave.prototype.mounted = function () {
console.log('mounted', this.duration);
this.host.anchorX = this.host.width / 2;
this.host.anchorY = this.host.height / 2;
};
Wave.prototype.destroy = function () {
console.log('destroy');
};
Wave.prototype.update = function (t) {
this.host.rotation = t * 0.1;
};
Wave.prototype.awake = function () {
console.log('awake');
};
Wave.prototype.sleep = function () {
console.log('sleep');
};
return Wave;
}());
exports["default"] = Wave;
/**
* Created by rockyl on 2019-11-07.
*/
export default class Wave {
host;
duration;
mounted(){
console.log('mounted', this.duration);
this.host.anchorX = this.host.width / 2;
this.host.anchorY = this.host.height / 2;
}
destroy(){
console.log('destroy');
}
update(t){
//console.log('update', t);
this.host.rotation = t * 0.1;
}
awake(){
console.log('awake');
}
sleep(){
console.log('sleep');
}
}
...@@ -42,10 +42,11 @@ export interface IScript { ...@@ -42,10 +42,11 @@ export interface IScript {
/** /**
* 注册脚本定义 * 注册脚本定义
* @param id
* @param def * @param def
*/ */
export function registerScriptDef(def) { export function registerScriptDef(id, def) {
scriptDefs[def.name] = def; scriptDefs[id] = def;
Object.defineProperty(def, 'disabled', { Object.defineProperty(def, 'disabled', {
get: function () { get: function () {
...@@ -67,6 +68,16 @@ export function registerScriptDef(def) { ...@@ -67,6 +68,16 @@ export function registerScriptDef(def) {
}); });
} }
export function registerScripts(scripts){
for(let id in scripts){
let code = scripts[id];
let create = new Function('exports', code);
let exports = {};
create(exports);
registerScriptDef(id, exports['default']);
}
}
/** /**
* 脚本容器 * 脚本容器
*/ */
......
...@@ -8,6 +8,7 @@ import {loadAssets} from "./assets-manager"; ...@@ -8,6 +8,7 @@ import {loadAssets} from "./assets-manager";
import {instantiate} from "./view-interpreter"; import {instantiate} from "./view-interpreter";
import {dataCenter, DataCenter} from "./data-center"; import {dataCenter, DataCenter} from "./data-center";
import {setProcessMetaLibs} from "../behavior-runtime"; import {setProcessMetaLibs} from "../behavior-runtime";
import {registerScripts} from "..";
/** /**
* 游戏舞台 * 游戏舞台
...@@ -81,10 +82,11 @@ export class GameStage extends Container { ...@@ -81,10 +82,11 @@ export class GameStage extends Container {
* 开始游戏 * 开始游戏
*/ */
start() { start() {
const {launchOptions, dataMapping, processes, globalProcesses} = this._config; const {options, dataMapping, processes, builtinProcesses, scripts} = this._config;
registerScripts(scripts);
this.dataCenter.registerDataMapping(dataMapping); this.dataCenter.registerDataMapping(dataMapping);
setProcessMetaLibs(processes, globalProcesses); setProcessMetaLibs(processes, builtinProcesses);
const entryViewName = launchOptions.entrySceneView; const entryViewName = options.entrySceneView;
let entryViewConfig = this.getViewConfigByName(entryViewName); let entryViewConfig = this.getViewConfigByName(entryViewName);
if (entryViewConfig) { if (entryViewConfig) {
let sceneEntry = instantiate(entryViewConfig); let sceneEntry = instantiate(entryViewConfig);
......
...@@ -27,7 +27,7 @@ export function launch(url, onAssetsProgress, onAssetsComplete) { ...@@ -27,7 +27,7 @@ export function launch(url, onAssetsProgress, onAssetsComplete) {
export function launchWithConfig(config, onAssetsProgress, onAssetsComplete) { export function launchWithConfig(config, onAssetsProgress, onAssetsComplete) {
return new Promise(resolve => { return new Promise(resolve => {
const {containerID, designWidth, designHeight, frameRate, scaleMode, rendererType,} = config.launchOptions; const {containerID, designWidth, designHeight, frameRate, scaleMode, rendererType,} = config.options;
let stage = window['stage'] = new Stage( let stage = window['stage'] = new Stage(
containerID || "game-container", containerID || "game-container",
designWidth || 750, designWidth || 750,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"removeComments": true, "removeComments": true,
"noEmitOnError": true, "noEmitOnError": true,
// "declarationDir": "types", // "declarationDir": "types",
"declaration": true, //"declaration": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"outDir": "dist", "outDir": "dist",
"lib": [ "lib": [
......
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