Commit 58a746b7 authored by Master Q's avatar Master Q

游戏流程

parent bfbf8b85
declare namespace FYGE{export const VERSION = "2.0.28";
export const osType: "ios" | "android" | "pc";
export function cos(angle: number): number;
export function sin(angle: number): number;
export const PI_2: number;
export const RAD_TO_DEG: number;
export const DEG_TO_RAD: number;
declare namespace FYGE{export const VERSION = "2.0.28";
export const osType: "ios" | "android" | "pc";
export function cos(angle: number): number;
export function sin(angle: number): number;
export const PI_2: number;
export const RAD_TO_DEG: number;
export const DEG_TO_RAD: number;
export enum RENDERER_TYPE {
UNKNOWN = 0,
WEBGL = 1,
CANVAS = 2
}
}
export enum SHAPES {
POLY = 0,
RECT = 1,
CIRC = 2,
ELIP = 3,
RREC = 4
}
}
export enum PRECISION {
LOW = "lowp",
MEDIUM = "mediump",
HIGH = "highp"
}
}
export enum TEXT_GRADIENT {
LINEAR_VERTICAL = 0,
LINEAR_HORIZONTAL = 1
}
}
export enum TEXT_ALIGN {
CENTER = "center",
LEFT = "left",
RIGHT = "right"
}
}
export enum VERTICAL_ALIGN {
MIDDLE = "middle",
UP = "up",
DOWN = "down"
}
}
export enum TEXT_lINETYPE {
SINGLE = "single",
MULTI = "multi"
}
}
export enum LINE_ALIGNMENT {
middle = 0.5,
outter = 1,
inner = 0
}
}
export enum LINE_CAP {
BUTT = "butt",
ROUND = "round",
SQUARE = "square"
}
}
export enum LINE_JOIN {
MITER = "miter",
ROUND = "round",
BEVEL = "bevel"
}
}
export enum BLEND_MODES {
NORMAL = 0,
ADD = 1,
......@@ -104,8 +104,8 @@ export enum BLEND_MODES {
DST_ATOP = 28,
ERASE = 29,
SUBTRACT = 30
}
}
export enum DRAW_MODES {
POINTS = 0,
LINES = 1,
......@@ -114,24 +114,24 @@ export enum DRAW_MODES {
TRIANGLES = 4,
TRIANGLE_STRIP = 5,
TRIANGLE_FAN = 6
}
}
export enum SCALE_MODES {
LINEAR = 0,
NEAREST = 1
}
}
export enum WRAP_MODES {
CLAMP = 33071,
REPEAT = 10497,
MIRRORED_REPEAT = 33648
}
}
export enum GC_MODES {
AUTO = 0,
MANUAL = 1
}
}
export abstract class HashObject {
protected _instanceId: number;
protected _instanceType: string;
......@@ -166,8 +166,8 @@ export abstract class HashObject {
* @return {void}
*/
abstract destroy(): void;
}
}
export class Event extends HashObject {
/**
* 舞台尺寸发生变化时触发
......@@ -380,8 +380,8 @@ export class Event extends HashObject {
* @public
*/
reset(type: string, target: any): void;
}
}
export class EventDispatcher extends HashObject {
/**
* 捕获阶段事件名
......@@ -499,8 +499,8 @@ export class EventDispatcher extends HashObject {
*/
removeAllEventListener(): void;
destroy(): void;
}
}
export class Point extends HashObject {
destroy(): void;
/**
......@@ -537,8 +537,8 @@ export class Point extends HashObject {
*/
static distance(...args: any[]): number;
set(x: number, y: number): void;
}
}
export class ObservablePoint extends HashObject {
_x: number;
_y: number;
......@@ -568,8 +568,8 @@ export class ObservablePoint extends HashObject {
get y(): number;
set y(value: number);
destroy(): void;
}
}
export class Transform extends HashObject {
/**
* 世界矩阵
......@@ -648,8 +648,8 @@ export class Transform extends HashObject {
get rotation(): number;
set rotation(value: number);
destroy(): void;
}
}
export class Matrix extends HashObject {
/**
* @property a
......@@ -868,8 +868,8 @@ export class Matrix extends HashObject {
*/
static get TEMP_MATRIX(): Matrix;
destroy(): void;
}
}
export class Rectangle extends HashObject {
/**
* 类型
......@@ -1013,8 +1013,8 @@ export class Rectangle extends HashObject {
*/
static testRectCross(ra: Rectangle, rb: Rectangle): boolean;
destroy(): void;
}
}
export const GroupD8: {
E: number;
SE: number;
......@@ -1068,8 +1068,8 @@ export const GroupD8: {
* @param {number} ty - sprite anchoring
*/
matrixAppendRotationInv: (matrix: any, rotation: any, tx?: number, ty?: number) => void;
}
}
export class Circle {
/**
* @member {number}
......@@ -1117,8 +1117,8 @@ export class Circle {
* @return {Rectangle} the framing rectangle
*/
getBounds(): Rectangle;
}
}
export class Ellipse {
/**
* @member {number}
......@@ -1175,8 +1175,8 @@ export class Ellipse {
* @return {Rectangle} the framing rectangle
*/
getBounds(): Rectangle;
}
}
export class Polygon {
/**
* 是否闭合
......@@ -1227,8 +1227,8 @@ export class Polygon {
* @return {boolean} Whether the x/y coordinates are within this polygon
*/
isPointIn(point: Point): boolean;
}
}
export class RoundedRectangle {
x: number;
y: number;
......@@ -1261,70 +1261,70 @@ export class RoundedRectangle {
* @return {boolean} Whether the x/y coords are within this ellipse
*/
isPointIn(point: Point): boolean;
}
export function getEnv(): "tb" | "web";
export function setEnv(e: "tb" | "web"): void;
export function createCanvas(): HTMLCanvasElement;
export function initedByTbCanvas(canvas: any): void;
export function initedByCanvas(canvas: any): void;
export function destroyTbCanvas(): void;
export function destroyCanvasContent(): void;
export function createImage(): HTMLImageElement;
export function requestAnimationFrame(callback: any): any;
export function cancelAnimationFrame(id: number): void;
export function getRequestAnimationFrame(): void;
export const INT_BITS1 = 32;
export const INT_MAX = 2147483647;
export const INT_MIN: number;
export function abs(v: any): number;
export function min(x: any, y: any): number;
export function max(x: any, y: any): number;
export function isPow2(v: any): boolean;
export function log2(v: any): number;
export function log10(v: any): 1 | 0 | 2 | 4 | 3 | 9 | 5 | 6 | 7 | 8;
export function popCount(v: any): number;
export function countTrailingZeros(v: any): number;
export function nextPow2(v: any): any;
export function prevPow2(v: any): number;
export function parity(v: any): number;
export function reverse(v: any): number;
export function interleave2(x: any, y: any): number;
export function deinterleave2(v: any, n: any): number;
export function interleave3(x: any, y: any, z: any): number;
export function deinterleave3(v: any, n: any): number;
export function nextCombination(v: any): number;
}
export function getEnv(): "tb" | "web";
export function setEnv(e: "tb" | "web"): void;
export function createCanvas(): HTMLCanvasElement;
export function initedByTbCanvas(canvas: any): void;
export function initedByCanvas(canvas: any): void;
export function destroyTbCanvas(): void;
export function destroyCanvasContent(): void;
export function createImage(): HTMLImageElement;
export function requestAnimationFrame(callback: any): any;
export function cancelAnimationFrame(id: number): void;
export function getRequestAnimationFrame(): void;
export const INT_BITS1 = 32;
export const INT_MAX = 2147483647;
export const INT_MIN: number;
export function abs(v: any): number;
export function min(x: any, y: any): number;
export function max(x: any, y: any): number;
export function isPow2(v: any): boolean;
export function log2(v: any): number;
export function log10(v: any): 1 | 0 | 2 | 4 | 3 | 9 | 5 | 6 | 7 | 8;
export function popCount(v: any): number;
export function countTrailingZeros(v: any): number;
export function nextPow2(v: any): any;
export function prevPow2(v: any): number;
export function parity(v: any): number;
export function reverse(v: any): number;
export function interleave2(x: any, y: any): number;
export function deinterleave2(v: any, n: any): number;
export function interleave3(x: any, y: any, z: any): number;
export function deinterleave3(v: any, n: any): number;
export function nextCombination(v: any): number;
export class CanvasGraphicsRenderer {
renderer: CanvasRenderer;
/**
......@@ -1342,12 +1342,12 @@ export class CanvasGraphicsRenderer {
*
*/
destroy(): void;
}
export function holePath(graphicsData: GraphicsData, context: CanvasRenderingContext2D, ccw?: boolean): void;
export function judgeCcw(points: number[]): boolean;
}
export function holePath(graphicsData: GraphicsData, context: CanvasRenderingContext2D, ccw?: boolean): void;
export function judgeCcw(points: number[]): boolean;
export class CanvasMaskManager extends HashObject {
renderer: any;
/**
......@@ -1377,8 +1377,8 @@ export class CanvasMaskManager extends HashObject {
*
*/
destroy(): void;
}
}
export class BatchDrawCall {
/**
* 存储基础图片
......@@ -1405,8 +1405,8 @@ export class BatchDrawCall {
*/
type: number;
constructor();
}
}
export class ObjectRenderer {
/**
* The renderer this manager works for.
......@@ -1445,12 +1445,12 @@ export class ObjectRenderer {
* Generic destroy methods to be overridden by the subclass
*/
destroy(): void;
}
export function createContext(canvas: HTMLCanvasElement, options?: any): WebGLRenderingContext;
export function checkMaxIfStatementsInShader(maxIfs: number, gl: WebGLRenderingContext): number;
}
export function createContext(canvas: HTMLCanvasElement, options?: any): WebGLRenderingContext;
export function checkMaxIfStatementsInShader(maxIfs: number, gl: WebGLRenderingContext): number;
export class BatchBuffer {
/**
* 顶点数据,类型化数组
......@@ -1482,8 +1482,8 @@ export class BatchBuffer {
*
*/
destroy(): void;
}
}
export class GLTexture {
/**
* 当前上下文
......@@ -1604,8 +1604,8 @@ export class GLTexture {
* @param height {number} the new height of the texture
*/
static fromData(gl: any, data: any, width: any, height: any): GLTexture;
}
}
export class GLBuffer {
/**
* 当前上下文
......@@ -1679,10 +1679,10 @@ export class GLBuffer {
*/
static createIndexBuffer(gl: any, data?: any, drawType?: any): GLBuffer;
static create(gl: any, type: any, data: any, drawType: any): GLBuffer;
}
export function setVertexAttribArrays(gl: any, attribs: any, state?: any): void;
}
export function setVertexAttribArrays(gl: any, attribs: any, state?: any): void;
export class VertexArrayObject {
nativeVaoExtension: any;
nativeState: any;
......@@ -1772,8 +1772,8 @@ export class VertexArrayObject {
* @property {Boolean} FORCE_NATIVE
*/
static FORCE_NATIVE: boolean;
}
}
export class GLFramebuffer {
/**
* 当前渲染上下文
......@@ -1844,26 +1844,26 @@ export class GLFramebuffer {
* @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data
*/
static createFloat32(gl: WebGLRenderingContext, width: number, height: number, data: any): GLFramebuffer;
}
export function compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, attributeLocations?: any): WebGLProgram;
export function mapType(gl: any, type: any): any;
export function mapSize(type: string): number;
export function extractAttributes(gl: WebGLRenderingContext, program: WebGLProgram): {};
export function defaultValue(type: string, size: number): false | any[] | Int32Array | 0;
export function extractUniforms(gl: WebGLRenderingContext, program: WebGLProgram): {};
export function setPrecision(src: string, precision: string): string;
}
export function compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, attributeLocations?: any): WebGLProgram;
export function mapType(gl: any, type: any): any;
export function mapSize(type: string): number;
export function extractAttributes(gl: WebGLRenderingContext, program: WebGLProgram): {};
export function defaultValue(type: string, size: number): false | any[] | Int32Array | 0;
export function extractUniforms(gl: WebGLRenderingContext, program: WebGLProgram): {};
export function setPrecision(src: string, precision: string): string;
export function generateUniformAccessObject(gl: WebGLRenderingContext, uniformData: any): {
data: {};
}
}
export class GLShader {
/**
* The current WebGL rendering context
......@@ -1908,12 +1908,12 @@ export class GLShader {
* TODO
*/
destroy(): void;
}
export function generateMultiTextureShader(gl: any, maxTextures: any): GLShader;
export const premultiplyBlendMode: any[];
}
export function generateMultiTextureShader(gl: any, maxTextures: any): GLShader;
export const premultiplyBlendMode: any[];
export class BatchRenderer extends ObjectRenderer {
vertSize: number;
vertByteSize: number;
......@@ -2010,10 +2010,10 @@ export class BatchRenderer extends ObjectRenderer {
*
*/
destroy(): void;
}
export {};
}
export {};
export class SystemRenderer extends EventDispatcher {
/**
* 渲染类型
......@@ -2075,8 +2075,8 @@ export class SystemRenderer extends EventDispatcher {
* 背景色,十六进制颜色
*/
set backgroundColor(value: number);
}
}
export class RenderTarget {
/**
* The current WebGL drawing context.
......@@ -2195,8 +2195,8 @@ export class RenderTarget {
* 销毁方法
*/
destroy(): void;
}
}
export class TextureManager {
boundTextures: any;
renderer: WebglRenderer;
......@@ -2259,8 +2259,8 @@ export class TextureManager {
* Destroys this manager and removes all its textures
*/
destroy(): void;
}
}
export class TextureGarbageCollector {
renderer: WebglRenderer;
count: number;
......@@ -2288,10 +2288,10 @@ export class TextureGarbageCollector {
* @param {DisplayObject} displayObject - the displayObject to remove the textures from.
*/
unload(displayObject: any): void;
}
export function mapWebGLBlendModes(gl: WebGLRenderingContext, array?: any[]): any[];
}
export function mapWebGLBlendModes(gl: WebGLRenderingContext, array?: any[]): any[];
export class WebGLState {
blendModes: any;
/**
......@@ -2368,8 +2368,8 @@ export class WebGLState {
*
*/
resetTo3D(): void;
}
}
export class BatchManager {
/**
*
......@@ -2400,8 +2400,8 @@ export class BatchManager {
* Reset the system to an empty renderer
*/
reset(): void;
}
}
export class Filter {
vertexSrc: string;
fragmentSrc: string;
......@@ -2482,16 +2482,16 @@ export class Filter {
* @constant
*/
private static get defaultFragmentSrc();
}
}
export class FXAAFilter extends Filter {
constructor();
}
export const defaultVert: string;
export const defaultFilterMatrix: string;
}
export const defaultVert: string;
export const defaultFilterMatrix: string;
export class NoiseFilter extends Filter {
/**
* @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1].
......@@ -2513,8 +2513,8 @@ export class NoiseFilter extends Filter {
*/
get seed(): any;
set seed(value: any);
}
}
export class DisplacementFilter extends Filter {
maskSprite: Sprite;
maskMatrix: Matrix;
......@@ -2539,8 +2539,8 @@ export class DisplacementFilter extends Filter {
*/
get map(): any;
set map(value: any);
}
}
export class BlurXFilter extends Filter {
strength: number;
/**
......@@ -2579,10 +2579,10 @@ export class BlurXFilter extends Filter {
* @param {boolean} clear - Should the output be cleared before rendering?
*/
apply(filterManager: any, input: any, output: any, clear: any): void;
}
export function createIndicesForQuads(size: number): Uint16Array;
}
export function createIndicesForQuads(size: number): Uint16Array;
export class Quad {
/**
* 当前gl上下文
......@@ -2629,14 +2629,14 @@ export class Quad {
*/
upload(): Quad;
destroy(): void;
}
export function calculateScreenSpaceMatrix(outputMatrix: any, filterArea: any, textureSize: any): any;
export function calculateNormalizedScreenSpaceMatrix(outputMatrix: any, filterArea: any, textureSize: any): any;
export function calculateSpriteMatrix(outputMatrix: any, filterArea: any, textureSize: any, sprite: Sprite): Matrix;
}
export function calculateScreenSpaceMatrix(outputMatrix: any, filterArea: any, textureSize: any): any;
export function calculateNormalizedScreenSpaceMatrix(outputMatrix: any, filterArea: any, textureSize: any): any;
export function calculateSpriteMatrix(outputMatrix: any, filterArea: any, textureSize: any, sprite: Sprite): Matrix;
export class FilterManager {
gl: WebGLRenderingContext;
renderer: WebglRenderer;
......@@ -2755,8 +2755,8 @@ export class FilterManager {
*
*/
onPreRender(): void;
}
}
export class BlurYFilter extends Filter {
strength: number;
/**
......@@ -2795,8 +2795,8 @@ export class BlurYFilter extends Filter {
* @param {boolean} clear - Should the output be cleared before rendering?
*/
apply(filterManager: FilterManager, input: any, output: any, clear: any): void;
}
}
export class BlurFilter extends Filter {
private blurXFilter;
private blurYFilter;
......@@ -2855,8 +2855,8 @@ export class BlurFilter extends Filter {
*/
get blendMode(): BLEND_MODES;
set blendMode(value: BLEND_MODES);
}
}
export class ColorMatrixFilter extends Filter {
grayscale: (scale: any, multiply: any) => void;
/**
......@@ -3065,8 +3065,8 @@ export class ColorMatrixFilter extends Filter {
*/
get alpha(): any;
set alpha(value: any);
}
}
export class AlphaFilter extends Filter {
/**
* @param {number} [alpha=1] Amount of alpha from 0 to 1, where 0 is transparent
......@@ -3080,8 +3080,8 @@ export class AlphaFilter extends Filter {
*/
get alpha(): number;
set alpha(value: number);
}
}
export class TextureMatrix {
_texture: Texture;
mapCoord: Matrix;
......@@ -3132,8 +3132,8 @@ export class TextureMatrix {
* @returns {boolean} whether or not it was updated
*/
update(forceUpdate?: boolean): boolean;
}
}
export class SpriteMaskFilter extends Filter {
maskSprite: Sprite;
maskMatrix: Matrix;
......@@ -3149,8 +3149,8 @@ export class SpriteMaskFilter extends Filter {
* @param {RenderTarget} output - The target to output to.
*/
apply(filterManager: FilterManager, input: any, output: any): void;
}
}
export class BlurFilterNew extends Filter {
private _blur;
get blur(): number;
......@@ -3163,8 +3163,8 @@ export class BlurFilterNew extends Filter {
* @param blur 模糊系数 0到1
*/
constructor(blur?: number);
}
}
export class ExtractBrightnessFilter extends Filter {
constructor(threshold?: number);
/**
......@@ -3175,8 +3175,8 @@ export class ExtractBrightnessFilter extends Filter {
*/
get threshold(): any;
set threshold(value: any);
}
}
export class KawaseBlurFilter extends Filter {
private _pixelSize;
private _clamp;
......@@ -3234,8 +3234,8 @@ export class KawaseBlurFilter extends Filter {
*/
get blur(): number;
set blur(value: number);
}
}
export class AdvancedBloomFilter extends Filter {
private _extractFilter;
private _blurFilter;
......@@ -3295,10 +3295,10 @@ export class AdvancedBloomFilter extends Filter {
*/
get pixelSize(): any;
set pixelSize(value: any);
}
export {};
}
export {};
export class MaskManager {
renderer: WebglRenderer;
scissor: boolean;
......@@ -3360,8 +3360,8 @@ export class MaskManager {
*/
private popScissorMask;
destroy(): void;
}
}
export class StencilManager {
renderer: WebglRenderer;
stencilMaskStack: Graphics[];
......@@ -3400,8 +3400,8 @@ export class StencilManager {
*
*/
destroy(): void;
}
}
export class BaseRenderTexture extends BaseTexture {
/**
* webgl帧缓存列表,键值为渲染器的id
......@@ -3436,8 +3436,8 @@ export class BaseRenderTexture extends BaseTexture {
* 销毁
*/
destroy(): void;
}
}
export class RenderTexture extends Texture {
/**
* 它的基础纹理变成了BaseRenderTexture
......@@ -3463,8 +3463,8 @@ export class RenderTexture extends Texture {
* @return {RenderTexture}
*/
static create(width: number, height: number, scaleMode?: number): RenderTexture;
}
}
export class WebglRenderer extends SystemRenderer {
/**
* 所有插件列表,目前只有batch
......@@ -3643,8 +3643,8 @@ export class WebglRenderer extends SystemRenderer {
* @param {Function} ctor - 插件类
*/
static registerPlugin(pluginName: any, ctor: any): void;
}
}
export class Sprite extends Container {
/**
* 混色模式
......@@ -3837,12 +3837,12 @@ export class Sprite extends Container {
* @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId
*/
static fromFrame(frameId: string): Sprite;
}
export function canUseNewCanvasBlendModes(): boolean;
export function getTintedTexture(texture: Texture, color: number): HTMLCanvasElement;
}
export function canUseNewCanvasBlendModes(): boolean;
export function getTintedTexture(texture: Texture, color: number): HTMLCanvasElement;
export class CanvasSpriteRenderer {
renderer: CanvasRenderer;
/**
......@@ -3860,8 +3860,8 @@ export class CanvasSpriteRenderer {
*
*/
destroy(): void;
}
}
export class CanvasRenderTarget {
/**
* The Canvas object that belongs to this CanvasRenderTarget.
......@@ -3908,8 +3908,8 @@ export class CanvasRenderTarget {
*/
get height(): number;
set height(val: number);
}
}
export class Mesh extends Container {
/**
* 混色模式
......@@ -4052,12 +4052,12 @@ export class Mesh extends Container {
* 销毁
*/
destroy(): void;
}
}
export function createTextureSheet(baseTexture: BaseTexture, altaData: any): {
[key: string]: Texture;
}
}
export class Plane extends Mesh {
verticesX: number;
verticesY: number;
......@@ -4072,10 +4072,10 @@ export class Plane extends Mesh {
*
*/
_refresh(): void;
}
export function calculatePlaneIndices(verticesX: number, verticesY: number): Uint16Array;
}
export function calculatePlaneIndices(verticesX: number, verticesY: number): Uint16Array;
export class NineSlicePlane extends Mesh {
/**
* 原始宽度
......@@ -4188,8 +4188,8 @@ export class NineSlicePlane extends Mesh {
* 刷新所有坐标
*/
_refresh(): void;
}
}
export class Rope extends Mesh {
/**
* 一组点
......@@ -4217,8 +4217,8 @@ export class Rope extends Mesh {
*/
refreshVertices(): void;
update(): void;
}
}
export class CanvasMeshRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
......@@ -4226,10 +4226,10 @@ export class CanvasMeshRenderer {
private _renderTriangles;
private _renderDrawTriangle;
destroy(): void;
}
export function mapCanvasBlendModes(array?: any[]): any[];
}
export function mapCanvasBlendModes(array?: any[]): any[];
export class CanvasRenderer extends SystemRenderer {
/**
* 主屏幕渲染上下文
......@@ -4282,40 +4282,40 @@ export class CanvasRenderer extends SystemRenderer {
*/
destroy(): void;
destroyPlugins(): void;
}
export function uid(): number;
export function getBackupCanvasCtx(): CanvasRenderingContext2D;
export function getGradientColor(points: number[], colors: [number, string, number][]): any;
export function getCanvasBitmapStyle(image: any): any;
export function hex2rgb(hex: number, out?: number[] | Float32Array): number[] | Float32Array;
export function hex2string(hex: any): string;
export function string2hex(string: string): number;
export function rgb2hex(rgb: number[]): number;
export function getRGBA(color: string, alpha: number): string;
export function sign(n: number): number;
export function premultiplyTint(tint: number, alpha: number): number;
export const TextureCache: any;
export const BaseTextureCache: any;
export const TextureSheetCache: any;
export function destroyTextureCache(): void;
export function clearTextureCache(): void;
}
export function uid(): number;
export function getBackupCanvasCtx(): CanvasRenderingContext2D;
export function getGradientColor(points: number[], colors: [number, string, number][]): any;
export function getCanvasBitmapStyle(image: any): any;
export function hex2rgb(hex: number, out?: number[] | Float32Array): number[] | Float32Array;
export function hex2string(hex: any): string;
export function string2hex(string: string): number;
export function rgb2hex(rgb: number[]): number;
export function getRGBA(color: string, alpha: number): string;
export function sign(n: number): number;
export function premultiplyTint(tint: number, alpha: number): number;
export const TextureCache: any;
export const BaseTextureCache: any;
export const TextureSheetCache: any;
export function destroyTextureCache(): void;
export function clearTextureCache(): void;
export const GlobalPro: {
/**
* 舞台渲染类型,
......@@ -4329,18 +4329,18 @@ export const GlobalPro: {
* 图集间隙
*/
padding: number;
}
export function isWebGLSupported(): boolean;
export function removeItems(arr: Array<any>, startIdx: number, removeCount: number): void;
export function clamp(value: number, min: number, max: number): number;
export function ArrayBufferToBase64(buff: ArrayBuffer): string;
export function decodeText(array: Uint8Array): string;
}
export function isWebGLSupported(): boolean;
export function removeItems(arr: Array<any>, startIdx: number, removeCount: number): void;
export function clamp(value: number, min: number, max: number): number;
export function ArrayBufferToBase64(buff: ArrayBuffer): string;
export function decodeText(array: Uint8Array): string;
export class Loader extends EventDispatcher {
/**
* 记录原始数据,json和image,贴图在建立时会被缓存
......@@ -4405,10 +4405,10 @@ export class Loader extends EventDispatcher {
*/
private downloadReadFile;
private cache;
}
export const GlobalLoader: Loader;
}
export const GlobalLoader: Loader;
export class BaseTexture extends EventDispatcher {
/**
* 贴图回收时用到,
......@@ -4561,8 +4561,8 @@ export class BaseTexture extends EventDispatcher {
* @return {BaseTexture|null} 移除的BaseTexture或null
*/
static removeFromCache(baseTexture: string | BaseTexture): BaseTexture;
}
}
export class TextureUvs {
x0: number;
y0: number;
......@@ -4591,8 +4591,8 @@ export class TextureUvs {
* @param {number} rotate - Rotation of frame, see {@link GroupD8}
*/
set(frame: Rectangle, baseFrame: Rectangle | BaseTexture, rotate: number): void;
}
}
export class Texture extends EventDispatcher {
/**
* 标记texture没有frame
......@@ -4762,8 +4762,8 @@ export class Texture extends EventDispatcher {
* @return {Texture} 返回移除的纹理
*/
static removeFromCache(texture: any): Texture;
}
}
export class FillStyle {
/**
* 十六进制颜色
......@@ -4804,8 +4804,8 @@ export class FillStyle {
* 销毁
*/
destroy(): void;
}
}
export class LineStyle extends FillStyle {
/**
* webgl的画线模式
......@@ -4832,8 +4832,8 @@ export class LineStyle extends FillStyle {
* 重置
*/
reset(): void;
}
}
export class GraphicsData extends HashObject {
fillStyle: FillStyle;
lineStyle: LineStyle;
......@@ -4868,43 +4868,43 @@ export class GraphicsData extends HashObject {
* Destroys the Graphics data.
*/
destroy(): void;
}
export function earcut(data: any, holeIndices: any, dim: any): any[];
}
export function earcut(data: any, holeIndices: any, dim: any): any[];
export const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
}
}
export const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: any, graphicsGeometry: Graphics): void;
}
}
export const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphics: Graphics): void;
}
}
export const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
}
}
export function bezierCurveControlPoint(points: any): {
A: any[];
B: any[];
}
}
export const GRAPHICS_CURVES: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
segmentsCount: Function;
}
}
export class Graphics extends Container {
/**
* 混色模式
......@@ -5294,8 +5294,8 @@ export class Graphics extends Container {
* @param {number} size
*/
private adjustUvs;
}
}
export class MouseEvent extends Event {
/**
* 鼠标或者手指按下事件
......@@ -5427,8 +5427,8 @@ export class MouseEvent extends Event {
* 销毁
*/
destroy(): void;
}
}
export class Stage extends Container {
/**
* 当前stage所使用的渲染器
......@@ -5647,8 +5647,8 @@ export class Stage extends Container {
*/
getBounds(): Rectangle;
destroy(): void;
}
}
export class DisplayObject extends EventDispatcher {
/**
* 基础信息
......@@ -6011,8 +6011,8 @@ export class DisplayObject extends EventDispatcher {
* 更新方法,帧循环的监听事件是放在这派发的
*/
update(): void;
}
}
export class Container extends DisplayObject {
/**
* 为false鼠标事件不再向下传递
......@@ -6206,8 +6206,8 @@ export class Container extends DisplayObject {
* @static
*/
private static _getElementsByName;
}
}
export class FloatDisplay extends DisplayObject {
/**
* 需要封装起来的html元素的引用。你可以通过这个引用来调用或设置此元素自身的属性方法和事件,甚至是样式
......@@ -6292,8 +6292,8 @@ export class FloatDisplay extends DisplayObject {
renderCanvas(): void;
renderWebGL(): void;
destroy(): void;
}
}
export class Shape extends Sprite {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
......@@ -6601,8 +6601,8 @@ export class Shape extends Sprite {
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
}
export class TextField extends Sprite {
private static shareCanvas;
private static shareContext;
......@@ -6834,8 +6834,8 @@ export class TextField extends Sprite {
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
}
export class EditableText extends TextField {
htmlElement: any;
private _prompt;
......@@ -6863,8 +6863,8 @@ export class EditableText extends TextField {
set inputValue(v: string);
constructor();
private initElement;
}
}
export class InputText extends FloatDisplay {
/**
* 输入文本的类型.
......@@ -7014,10 +7014,10 @@ export class InputText extends FloatDisplay {
* @param textField
*/
convertToTextField(textField?: TextField): TextField;
}
}
export class BitmapText extends Container {
private textures;
textures;
/**
* 水平对齐方式,默认居中
* 改变x坐标原点
......@@ -7058,8 +7058,8 @@ export class BitmapText extends Container {
* 适配,
*/
private adaptate;
}
}
export class Tween {
/**
* 不做特殊处理
......@@ -7499,8 +7499,8 @@ export class Tween {
* @platform Web,Native
*/
$tick(delta: number): void;
}
}
export class Button extends Sprite {
private textureUp;
private textureDown;
......@@ -7534,8 +7534,8 @@ export class Button extends Sprite {
set textureStatusEnable(value: boolean);
set enabled(value: boolean);
destroy(): void;
}
}
export class FrameAni extends Container {
private showImage;
/**
......@@ -7603,8 +7603,8 @@ export class FrameAni extends Container {
* @param texturesAll
*/
resetTexturesAll(texturesAll: Texture[]): void;
}
}
export class Ease {
/**
* @version
......@@ -8092,8 +8092,8 @@ export class Ease {
* @language zh_CN
*/
static elasticInOut: (t: number) => number;
}
}
export class ScrollPage extends Container {
/**
* 横向还是纵向 默认为纵向
......@@ -8262,14 +8262,14 @@ export class ScrollPage extends Container {
*/
scrollTo(dis: number, time?: number): void;
destroy(): void;
}
}
export interface IScrollListItem extends DisplayObject {
initData(id: number, data: any): void;
id: number;
data: number;
}
}
export class ScrollList extends ScrollPage {
private _items;
private _itemW;
......@@ -8333,8 +8333,8 @@ export class ScrollList extends ScrollPage {
*/
setLoading(downLoading: DisplayObject): void;
destroy(): void;
}
}
export class MovieClip extends Container {
/**
* 原始数据,接口在解析类上,不搞先
......@@ -8563,13 +8563,13 @@ export class MovieClip extends Container {
_styles: any;
_transform: any;
}, useStyle?: boolean): Shape;
}
}
export interface IAnimationTrack {
setValue: (time: number) => void;
resetValue: () => void;
}
}
export class AnimationClip extends EventDispatcher {
name: string;
/**
......@@ -8663,8 +8663,8 @@ export class AnimationClip extends EventDispatcher {
* 所以各自track自行处理
*/
resetState(): void;
}
}
export abstract class AnimationNode extends Container {
/**
* 原始数据,尽量只获取,不修改
......@@ -8782,8 +8782,8 @@ export abstract class AnimationNode extends Container {
* @param callback 参数loop表示还剩几次
*/
startAniRange: (beginTime: number, endTime: number, loops: number, callback?: (loop: number) => void) => void;
}
}
export class SvgaAni extends AnimationNode {
/**
* 原始数据,接口在解析类上,不搞先,尽量只获取,不修改
......@@ -8866,14 +8866,14 @@ export class SvgaAni extends AnimationNode {
* @param anchorY 相对锚点y,默认0
*/
static deepCopyFrames(frames: FrameEntity[], x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, anchorX?: number, anchorY?: number): any[];
}
export {};
export const getBezierEasing: (a: any, b: any, c: any, d: any, nm?: any) => any;
export function buildBezierProp(pt1: any, pt2: any, pt3: any, pt4: any, startIndex: any, endIndex: any, time: any, fnc: any): any[];
}
export {};
export const getBezierEasing: (a: any, b: any, c: any, d: any, nm?: any) => any;
export function buildBezierProp(pt1: any, pt2: any, pt3: any, pt4: any, startIndex: any, endIndex: any, time: any, fnc: any): any[];
export class Lottie extends AnimationNode {
/**
* 原始数据,尽量只获取,不修改
......@@ -8909,10 +8909,10 @@ export class Lottie extends AnimationNode {
* @returns
*/
init(data: LottieData): void;
}
export {};
}
export {};
export class Vector3 {
x: number;
y: number;
......@@ -8977,8 +8977,8 @@ export class Vector3 {
equals(v: Vector3): boolean;
fromArray(array: number[] | Float32Array, offset?: number): this;
toArray(array?: any[], offset?: number): any[];
}
}
export class Quaternion {
private _x;
private _y;
......@@ -9019,8 +9019,8 @@ export class Quaternion {
toArray(array?: any[], offset?: number): any[];
onChange(callback: any): this;
private onChangeCallback;
}
}
export class Matrix4 {
elements: Float32Array;
constructor();
......@@ -9215,8 +9215,8 @@ export class Matrix4 {
decompose(position: any, quaternion: any, scale: any): this;
determinant(): number;
extractRotation(m: any): this;
}
}
export class Camera extends Object3D {
worldMatrixInverse: Matrix4;
projectionMatrix: Matrix4;
......@@ -9230,8 +9230,8 @@ export class Camera extends Object3D {
copy(source: any, recursive?: any): this;
getWorldDirection(target: Vector3): Vector3;
updateWorldMatrix(): void;
}
}
export class PerspectiveCamera extends Camera {
fov: number;
aspect: number;
......@@ -9254,35 +9254,35 @@ export class PerspectiveCamera extends Camera {
* 更新
*/
updateProjectionMatrix(): void;
}
}
export class BaseShader extends GLShader {
/**
* 作为该着色器的标识
*/
_glShaderKey: string;
constructor(gl: WebGLRenderingContext);
}
}
export enum shaderReplaceStr {
POINT_LIGHTS_NUM = "POINT_LIGHTS_NUM",
DIR_LIGHTS_NUM = "DIR_LIGHTS_NUM"
}
}
export class LightShader extends GLShader {
/**
* 作为该着色器的标识
*/
_glShaderKey: string;
constructor(gl: WebGLRenderingContext, pointLightsNum?: number, dirLightsNum?: number);
}
}
export enum EnvBlendType {
ENVMAP_BLENDING_MULTIPLY = "ENVMAP_BLENDING_MULTIPLY",
ENVMAP_BLENDING_MIX = "ENVMAP_BLENDING_MIX",
ENVMAP_BLENDING_ADD = "ENVMAP_BLENDING_ADD"
}
}
export enum RenderSideType {
/**
* 正面才渲染,逆时针顶点
......@@ -9296,8 +9296,8 @@ export enum RenderSideType {
* 两面都渲染
*/
DoubleSide = 2
}
}
export class BaseMaterial extends HashObject {
/**
* 十六进制 hex2rgb ,转成0到1的数组
......@@ -9348,8 +9348,8 @@ export class BaseMaterial extends HashObject {
copy(material: BaseMaterial): this;
clone(): BaseMaterial;
destroy(): void;
}
}
export interface BaseMaterialParamsInt {
color?: number;
alpha?: number;
......@@ -9362,10 +9362,10 @@ export interface BaseMaterialParamsInt {
morphTargets?: boolean;
morphNormals?: boolean;
skinning?: boolean;
}
export function getCusShader(render: WebglRenderer, material: BaseMaterial, lights: LightsConfig, mesh: Mesh3D, maxBones?: number, useVertexTexture?: boolean, fog?: any, shadow?: any): CusShader;
}
export function getCusShader(render: WebglRenderer, material: BaseMaterial, lights: LightsConfig, mesh: Mesh3D, maxBones?: number, useVertexTexture?: boolean, fog?: any, shadow?: any): CusShader;
export class CusShader extends GLShader {
/**
* 以后回收时用TODO
......@@ -9381,18 +9381,18 @@ export class CusShader extends GLShader {
* @param parameters
*/
constructor(gl: WebGLRenderingContext, parameters: ShaderParametersInt);
}
export {};
}
export {};
export class Bone3D extends Object3D {
par: number;
pos: any;
rotq: any;
scl: any;
constructor();
}
}
export class Skeleton3D extends HashObject {
bones: Bone3D[];
boneMatrices: Float32Array;
......@@ -9409,8 +9409,8 @@ export class Skeleton3D extends HashObject {
clone(): Skeleton3D;
getBoneByName(name: string): Bone3D;
destroy(): void;
}
}
export class Vector2 {
x: number;
y: number;
......@@ -9446,8 +9446,8 @@ export class Vector2 {
equals(v: any): boolean;
fromArray(array: any, offset: any): this;
toArray(array?: any[], offset?: number): any[];
}
}
export class Sphere {
center: Vector3;
radius: number;
......@@ -9466,8 +9466,8 @@ export class Sphere {
applyMatrix4(matrix: Matrix4): this;
translate(offset: Vector3): this;
equals(sphere: Sphere): boolean;
}
}
export class Box3 {
min: Vector3;
max: Vector3;
......@@ -9519,8 +9519,8 @@ export class Box3 {
applyMatrix4(matrix: Matrix4): this;
translate(offset: Vector3): this;
equals(box: Box3): boolean;
}
}
export class Geometry extends HashObject {
/**
* 顶点坐标3,颜色3,uv2,法线3,到时还是搞成three的那种方式,多属性对象,统一放到vao上
......@@ -9577,8 +9577,8 @@ export class Geometry extends HashObject {
computeBoundingBox(): void;
computeBoundingSphere(): void;
destroy(): void;
}
}
export interface VaoBufferInt {
/**
* 索引
......@@ -9608,17 +9608,17 @@ export interface VaoBufferInt {
vaos: {
[key: string]: VertexArrayObject;
};
}
}
export class LightMaterial extends BaseMaterial {
constructor(parameters?: any);
clone(): any;
}
export const defaultVertexShader3d = "attribute vec3 aPosition;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat4 uModelMatrix;\nvoid main() {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4( aPosition, 1.0 );\n}";
export const defaultFragmentShader3d = "void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
}
export const defaultVertexShader3d = "attribute vec3 aPosition;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat4 uModelMatrix;\nvoid main() {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4( aPosition, 1.0 );\n}";
export const defaultFragmentShader3d = "void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
export class ShaderMaterial extends HashObject {
protected vertexShader: string;
protected fragmentShader: string;
......@@ -9652,8 +9652,8 @@ export class ShaderMaterial extends HashObject {
*/
getShader(renderer: WebglRenderer): GLShader;
destroy(): void;
}
}
export enum UniformType {
float = "f",
/**
......@@ -9680,8 +9680,8 @@ export enum UniformType {
* m4对象
*/
matrix4 = "m4"
}
}
export class Sprite3dMaterial extends ShaderMaterial {
sizeAttenuation: boolean;
constructor();
......@@ -9696,8 +9696,8 @@ export class Sprite3dMaterial extends ShaderMaterial {
set alpha(v: number);
get map(): Texture;
set map(v: Texture);
}
}
export class SkinnedMesh3D extends Mesh3D {
bindMode: "attached" | "detached";
bindMatrix: Matrix4;
......@@ -9711,16 +9711,16 @@ export class SkinnedMesh3D extends Mesh3D {
updateWorldMatrix(): void;
update(): void;
clone(): any;
}
}
export class ShadowShader extends GLShader {
/**
* TODO,以后用,是否有顶点动画,骨骼动画等还要区分着色器唯一id
*/
_glShaderKey: string;
constructor(gl: WebGLRenderingContext);
}
}
export class OrthographicCamera extends Camera {
private left;
private right;
......@@ -9734,8 +9734,8 @@ export class OrthographicCamera extends Camera {
copy(source: OrthographicCamera, recursive?: boolean): this;
clone(): OrthographicCamera;
updateProjectionMatrix(): void;
}
}
export class D3Renderer extends ObjectRenderer {
/**
* 赋值的相机,需要里面的worldMatrixInverse和projectionMatrix
......@@ -9780,8 +9780,8 @@ export class D3Renderer extends ObjectRenderer {
render(obj: Mesh3D): void;
flush(): void;
private getMaxBones;
}
}
export class LightShadow extends HashObject {
camera?: Camera;
bias: number;
......@@ -9797,8 +9797,8 @@ export class LightShadow extends HashObject {
*/
clone(): LightShadow;
destroy(): void;
}
}
export class Light extends Object3D {
intensity: number;
private _color;
......@@ -9819,8 +9819,8 @@ export class Light extends Object3D {
*/
constructor(color: number, intensity?: number);
copy(light: Light): this;
}
}
export class PointLight extends Light {
distance: number;
decay: number;
......@@ -9835,13 +9835,13 @@ export class PointLight extends Light {
get power(): number;
set power(value: number);
copy(pointLight: PointLight): this;
}
}
export class DirectionalLightShadow extends LightShadow {
constructor();
clone(): any;
}
}
export class DirectionalLight extends Light {
/**
* 目标对象
......@@ -9849,8 +9849,8 @@ export class DirectionalLight extends Light {
target: Object3D;
constructor(color: number, intensity: number);
copy(directionalLight: DirectionalLight): this;
}
}
export class Ray {
origin: Vector3;
direction: Vector3;
......@@ -9871,8 +9871,8 @@ export class Ray {
intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, out: Vector3): Vector3;
applyMatrix4(matrix4: Matrix4): this;
equals(ray: Ray): boolean;
}
}
export class Raycaster {
near: number;
far: number;
......@@ -9881,20 +9881,20 @@ export class Raycaster {
set(origin: Vector3, direction: Vector3): void;
setFromCamera(coords: Vector3, camera: Camera): void;
intersectObject(object: Object3D, optionalTarget?: IntersectData[]): IntersectData[];
}
}
export interface IntersectData {
distance: number;
point?: Vector3;
object: Object3D;
uv?: Vector2;
}
}
export enum ShadowType {
basic = "SHADOWMAP_TYPE_BASIC",
pcf = "SHADOWMAP_TYPE_PCF"
}
}
export class Scene3D extends Object3D {
private _viewId;
/**
......@@ -9956,8 +9956,8 @@ export class Scene3D extends Object3D {
private orbitControlConfig;
setOrbCtrCfg(options: IOrbitControlConfig): void;
setOrbitControl(options?: IOrbitControlConfig): void;
}
}
export interface IOrbitControlConfig {
enabled?: boolean;
enableDamping?: boolean;
......@@ -9973,16 +9973,16 @@ export interface IOrbitControlConfig {
minDistance?: number;
maxDistance?: number;
enablePitch?: boolean;
}
}
export interface LightsConfig {
pointLights: PointLightConfig[];
directionalLights: DirectionalLightConfig[];
ambientLightColor: number[];
}
export {};
}
export {};
export enum RotationOrders {
XYZ = "XYZ",
YZX = "YZX",
......@@ -9990,8 +9990,8 @@ export enum RotationOrders {
XZY = "XZY",
YXZ = "YXZ",
ZYX = "ZYX"
}
}
export class Euler {
private _x;
private _y;
......@@ -10019,8 +10019,8 @@ export class Euler {
toVector3(optionalResult: any): any;
onChange(callback: any): this;
onChangeCallback(): void;
}
}
export class Object3D extends EventDispatcher {
static DefaultUp: Vector3;
/**
......@@ -10174,8 +10174,8 @@ export class Object3D extends EventDispatcher {
* 角度制
*/
set rotationZ(value: number);
}
}
export class Mesh3D extends Object3D {
geometry: Geometry;
material: BaseMaterial;
......@@ -10194,12 +10194,12 @@ export class Mesh3D extends Object3D {
* @param recursive 默认克隆子级
*/
clone(recursive?: boolean): Mesh3D;
}
}
export class SphereGeometry extends Geometry {
constructor(radius?: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number);
}
}
export class BoxGeometry extends Geometry {
/**
*
......@@ -10211,16 +10211,16 @@ export class BoxGeometry extends Geometry {
* @param depthSegments
*/
constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number);
}
}
export class PlaneGeometry extends Geometry {
constructor(width?: number, height?: number, widthSegments?: number, heightSegments?: number);
}
}
export class CircleGeometry extends Geometry {
constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number);
}
}
export class CylinderGeometry extends Geometry {
constructor(
/**
......@@ -10255,50 +10255,50 @@ export class CylinderGeometry extends Geometry {
* 圆柱结束角度,默认Math.PI * 2
*/
thetaLength?: number);
}
}
export class RingGeometry extends Geometry {
constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number);
}
}
export class TorusGeometry extends Geometry {
constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number);
}
}
export class AmbientLight extends Light {
constructor(color: number, intensity: number);
}
}
export class AxesHelper extends Mesh3D {
constructor(size?: number);
}
}
export class GridHelper extends Mesh3D {
constructor(size?: number, divisions?: number, color1?: number, color2?: number);
}
}
export class Box3Helper extends Mesh3D {
box: Box3;
constructor(box: Box3, color?: number);
updateWorldMatrix(updateParents?: boolean, updateChildren?: boolean): void;
}
export function isTypedArray(object: any): boolean;
export function convertArray(array: any, type: any, forceClone?: boolean): any;
export function flattenJSON(jsonKeys: any, times: any, values: any, valuePropertyName: any): void;
export function getKeyframeOrder(times: any): any[];
export function sortedArray(values: any, stride: any, order: any): any;
export var InterpolateDiscrete: number;
export var InterpolateLinear: number;
export var InterpolateSmooth: number;
}
export function isTypedArray(object: any): boolean;
export function convertArray(array: any, type: any, forceClone?: boolean): any;
export function flattenJSON(jsonKeys: any, times: any, values: any, valuePropertyName: any): void;
export function getKeyframeOrder(times: any): any[];
export function sortedArray(values: any, stride: any, order: any): any;
export var InterpolateDiscrete: number;
export var InterpolateLinear: number;
export var InterpolateSmooth: number;
export enum AnimationType3D {
/**
* 旋转
......@@ -10316,8 +10316,8 @@ export enum AnimationType3D {
* 位移
*/
position = "position"
}
}
export class AnimationTrack3D extends HashObject implements IAnimationTrack {
/**
* 需要改变属性的节点对象
......@@ -10366,8 +10366,8 @@ export class AnimationTrack3D extends HashObject implements IAnimationTrack {
*/
private findPreIndex;
destroy(): void;
}
}
export class AnimationManager extends HashObject {
private animationClips;
protected currentClip: AnimationClip;
......@@ -10402,8 +10402,8 @@ export class AnimationManager extends HashObject {
*/
update(deltaTime?: number): void;
destroy(): void;
}
}
export interface GltfData {
scene: Scene3D;
scenes: Scene3D[];
......@@ -10415,10 +10415,10 @@ export interface GltfData {
version: string;
};
parser: GLTFParser;
}
export function loadGltf(url: string, onLoad: (gltf: GltfData) => void, onError: (err: any) => void): void;
}
export function loadGltf(url: string, onLoad: (gltf: GltfData) => void, onError: (err: any) => void): void;
export class GLTFParser {
json: any;
extensions: {};
......@@ -10537,8 +10537,8 @@ export class GLTFParser {
* @return {Promise<THREE.Scene>}
*/
loadScene: (sceneIndex: any) => any;
}
}
export class GLTFRegistry {
private objects;
constructor();
......@@ -10546,8 +10546,8 @@ export class GLTFRegistry {
add(key: string, object: any): void;
remove(key: string): void;
removeAll(): void;
}
}
export class BufferAttribute {
array: any;
itemSize: number;
......@@ -10589,8 +10589,8 @@ export class BufferAttribute {
setXYZW(index: number, x: number, y: number, z: number, w: number): this;
copy(source: BufferAttribute): this;
clone(): BufferAttribute;
}
}
export class InterleavedBuffer {
array?: any;
stride?: number;
......@@ -10600,8 +10600,8 @@ export class InterleavedBuffer {
copy(source: InterleavedBuffer): this;
set(value: any, offset?: number): this;
clone(): InterleavedBuffer;
}
}
export class InterleavedBufferAttribute {
itemSize: number;
offset: number;
......@@ -10622,14 +10622,14 @@ export class InterleavedBufferAttribute {
setXY(index: any, x: any, y: any): this;
setXYZ(index: any, x: any, y: any, z: any): this;
setXYZW(index: any, x: any, y: any, z: any, w: any): this;
}
export {};
}
export {};
export class Sprite3D extends Mesh3D {
constructor(material: Sprite3dMaterial);
}
}
export class Bone extends Container {
data: IBoneData;
root: Container;
......@@ -10663,8 +10663,8 @@ export class Bone extends Container {
*/
updateWorldTransformWith(x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number): void;
private appliedSelf;
}
}
export interface IBoneData {
length: number;
name: string;
......@@ -10678,21 +10678,21 @@ export interface IBoneData {
shearY: number;
transform: TransformType;
skin: boolean;
}
}
export enum TransformType {
normal = "normal",
onlyTranslation = "onlyTranslation",
noRotationOrReflection = "noRotationOrReflection",
noScale = "noScale",
noScaleOrReflection = "noScaleOrReflection"
}
}
export abstract class Attachment {
name: string;
constructor(name: string);
}
}
export abstract class VertexAttachment extends Attachment {
private static nextID;
id: number;
......@@ -10709,8 +10709,8 @@ export abstract class VertexAttachment extends Attachment {
* @param worldVertices The output world vertices. Must have a length >= offset + count.
* @param offset The worldVertices index to begin writing values. */
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number, skeletonBones: Bone[]): void;
}
}
export class SpineColor {
r: number;
g: number;
......@@ -10728,8 +10728,8 @@ export class SpineColor {
static BLUE: SpineColor;
static MAGENTA: SpineColor;
static fromString(hex: string): SpineColor;
}
}
export class Slot extends Container {
/**
* 绑定的骨骼
......@@ -10767,8 +10767,8 @@ export class Slot extends Container {
getAttachment(): Attachment;
setAttachment(attachment: Attachment): void;
setToSetupPose(): void;
}
}
export interface ISlotData {
attachment: string;
bone: string;
......@@ -10777,8 +10777,8 @@ export interface ISlotData {
color: string;
dark: string;
sColor?: SpineColor;
}
}
export class Skin {
name: string;
attachments: any[];
......@@ -10786,8 +10786,8 @@ export class Skin {
addAttachment(slotIndex: number, name: string, attachment: Attachment): void;
getAttachment(slotIndex: number, name: string): any;
attachAll(slots: Slot[], oldSkin: Skin): void;
}
}
export class RegionAttachment extends Attachment {
x: number;
y: number;
......@@ -10799,8 +10799,8 @@ export class RegionAttachment extends Attachment {
texture: Texture;
color: SpineColor;
constructor(name: string, x: number, y: number, scaleX: number, scaleY: number, rotation: number, width: number, height: number, texture: Texture);
}
}
export class MeshAttachment extends VertexAttachment {
texture: Texture;
path: string;
......@@ -10812,8 +10812,8 @@ export class MeshAttachment extends VertexAttachment {
height: number;
hullLength: number;
edges: Array<number>;
}
}
export class Curve {
static LINEAR: number;
static STEPPED: number;
......@@ -10836,51 +10836,51 @@ export class Curve {
setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
/** Returns the interpolated percentage for the specified key frame and linear percentage. */
getCurvePercent(frameIndex: number, percent: number): number;
}
export function readCurve(map: any, curve: Curve, frameIndex: number): void;
}
export function readCurve(map: any, curve: Curve, frameIndex: number): void;
export enum MixBlend {
setup = 0,
first = 1,
replace = 2,
add = 3
}
}
export enum MixDirection {
in = 0,
out = 1
}
export function binarySearch(values: Float32Array | number[], target: number, step?: number): number;
export function arrayCopy(source: any, sourceStart: any, dest: any, destStart: any, numElements: any): void;
export function setArraySize(array: any, size: any, value?: number): any;
export function newArray(size: number, defaultValue: any): any[];
}
export function binarySearch(values: Float32Array | number[], target: number, step?: number): number;
export function arrayCopy(source: any, sourceStart: any, dest: any, destStart: any, numElements: any): void;
export function setArraySize(array: any, size: any, value?: number): any;
export function newArray(size: number, defaultValue: any): any[];
export class BaseTrack extends HashObject implements IAnimationTrack {
setValue(time: number, alpha?: number, blend?: MixBlend, direction?: MixDirection): void;
resetValue(): void;
destroy(): void;
}
}
export interface IBoneAniData {
time: number;
angle: number;
x: number;
y: number;
curve: "stepped" | [number, number, number, number];
}
}
export enum SpineBoneAniType {
rotate = "rotate",
translate = "translate",
scale = "scale",
shear = "shear"
}
}
export class SpineBoneAniTrack extends BaseTrack {
/**
* 需要改变属性的节点对象
......@@ -10924,14 +10924,14 @@ export class SpineBoneAniTrack extends BaseTrack {
*/
private findPreIndex;
destroy(): void;
}
}
export interface IColorAniData {
curve: "stepped" | [number, number, number, number];
color: string;
time: number;
}
}
export class SpineColorAniTrack extends BaseTrack {
/**
* 需要改变颜色的插槽
......@@ -10960,15 +10960,15 @@ export class SpineColorAniTrack extends BaseTrack {
static G: number;
static B: number;
static A: number;
}
}
export interface IDeformAniData {
curve: "stepped" | [number, number, number, number];
offset: number;
time: number;
vertices: number[];
}
}
export class SpineDeformAniTrack extends BaseTrack {
/**
* 需要改变属性的节点对象
......@@ -10999,13 +10999,13 @@ export class SpineDeformAniTrack extends BaseTrack {
*/
times: IDeformAniData[]);
setValue(time: number, alpha?: number, blend?: MixBlend): void;
}
}
export interface IAttachmentAniData {
name?: string;
time: number;
}
}
export class AttachmentAniTrack extends BaseTrack {
/**
* 需要改变附件的插槽
......@@ -11034,8 +11034,8 @@ export class AttachmentAniTrack extends BaseTrack {
*/
spine: Spine);
setValue(time: number, alpha?: number, blend?: MixBlend, direction?: MixDirection): void;
}
}
export interface IDrawOrderAniData {
time: number;
offsets?: {
......@@ -11043,8 +11043,8 @@ export interface IDrawOrderAniData {
offset: number;
}[];
drawOrder?: number[];
}
}
export class DrawOrderAniTrack extends BaseTrack {
slots: Slot[];
drawOrder: Slot[];
......@@ -11055,8 +11055,8 @@ export class DrawOrderAniTrack extends BaseTrack {
* 层级需要加个重置方法,因为部分动画并没有层级时间轴,会导致当前动画层级根据上一个动画来
*/
resetValue(): void;
}
}
export class SpineAniClip extends AnimationClip {
alpha: number;
blend: MixBlend;
......@@ -11072,8 +11072,8 @@ export class SpineAniClip extends AnimationClip {
*/
mixDuration: number;
protected rectify(): void;
}
}
export class SpineAniManager extends AnimationManager {
currentClip: SpineAniClip;
/**
......@@ -11089,8 +11089,8 @@ export class SpineAniManager extends AnimationManager {
update(deltaTime?: number): void;
private applyMixingFrom;
private resetFrom;
}
}
export class IkConstraint extends HashObject {
destroy(): void;
target: Bone;
......@@ -11118,13 +11118,13 @@ export class IkConstraint extends HashObject {
* A direct descendant of the parent bone.
*/
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
}
}
export class ClippingAttachment extends VertexAttachment {
color: SpineColor;
endSlot: ISlotData;
}
}
export interface ISkeletonData {
skeleton: {
images: string;
......@@ -11199,8 +11199,8 @@ export interface ISkeletonData {
compress: boolean;
stretch: boolean;
}[];
}
}
export enum SkinType {
region = "region",
mesh = "mesh",
......@@ -11208,8 +11208,8 @@ export enum SkinType {
linkedmesh = "linkedmesh",
path = "path",
point = "point"
}
}
export class Spine extends Container {
private spineData;
private boneContainer;
......@@ -11267,14 +11267,14 @@ export class Spine extends Container {
* 获取所有动画的名字
*/
get aniNames(): string[];
}
export {};
export function loadAtlas(url: string, onLoad: (textures: any) => void, onError?: (err: any) => void, imgUrl?: string): void;
}
export {};
export function loadAtlas(url: string, onLoad: (textures: any) => void, onError?: (err: any) => void, imgUrl?: string): void;
export function createTexturesByAtlas(baseTexture: BaseTexture, altaData: string): {
[key: string]: Texture;
}
}
export function loadSpine(url: string, onLoad: (spineData: ISkeletonData) => void, onError?: (err: any) => void): void;}
\ No newline at end of file
{
"data": {
"id": 666666,
"isFirstJoin": true
},
"success": true,
"code": "111",
......
......@@ -2,7 +2,7 @@
"success": true,
"data": {
"id": "123456",
"type": 5,
"type": 3,
"name": "吕秀兰",
"image": "https://yun.duiba.com.cn/aurora/assets/8c6cce25b4970d776a4ac89780ffe97b2c69c56c.png"
}
......
{
"data": {
"id": 666666,
"score": 233,
"isNewRecord": false,
"productLink": "http://qnpic.top/yoona2",
"isWinPrize": false
},
"success": true,
"code": "111",
"message": "ok"
}
......@@ -5,17 +5,21 @@
"name": "CountDownComp"
},
{
"keys": "back-home.png,more-btn.png,new-record-icon.png,share-btn.png",
"keys": "back-home.png,jump-icon.png,more-btn.png,new-record-icon.png,product-link__icon.png,share-btn.png",
"name": "GameOver"
},
{
"keys": "back_index.png,gg_back.png,one_more-btn.png",
"keys": "over-back.png,over-tipsicon.png,prize-icon1.png",
"name": "GameOverPanel"
},
{
"keys": "balance_guidance.png,guidance-t1.png,num0.png,num1.png,num2.png,num3.png,num4.png,num5.png,num6.png,num7.png,num8.png,num9.png,numb0.png,numb1.png,numb2.png,numb3.png,numb4.png,numb5.png,numb6.png,numb7.png,numb8.png,numb9.png,numbp.png,nump.png,p1-b.png,p1.png,p10-b.png,p10.png,p11-b.png,p11.png,p12-b.png,p12.png,p13-b.png,p13.png,p14-b.png,p14.png,p15-b.png,p15.png,p16-b.png,p16.png,p17-b.png,p17.png,p18-b.png,p18.png,p19-b.png,p19.png,p2-b.png,p2.png,p20-b.png,p20.png,p3-b.png,p3.png,p4-b.png,p4.png,p5-b.png,p5.png,p6-b.png,p6.png,p7-b.png,p7.png,p8-b.png,p8.png,p9-b.png,p9.png",
"name": "GameScene"
},
{
"keys": "confirm-btn.png,prize-back.png",
"name": "PrizeShowPanel"
},
{
"keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common"
......
import { GameOverPanel } from './panels/GameOverPanel';
import { GameScene } from './scenes/GameScene/GameScene';
import { NewGuyScene } from './scenes/NewGuyScene/NewGuyScene';
import { destroyLayers, layers } from "../module/views/layers";
import { RES } from "../module/RES";
import { changeScene, destroyAllCtrls, showToast } from "../module/ctrls";
import { changeScene, destroyAllCtrls, showPanel, showToast } from "../module/ctrls";
import MusicBtn from "./common/MusicBtn";
import { ResJson } from "./ResJson";
......@@ -11,6 +12,7 @@ import { SkinJson } from "./SkinJson";
import { G_EVENT } from "./common/G_EVENT";
import { Tools } from "./Tools";
import { GameOverScene } from "./scenes/GameOverScene/GameOverScene";
import DeviceMotion from './scenes/GameScene/DeviceMotion';
/**
* 全局事件,为了和小程序交互
......@@ -145,6 +147,8 @@ export class Main {
destroyTbNetData();
// web环境其实没必要
// destroyWebNetData()
DeviceMotion.instance && DeviceMotion.instance.destory()
}
private async onAddToStage() {
......@@ -163,7 +167,7 @@ export class Main {
// h5环境时,隐藏加载中
if (FYGE.getEnv() == "web" && document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
console.log('getGlobalData')
await Tools.getGlobalData()
// const baseSuccess = await Tools.getActivityBaseInfo();
......@@ -178,18 +182,17 @@ export class Main {
// return;
// }
// const scene = Tools.globalData.newUser ? StoryScene : IndexScene;
const scene = Tools.globalData.completed ? GameScene : NewGuyScene;
// vtodo 是否是新手
changeScene(GameScene, {
score: 45,
isNewRecord: true,
productLink: 'http://qnpic.top/yoona2.jpg',
isWinPrize: false
});
changeScene(scene);
// MusicBtn.changeMusicStatus(true); // TODO 进游戏打开音乐先
// (function() {
// showPanel(GameOverPanel, {
// score: '1'
// })
// })()
}
}
......
......@@ -2,903 +2,28 @@ export const ResJson = {
"groups": [
{
"keys": "countdown-back.png",
"name": "CountDownComp",
"atlas": {
"countdown-back.png": {
"x": 2,
"y": 2,
"w": 207,
"h": 57,
"ox": 0,
"oy": 0,
"sw": 207,
"sh": 57,
"ro": false
}
}
"name": "CountDownComp"
},
{
"keys": "back-home.png,more-btn.png,new-record-icon.png,share-btn.png",
"name": "GameOver",
"atlas": {
"more-btn.png": {
"x": 2,
"y": 2,
"w": 655,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 655,
"sh": 120,
"ro": false
},
"share-btn.png": {
"x": 2,
"y": 124,
"w": 655,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 655,
"sh": 120,
"ro": false
},
"back-home.png": {
"x": 2,
"y": 246,
"w": 130,
"h": 43,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 43,
"ro": false
},
"new-record-icon.png": {
"x": 134,
"y": 246,
"w": 102,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 102,
"sh": 37,
"ro": false
}
}
"keys": "back-home.png,jump-icon.png,more-btn.png,new-record-icon.png,product-link__icon.png,share-btn.png",
"name": "GameOver"
},
{
"keys": "back_index.png,gg_back.png,one_more-btn.png",
"name": "GameOverPanel",
"atlas": {
"gg_back.png": {
"x": 2,
"y": 2,
"w": 667,
"h": 578,
"ox": 0,
"oy": 1,
"sw": 666,
"sh": 579,
"ro": false
},
"back_index.png": {
"x": 2,
"y": 582,
"w": 254,
"h": 74,
"ox": 0,
"oy": 0,
"sw": 254,
"sh": 74,
"ro": false
},
"one_more-btn.png": {
"x": 2,
"y": 658,
"w": 254,
"h": 75,
"ox": 0,
"oy": 0,
"sw": 254,
"sh": 75,
"ro": false
}
}
"keys": "over-back.png,over-tipsicon.png,prize-icon1.png",
"name": "GameOverPanel"
},
{
"keys": "balance_guidance.png,guidance-t1.png,num0.png,num1.png,num2.png,num3.png,num4.png,num5.png,num6.png,num7.png,num8.png,num9.png,numb0.png,numb1.png,numb2.png,numb3.png,numb4.png,numb5.png,numb6.png,numb7.png,numb8.png,numb9.png,numbp.png,nump.png,p1-b.png,p1.png,p10-b.png,p10.png,p11-b.png,p11.png,p12-b.png,p12.png,p13-b.png,p13.png,p14-b.png,p14.png,p15-b.png,p15.png,p16-b.png,p16.png,p17-b.png,p17.png,p18-b.png,p18.png,p19-b.png,p19.png,p2-b.png,p2.png,p20-b.png,p20.png,p3-b.png,p3.png,p4-b.png,p4.png,p5-b.png,p5.png,p6-b.png,p6.png,p7-b.png,p7.png,p8-b.png,p8.png,p9-b.png,p9.png",
"name": "GameScene",
"atlas": {
"guidance-t1.png": {
"x": 2,
"y": 2,
"w": 574,
"h": 183,
"ox": 0,
"oy": 0,
"sw": 574,
"sh": 183,
"ro": false
},
"p12-b.png": {
"x": 2,
"y": 187,
"w": 335,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 335,
"sh": 535,
"ro": true
},
"p12.png": {
"x": 2,
"y": 524,
"w": 335,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 335,
"sh": 535,
"ro": true
},
"p20-b.png": {
"x": 578,
"y": 2,
"w": 287,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 287,
"sh": 535,
"ro": false
},
"p20.png": {
"x": 2,
"y": 861,
"w": 287,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 287,
"sh": 535,
"ro": true
},
"p11-b.png": {
"x": 867,
"y": 2,
"w": 496,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 496,
"sh": 533,
"ro": false
},
"p11.png": {
"x": 867,
"y": 537,
"w": 496,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 496,
"sh": 533,
"ro": false
},
"p13-b.png": {
"x": 2,
"y": 1150,
"w": 421,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 421,
"sh": 533,
"ro": true
},
"p13.png": {
"x": 537,
"y": 1150,
"w": 421,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 421,
"sh": 533,
"ro": true
},
"balance_guidance.png": {
"x": 539,
"y": 539,
"w": 258,
"h": 532,
"ox": 0,
"oy": 0,
"sw": 258,
"sh": 532,
"ro": false
},
"p3-b.png": {
"x": 1365,
"y": 2,
"w": 532,
"h": 520,
"ox": 0,
"oy": 0,
"sw": 532,
"sh": 520,
"ro": true
},
"p3.png": {
"x": 1365,
"y": 536,
"w": 532,
"h": 520,
"ox": 0,
"oy": 0,
"sw": 532,
"sh": 520,
"ro": true
},
"p9-b.png": {
"x": 1072,
"y": 1072,
"w": 487,
"h": 532,
"ox": 0,
"oy": 0,
"sw": 487,
"sh": 532,
"ro": true
},
"p9.png": {
"x": 2,
"y": 1573,
"w": 487,
"h": 532,
"ox": 0,
"oy": 0,
"sw": 487,
"sh": 532,
"ro": true
},
"p4-b.png": {
"x": 1072,
"y": 1561,
"w": 499,
"h": 531,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 531,
"ro": true
},
"p4.png": {
"x": 1605,
"y": 1561,
"w": 499,
"h": 531,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 531,
"ro": true
},
"p6-b.png": {
"x": 536,
"y": 1573,
"w": 526,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 526,
"sh": 368,
"ro": false
},
"p6.png": {
"x": 1606,
"y": 1070,
"w": 526,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 526,
"sh": 368,
"ro": false
},
"p2-b.png": {
"x": 2,
"y": 2062,
"w": 524,
"h": 518,
"ox": 0,
"oy": 0,
"sw": 524,
"sh": 518,
"ro": false
},
"p2.png": {
"x": 528,
"y": 2062,
"w": 524,
"h": 518,
"ox": 0,
"oy": 0,
"sw": 524,
"sh": 518,
"ro": false
},
"p18-b.png": {
"x": 1887,
"y": 2,
"w": 270,
"h": 521,
"ox": 0,
"oy": 0,
"sw": 270,
"sh": 521,
"ro": false
},
"p18.png": {
"x": 1887,
"y": 525,
"w": 270,
"h": 521,
"ox": 0,
"oy": 0,
"sw": 270,
"sh": 521,
"ro": false
},
"p10-b.png": {
"x": 1054,
"y": 2062,
"w": 502,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 502,
"sh": 513,
"ro": false
},
"p10.png": {
"x": 1558,
"y": 2062,
"w": 502,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 502,
"sh": 513,
"ro": false
},
"p5-b.png": {
"x": 2062,
"y": 2062,
"w": 460,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 513,
"ro": false
},
"p5.png": {
"x": 2134,
"y": 1048,
"w": 460,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 513,
"ro": true
},
"p15-b.png": {
"x": 2138,
"y": 1510,
"w": 499,
"h": 463,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 463,
"ro": true
},
"p15.png": {
"x": 2159,
"y": 2,
"w": 499,
"h": 463,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 463,
"ro": false
},
"p14-b.png": {
"x": 2159,
"y": 467,
"w": 438,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 438,
"sh": 460,
"ro": false
},
"p14.png": {
"x": 2,
"y": 2582,
"w": 438,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 438,
"sh": 460,
"ro": true
},
"p8-b.png": {
"x": 2524,
"y": 2011,
"w": 308,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 308,
"sh": 460,
"ro": false
},
"p8.png": {
"x": 2524,
"y": 2473,
"w": 308,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 308,
"sh": 460,
"ro": false
},
"p7-b.png": {
"x": 1054,
"y": 2577,
"w": 426,
"h": 443,
"ox": 0,
"oy": 0,
"sw": 426,
"sh": 443,
"ro": false
},
"p7.png": {
"x": 1482,
"y": 2577,
"w": 426,
"h": 443,
"ox": 0,
"oy": 0,
"sw": 426,
"sh": 443,
"ro": false
},
"p17-b.png": {
"x": 464,
"y": 2582,
"w": 434,
"h": 398,
"ox": 0,
"oy": 0,
"sw": 434,
"sh": 398,
"ro": true
},
"p17.png": {
"x": 1910,
"y": 2577,
"w": 434,
"h": 398,
"ox": 0,
"oy": 0,
"sw": 434,
"sh": 398,
"ro": true
},
"p19-b.png": {
"x": 2834,
"y": 2,
"w": 416,
"h": 364,
"ox": 0,
"oy": 0,
"sw": 416,
"sh": 364,
"ro": true
},
"p19.png": {
"x": 2834,
"y": 420,
"w": 416,
"h": 364,
"ox": 0,
"oy": 0,
"sw": 416,
"sh": 364,
"ro": true
},
"p16-b.png": {
"x": 2834,
"y": 838,
"w": 406,
"h": 360,
"ox": 0,
"oy": 0,
"sw": 406,
"sh": 360,
"ro": true
},
"p16.png": {
"x": 2834,
"y": 1246,
"w": 406,
"h": 360,
"ox": 0,
"oy": 0,
"sw": 406,
"sh": 360,
"ro": true
},
"p1-b.png": {
"x": 2834,
"y": 1654,
"w": 321,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 321,
"sh": 368,
"ro": true
},
"p1.png": {
"x": 2834,
"y": 1977,
"w": 321,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 321,
"sh": 368,
"ro": true
},
"num0.png": {
"x": 2603,
"y": 1510,
"w": 160,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 226,
"ro": true
},
"num3.png": {
"x": 2603,
"y": 1672,
"w": 151,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 151,
"sh": 226,
"ro": true
},
"num8.png": {
"x": 2603,
"y": 1825,
"w": 154,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 154,
"sh": 226,
"ro": true
},
"numb0.png": {
"x": 2599,
"y": 467,
"w": 160,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 226,
"ro": true
},
"numb3.png": {
"x": 2599,
"y": 629,
"w": 151,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 151,
"sh": 226,
"ro": true
},
"numb8.png": {
"x": 2599,
"y": 782,
"w": 154,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 154,
"sh": 226,
"ro": true
},
"num2.png": {
"x": 2660,
"y": 2,
"w": 155,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 155,
"sh": 222,
"ro": false
},
"num5.png": {
"x": 2660,
"y": 226,
"w": 148,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 148,
"sh": 222,
"ro": false
},
"num6.png": {
"x": 2649,
"y": 938,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": false
},
"num9.png": {
"x": 2649,
"y": 1162,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": false
},
"numb2.png": {
"x": 864,
"y": 2582,
"w": 155,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 155,
"sh": 222,
"ro": false
},
"numb5.png": {
"x": 2310,
"y": 2577,
"w": 148,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 148,
"sh": 222,
"ro": false
},
"numb6.png": {
"x": 2834,
"y": 2300,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": true
},
"numb9.png": {
"x": 3058,
"y": 2300,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": false
},
"num1.png": {
"x": 2310,
"y": 2801,
"w": 94,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 218,
"ro": false
},
"num4.png": {
"x": 2834,
"y": 2455,
"w": 162,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 162,
"sh": 218,
"ro": true
},
"num7.png": {
"x": 2834,
"y": 2619,
"w": 163,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 163,
"sh": 218,
"ro": true
},
"numb1.png": {
"x": 2406,
"y": 2801,
"w": 94,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 218,
"ro": false
},
"numb4.png": {
"x": 2834,
"y": 2784,
"w": 162,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 162,
"sh": 218,
"ro": false
},
"numb7.png": {
"x": 2998,
"y": 2784,
"w": 163,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 163,
"sh": 218,
"ro": false
},
"numbp.png": {
"x": 1606,
"y": 1440,
"w": 118,
"h": 128,
"ox": 0,
"oy": 0,
"sw": 118,
"sh": 128,
"ro": true
},
"nump.png": {
"x": 1736,
"y": 1440,
"w": 118,
"h": 128,
"ox": 0,
"oy": 0,
"sw": 118,
"sh": 128,
"ro": true
}
}
"name": "GameScene"
},
{
"keys": "confirm-btn.png,prize-back.png",
"name": "PrizeShowPanel"
},
{
"keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common",
"atlas": {
"back.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"com_light.png": {
"x": 754,
"y": 2,
"w": 746,
"h": 756,
"ox": 0,
"oy": 0,
"sw": 746,
"sh": 756,
"ro": false
},
"toastBg.png": {
"x": 754,
"y": 760,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": false
},
"waitingBg.png": {
"x": 1216,
"y": 760,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"跳过按钮.png": {
"x": 1398,
"y": 760,
"w": 123,
"h": 57,
"ox": 0,
"oy": 0,
"sw": 123,
"sh": 57,
"ro": true
},
"comCloseBtn.png": {
"x": 1398,
"y": 885,
"w": 72,
"h": 72,
"ox": 0,
"oy": 0,
"sw": 72,
"sh": 72,
"ro": false
},
"waitingRot.png": {
"x": 754,
"y": 892,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
}
}
"name": "common"
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1628512488/resource/"
"path": "./resource/"
}
\ No newline at end of file
......@@ -18,11 +18,11 @@ export enum TbNetName {
receiveInvitePrize = "xunzai.receiveInvitePrize",
startGame = "okamoto.startGame",
startGame = "yoga.startGame",
submitGame = "okamoto.submitGame",
submitGame = "yoga.submitGame",
drawLotteryPrize = "xunzai.drawLotteryPrize",
drawLotteryPrize = "yoga.drawLotteryPrize",
doHelp = "xunzai.doHelp",
......@@ -96,6 +96,8 @@ export enum TbNetName {
* isOn
*/
openMusic = "mine.openMusic",
complteGuidance = 'yoga.complateGuide'
}
//返回数据类型
......
......@@ -56,7 +56,8 @@ export class Tools {
newUser1: boolean
firstLoginToday: boolean
shop: string,
startId: string
startId: string,
completed: boolean
}
public static async getGlobalData() {
......
......@@ -62,7 +62,13 @@ export default class UI {
imageName: string,
x: number = 0, y: number = 0
): Sprite {
const sprite = new Sprite(RES.getRes(imageName));
var texture = RES.getRes(imageName)
var sprite
if (texture) {
sprite = new Sprite(texture);
} else {
sprite = Sprite.fromUrl(imageName)
}
sprite.position.set(x, y);
parent && parent.addChild(sprite);
return sprite;
......
......@@ -74,6 +74,7 @@ export default class CountDownComp extends Module {
})
.to({t: 0}, time.t)
.call(() => {
this.stop()
this.timeoutFn && this.timeoutFn.forEach(f => f())
})
......
import { PrizeShowPanel } from './PrizeShowPanel';
import { changeScene, showPanel } from './../../module/ctrls/index';
import { layers } from './../../module/views/layers';
import { Panel } from "../../module/views/Panel";
import UI from "../UI";
import { Tools } from '../Tools';
import { sendTbNet, TbNetName } from '../TaoBaoNet';
import { GameOverScene } from '../scenes/GameOverScene/GameOverScene';
export class GameOverPanel extends Panel {
get groupNames() {
return ["GameOverPanel"]
}
bitmapTextCount: FYGE.BitmapText
initUi() {
var panelCtn = UI.Ctn(this, (layers.stageWidth - 666) / 2, (1624 - 579)/2)
UI.Sp(panelCtn, 'gg_back.png')
var panelCtn = UI.Ctn(this)
UI.Sp(panelCtn, 'over-back.png')
panelCtn.position.set(layers.stageCenterX - panelCtn.width / 2, layers.stageCenterY - panelCtn.height / 2)
UI.Btn(panelCtn, 'back_index.png', function() {
console.log('返回首页')
this.hidePanel()
// 京东淘宝改动点
if (my) {
// @ts-ignore
my.navigateBack()
} else {
// @ts-ignore
window.jdk._navigateBack()
}
}, this, 60, 440)
var bitMapc = Tools.getNumTextures('num')
var bitMapc2 = Tools.getNumTextures('numb')
this.bitmapTextCount = panelCtn.addChild(new FYGE.BitmapText(bitMapc))
if (this.data.score < 10) {
this.bitmapTextCount.textures = bitMapc2
}
this.bitmapTextCount.position.set(panelCtn.width / 2, 230)
this.bitmapTextCount.scaleX = 0.5
this.bitmapTextCount.scaleY = 0.5
this.bitmapTextCount.text = this.data.score + ''
UI.Btn(panelCtn, 'one_more-btn.png', function(e) {
Tools.btnDelay(e.target)
console.log('再来一局')
// 京东淘宝改动点
if (my) {
// @ts-ignore
this.hidePanel()
this.data.restart()
} else {
// @ts-ignore
window.jdk._startGame && window.jdk._startGame(() => {
this.hidePanel()
this.data.restart()
})
}
}, this, 355, 440)
UI.Txt(panelCtn, '本次得分', 30, '#e95d2a', FYGE.TEXT_ALIGN.CENTER, panelCtn.width, 0, 320)
UI.Txt(panelCtn, this.data.score.toString(), 70, '#e8524b', FYGE.TEXT_ALIGN.CENTER, 300, 180, 320, true)
UI.Sp(panelCtn, 'over-tipsicon.png', panelCtn.width / 2, 420).anchorTexture.set(0.5, 0.5)
var icon = UI.Sp(panelCtn, 'prize-icon1.png', panelCtn.width / 2, 580)
icon.anchorTexture.set(0.5, 0.5)
icon.addEventListener(FYGE.MouseEvent.CLICK, async function() {
const {data, success} = await sendTbNet(TbNetName.drawLotteryPrize)
if (success) {
if (data.type != 5) {
// 中奖了
this.hidePanel()
showPanel(PrizeShowPanel, Object.assign({}, data, this.data))
} else {
this.hidePanel()
changeScene(GameOverScene, this.data)
}
}
}, this)
}
}
\ No newline at end of file
import { changeScene } from './../../module/ctrls/index';
import { showToast } from '../../module/ctrls';
import { layers } from '../../module/views/layers';
import UI from '../UI';
import { Panel } from './../../module/views/Panel';
import { GameOverScene } from '../scenes/GameOverScene/GameOverScene';
export class PrizeShowPanel extends Panel {
get groupNames(): string[] {
return ['PrizeShowPanel']
}
initUi() {
var panelCtn = UI.Ctn(this)
UI.Sp(panelCtn, 'prize-back.png')
panelCtn.position.set(layers.stageCenterX - panelCtn.width / 2, layers.stageCenterY - panelCtn.height / 2)
UI.Txt(panelCtn, this.data.name, 30, '#757575', FYGE.TEXT_ALIGN.CENTER, panelCtn.width - 60, 30, 170)
var preview = UI.Sp(panelCtn, decodeURI(this.data.image))
preview.width = 300
preview.height = 300
preview.position.set(150, 230)
preview.mask = panelCtn.addChild(new FYGE.Graphics())
.beginFill()
.drawRoundedRect(150, 230, 300, 300, 20)
.endFill()
UI.Btn(panelCtn, 'confirm-btn.png', function() {
if (this.data.type == 3) {
this.hidePanel()
changeScene(GameOverScene, this.data)
//@ts-ignore
my && my.navigateTo({
url: `/pages/rewardinfofill/rewardinfofill?id=${this.data.id}&prizeId=${this.data.prizeId}`
})
} else {
// @ts-ignore
showToast('奖品已为您发放至淘宝卡券~')
this.hidePanel()
changeScene(GameOverScene, this.data)
}
}, this, 40, 580)
}
}
\ No newline at end of file
import { layers } from "../../../module/views/layers";
import { Scene } from "../../../module/views/Scene";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
import { Tools } from "../../Tools";
import UI from "../../UI";
......@@ -16,7 +17,11 @@ export class GameOverScene extends Scene {
initUi() {
UI.Sp(this, 'back.png')
var bitMapc = Tools.getNumTextures('num')
var bitMapc2 = Tools.getNumTextures('numb')
this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
if (this.data.score < 10) {
this.bitmapTextCount.textures = bitMapc2
}
this.bitmapTextCount.position.set(layers.stageCenterX, 500)
this.bitmapTextCount.text = this.data.score + ''
......@@ -26,15 +31,36 @@ export class GameOverScene extends Scene {
this.data.isNewRecord && UI.Sp(desc, 'new-record-icon.png', 490, -30)
UI.Btn(this, 'share-btn.png', function() {
console.log('点击了分享')
// @ts-ignore todo 分享
my && my.showSharePanel()
}, this, 45, 950)
UI.Btn(this, 'more-btn.png', function() {
console.log('点击了再来一次')
// @ts-ignore
my.redirectTo({
url: '/pages/mainscene/mainscene'
})
}, this, 45, 1110)
var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350)
_s.addEventListener(FYGE.MouseEvent.CLICK, function() {
// todo
console.log('回到主场')
})
_s.anchorTexture.set(0.5, 0.5)
var bottomCont = UI.Ctn(this)
bottomCont.position.set(0, layers.stageOffsetY + layers.stageHeight - 130)
UI.Rect(bottomCont, layers.stageWidth, 130, 0xffffff)
UI.Sp(bottomCont, 'product-link__icon.png', 50, 25)
UI.Txt(bottomCont, 'Nike 瑜伽商品', 28, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 35)
UI.Txt(bottomCont, '让你的体态更加健康', 26, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 75)
UI.Sp(bottomCont, 'jump-icon.png', 600, 40)
.addEventListener(FYGE.MouseEvent.CLICK, function() {
// @ts-ignore
// my.
console.log(this.data.productLink)
})
}
}
\ No newline at end of file
......@@ -22,6 +22,11 @@ function getSystemInfo():Promise<SystemInfo> {
class DeviceMotion {
subs: Array<SubType> = [] // 订阅 方法
private static _instance: DeviceMotion;
static get instance() {
return DeviceMotion._instance || (DeviceMotion._instance = new DeviceMotion())
}
constructor() {
this.initEvents()
}
......@@ -67,6 +72,12 @@ class DeviceMotion {
}
}
destory() {
this._tmdremoveEvents()
this.subs = []
DeviceMotion._instance = null
}
orientationHandler = (event) => {
const res = event
......@@ -101,6 +112,4 @@ class DeviceMotion {
}
}
const deviceMotionSubs = new DeviceMotion()
export default deviceMotionSubs
export default DeviceMotion
import { Tools } from './../../Tools';
import { changeScene, showPanel } from './../../../module/ctrls/index';
import { layers } from './../../../module/views/layers';
import UI from "../../UI"
import { GameCfg } from './GameConfig';
import deviceMotionSubs from './DeviceMotion';
import DeviceMotion from './DeviceMotion';
import { GDispatcher } from '../../Main';
import { MotionInitFunc, MotionInitScene } from './MotionInit';
import CountDownComp from '../../components/CountDownComp';
import { RES } from '../../../module/RES';
import { sendTbNet, TbNetName } from '../../TaoBaoNet';
import { GameOverScene } from '../GameOverScene/GameOverScene';
import { GameOverPanel } from '../../panels/GameOverPanel';
const Container = FYGE.Container
const TEXT_ALIGN = FYGE.TEXT_ALIGN
......@@ -95,10 +100,14 @@ export class GameScene extends MotionInitScene {
var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime))
this.cdp.addTimeoutFunc(() => {
// this.cdp.visible = false
this.cdp.visible = false
// 销毁 instance
DeviceMotion.instance.destory()
//@ts-ignore
my && my.showToast({
content: '游戏结束'
this.onSubmit({
id: Tools.globalData.startId,
score: this.score
})
})
cdp.position.set(layers.stageCenterX - 105, layers.stageOffsetY + 260)
......@@ -118,6 +127,28 @@ export class GameScene extends MotionInitScene {
}))
}
async onSubmit(params) {
const {data, success} = await sendTbNet(TbNetName.submitGame, params)
if (success) {
const {score, isNewRecord, productLink, isWinPrize} = data
if (isWinPrize) {
showPanel(GameOverPanel, {
score,
isNewRecord,
productLink,
isWinPrize
})
} else {
changeScene(GameOverScene, {
score,
isNewRecord,
productLink,
isWinPrize
})
}
}
}
shoot() {
this.cdp.stop()
}
......@@ -216,11 +247,11 @@ export class GameEle extends Container {
}
initEvents() {
deviceMotionSubs.notify(this.orientationChange, this)
DeviceMotion.instance.notify(this.orientationChange, this)
}
removeEvents() {
deviceMotionSubs.off(this.orientationChange)
DeviceMotion.instance.off(this.orientationChange)
}
destroy() {
......@@ -281,7 +312,7 @@ export class GameEle extends Container {
// this.vy =0
// }
var sw = this.sprite.width / 4
var sw = this.sprite.width / 2
if (this.x > layers.stageWidth + layers.stageOffsetX - sw) {
this.x = layers.stageWidth + layers.stageOffsetX - sw
this.vx = 0
......@@ -290,7 +321,7 @@ export class GameEle extends Container {
this.vx = 0
}
var sh = this.sprite.height / 4
var sh = this.sprite.height / 2
if (this.y > layers.stageHeight + layers.stageOffsetY - sh) {
this.y = layers.stageHeight + layers.stageOffsetY - sh
this.vy = 0
......
......@@ -7,7 +7,7 @@ import { GDispatcher } from "../../Main"
import { Tools } from "../../Tools"
import UI from "../../UI"
import { setCenterPos } from "../../utils/utils"
import deviceMotionSubs from "./DeviceMotion"
import DeviceMotion from "./DeviceMotion"
import { GameCfg } from "./GameConfig"
const Container = FYGE.Container
const TEXT_ALIGN = FYGE.TEXT_ALIGN
......@@ -73,12 +73,12 @@ export class MotionInitFunc extends Container {
showGuidance() {
this.maskCont.visible = true
deviceMotionSubs.notify(this.deviceOritationChange, this)
DeviceMotion.instance.notify(this.deviceOritationChange, this)
}
hideGuidance() {
this.maskCont.visible = false
deviceMotionSubs.off(this.deviceOritationChange)
DeviceMotion.instance.off(this.deviceOritationChange)
}
timer
......
......@@ -4,6 +4,7 @@ import { GameEle, GameScene } from "../GameScene/GameScene"
import { MotionInitScene } from '../GameScene/MotionInit';
import UI from '../../UI';
import { RES } from '../../../module/RES';
import { sendTbNet, TbNetName } from '../../TaoBaoNet';
export function setCenterPos(cont: FYGE.Sprite) {
cont.anchorTexture.set(0.5, 0.5)
......@@ -37,8 +38,9 @@ export class NewGuyScene extends MotionInitScene {
this.g1 = UI.Sp(this, 'guidance-t1.png', layers.stageCenterX, layers.stageCenterY + 400)
this.g1.anchorTexture.set(0.5, 0.5)
var e = this.addChild(new GameEle('p1.png', this.centerp, () => {
changeScene(GameScene)
var e = this.addChild(new GameEle('p1.png', this.centerp, async () => {
const {success} = await sendTbNet(TbNetName.complteGuidance)
success && changeScene(GameScene)
}))
}
......
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