mirror of
https://github.com/Leo501/CocosCreatorTutorial.git
synced 2026-09-03 07:27:12 +08:00
添加一个角度移动的demo跟转盘新方案的demo
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "272f0443-5fea-4f67-a387-9f2b0b9ac06b",
|
||||
"uuid": "ec6ef45c-8ca5-4c00-88d4-8276a1a3c67d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
@@ -2,7 +2,7 @@
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "ed74a1f0-6442-431e-9455-98cad21acf62",
|
||||
"uuid": "6ea77712-09d4-450b-bd1d-88d5e1cb924e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
@@ -32,7 +32,7 @@
|
||||
"_prefab": null,
|
||||
"autoReleaseAssets": false,
|
||||
"_globals": {
|
||||
"__id__": 22
|
||||
"__id__": 27
|
||||
},
|
||||
"_id": "8fe932db-a1ce-4eb6-82f8-5d882c09410a"
|
||||
},
|
||||
@@ -296,21 +296,24 @@
|
||||
},
|
||||
{
|
||||
"__id__": 13
|
||||
},
|
||||
{
|
||||
"__id__": 16
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 18
|
||||
"__id__": 23
|
||||
},
|
||||
{
|
||||
"__id__": 19
|
||||
"__id__": 24
|
||||
},
|
||||
{
|
||||
"__id__": 20
|
||||
"__id__": 25
|
||||
},
|
||||
{
|
||||
"__id__": 21
|
||||
"__id__": 26
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -428,7 +431,7 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Sprite",
|
||||
"_name": "Graphics",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 10
|
||||
@@ -441,14 +444,168 @@
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
},
|
||||
{
|
||||
"__id__": 16
|
||||
},
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": "cbz/iEZudKZpi8XjylyESi"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": "beQkhOh21CzZFMlontW326"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Graphics",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_lineWidth": 1,
|
||||
"_strokeColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_lineJoin": 2,
|
||||
"_lineCap": 0,
|
||||
"_fillColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_miterLimit": 10,
|
||||
"_id": "5b+IVl4ltANqpocrEVjJd9"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Manager",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 17
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 21
|
||||
},
|
||||
{
|
||||
"__id__": 22
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": "0fIUVTPN9B0ZdPruR9pmh/"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Sprite",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 18
|
||||
},
|
||||
{
|
||||
"__id__": 19
|
||||
},
|
||||
{
|
||||
"__id__": 20
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -483,7 +640,7 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
"__id__": 17
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -504,7 +661,7 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
"__id__": 17
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -543,31 +700,46 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
"__id__": 17
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"speed": 50,
|
||||
"angleSpeed": 1,
|
||||
"radius": 100,
|
||||
"angle": 0,
|
||||
"accelerate": 1,
|
||||
"state": 1,
|
||||
"_id": "7blWokXwJMr7m+nf/t2DUY"
|
||||
},
|
||||
{
|
||||
"__type__": "07719kiJa5PBKBO80p1OQSA",
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
"__id__": 16
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"moveComponent": {
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": "606rp8qMlEY7JIX7SYxj1g"
|
||||
},
|
||||
{
|
||||
"__type__": "6535bMi1E5BqJm9z8DmRpzC",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_id": "daNab3b9RPRqfh09RY26JE"
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"movement": {
|
||||
"__id__": 20
|
||||
},
|
||||
"_id": "c6h/yFCxJGd6CqhC9Vof2M"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
@@ -648,19 +820,19 @@
|
||||
{
|
||||
"__type__": "cc.SceneGlobals",
|
||||
"ambient": {
|
||||
"__id__": 23
|
||||
"__id__": 28
|
||||
},
|
||||
"shadows": {
|
||||
"__id__": 24
|
||||
"__id__": 29
|
||||
},
|
||||
"_skybox": {
|
||||
"__id__": 25
|
||||
"__id__": 30
|
||||
},
|
||||
"fog": {
|
||||
"__id__": 26
|
||||
"__id__": 31
|
||||
},
|
||||
"octree": {
|
||||
"__id__": 27
|
||||
"__id__": 32
|
||||
}
|
||||
},
|
||||
{
|
||||
12
MovementDemo/assets/Movement/scripts.meta
Normal file
12
MovementDemo/assets/Movement/scripts.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "927ae77c-97ef-4b5f-9c50-24b90ed5500d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
@@ -36,54 +36,63 @@ export class MovePath extends Component {
|
||||
displayName: "移动组件"
|
||||
})
|
||||
private movement: Movement = null;
|
||||
// @property({ type: Node, displayName: "移动节点" })
|
||||
// private target:
|
||||
|
||||
private pathList: PathInfo[] = [];
|
||||
private curPath: PathInfo = null;
|
||||
private curDistance: number;
|
||||
private curDistance: number = 0;
|
||||
private curIndex: number = 0;
|
||||
|
||||
start() {
|
||||
|
||||
onLoad() {
|
||||
let p1 = new PathInfo();
|
||||
p1.type = PathType.line;
|
||||
p1.speed = 50;
|
||||
p1.angle = -Math.PI / 2;
|
||||
p1.startPos = v2(200, 200);
|
||||
p1.distance = 400;
|
||||
p1.startPos = v2(100, 100);
|
||||
p1.distance = 200;
|
||||
this.pathList.push(p1);
|
||||
|
||||
p1 = new PathInfo();
|
||||
p1.type = PathType.line;
|
||||
p1.type = PathType.circle;
|
||||
p1.speed = 50;
|
||||
p1.angle = Math.PI
|
||||
p1.startPos = v2(200, -200);
|
||||
p1.distance = 400;
|
||||
p1.angle = 0;
|
||||
p1.radius = 100;
|
||||
p1.startPos = v2(100, -100);
|
||||
p1.distance = 100 * Math.PI;
|
||||
p1.center = v2(0, -100);
|
||||
this.pathList.push(p1);
|
||||
|
||||
p1 = new PathInfo();
|
||||
p1.type = PathType.line;
|
||||
p1.speed = 50;
|
||||
p1.angle = Math.PI / 2
|
||||
p1.startPos = v2(-200, -200);
|
||||
p1.distance = 400;
|
||||
p1.startPos = v2(-100, -100);
|
||||
p1.distance = 200;
|
||||
this.pathList.push(p1);
|
||||
|
||||
p1 = new PathInfo();
|
||||
p1.type = PathType.line;
|
||||
p1.type = PathType.circle;
|
||||
p1.speed = 50;
|
||||
p1.angle = 0;
|
||||
p1.startPos = v2(-200, 200);
|
||||
p1.distance = 400;
|
||||
p1.angle = Math.PI;
|
||||
p1.radius = 100;
|
||||
p1.startPos = v2(-100, 100);
|
||||
p1.distance = p1.radius * Math.PI;
|
||||
p1.center = v2(0, 100);
|
||||
this.pathList.push(p1);
|
||||
|
||||
this.curPath = this.getPathInfo();
|
||||
this.initPathInfo();
|
||||
this.initMovement();
|
||||
}
|
||||
|
||||
addIndex() {
|
||||
this.curIndex++;
|
||||
}
|
||||
|
||||
getPathInfo() {
|
||||
return this.pathList[this.curIndex];
|
||||
initPathInfo() {
|
||||
let index = this.curIndex % this.pathList.length;
|
||||
this.curPath = this.pathList[index];
|
||||
}
|
||||
|
||||
initMovement() {
|
||||
@@ -91,12 +100,33 @@ export class MovePath extends Component {
|
||||
this.movement.speed = this.curPath.speed;
|
||||
this.movement.radius = this.curPath.radius;
|
||||
this.movement.center = this.curPath.center;
|
||||
this.movement.setPostion(this.curPath.startPos);
|
||||
}
|
||||
|
||||
move(dt) {
|
||||
if (this.curPath.type == PathType.line) {
|
||||
this.movement.line(dt);
|
||||
} else if (this.curPath.type == PathType.circle) {
|
||||
this.movement.circle(dt);
|
||||
}
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if (null != this.curPath) {
|
||||
this.curDistance < this.curPath.distance;
|
||||
|
||||
let distance = this.movement.deltaDistance(deltaTime);
|
||||
let left = this.curPath.distance - this.curDistance;
|
||||
while (distance > left) {
|
||||
let t = this.movement.deltaTime(left);
|
||||
deltaTime -= t;
|
||||
this.addIndex();
|
||||
this.initPathInfo();
|
||||
this.initMovement();
|
||||
this.curDistance = 0;
|
||||
distance = this.movement.deltaDistance(deltaTime);
|
||||
left = this.curPath.distance - this.curDistance;
|
||||
}
|
||||
this.move(deltaTime);
|
||||
this.curDistance += distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,14 @@ export class Movement extends Component {
|
||||
/**圆周运动中心点 */
|
||||
center: Vec2 = new Vec2();
|
||||
|
||||
/**
|
||||
* 设置初始位置
|
||||
* @param pos
|
||||
*/
|
||||
setPostion(pos: Vec2) {
|
||||
this.node.position = new Vec3(pos.x, pos.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* 距离增量
|
||||
* @param time
|
||||
@@ -22,6 +30,15 @@ export class Movement extends Component {
|
||||
return this.speed * time;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算时间
|
||||
* @param distance
|
||||
* @returns
|
||||
*/
|
||||
deltaTime(distance: number) {
|
||||
return distance / this.speed
|
||||
}
|
||||
|
||||
/**
|
||||
* 角度增量
|
||||
* @param time
|
||||
@@ -29,7 +46,8 @@ export class Movement extends Component {
|
||||
*/
|
||||
deltaAngle(time: number) {
|
||||
let distance = this.deltaDistance(time);
|
||||
return distance / this.radius;
|
||||
let delta = distance / this.radius;
|
||||
return -delta;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,9 +60,11 @@ export class Movement extends Component {
|
||||
this.angle += delta;
|
||||
if (this.angle > Math.PI * 2) {
|
||||
this.angle -= Math.PI * 2;
|
||||
} else if (this.angle < Math.PI * 2) {
|
||||
this.angle += Math.PI * 2;
|
||||
}
|
||||
let x = this.radius * Math.cos(this.angle);
|
||||
let y = this.radius * Math.sin(this.angle);
|
||||
let x = this.center.x + this.radius * Math.cos(this.angle);
|
||||
let y = this.center.y + this.radius * Math.sin(this.angle);
|
||||
this.node.position = new Vec3(x, y, this.node.position.z);
|
||||
}
|
||||
|
||||
8
MovementDemo/settings/v2/packages/project.json
Normal file
8
MovementDemo/settings/v2/packages/project.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"general": {
|
||||
"designResolution": {
|
||||
"width": 720,
|
||||
"height": 1280
|
||||
}
|
||||
}
|
||||
}
|
||||
24
TurntableDemoV3/.gitignore
vendored
Normal file
24
TurntableDemoV3/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#///////////////////////////
|
||||
# Cocos Creator 3D Project
|
||||
#///////////////////////////
|
||||
library/
|
||||
temp/
|
||||
local/
|
||||
build/
|
||||
profiles/
|
||||
native
|
||||
#//////////////////////////
|
||||
# NPM
|
||||
#//////////////////////////
|
||||
node_modules/
|
||||
|
||||
#//////////////////////////
|
||||
# VSCode
|
||||
#//////////////////////////
|
||||
.vscode/
|
||||
|
||||
#//////////////////////////
|
||||
# WebStorm
|
||||
#//////////////////////////
|
||||
.idea/
|
||||
1191
TurntableDemoV3/@types/editor.d.ts
vendored
Normal file
1191
TurntableDemoV3/@types/editor.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16092
TurntableDemoV3/@types/electron.d.ts
vendored
Normal file
16092
TurntableDemoV3/@types/electron.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
57
TurntableDemoV3/@types/extension.d.ts
vendored
Normal file
57
TurntableDemoV3/@types/extension.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
declare namespace Editor {
|
||||
|
||||
namespace Interface {
|
||||
// ---- Package ---- start
|
||||
interface PackageInfo {
|
||||
debug: boolean;
|
||||
enable: boolean;
|
||||
info: PackageJson;
|
||||
invalid: boolean;
|
||||
name: string;
|
||||
path: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface PackageJson {
|
||||
name: string;
|
||||
version: string;
|
||||
|
||||
title?: string;
|
||||
author?: string;
|
||||
debug?: boolean;
|
||||
description?: string;
|
||||
main?: string;
|
||||
editor?: string;
|
||||
panel?: any;
|
||||
contributions?: { [key: string]: any };
|
||||
}
|
||||
// ---- Package ---- end
|
||||
|
||||
// ---- UI ---- start
|
||||
interface PanelInfo {
|
||||
template?: string;
|
||||
style?: string;
|
||||
listeners?: { [key: string]: () => {} };
|
||||
methods?: { [key: string]: Function };
|
||||
$?: { [key: string]: string };
|
||||
ready?(): void;
|
||||
update?(...args: any[]): void;
|
||||
beforeClose?(): void;
|
||||
close?(): void;
|
||||
}
|
||||
|
||||
namespace UIKit {
|
||||
interface UIPanelInfo extends PanelInfo {
|
||||
// 向上触发事件
|
||||
dispath(eventName: string, ...arg: any): void;
|
||||
}
|
||||
|
||||
interface EditorElementBase extends HTMLElement {
|
||||
value: any;
|
||||
dispath: (name: string, event: any) => void;
|
||||
}
|
||||
|
||||
}
|
||||
// ---- UI ---- end
|
||||
}
|
||||
}
|
||||
2
TurntableDemoV3/@types/index.d.ts
vendored
Normal file
2
TurntableDemoV3/@types/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference path="./editor.d.ts"/>
|
||||
/// <reference path="./message.d.ts"/>
|
||||
27
TurntableDemoV3/@types/message.d.ts
vendored
Normal file
27
TurntableDemoV3/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as AssetDB from './packages/asset-db/@types/message';
|
||||
import * as Scene from './packages/scene/@types/message';
|
||||
import * as Engine from './packages/engine/@types/message';
|
||||
import * as Builder from './packages/builder/@types/public/message';
|
||||
import * as Programming from './packages/programming/@types/message';
|
||||
// import * as Extension from './packages/extension/@types/message';
|
||||
|
||||
declare global {
|
||||
interface EditorMessageContent {
|
||||
params: any[],
|
||||
result: any;
|
||||
}
|
||||
|
||||
interface EditorMessageMap {
|
||||
[x: string]: EditorMessageContent;
|
||||
}
|
||||
|
||||
interface EditorMessageMaps {
|
||||
[x: string]: EditorMessageMap;
|
||||
'asset-db': AssetDB.message;
|
||||
'scene': Scene.message;
|
||||
'engine': Engine.message;
|
||||
'builder': Builder.message;
|
||||
'programming': Programming.message,
|
||||
// 'extension': Extension.message;
|
||||
}
|
||||
}
|
||||
179
TurntableDemoV3/@types/packages/asset-db/@types/message.d.ts
vendored
Normal file
179
TurntableDemoV3/@types/packages/asset-db/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
import { AssetInfo, QueryAssetsOption, AssetOperationOption, AssetDBOptions, IAssetMeta } from './public';
|
||||
|
||||
export interface message extends EditorMessageMap {
|
||||
'query-ready': {
|
||||
params: [],
|
||||
result: boolean,
|
||||
},
|
||||
'create-asset': {
|
||||
params: [
|
||||
string,
|
||||
string | Buffer | null,
|
||||
] | [
|
||||
string,
|
||||
string | Buffer | null,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'import-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'copy-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'move-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'delete-asset': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'open-asset': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: void,
|
||||
},
|
||||
'save-asset': {
|
||||
params: [
|
||||
string,
|
||||
string | Buffer,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'save-asset-meta': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'reimport-asset': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'refresh-asset': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'query-asset-info': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'query-asset-meta': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: IAssetMeta | null,
|
||||
},
|
||||
'query-path': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'query-url': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'query-uuid': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'query-assets': {
|
||||
params: [] | [
|
||||
QueryAssetsOption,
|
||||
],
|
||||
result: AssetInfo[],
|
||||
},
|
||||
'generate-available-url': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: string,
|
||||
},
|
||||
|
||||
// private
|
||||
|
||||
'query-asset-mtime': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'refresh': {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
'open-devtools': {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
'query-db-info': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: AssetDBOptions,
|
||||
},
|
||||
'create-asset-dialog': {
|
||||
params: [
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'init-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'query-all-importer': {
|
||||
params: [],
|
||||
result: string[],
|
||||
},
|
||||
'query-all-asset-types': {
|
||||
params: [],
|
||||
result: string[],
|
||||
},
|
||||
}
|
||||
115
TurntableDemoV3/@types/packages/asset-db/@types/public.d.ts
vendored
Normal file
115
TurntableDemoV3/@types/packages/asset-db/@types/public.d.ts
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// Basic information about the resource
|
||||
// 资源的基础信息
|
||||
export interface AssetInfo {
|
||||
// Asset name
|
||||
// 资源名字
|
||||
name: string;
|
||||
// Asset display name
|
||||
// 资源用于显示的名字
|
||||
displayName: string;
|
||||
// URL
|
||||
source: string;
|
||||
// loader 加载的层级地址
|
||||
path: string;
|
||||
// loader 加载地址会去掉扩展名,这个参数不去掉
|
||||
url: string;
|
||||
// 绝对路径
|
||||
file: string;
|
||||
// 资源的唯一 ID
|
||||
uuid: string;
|
||||
// 使用的导入器名字
|
||||
importer: string;
|
||||
// 类型
|
||||
type: string;
|
||||
// 是否是文件夹
|
||||
isDirectory: boolean;
|
||||
// 导入资源的 map
|
||||
library: { [key: string]: string };
|
||||
// 子资源 map
|
||||
subAssets: { [key: string]: AssetInfo };
|
||||
// 是否显示
|
||||
visible: boolean;
|
||||
// 是否只读
|
||||
readonly: boolean;
|
||||
|
||||
// 虚拟资源可以实例化成实体的话,会带上这个扩展名
|
||||
instantiation?: string;
|
||||
// 跳转指向资源
|
||||
redirect?: IRedirectInfo;
|
||||
// 继承类型
|
||||
extends?: string[];
|
||||
// 是否导入完成
|
||||
imported: boolean;
|
||||
// 是否导入失败
|
||||
invalid: boolean;
|
||||
}
|
||||
|
||||
export interface IRedirectInfo {
|
||||
// 跳转资源的类型
|
||||
type: string;
|
||||
// 跳转资源的 uuid
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface QueryAssetsOption {
|
||||
type?: string;
|
||||
pattern?: string;
|
||||
ccType?: string;
|
||||
extname?: string;
|
||||
importer?: string;
|
||||
isBundle?: boolean;
|
||||
}
|
||||
|
||||
export interface AssetOperationOption {
|
||||
// 是否强制覆盖已经存在的文件,默认 false
|
||||
overwrite?: boolean;
|
||||
// 是否自动重命名冲突文件,默认 false
|
||||
rename?: boolean;
|
||||
}
|
||||
|
||||
export interface AssetDBOptions {
|
||||
name: string;
|
||||
target: string;
|
||||
library: string;
|
||||
temp: string;
|
||||
/**
|
||||
* 0: 忽略错误
|
||||
* 1: 仅仅打印错误
|
||||
* 2: 打印错误、警告
|
||||
* 3: 打印错误、警告、日志
|
||||
* 4: 打印错误、警告、日志、调试信息
|
||||
*/
|
||||
level: number;
|
||||
ignoreFiles: string[];
|
||||
readonly: boolean;
|
||||
}
|
||||
|
||||
export interface ContributionInfo {
|
||||
mount?: {
|
||||
path: string;
|
||||
readonly?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ExecuteAssetDBScriptMethodOptions {
|
||||
name: string;
|
||||
method: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export interface IAssetMeta {
|
||||
ver: string;
|
||||
importer: string;
|
||||
imported: boolean;
|
||||
uuid: string;
|
||||
files: string[];
|
||||
subMetas: {
|
||||
[index: string]: IAssetMeta;
|
||||
};
|
||||
userData: {
|
||||
[index: string]: any;
|
||||
};
|
||||
displayName: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
2
TurntableDemoV3/@types/packages/builder/@types/index.d.ts
vendored
Normal file
2
TurntableDemoV3/@types/packages/builder/@types/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
export * from './public';
|
||||
117
TurntableDemoV3/@types/packages/builder/@types/protect/asset-manager.d.ts
vendored
Normal file
117
TurntableDemoV3/@types/packages/builder/@types/protect/asset-manager.d.ts
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
import { AssetInfo } from "../../../asset-db/@types/public";
|
||||
import { UUID } from "../public";
|
||||
import { IInternalBuildOptions } from "./options";
|
||||
export interface IBuildStatiscInfo {
|
||||
packageName: string;
|
||||
gameName: string;
|
||||
platform: string;
|
||||
scenesNum: number;
|
||||
assetsNum: number;
|
||||
scriptNum: number;
|
||||
|
||||
includeModules: string[];
|
||||
orientation: string;
|
||||
remoteServerAddress: string;
|
||||
appid: string;
|
||||
|
||||
size: number;
|
||||
time: number;
|
||||
err: string;
|
||||
}
|
||||
|
||||
// ********************************* asset-manager *********************************
|
||||
|
||||
export class BuilderAssetCache {
|
||||
// 场景资源的 assets 信息缓存
|
||||
public readonly sceneUuids: Array<string>;
|
||||
|
||||
// 脚本资源的 assets 信息缓存
|
||||
public readonly scriptUuids: Array<string>;
|
||||
|
||||
// 除场景、脚本资源外的资源 assets uuid 缓存
|
||||
public readonly assetUuids: Array<string>;
|
||||
|
||||
init: () => Promise<void>;
|
||||
addAsset: (asset: IAssetInfo) => void;
|
||||
addInstance: (instance: any) => void;
|
||||
clearAsset: (uuid: string) => void;
|
||||
getMeta: (uuid: string) => Promise<any>;
|
||||
getAssetInfo: (uuid: string) => IAssetInfo;
|
||||
getDependUuids: (uuid: string) => Promise<readonly string[]>;
|
||||
getDependUuidsDeep: (uuid: string) => Promise<readonly string[]>;
|
||||
/**
|
||||
* 获取序列化文件
|
||||
*/
|
||||
getLibraryJSON: (uuid: string) => Promise<any>;
|
||||
getSerializedJSON: (uuid: string, options: IInternalBuildOptions) => Promise<any>;
|
||||
forEach: (type: string, handle: Function) => Promise<void>;
|
||||
getInstance: (uuid: string) => Promise<any>;
|
||||
__addStaticsInfo: (info: any) => void;
|
||||
}
|
||||
|
||||
export interface IAssetInfo extends AssetInfo {
|
||||
meta?: any;
|
||||
temp?: string; // 资源的构建缓存目录
|
||||
fatherInfo?: any;
|
||||
// fatherUuid?: string | undefined;
|
||||
userData?: any;
|
||||
subAssets: Record<string, IAssetInfo>;
|
||||
dirty?: boolean;
|
||||
// 内置资源没有 mtime
|
||||
mtime?: number;
|
||||
}
|
||||
export type IUrl = string; // 需要的是符合 url 标准的字符串,例如 asset/script/text.ts
|
||||
export type IAssetInfoMap = Record<UUID, IAssetInfo>;
|
||||
export type IUuidDependMap = Record<UUID, UUID[]>;
|
||||
export type IJsonGroupMap = Record<UUID, IJSONGroupItem>;
|
||||
export type IAssetGroupMap = Record<UUID, IAssetGroupItem>;
|
||||
|
||||
// TODO meta 的类型定义
|
||||
export type IMetaMap = Record<UUID, any>;
|
||||
export type IJsonMap = Record<UUID, any>;
|
||||
export type IInstanceMap = Record<UUID, any>;
|
||||
|
||||
export type ICompressOptions = Record<string, number>;
|
||||
export interface IAssetGroupItem {
|
||||
// 分组名字
|
||||
// name: string;
|
||||
// 分组的根 url
|
||||
baseUrls: string[];
|
||||
// 脚本编译后的实际地址
|
||||
scriptDest: string;
|
||||
// 脚本 uuid 列表
|
||||
scriptUuids: UUID[];
|
||||
// raw 资源 uuid 列表
|
||||
assetUuids: UUID[];
|
||||
}
|
||||
|
||||
export interface IJSONGroupItem {
|
||||
// 分组名字
|
||||
name?: string;
|
||||
// 分组名字
|
||||
type: string;
|
||||
// json 资源 uuid 列表
|
||||
uuids: UUID[];
|
||||
}
|
||||
|
||||
export interface IAssetGroupOptions {
|
||||
// 脚本打包后的输出路径
|
||||
scriptUrl: string;
|
||||
baseUrl: string;
|
||||
}
|
||||
|
||||
export type IGroupType = 'json' | 'script' | 'asset';
|
||||
export interface PacInfo {
|
||||
meta: any;
|
||||
asset: IAssetInfo;
|
||||
spriteFrames: any[];
|
||||
relativePath: string;
|
||||
relativeDir: string;
|
||||
}
|
||||
|
||||
export type IUpdateType = 'asset-change' | 'asset-add' | 'asset-delete';
|
||||
export interface IUpdateInfo {
|
||||
type: IUpdateType;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
152
TurntableDemoV3/@types/packages/builder/@types/protect/build-plugin.d.ts
vendored
Normal file
152
TurntableDemoV3/@types/packages/builder/@types/protect/build-plugin.d.ts
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
// ********************************* plugin ****************************************
|
||||
|
||||
import { BundleCompressionType, IBuildPluginConfig, IBuildTaskOption, IDisplayOptions, ISettings, IVerificationRuleMap } from '../public';
|
||||
import { BuilderAssetCache } from './asset-manager';
|
||||
import { InternalBuildResult } from './build-result';
|
||||
import { IInternalBuildOptions } from './options';
|
||||
import { ITextureCompressPlatform, ITextureCompressType } from '../public/texture-compress';
|
||||
|
||||
export interface IBuildWorkerPluginInfo {
|
||||
assetHandlers?: string;
|
||||
// 注册到各个平台的钩子函数
|
||||
hooks?: Record<string, string>;
|
||||
pkgName: string;
|
||||
internal: boolean; // 是否为内置插件
|
||||
priority: number; // 优先级
|
||||
}
|
||||
|
||||
export type IPluginHookName =
|
||||
| 'onBeforeBuild'
|
||||
| 'onAfterInit'
|
||||
| 'onBeforeInit'
|
||||
| 'onAfterInit'
|
||||
| 'onBeforeBuildAssets'
|
||||
| 'onAfterBuildAssets'
|
||||
| 'onBeforeCompressSettings'
|
||||
| 'onAfterCompressSettings'
|
||||
| 'onAfterBuild';
|
||||
// | 'onBeforeCompile'
|
||||
// | 'compile'
|
||||
// | 'onAfterCompile'
|
||||
// | 'run';
|
||||
|
||||
export type IPluginHook = Record<IPluginHookName, IInternalBaseHooks>;
|
||||
export interface IInternalHook {
|
||||
throwError?: boolean; // 插件注入的钩子函数,在执行失败时是否直接退出构建流程
|
||||
title?: string; // 插件任务整体 title,支持 i18n 写法
|
||||
// ------------------ 钩子函数 --------------------------
|
||||
onBeforeBuild?: IInternalBaseHooks;
|
||||
onBeforeInit?: IInternalBaseHooks;
|
||||
onAfterInit?: IInternalBaseHooks;
|
||||
onBeforeBuildAssets?: IInternalBaseHooks;
|
||||
onAfterBuildAssets?: IInternalBaseHooks;
|
||||
onBeforeCompressSettings?: IInternalBaseHooks;
|
||||
onAfterCompressSettings?: IInternalBaseHooks;
|
||||
onAfterBuild?: IInternalBaseHooks;
|
||||
// ------------------ 其他操作函数 ---------------------
|
||||
// 内置插件才有可能触发这个函数
|
||||
run?: (dest: string, options: IBuildTaskOption) => Promise<boolean>;
|
||||
// 内置插件才有可能触发这个函数
|
||||
compile?: (dest: string, options: IBuildTaskOption) => boolean;
|
||||
}
|
||||
|
||||
export type IInternalBaseHooks = (options: IInternalBuildOptions, result: InternalBuildResult, cache: BuilderAssetCache, ...args: any[]) => void;
|
||||
export interface IBuildTask {
|
||||
handle: (options: IInternalBuildOptions, result: InternalBuildResult, cache: BuilderAssetCache, settings?: ISettings) => {};
|
||||
title: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IBuildHooksInfo {
|
||||
pkgNameOrder: string[];
|
||||
infos: Record<string, { path: string; internal: boolean }>;
|
||||
}
|
||||
export interface IBuildAssetHandlerInfo {
|
||||
pkgNameOrder: string[];
|
||||
handles: {[pkgName: string]: Function};
|
||||
}
|
||||
export interface IInternalBuildPluginConfig extends IBuildPluginConfig {
|
||||
platformName?: string; // 平台名,可以指定为 i18n 写法, 只有官方构建插件的该字段有效
|
||||
hooks?: string; // 钩子函数的存储路径
|
||||
panel?: string; // 存储导出 vue 组件、button 配置的脚本路径
|
||||
textureCompressConfig?: {
|
||||
// 仅对内部插件开放
|
||||
platformType: ITextureCompressPlatform; // 注册的纹理压缩平台类型
|
||||
support: {
|
||||
rgba: ITextureCompressType[];
|
||||
rgb: ITextureCompressType[];
|
||||
}; // 该平台支持的纹理压缩格式,按照推荐优先级排列
|
||||
};
|
||||
assetBundleConfig?: {
|
||||
// asset bundle 的配置
|
||||
supportedCompressionTypes: BundleCompressionType[];
|
||||
};
|
||||
priority?: number;
|
||||
wrapWithFold?: boolean; // 是否将选项显示在折叠框内(默认 true )
|
||||
options?: IDisplayOptions; // 需要注入的平台参数配置
|
||||
verifyRuleMap?: IVerificationRuleMap; // 注入的需要更改原有参数校验规则的函数
|
||||
commonOptions?: Record<string, boolean>;
|
||||
// TODO 之前为 ios-app-clip HACK 出来的接口,之后需要重新设计
|
||||
realInFileExplorer?: (options: IInternalBuildOptions | any) => void; // 根据构建配置计算输出地址(界面中的在文件夹中显示)
|
||||
debugConfig?: IDebugConfig;
|
||||
internal?: boolean;
|
||||
}
|
||||
|
||||
export interface BuildCheckResult {
|
||||
error: string;
|
||||
newValue: any;
|
||||
}
|
||||
|
||||
export type IBuildVerificationFunc = (value: any, options: IBuildTaskOption) => boolean | Promise<boolean>;
|
||||
|
||||
export interface IButtonConfigItem {
|
||||
label: string; // 按钮名称
|
||||
click?: (event: Event, options: IBuildTaskOption) => void; // 点击事件响应函数
|
||||
hookHandle?: string; // 点击后执行的方法,与 click 二选一
|
||||
tooltip?: string; // 鼠标上移到按钮上的文本提示
|
||||
// 只有指定 hookHandle 配置的按钮,才可以影响进度条,构建将会自动为每个按钮创建一个构建内置任务,并提供对应的进度 log 更新等等。
|
||||
// attributes?: any; // 想要添加在按钮上的一些属性值(class, style, title)
|
||||
}
|
||||
|
||||
export interface IDebugConfig {
|
||||
options?: IDisplayOptions; // 显示在构建平台编译运行调试工具上的配置选项
|
||||
custom?: string; // 显示在构建平台编译运行调试工具上的配置 vue 组件
|
||||
}
|
||||
|
||||
// ui-panel 注册数据
|
||||
export interface PanelInfo {
|
||||
$?: { [name: string]: string | HTMLElement | null };
|
||||
template?: string; // TODO 暂时设置为可选
|
||||
style?: string;
|
||||
methods?: { [name: string]: Function };
|
||||
ready?: Function;
|
||||
close?: Function;
|
||||
update?: (options: IBuildTaskOption, path: string, value: any) => void | Promise<void>;
|
||||
}
|
||||
|
||||
export interface IPanelThis {
|
||||
$: Record<string, HTMLElement>;
|
||||
dispatch: (name: string, ...args: any[]) => void;
|
||||
}
|
||||
|
||||
export interface IPanelInfo extends PanelInfo {
|
||||
component?: any; // 注入面板的 vue 组件,可与与 options 共存,options 会优先显示
|
||||
buttonConfig?: IButtonConfig; // 要注入的构建选项脚本
|
||||
}
|
||||
|
||||
export interface IButtonConfig {
|
||||
configs?: Record<string, IButtonConfigItem>;
|
||||
custom?: any;
|
||||
}
|
||||
|
||||
export interface ICompInfo {
|
||||
custom?: any;
|
||||
options?: IDisplayOptions;
|
||||
panelInfo?: PanelInfo;
|
||||
displayName?: string;
|
||||
wrapWithFold: boolean;
|
||||
|
||||
// ..... 初始化时未存在的字段 .....
|
||||
panel?: any; // 实例化后的 panel 对象
|
||||
pkgName?: string; // 插件名称
|
||||
}
|
||||
141
TurntableDemoV3/@types/packages/builder/@types/protect/build-result.d.ts
vendored
Normal file
141
TurntableDemoV3/@types/packages/builder/@types/protect/build-result.d.ts
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
import { BundleCompressionType, IAssetPathInfo, IBuildPaths, IBuildTaskOption, IBundleConfig, IJsonPathInfo, ISettings, UUID } from "../public";
|
||||
import { IAssetInfo } from "./asset-manager";
|
||||
import { ImportMapWithImports } from "./import-map";
|
||||
|
||||
export class InternalBuildResult {
|
||||
settings: ISettings;
|
||||
readonly bundles: IBundle[];
|
||||
readonly bundleMap: Record<string, IBundle>;
|
||||
// 构建实际使用到的插件脚本 uuid 列表
|
||||
plugins: UUID[];
|
||||
// 脚本资源包分组(子包/分包)
|
||||
scriptPackages: string[];
|
||||
// MD5 后缀 map
|
||||
pluginVers: Record<UUID, string>;
|
||||
// 纹理压缩任务
|
||||
imageTaskMap: Record<UUID, IImageTask>;
|
||||
compressImageResult: ICompressImageResult;
|
||||
importMap: ImportMapWithImports;
|
||||
// 传入构建的 options
|
||||
rawOptions: IBuildTaskOption;
|
||||
// 输出路径集合
|
||||
paths: IBuildPaths;
|
||||
// 允许自定义编译选项
|
||||
compileOptions?: any;
|
||||
addBundle: (bundle: IBundle) => void;
|
||||
addPlugin: (plugin: IAssetInfo) => void;
|
||||
}
|
||||
|
||||
export interface IImageTask {
|
||||
src: string;
|
||||
// TODO 这个名称已和意义有冲突需要整理调整
|
||||
dest: string[];
|
||||
presetId: string;
|
||||
hasAlpha: boolean;
|
||||
mtime?: any;
|
||||
// 生成阶段将会重新获取 bundle 的输出地址
|
||||
bundleNames: string[];
|
||||
}
|
||||
|
||||
export interface IVersionMap {
|
||||
import: Record<UUID, string>;
|
||||
native: Record<UUID, string>;
|
||||
}
|
||||
|
||||
export interface IMD5Map {
|
||||
'raw-assets': Record<UUID, string>;
|
||||
import: Record<UUID, string>;
|
||||
plugin?: Record<UUID, string>;
|
||||
}
|
||||
export interface IAtlasResult {
|
||||
assetsToImage: Record<string, string>;
|
||||
imageToAtlas: Record<string, string>;
|
||||
atlasToImages: Record<string, string[]>;
|
||||
}
|
||||
|
||||
export class IBundle {
|
||||
readonly scenes: UUID[]; // 该 bundle 中的所有场景,包含重定向的
|
||||
readonly assets: UUID[]; // 该 bundle 中的所有资源,包含重定向的
|
||||
readonly assetsWithoutRedirect: UUID[]; // 该 bundle 中的未重定向的资源
|
||||
readonly scripts: UUID[]; // 该 bundle 中的所有脚本
|
||||
readonly rootAssets: UUID[]; // 该 bundle 中的根资源,即直接放在 bundle 目录下的资源,包含重定向的资源
|
||||
readonly isSubpackage: boolean; // 该 bundle 是否是子包
|
||||
root: string; // bundle 的根目录, 开发者勾选的目录,如果是 main 包,这个字段为 ''
|
||||
dest: string; // bundle 的输出目录
|
||||
importBase: string;
|
||||
nativeBase: string;
|
||||
scriptDest: string; // 脚本的输出目录
|
||||
name: string; // bundle 的名称
|
||||
priority: number; // bundle 的优先级
|
||||
compressionType: BundleCompressionType; // bundle 的压缩类型
|
||||
assetVer: IVersionMap; // bundle 内的资源版本
|
||||
version: string; // bundle 本身的版本信息
|
||||
readonly isRemote: boolean; // bundle 是否是远程包
|
||||
redirect: Record<UUID, string>; // bundle 中的重定向资源
|
||||
deps: Set<string>; // bundle 的依赖 bundle
|
||||
groups: IGroup[]; // 该 bundle 中的资源分组
|
||||
cache: any;
|
||||
configOutPutName: string;
|
||||
config: IBundleConfig; // 该 bundle 的资源清单
|
||||
readonly isZip: boolean; // 该 bundle 是否是 zip 模式
|
||||
zipVer: string; // Zip 压缩模式,压缩包的版本
|
||||
atlasRes: IAtlasResult;
|
||||
_rootAssets: Set<UUID>; // 该 bundle 直接包含的资源
|
||||
_scenes: Set<UUID>;
|
||||
_scripts: Set<UUID>;
|
||||
_assets: Set<UUID>;
|
||||
|
||||
addScene(scene: IAssetInfo): void;
|
||||
addScript(script: IAssetInfo): void;
|
||||
addRootAsset(asset: IAssetInfo): void;
|
||||
addAsset(asset: IAssetInfo): void;
|
||||
removeAsset(asset: UUID): void;
|
||||
addRedirectWithUuid(asset: UUID, redirect: string): void;
|
||||
addRedirect(asset: IAssetInfo, redirect: string): void;
|
||||
addAssetWithUuid(asset: UUID): void;
|
||||
getRedirect(uuid: UUID): string | undefined;
|
||||
addGroup(type: IJSONGroupType, uuids: UUID[]): void;
|
||||
addToGroup(type: IJSONGroupType, uuid: UUID): void;
|
||||
removeFromGroups(uuid: UUID): void;
|
||||
getJsonPath(uuid: string): string;
|
||||
getAssetPathInfo(uuid: string): IAssetPathInfo | null;
|
||||
containsAsset(uuid: string): boolean;
|
||||
getRawAssetPaths(uuid: string): string[];
|
||||
getJsonPathInfo(uuid: string): IJsonPathInfo | null;
|
||||
|
||||
_resolveImportPath: (name: string) => string;
|
||||
_resolveNativePath: (libraryPath: string, extName: string) => string;
|
||||
}
|
||||
|
||||
export type ICompressImageResult = Record<UUID, {
|
||||
formats: string[],
|
||||
files: string[],
|
||||
}>;
|
||||
|
||||
export interface IGroup {
|
||||
// 分组名字
|
||||
name?: string;
|
||||
// 分组类型
|
||||
type: IJSONGroupType;
|
||||
// 该组中的资源 uuid 列表
|
||||
uuids: UUID[];
|
||||
}
|
||||
|
||||
export type IJSONGroupType = 'NORMAL' | 'TEXTURE' | 'IMAGE';
|
||||
|
||||
export interface IDefaultGroup {
|
||||
assetUuids: UUID[];
|
||||
scriptUuids: UUID[];
|
||||
jsonUuids: UUID[];
|
||||
}
|
||||
|
||||
export interface IBundleOptions {
|
||||
root: string, // bundle 的根目录, 开发者勾选的目录,如果是 main 包,这个字段为''
|
||||
dest: string, // bundle 的输出目录
|
||||
scriptDest: string, // 脚本的输出目录
|
||||
name: string, // bundle 的名称
|
||||
priority: number, // bundle 的优先级
|
||||
compressionType: BundleCompressionType, // bundle 的压缩类型
|
||||
isRemote: boolean // bundle 是否是远程包
|
||||
// isEncrypted: boolean // bundle 中的代码是否加密,原生平台使用
|
||||
}
|
||||
18
TurntableDemoV3/@types/packages/builder/@types/protect/global.d.ts
vendored
Normal file
18
TurntableDemoV3/@types/packages/builder/@types/protect/global.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IBuildPanel, IInternalBuild } from ".";
|
||||
|
||||
// 定义 builder 进程内的全局变量
|
||||
declare global {
|
||||
// 构建进程可用
|
||||
// @ts-ignore
|
||||
const Build: IInternalBuild;
|
||||
|
||||
const __manager: {
|
||||
taskManager: any;
|
||||
currentCompileTask: any;
|
||||
currentBuildTask: any;
|
||||
__taskId: string;
|
||||
};
|
||||
|
||||
// 渲染进程可用
|
||||
const BuildPanel: IBuildPanel;
|
||||
}
|
||||
7
TurntableDemoV3/@types/packages/builder/@types/protect/import-map.d.ts
vendored
Normal file
7
TurntableDemoV3/@types/packages/builder/@types/protect/import-map.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
export interface ImportMap {
|
||||
imports?: Record<string, string>;
|
||||
scopes?: Record<string, Record<string, string>>;
|
||||
}
|
||||
|
||||
export type ImportMapWithImports = ImportMap & { imports: NonNullable<ImportMap['imports']> };
|
||||
89
TurntableDemoV3/@types/packages/builder/@types/protect/index.d.ts
vendored
Normal file
89
TurntableDemoV3/@types/packages/builder/@types/protect/index.d.ts
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import { IBuild, IBuildUtils, ITaskState } from '../public';
|
||||
import { InternalBuildResult } from './build-result';
|
||||
|
||||
export * from './asset-manager';
|
||||
export * from './import-map';
|
||||
export * from './options';
|
||||
export * from './build-result';
|
||||
export * from './build-plugin';
|
||||
export * from '../public';
|
||||
|
||||
export type Physics = 'cannon' | 'ammo' | 'builtin';
|
||||
export type Url = string; // 需要的是符合 url 标准的字符串
|
||||
export type AssetInfoArr = Array<string | number>; // 固定两位或三位数组 [url,ccType,isSubAsset]
|
||||
export type IProcessingFunc = (process: number, message: string, state?: ITaskState) => void;
|
||||
export interface IBuildManager {
|
||||
taskManager: any;
|
||||
currentCompileTask: any;
|
||||
currentBuildTask: any;
|
||||
__taskId: string;
|
||||
}
|
||||
|
||||
export interface IQuickSpawnOption {
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
downGradeWaring?: boolean; // 将会转为 log 打印,默认为 false
|
||||
downGradeLog?: boolean; // 将会转为 debug 打印,默认为 true
|
||||
downGradeError?: boolean; // 将会转为警告,默认为 false
|
||||
ignoreLog?: boolean; // 忽略 log 信息
|
||||
}
|
||||
export interface IInternalBuildUtils extends IBuildUtils {
|
||||
/**
|
||||
* 获取构建出的所有模块或者模块包文件。
|
||||
*/
|
||||
getModuleFiles(result: InternalBuildResult): Promise<string[]>;
|
||||
|
||||
/**
|
||||
* 快速开启子进程
|
||||
* @param command
|
||||
* @param cmdParams
|
||||
* @param options
|
||||
*/
|
||||
quickSpawn(command: string, cmdParams: string[], options?: IQuickSpawnOption): Promise<number | boolean>;
|
||||
|
||||
/**
|
||||
* 将某个 hash 值添加到某个路径上
|
||||
* @param targetPath
|
||||
* @param hash
|
||||
* @returns
|
||||
*/
|
||||
patchMd5ToPath(targetPath: string, hash: string): string;
|
||||
}
|
||||
|
||||
export interface IInternalBuild extends IBuild {
|
||||
Utils: IInternalBuildUtils;
|
||||
}
|
||||
|
||||
export interface IBuildProcessInfo {
|
||||
state: ITaskState; // 任务状态
|
||||
progress: number; // 任务进度
|
||||
message: string; // 最后一次更新的进度消息
|
||||
id: string; // 任务唯一标识符
|
||||
options: any; // 构建参数
|
||||
}
|
||||
|
||||
export interface fileMap {
|
||||
src: string;
|
||||
dest: string;
|
||||
}
|
||||
|
||||
export interface IScriptInfo {
|
||||
file: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
type ICheckRule = 'pathExist' | 'valid' | 'required' | 'normalName' | 'noChinese' | 'array' | 'string' | 'number' | 'http';
|
||||
|
||||
export interface IBuildPanel {
|
||||
// 内部使用的 Vue
|
||||
Vue: any;
|
||||
// 内置 vue 组件
|
||||
vueComps: {
|
||||
buildProp: any;
|
||||
templateComp: any;
|
||||
},
|
||||
validator: {
|
||||
has: (ruleName: string) => boolean;
|
||||
check: (ruleName: ICheckRule, val: any) => boolean;
|
||||
},
|
||||
}
|
||||
145
TurntableDemoV3/@types/packages/builder/@types/protect/options.d.ts
vendored
Normal file
145
TurntableDemoV3/@types/packages/builder/@types/protect/options.d.ts
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
import { IBuildTimeConstantValue } from "@cocos/build-engine/dist/build-time-constants";
|
||||
import { IBuildDesignResolution, IBuildTaskOption } from "../public";
|
||||
|
||||
export interface ScriptAssetuserData {
|
||||
isPlugin?: boolean;
|
||||
isNative?: boolean;
|
||||
loadPluginInNative?: boolean;
|
||||
loadPluginInWeb?: boolean;
|
||||
}
|
||||
|
||||
export interface IBuildScriptParam {
|
||||
/**
|
||||
* 若存在,表示将 import map 转换为指定的模块格式。
|
||||
*/
|
||||
importMapFormat?: 'commonjs' | 'esm';
|
||||
|
||||
polyfills?: IPolyFills;
|
||||
|
||||
/**
|
||||
* 擦除模块结构。当选择后会获得更快的脚本导入速度,但无法再使用模块特性,如 `import.meta`、`import()` 等。
|
||||
* @experimental
|
||||
*/
|
||||
experimentalEraseModules?: boolean;
|
||||
outputName: string; // 输出文件夹名称(带后缀)
|
||||
targets?: ITransformTarget;
|
||||
|
||||
system?: {
|
||||
preset?: 'web' | 'commonjs-like',
|
||||
},
|
||||
|
||||
flags: Record<string, IBuildTimeConstantValue>,
|
||||
}
|
||||
|
||||
export interface IPolyFills {
|
||||
/**
|
||||
* True if async functions polyfills(i.e. regeneratorRuntime) needs to be included.
|
||||
* You need to turn on this field if you want to use async functions in language.
|
||||
*/
|
||||
asyncFunctions?: boolean;
|
||||
|
||||
/**
|
||||
* If true, [core-js](https://github.com/zloirock/core-js) polyfills are included.
|
||||
* The default options of [core-js-builder](https://github.com/zloirock/core-js/tree/master/packages/core-js-builder)
|
||||
* will be used to build the core-js.
|
||||
*/
|
||||
coreJs?: boolean;
|
||||
|
||||
targets?: string;
|
||||
}
|
||||
/**
|
||||
* 模块保留选项。
|
||||
* - 'erase' 擦除模块信息。生成的代码中将不会保留模块信息。
|
||||
* - 'preserve' 保留原始模块信息。生成的文件将和原始模块文件结构一致。
|
||||
* - 'facade' 保留原始模块信息,将所有模块转化为一个 SystemJS 模块,但这些模块都打包在一个单独的 IIFE bundle 模块中。
|
||||
* 当这个 bundle 模块执行时,所有模块都会被注册。
|
||||
* 当你希望代码中仍旧使用模块化的特性(如动态导入、import.meta.url),但又不希望模块零散在多个文件时可以使用这个选项。
|
||||
*/
|
||||
export type ModulePreservation = 'erase' | 'preserve' | 'facade';
|
||||
|
||||
export type INewConsoleType = 'log' | 'warn' | 'error' | 'debug';
|
||||
|
||||
export interface IInternalBuildOptions extends IBuildTaskOption {
|
||||
dest: string;
|
||||
// 编译 application.js 参数配置
|
||||
appTemplateData: appTemplateData;
|
||||
// 编译引擎参数配置
|
||||
buildEngineParam: IBuildEngineParam;
|
||||
// 编译脚本配置选项
|
||||
buildScriptParam: IBuildScriptParam;
|
||||
// 序列化打包资源时的特殊处理
|
||||
assetSerializeOptions: {
|
||||
'cc.EffectAsset': {
|
||||
glsl1: boolean;
|
||||
glsl3: boolean;
|
||||
glsl4: boolean;
|
||||
};
|
||||
// 是否输出 ccon 格式
|
||||
exportCCON?: boolean;
|
||||
|
||||
allowCCONExtension?: boolean;
|
||||
};
|
||||
updateOnly: boolean;
|
||||
nextTasks?: string[];
|
||||
generateCompileConfig?: boolean;
|
||||
recompileConfig?: IRecompileConfig;
|
||||
logDest?: string; // log 输出地址
|
||||
|
||||
// 项目设置,重复定义为必选参数
|
||||
includeModules: string[];
|
||||
renderPipeline: string;
|
||||
designResolution: IBuildDesignResolution;
|
||||
physicsConfig: any;
|
||||
flags: Record<string, boolean>;
|
||||
}
|
||||
|
||||
|
||||
export interface appTemplateData {
|
||||
debugMode: boolean;
|
||||
renderMode: boolean; // !!options.renderMode,
|
||||
// ImportMapSupported: boolean;
|
||||
// NonconformingCommonJs: boolean;
|
||||
showFPS: boolean;
|
||||
importMapFile?: string;
|
||||
resolution: {
|
||||
policy: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
// hasPhysicsAmmo: boolean;
|
||||
md5Cache: boolean;
|
||||
server: string; // 服务器地址
|
||||
|
||||
cocosTemplate?: string; // 注入的子模板路径
|
||||
}
|
||||
|
||||
export interface IBuildEngineParam {
|
||||
entry?: string; // 引擎入口文件
|
||||
debug: boolean;
|
||||
sourceMaps: boolean;
|
||||
platform: string;
|
||||
includeModules: string[];
|
||||
engineVersion: string;
|
||||
md5Map: string[];
|
||||
engineName: string;
|
||||
useCache: boolean;
|
||||
split?: boolean;
|
||||
targets?: ITransformTarget;
|
||||
skip?: boolean;
|
||||
ammoJsWasm?: boolean | 'fallback';
|
||||
assetURLFormat?:
|
||||
| 'relative-from-out'
|
||||
| 'relative-from-chunk'
|
||||
| 'runtime-resolved';
|
||||
baseUrl?: string;
|
||||
}
|
||||
|
||||
export type ITransformTarget = string | string[] | Record<string, string>;
|
||||
|
||||
export interface IRecompileConfig {
|
||||
enable: boolean;
|
||||
generateAssets: boolean;
|
||||
generateScripts: boolean;
|
||||
generateEngine: boolean; // 是否生成引擎
|
||||
generateEngineByCache: boolean; // 是否使用缓存引擎
|
||||
}
|
||||
76
TurntableDemoV3/@types/packages/builder/@types/public/build-plugin.d.ts
vendored
Normal file
76
TurntableDemoV3/@types/packages/builder/@types/public/build-plugin.d.ts
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import { ITextureCompressType, IPVRQuality, IASTCQuality, IETCQuality } from './texture-compress';
|
||||
import { IBuildTaskOption } from './options';
|
||||
import { IBuildResult } from './build-result';
|
||||
|
||||
export interface IBuildPluginConfig {
|
||||
hooks?: string; // relate url about IHook
|
||||
options?: IDisplayOptions; // config of options
|
||||
verifyRuleMap?: IVerificationRuleMap;
|
||||
}
|
||||
|
||||
export type IVerificationFunc = (val: any, ...arg: any[]) => boolean | Promise<boolean>;
|
||||
|
||||
export type IVerificationRuleMap = Record<
|
||||
string,
|
||||
{
|
||||
func?: IVerificationFunc;
|
||||
message?: string;
|
||||
}
|
||||
>;
|
||||
|
||||
export type IDisplayOptions = Record<string, IConfigItem>;
|
||||
|
||||
export type ArrayItem = {
|
||||
label: string;
|
||||
value: string;
|
||||
};
|
||||
export interface IConfigItem {
|
||||
// 配置显示的名字,如果需要翻译,则传入 i18n:${key}
|
||||
label?: string;
|
||||
// 设置的简单说明
|
||||
description?: string;
|
||||
// 默认值
|
||||
default?: any;
|
||||
// 配置的类型
|
||||
type?: 'array' | 'object';
|
||||
itemConfigs?: IConfigItem[] | Record<string, IConfigItem>;
|
||||
verifyRules?: string[];
|
||||
attributes?: any;
|
||||
render?: {
|
||||
ui: string;
|
||||
attributes?: any;
|
||||
items?: ArrayItem[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface IBuildPlugin {
|
||||
configs?: BuildPlugin.Configs;
|
||||
assetHandlers?: BuildPlugin.AssetHandlers;
|
||||
load?: BuildPlugin.load;
|
||||
unload?: BuildPlugin.Unload;
|
||||
}
|
||||
export type IBaseHooks = (options: IBuildTaskOption, result: IBuildResult) => Promise<void> | void;
|
||||
|
||||
export namespace BuildPlugin {
|
||||
export type Configs = Record<string, IBuildPluginConfig>;
|
||||
export type AssetHandlers = string;
|
||||
export type load = () => Promise<void> | void;
|
||||
export type Unload = () => Promise<void> | void;
|
||||
}
|
||||
|
||||
export namespace BuildHook {
|
||||
export type throwError = boolean; // 插件注入的钩子函数,在执行失败时是否直接退出构建流程
|
||||
export type title = string; // 插件任务整体 title,支持 i18n 写法
|
||||
export type onBeforeBuild = IBaseHooks;
|
||||
export type onBeforeCompressSettings = IBaseHooks;
|
||||
export type onAfterCompressSettings = IBaseHooks;
|
||||
export type onAfterBuild = IBaseHooks;
|
||||
export type load = () => Promise<void> | void;
|
||||
export type unload = () => Promise<void> | void;
|
||||
}
|
||||
|
||||
export namespace AssetHandlers {
|
||||
export type compressTextures = (
|
||||
tasks: { src: string; dest: string; quality: number | IPVRQuality | IASTCQuality | IETCQuality; format: ITextureCompressType }[],
|
||||
) => Promise<void>;
|
||||
}
|
||||
189
TurntableDemoV3/@types/packages/builder/@types/public/build-result.d.ts
vendored
Normal file
189
TurntableDemoV3/@types/packages/builder/@types/public/build-result.d.ts
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
* settings.js 里定义的数据
|
||||
*/
|
||||
|
||||
import { ISplashSetting, ICustomJointTextureLayout, UUID } from "./options";
|
||||
|
||||
// ****************************** settings ************************************************
|
||||
|
||||
// debug: true
|
||||
// designResolution: {width: "960", height: "640", policy: 4}
|
||||
// jsList: ["assets/resources/b.js", "assets/resources/a.js"]
|
||||
// launchScene: "db://assets/New Scene-001.scene"
|
||||
// platform: "web-desktop"
|
||||
// rawAssets: {
|
||||
// assets: {
|
||||
// "0e95a9f8-d4e7-4849-875a-7a11dd692b34": ["mesh/env/gltf/textures/birch_yellow_mat_baseColor.png", "cc.ImageAsset"]
|
||||
// }
|
||||
// internal: {
|
||||
// "1baf0fc9-befa-459c-8bdd-af1a450a0319": ["effects/builtin-standard.effect", "cc.EffectAsset"]
|
||||
// }
|
||||
// }
|
||||
// scenes: [{url: "db://assets/New Scene-001.scene", uuid: "69dc4a42-cc6c-49fb-9a57-7de0c212f83d"},…]
|
||||
// startScene: "current_scene"
|
||||
export interface ISettings {
|
||||
CocosEngine: string;
|
||||
debug: boolean;
|
||||
designResolution: ISettingsDesignResolution;
|
||||
jsList: string[];
|
||||
launchScene: string;
|
||||
moduleIds: string[];
|
||||
platform: string;
|
||||
renderPipeline: string;
|
||||
physics?: IPhysicsConfig;
|
||||
exactFitScreen: boolean;
|
||||
|
||||
bundleVers: Record<string, string>;
|
||||
subpackages: string[];
|
||||
remoteBundles: string[];
|
||||
server: string;
|
||||
hasResourcesBundle: boolean;
|
||||
hasStartSceneBundle: boolean;
|
||||
|
||||
scriptPackages?: string[];
|
||||
splashScreen?: ISplashSetting;
|
||||
|
||||
customJointTextureLayouts?: ICustomJointTextureLayout[];
|
||||
|
||||
importMaps?: Array<{
|
||||
url: string;
|
||||
map: any;
|
||||
}>;
|
||||
|
||||
macros?: Record<string, any>;
|
||||
collisionMatrix?: any;
|
||||
groupList?: any;
|
||||
// preview
|
||||
engineModules: string[];
|
||||
customLayers: {name: string, bit: number}[];
|
||||
}
|
||||
|
||||
// 物理配置
|
||||
export interface IVec3Like {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface ICollisionMatrix {
|
||||
[x: string]: number;
|
||||
}
|
||||
|
||||
export interface IPhysicsMaterial {
|
||||
friction: number; // 0.5
|
||||
rollingFriction: number; // 0.1
|
||||
spinningFriction: number; // 0.1
|
||||
restitution: number; // 0.1
|
||||
}
|
||||
|
||||
export interface IPhysicsConfig {
|
||||
gravity: IVec3Like; // (0,-10, 0)
|
||||
allowSleep: boolean; // true
|
||||
sleepThreshold: number; // 0.1,最小 0
|
||||
autoSimulation: boolean; // true
|
||||
fixedTimeStep: number; // 1 / 60 ,最小 0
|
||||
maxSubSteps: number; // 1,最小 0
|
||||
defaultMaterial: IPhysicsMaterial;
|
||||
useNodeChains: boolean; // true
|
||||
collisionMatrix: ICollisionMatrix;
|
||||
physicsEngine: string;
|
||||
}
|
||||
|
||||
export interface IPackageInfo {
|
||||
name: string;
|
||||
path: string;
|
||||
uuids: UUID[];
|
||||
}
|
||||
|
||||
export interface ISettingsDesignResolution {
|
||||
width: number;
|
||||
height: number;
|
||||
policy: number;
|
||||
}
|
||||
|
||||
interface IAssetPathBase {
|
||||
bundleName?: string;
|
||||
redirect?: string; // 重定向的 bundle 包名
|
||||
}
|
||||
|
||||
export interface IRawAssetPathInfo extends IAssetPathBase {
|
||||
raw: string[];
|
||||
}
|
||||
export declare interface IAssetPathInfo extends IAssetPathBase {
|
||||
raw?: string[];
|
||||
json?: string;
|
||||
groupIndex?: number;
|
||||
}
|
||||
|
||||
export interface IJsonPathInfo extends IAssetPathBase {
|
||||
json?: string;
|
||||
groupIndex?: number;
|
||||
}
|
||||
|
||||
export interface IBuildPaths {
|
||||
dir: string; // 构建资源输出地址( assets 所在的目录,并不一定与构建目录对应)
|
||||
settings: string; // settings.json 输出地址
|
||||
systemJs?: string; // system.js 生成地址
|
||||
engineDir?: string; // 引擎生成地址
|
||||
polyfillsJs?: string; // polyfill.js 生成地址
|
||||
assets: string; // assets 目录
|
||||
subpackages: string; // subpackages 目录
|
||||
remote: string; // remote 目录
|
||||
bundleScripts: string // bundle 的脚本,某些平台无法下载脚本,则将远程包中的脚本移到本地
|
||||
applicationJS: string; // application.js 的生成地址
|
||||
compileConfig?: string; // cocos.compile.config.json
|
||||
importMap: string; // import-map 文件地址
|
||||
}
|
||||
|
||||
export declare class IBuildResult {
|
||||
dest: string; // options 指定的构建目录
|
||||
|
||||
paths: IBuildPaths; // 构建后资源相关地址集合
|
||||
|
||||
settings?: ISettings;
|
||||
|
||||
/**
|
||||
* 指定的 uuid 资源是否包含在构建资源中
|
||||
*/
|
||||
containsAsset: (uuid: string) => boolean;
|
||||
|
||||
/**
|
||||
* 获取指定 uuid 原始资源的存放路径(不包括序列化 json)
|
||||
* 自动图集的小图 uuid 和自动图集的 uuid 都将会查询到合图大图的生成路径
|
||||
* 实际返回多个路径的情况:查询 uuid 为自动图集资源,且对应图集生成多张大图,纹理压缩会有多个图片格式路径
|
||||
*/
|
||||
getRawAssetPaths: (uuid: string) => IRawAssetPathInfo[];
|
||||
|
||||
/**
|
||||
* 获取指定 uuid 资源的序列化 json 路径
|
||||
*/
|
||||
getJsonPathInfo: (uuid: string) => IJsonPathInfo[];
|
||||
|
||||
/**
|
||||
* 获取指定 uuid 资源的路径相关信息
|
||||
* @return {raw?: string[]; json?: string; groupIndex?: number;}
|
||||
* @return.raw: 该资源源文件的实际存储位置
|
||||
* @return.json: 该资源序列化 json 的实际存储位置,不存在为空
|
||||
* @return.groupIndex: 若该资源的序列化 json 在某个 json 分组内,这里标识在分组内的 index,不存在为空
|
||||
*/
|
||||
getAssetPathInfo: (uuid: string) => IAssetPathInfo[];
|
||||
}
|
||||
|
||||
export interface IBundleConfig {
|
||||
importBase: string; // bundle 中 import 目录的名称,通常是 'import'
|
||||
nativeBase: string; // native 中 native 目录的名称,通常是 'native'
|
||||
name: string; // bundle 的名称,可以通过 bundle 名称加载 bundle
|
||||
deps: string[]; // 该 bundle 依赖的其他 bundle 名称
|
||||
uuids: UUID[]; // 该 bundle 中的所有资源的 uuid
|
||||
paths: Record<string, any[]>; // 该 bundle 中可以通过路径加载的资源,参考以前 settings 中 rawAssets 的定义
|
||||
scenes: Record<string, UUID|number>; // 该 bundle 中所有场景,场景名为 key, uuid 为 value
|
||||
packs: Record<UUID, UUID[]>; // 该 bundle 中所有合并的 json, 参考以前 settings 中 packedAssets 的定义
|
||||
versions: { import: Array<string|number>, native: Array<string|number> }; // 该 bundle 中所有资源的版本号,参考以前 settings 中 md5AssetsMap 的定义
|
||||
redirect: Array<string|number>; // 该 bundle 中重定向到其他 bundle 的资源
|
||||
debug: boolean; // 是否是 debug 模式,debug 模式会对 config.json 的数据进行压缩,所以运行时得解压
|
||||
types?: string[]; // paths 中的类型数组,参考以前 settings 中 assetTypes 的定义
|
||||
encrypted?: boolean; // 原生上使用,标记该 bundle 中的脚本是否加密
|
||||
isZip?: boolean; // 是否是 zip 模式
|
||||
zipVersion?: string;
|
||||
extensionMap: Record<string, UUID[]>
|
||||
}
|
||||
7
TurntableDemoV3/@types/packages/builder/@types/public/global.d.ts
vendored
Normal file
7
TurntableDemoV3/@types/packages/builder/@types/public/global.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { IBuild } from ".";
|
||||
|
||||
// 定义 builder 进程内的全局变量
|
||||
declare global {
|
||||
// @ts-ignore
|
||||
const Build: IBuild;
|
||||
}
|
||||
100
TurntableDemoV3/@types/packages/builder/@types/public/index.d.ts
vendored
Normal file
100
TurntableDemoV3/@types/packages/builder/@types/public/index.d.ts
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import { ITransformOptions } from './options';
|
||||
|
||||
export * from './build-result';
|
||||
export * from './build-plugin';
|
||||
export * from './texture-compress';
|
||||
export * from './options';
|
||||
|
||||
interface IAppendRes {
|
||||
hash: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
interface ICreateBundleOptions {
|
||||
excludes?: string[];
|
||||
debug?: boolean;
|
||||
sourceMap?: boolean;
|
||||
}
|
||||
export interface IBuildUtils {
|
||||
/**
|
||||
* 压缩 uuid
|
||||
* 'fc991dd7-0033-4b80-9d41-c8a86a702e59' -> 'fc9913XADNLgJ1ByKhqcC5Z'
|
||||
*/
|
||||
compressUuid: (uuid: string, min: boolean) => string;
|
||||
|
||||
/**
|
||||
* 解压缩 uuid
|
||||
* 'fc9913XADNLgJ1ByKhqcC5Z' -> 'fc991dd7-0033-4b80-9d41-c8a86a702e59'
|
||||
*/
|
||||
decompressUuid: (uuid: string) => string;
|
||||
|
||||
/**
|
||||
* 翻译带有 i18n 开头的名称(i18n:test)(待定)
|
||||
* 'i18n:test' -> '测试'
|
||||
*/
|
||||
transI18nName: (name: string) => string;
|
||||
|
||||
/**
|
||||
* 移除 db 前缀
|
||||
* 'db://assets/test.jpg' -> 'assets/test.jpg'
|
||||
*/
|
||||
removeDbHeader: (url: string) => string;
|
||||
|
||||
/**
|
||||
* 将 db 开头的 url 转为项目里的实际 url
|
||||
* 'db://assets/test.jpg' -> 'c:/project/assets/test.jpg'
|
||||
*/
|
||||
dbUrlToRawPath: (url: string) => string;
|
||||
|
||||
/**
|
||||
* 从路径里获取存在的 uuid
|
||||
* 'E:\test3d\library\oc\0c0c1f5742-89b0-4a1e-b5eb-914d84f48c1c.json' -> '0c0c1f5742-89b0-4a1e-b5eb-914d84f48c1c'
|
||||
*/
|
||||
getUuidFromPath: (path: string) => string;
|
||||
|
||||
/**
|
||||
* 检查是否全局安装了 nodejs
|
||||
*/
|
||||
isInstallNodeJs: () => Promise<boolean>;
|
||||
|
||||
/**
|
||||
* 逐文件拷贝
|
||||
*/
|
||||
copyDirSync: (src: string, dest: string) => void;
|
||||
|
||||
/**
|
||||
* 获取相对路径接口
|
||||
* 返回 / 拼接的相对路径
|
||||
*/
|
||||
relativeUrl: (from: string, to: string) => string;
|
||||
|
||||
transformCode: (code: string, options: ITransformOptions) => Promise<string>;
|
||||
|
||||
/**
|
||||
* 给指定路径添加 md5
|
||||
*/
|
||||
appendMd5ToPaths: (paths: string[]) => Promise<IAppendRes | null>;
|
||||
|
||||
calcMd5: (data: Buffer | string) => string;
|
||||
|
||||
copyPaths: (paths: { src: string; dest: string }[]) => Promise<void[]>;
|
||||
|
||||
createBundle: (src: string, dest: string, options?: ICreateBundleOptions) => Promise<unknown>;
|
||||
}
|
||||
export interface IBuild {
|
||||
Utils: IBuildUtils;
|
||||
|
||||
LIBRARY_NAME: string;
|
||||
IMPORT_HEADER: string;
|
||||
NATIVE_HEADER: string;
|
||||
ASSETS_HEADER: string;
|
||||
SUBPACKAGES_HEADER: string;
|
||||
REMOTE_HEADER: string;
|
||||
BUNDLE_SCRIPTS_HEADER: string;
|
||||
SCRIPT_NAME: string;
|
||||
CONFIG_NAME: string;
|
||||
BUNDLE_ZIP_NAME: string;
|
||||
projectTempDir: string;
|
||||
globalTempDir: string;
|
||||
buildTemplateDir: string; // 构建模板地址 build-templates
|
||||
}
|
||||
40
TurntableDemoV3/@types/packages/builder/@types/public/message.d.ts
vendored
Normal file
40
TurntableDemoV3/@types/packages/builder/@types/public/message.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { IBundleConfig, ISettings } from "./build-result";
|
||||
import { ITaskItemJSON } from "./options";
|
||||
export interface message extends EditorMessageMap {
|
||||
'open-devtools': {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
open: {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
'generate-preview-setting': {
|
||||
params: any[],
|
||||
result: Promise<{
|
||||
settings: ISettings;
|
||||
script2library: Record<string, string>;
|
||||
bundleConfigs: IBundleConfig[];
|
||||
}>,
|
||||
},
|
||||
'query-tasks-info': {
|
||||
params: [],
|
||||
result: {
|
||||
queue: Record<string, ITaskItemJSON>,
|
||||
free: Promise<boolean>,
|
||||
},
|
||||
},
|
||||
'query-task': {
|
||||
params: string[],
|
||||
result: Promise<ITaskItemJSON>,
|
||||
},
|
||||
/**
|
||||
* 预览合图
|
||||
* @param {object} pacUuid
|
||||
*/
|
||||
'preview-pac': {
|
||||
params: string[],
|
||||
result: Promise<ITaskItemJSON>,
|
||||
},
|
||||
|
||||
}
|
||||
132
TurntableDemoV3/@types/packages/builder/@types/public/options.d.ts
vendored
Normal file
132
TurntableDemoV3/@types/packages/builder/@types/public/options.d.ts
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* 构建所需的完整参数
|
||||
*/
|
||||
export interface IBuildTaskOption {
|
||||
// 构建后的游戏文件夹生成的路径
|
||||
buildPath: string;
|
||||
debug: boolean;
|
||||
inlineSpriteFrames: boolean;
|
||||
md5Cache: boolean;
|
||||
// bundle 设置
|
||||
mainBundleCompressionType: BundleCompressionType;
|
||||
mainBundleIsRemote: boolean;
|
||||
moveRemoteBundleScript: boolean;
|
||||
mergeJson: boolean;
|
||||
name: string;
|
||||
packAutoAtlas: boolean;
|
||||
platform: Platform;
|
||||
scenes: IBuildSceneItem[];
|
||||
compressTexture: boolean;
|
||||
sourceMaps: boolean;
|
||||
startScene: string;
|
||||
outputName: string;
|
||||
experimentalEraseModules: boolean;
|
||||
|
||||
/**
|
||||
* 是否是预览进程发送的构建请求。
|
||||
* @default false
|
||||
*/
|
||||
preview?: boolean;
|
||||
|
||||
// 项目设置
|
||||
includeModules?: string[];
|
||||
renderPipeline?: string;
|
||||
designResolution?: IBuildDesignResolution;
|
||||
physicsConfig?: any;
|
||||
flags?: Record<string, boolean>;
|
||||
|
||||
|
||||
// 是否使用自定义插屏选项
|
||||
replaceSplashScreen?: boolean;
|
||||
splashScreen: ISplashSetting;
|
||||
|
||||
packages?: Record<string, any>;
|
||||
id?: string; // 手动配置构建任务 id
|
||||
// recompileConfig?: IRecompileConfig;
|
||||
|
||||
customLayers: {name: string, value: number}[];
|
||||
}
|
||||
|
||||
export type UUID = string;
|
||||
|
||||
export interface ISplashSetting {
|
||||
base64src: string;
|
||||
displayRatio: number;
|
||||
totalTime: number;
|
||||
effect: string;
|
||||
clearColor: { x: number; y: number; z: number; w: number };
|
||||
displayWatermark: boolean;
|
||||
}
|
||||
|
||||
export interface ICustomJointTextureLayout {
|
||||
textureLength: number;
|
||||
contents: IChunkContent[];
|
||||
}
|
||||
|
||||
export interface IChunkContent {
|
||||
skeleton: null | string;
|
||||
clips: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建使用的设计分辨率数据
|
||||
*/
|
||||
export interface IBuildDesignResolution {
|
||||
height: number;
|
||||
width: number;
|
||||
fitWidth?: boolean;
|
||||
fitHeight?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建使用的场景的数据
|
||||
*/
|
||||
export interface IBuildSceneItem {
|
||||
url: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
// **************************** options *******************************************
|
||||
export type Platform =
|
||||
| 'web-desktop'
|
||||
| 'web-mobile'
|
||||
| 'wechatgame'
|
||||
| 'oppo-mini-game'
|
||||
| 'vivo-mini-game'
|
||||
| 'huawei-quick-game'
|
||||
| 'alipay-mini-game'
|
||||
| 'mac'
|
||||
| 'ios'
|
||||
// | 'ios-app-clip'
|
||||
| 'android'
|
||||
| 'ohos'
|
||||
| 'windows'
|
||||
| 'xiaomi-quick-game'
|
||||
| 'baidu-mini-game'
|
||||
| 'bytedance-mini-game'
|
||||
| 'cocos-play'
|
||||
| 'huawei-agc'
|
||||
| 'link-sure'
|
||||
| 'qtt'
|
||||
| 'cocos-runtime'
|
||||
;
|
||||
|
||||
export type BundleCompressionType = 'none' | 'merge_dep' | 'merge_all_json' | 'subpackage' | 'zip';
|
||||
export type IModules = 'esm' | 'commonjs' | 'systemjs';
|
||||
|
||||
export interface ITransformOptions {
|
||||
importMapFormat: IModules;
|
||||
}
|
||||
|
||||
export type ITaskState = 'waiting' | 'success' | 'failure' | 'cancel' | 'processing';
|
||||
|
||||
export interface ITaskItemJSON {
|
||||
id: string;
|
||||
progress: number;
|
||||
state: ITaskState;
|
||||
message: string;
|
||||
options: IBuildTaskOption;
|
||||
time: string;
|
||||
dirty: boolean;
|
||||
rawOptions: IBuildTaskOption;
|
||||
}
|
||||
43
TurntableDemoV3/@types/packages/builder/@types/public/texture-compress.d.ts
vendored
Normal file
43
TurntableDemoV3/@types/packages/builder/@types/public/texture-compress.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
export type ITextureCompressType =
|
||||
| 'jpg'
|
||||
| 'png'
|
||||
| 'webp'
|
||||
| 'pvrtc_4bits_rgb'
|
||||
| 'pvrtc_4bits_rgba'
|
||||
| 'pvrtc_4bits_rgb_a'
|
||||
| 'pvrtc_2bits_rgb'
|
||||
| 'pvrtc_2bits_rgba'
|
||||
| 'pvrtc_2bits_rgb_a'
|
||||
| 'etc1_rgb'
|
||||
| 'etc1_rgb_a'
|
||||
| 'etc2_rgb'
|
||||
| 'etc2_rgba'
|
||||
| 'astc_4x4'
|
||||
| 'astc_5x5'
|
||||
| 'astc_6x6'
|
||||
| 'astc_8x8'
|
||||
| 'astc_10x5'
|
||||
| 'astc_10x10'
|
||||
| 'astc_12x12';
|
||||
export type ITextureCompressPlatform = 'miniGame' | 'web' | 'ios' | 'android';
|
||||
export type IQualityType = 'etc' | 'pvr' | 'number' | 'astc';
|
||||
export interface ITextureFormatInfo {
|
||||
displayName: string;
|
||||
qualityType: IQualityType;
|
||||
alpha?: boolean;
|
||||
}
|
||||
export interface ISupportFormat {
|
||||
rgb: ITextureCompressType[];
|
||||
rgba: ITextureCompressType[];
|
||||
}
|
||||
export interface IConfigGroupsInfo {
|
||||
defaultSupport?: ISupportFormat,
|
||||
support: ISupportFormat,
|
||||
displayName: string;
|
||||
icon: string;
|
||||
}
|
||||
export type IConfigGroups = Record<ITextureCompressPlatform, IConfigGroupsInfo>;
|
||||
|
||||
export type IPVRQuality = 'fastest' | 'fast' | 'normal' | 'high' | 'best';
|
||||
export type IETCQuality = 'slow' | 'fast';
|
||||
export type IASTCQuality = 'veryfast' | 'fast' | 'medium' | 'thorough' | 'exhaustive';
|
||||
16
TurntableDemoV3/@types/packages/console/@types/pritate.d.ts
vendored
Normal file
16
TurntableDemoV3/@types/packages/console/@types/pritate.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface IMessageItem {
|
||||
rows: number;
|
||||
translateY: number;
|
||||
show: boolean;
|
||||
title: string;
|
||||
content: string[];
|
||||
count: number;
|
||||
fold: boolean;
|
||||
type: string;
|
||||
message: any;
|
||||
texture: string;
|
||||
date?: number;
|
||||
time?: number;
|
||||
process?: string;
|
||||
stack: string[];
|
||||
}
|
||||
16
TurntableDemoV3/@types/packages/engine/@types/message.d.ts
vendored
Normal file
16
TurntableDemoV3/@types/packages/engine/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface message extends EditorMessageMap {
|
||||
'query-info': {
|
||||
params: [] | [
|
||||
string,
|
||||
],
|
||||
result: {
|
||||
type: string;
|
||||
version: string;
|
||||
path: string;
|
||||
nativeVersion: string; // 原生引擎类型 'custom' 'builtin'
|
||||
nativePath: string;
|
||||
editor: string;
|
||||
renderPipeline: string;
|
||||
},
|
||||
},
|
||||
}
|
||||
1
TurntableDemoV3/@types/packages/preview/@types/index.d.ts
vendored
Normal file
1
TurntableDemoV3/@types/packages/preview/@types/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './protect/';
|
||||
33
TurntableDemoV3/@types/packages/preview/@types/protect/index.d.ts
vendored
Normal file
33
TurntableDemoV3/@types/packages/preview/@types/protect/index.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Platform } from "../../../builder/@types/public";
|
||||
|
||||
export type IPreviewType = 'game-view' | 'simulator' | 'browser';
|
||||
|
||||
export type ISupportDataType = 'settings' | 'renderData';
|
||||
|
||||
export interface IHookConfig {
|
||||
methods: string;
|
||||
hook: string;
|
||||
}
|
||||
export interface IGenerateSettingsOptions {
|
||||
type: IPreviewType;
|
||||
startScene?: string;
|
||||
platform?: Platform;
|
||||
}
|
||||
|
||||
export interface IPreviewPluginConfig {
|
||||
methods?: string;
|
||||
hooks?: Record<string, string>;
|
||||
}
|
||||
|
||||
// 界面渲染配置
|
||||
export interface IRenderData {
|
||||
title: string; // 预览页面 title
|
||||
enableDebugger: boolean; // 是否开启 vConsole
|
||||
config: { // 预览页面菜单栏配置
|
||||
device: string; // 设备名称
|
||||
// https://github.com/cocos-creator/engine/blob/3d/cocos/core/platform/debug.ts
|
||||
debugMode: string; // cc.DebugMode 枚举名称
|
||||
showFps: boolean;
|
||||
fps: number;
|
||||
}
|
||||
}
|
||||
19
TurntableDemoV3/@types/packages/programming/@types/message.d.ts
vendored
Normal file
19
TurntableDemoV3/@types/packages/programming/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface message extends EditorMessageMap {
|
||||
'query-shared-settings': {
|
||||
params: [],
|
||||
result: {
|
||||
useDefineForClassFields: boolean;
|
||||
allowDeclareFields: boolean;
|
||||
loose: boolean;
|
||||
guessCommonJsExports: boolean;
|
||||
exportsConditions: string[];
|
||||
importMap?: {
|
||||
json: {
|
||||
imports?: Record<string, string>;
|
||||
scopes?: Record<string, Record<string, string>>;
|
||||
};
|
||||
url: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
68
TurntableDemoV3/@types/packages/scene/@types/message.d.ts
vendored
Normal file
68
TurntableDemoV3/@types/packages/scene/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import {
|
||||
SetPropertyOptions,
|
||||
} from './public';
|
||||
|
||||
export interface message extends EditorMessageMap {
|
||||
'update-create-node-template': {
|
||||
params: [],
|
||||
result: any,
|
||||
},
|
||||
'open': {
|
||||
params: [],
|
||||
result: any,
|
||||
},
|
||||
'open-devtools': {
|
||||
params: [],
|
||||
result: any,
|
||||
},
|
||||
'graphical-tools': {
|
||||
params: [
|
||||
boolean,
|
||||
],
|
||||
result: void,
|
||||
},
|
||||
'open-scene': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'save-scene': {
|
||||
params: [] | [
|
||||
boolean,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'save-as-scene': {
|
||||
params: [
|
||||
boolean,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'close-scene': {
|
||||
params: [],
|
||||
result: boolean,
|
||||
},
|
||||
'set-property': {
|
||||
params: [
|
||||
SetPropertyOptions,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'query-node-tree': {
|
||||
params: [] | [
|
||||
string,
|
||||
],
|
||||
result: any,
|
||||
},
|
||||
'execute-scene-script': {
|
||||
params: [] | [
|
||||
{
|
||||
name: string;
|
||||
method: string;
|
||||
args: any[];
|
||||
}
|
||||
],
|
||||
result: any,
|
||||
},
|
||||
}
|
||||
407
TurntableDemoV3/@types/packages/scene/@types/public.d.ts
vendored
Normal file
407
TurntableDemoV3/@types/packages/scene/@types/public.d.ts
vendored
Normal file
@@ -0,0 +1,407 @@
|
||||
// ---- 一些 engine 基础数据 ---- start
|
||||
interface Vec2 {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Vec3 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
interface Vec4 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
w: number;
|
||||
}
|
||||
|
||||
interface Quat {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
w: number;
|
||||
}
|
||||
|
||||
interface Color3 {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
}
|
||||
|
||||
interface Color4 {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
a: number;
|
||||
}
|
||||
|
||||
interface Mat3 {
|
||||
m00: number;
|
||||
m01: number;
|
||||
m02: number;
|
||||
|
||||
m03: number;
|
||||
m04: number;
|
||||
m05: number;
|
||||
|
||||
m06: number;
|
||||
m07: number;
|
||||
m08: number;
|
||||
}
|
||||
|
||||
interface Mat4 {
|
||||
m00: number;
|
||||
m01: number;
|
||||
m02: number;
|
||||
m03: number;
|
||||
|
||||
m04: number;
|
||||
m05: number;
|
||||
m06: number;
|
||||
m07: number;
|
||||
|
||||
m08: number;
|
||||
m09: number;
|
||||
m10: number;
|
||||
m11: number;
|
||||
|
||||
m12: number;
|
||||
m13: number;
|
||||
m14: number;
|
||||
m15: number;
|
||||
}
|
||||
// ---- 一些 engine 基础数据 ---- end
|
||||
|
||||
// ---- 操作消息的参数定义 --- strart
|
||||
|
||||
// set-property 消息的 options 定义
|
||||
export interface SetPropertyOptions {
|
||||
uuid: string; // 修改属性的对象的 uuid
|
||||
path: string; // 属性挂载对象的搜索路径
|
||||
// key: string; // 属性的 key
|
||||
dump: IProperty; // 属性 dump 出来的数据
|
||||
}
|
||||
|
||||
// move-array-element 消息的 options 定义
|
||||
export interface MoveArrayOptions {
|
||||
uuid: string;
|
||||
path: string;
|
||||
target: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
// remove-array-element 消息的 options 定义
|
||||
export interface RemoveArrayOptions {
|
||||
uuid: string;
|
||||
path: string;
|
||||
index: number;
|
||||
}
|
||||
|
||||
export interface PasteNodeOptions {
|
||||
target: string; // 目标节点
|
||||
uuids: string | string[]; // 被复制的节点 uuids
|
||||
keepWorldTransform?: boolean; // 是否保持新节点的世界坐标不变
|
||||
}
|
||||
|
||||
export interface CutNodeOptions {
|
||||
parent: string; // 父节点
|
||||
uuids: string | string[]; // 被移入的节点 uuids
|
||||
keepWorldTransform?: boolean; // 是否保持新节点的世界坐标不变
|
||||
}
|
||||
|
||||
// create-node 消息的 options 定义
|
||||
export interface CreateNodeOptions {
|
||||
parent?: string;
|
||||
components?: string[];
|
||||
|
||||
name?: string;
|
||||
dump?: INode | IScene; // node 初始化应用的数据
|
||||
keepWorldTransform?: boolean; // 是否保持新节点的世界坐标不变
|
||||
type?: string; // 资源类型
|
||||
assetUuid?: string; // asset uuid , type value 格式保持兼容拖动的数据格式,有资源 id,则从资源内创建对应的节点
|
||||
canvasRequired?: boolean; // 是否需要有 Canvas
|
||||
unlinkPrefab?: boolean; // 创建后取消 prefab 状态
|
||||
position?: Vec3; // 指定生成的位置
|
||||
}
|
||||
|
||||
export interface ResetNodeOptions {
|
||||
uuid: string | string[];
|
||||
}
|
||||
|
||||
export interface RemoveNodeOptions {
|
||||
uuid: string | string[];
|
||||
keepWorldTransform?: boolean;
|
||||
}
|
||||
|
||||
export interface CreateComponentOptions {
|
||||
uuid: string;
|
||||
component: string;
|
||||
}
|
||||
|
||||
export interface ResetComponentOptions {
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface RemoveComponentOptions {
|
||||
uuid: string;
|
||||
component: string;
|
||||
}
|
||||
|
||||
export interface ExecuteComponentMethodOptions {
|
||||
uuid: string;
|
||||
name: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export interface IAnimOperation {
|
||||
funcName: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export interface ExecuteSceneScriptMethodOptions {
|
||||
name: string;
|
||||
method: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export type IPropertyValueType = IProperty | IProperty[] | null | undefined | number | boolean | string | Vec3 | Vec2;
|
||||
|
||||
export interface IPropertyGroupOptions {
|
||||
id: string // 默认 'default'
|
||||
name: string,
|
||||
displayOrder: number, // 默认 Infinity, 排在最后面
|
||||
style: string // 默认为 'tab'
|
||||
}
|
||||
|
||||
export interface IProperty {
|
||||
value: { [key: string]: IPropertyValueType } | IPropertyValueType;
|
||||
default?: any; // 默认值
|
||||
|
||||
// 多选节点之后,这里存储多个数据,用于自行判断多选后的显示效果,无需更新该数据
|
||||
values?: ({ [key: string]: IPropertyValueType } | IPropertyValueType)[];
|
||||
|
||||
cid?: string;
|
||||
type?: string;
|
||||
readonly?: boolean;
|
||||
visible?: boolean;
|
||||
name?: string;
|
||||
|
||||
elementTypeData?: IProperty; // 数组里的数据的默认值 dump
|
||||
|
||||
path?: string; // 数据的搜索路径,这个是由使用方填充的
|
||||
|
||||
isArray?: boolean;
|
||||
invalid?: boolean;
|
||||
extends?: string[]; // 继承链
|
||||
displayName?: string; // 显示到界面上的名字
|
||||
displayOrder?: number; // 显示排序
|
||||
group?: IPropertyGroupOptions; // tab
|
||||
tooltip?: string; // 提示文本
|
||||
editor?: any; // 组件上定义的编辑器数据
|
||||
animatable?: boolean; // 是否可以在动画中编辑
|
||||
|
||||
// Enum
|
||||
enumList?: any[]; // enum 类型的 list 选项数组
|
||||
|
||||
bitmaskList?: any[];
|
||||
|
||||
// Number
|
||||
min?: number; // 数值类型的最小值
|
||||
max?: number; // 数值类型的最大值
|
||||
step?: number; // 数值类型的步进值
|
||||
slide?: boolean; // 数组是否显示为滑块
|
||||
unit?: string; // 显示的单位
|
||||
radian?: boolean; // 标识是否为角度
|
||||
|
||||
// Label
|
||||
multiline?: boolean; // 字符串是否允许换行
|
||||
// nullable?: boolean; 属性是否允许为空
|
||||
}
|
||||
|
||||
export interface IRemovedComponentInfo {
|
||||
name: string;
|
||||
fileID: string;
|
||||
}
|
||||
|
||||
export interface INode {
|
||||
active: IProperty;
|
||||
locked: IProperty;
|
||||
name: IProperty;
|
||||
position: IProperty;
|
||||
|
||||
/**
|
||||
* 此为 dump 数据,非 node.rotation
|
||||
* 实际指向 node.eulerAngles
|
||||
* rotation 为了给用户更友好的文案
|
||||
*/
|
||||
rotation: IProperty;
|
||||
|
||||
scale: IProperty;
|
||||
layer: IProperty;
|
||||
uuid: IProperty;
|
||||
|
||||
children: any[];
|
||||
parent: any;
|
||||
|
||||
__comps__: IProperty[];
|
||||
__type__: string;
|
||||
__prefab__?: any;
|
||||
_prefabInstance?: any;
|
||||
removedComponents?: IRemovedComponentInfo[];
|
||||
mountedRoot?: string;
|
||||
}
|
||||
|
||||
export interface IComponent extends IProperty {
|
||||
value: {
|
||||
enabled: IPropertyValueType;
|
||||
uuid: IPropertyValueType;
|
||||
name: IPropertyValueType;
|
||||
} & Record<string, IPropertyValueType>;
|
||||
mountedRoot?: string;
|
||||
}
|
||||
|
||||
export interface IScene {
|
||||
name: IProperty;
|
||||
active: IProperty;
|
||||
locked: IProperty;
|
||||
_globals: any;
|
||||
isScene: boolean;
|
||||
autoReleaseAssets: IProperty;
|
||||
|
||||
uuid: IProperty;
|
||||
children: any[];
|
||||
parent: any;
|
||||
__type__: string;
|
||||
targetOverrides?: any;
|
||||
}
|
||||
|
||||
export interface ITargetOverrideInfo {
|
||||
source: string;
|
||||
sourceInfo?: string[];
|
||||
propertyPath: string[];
|
||||
target: string;
|
||||
targetInfo?: string[];
|
||||
}
|
||||
// ---- 操作消息的参数定义 --- end
|
||||
|
||||
// ---- 场景插件返回的 info 信息 ---- start
|
||||
interface ScenePluginNodeInfo {
|
||||
uuid: string;
|
||||
components: ScenePluginComponentInfo[];
|
||||
}
|
||||
|
||||
// 场景插件传回的场景信息
|
||||
export interface ScenePluginInfo {
|
||||
// 选中节点列表
|
||||
nodes: ScenePluginNodeInfo[];
|
||||
|
||||
// gizmo 的一些信息
|
||||
gizmo: {
|
||||
is2D: boolean;
|
||||
};
|
||||
// 当前编辑模式数组
|
||||
modes: string[];
|
||||
}
|
||||
|
||||
// 场景插件传回的组件信息
|
||||
export interface ScenePluginComponentInfo {
|
||||
uuid: string;
|
||||
enabled: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface QueryClassesOptions {
|
||||
extends?: string | string[];
|
||||
excludeSelf?: boolean;
|
||||
}
|
||||
|
||||
// ---- 场景插件返回的 info 信息 ---- end
|
||||
|
||||
// ---- 动画数据 ---- start
|
||||
|
||||
export interface IKeyDumpData {
|
||||
frame: number;
|
||||
dump: any; // value的dump数据
|
||||
inTangent?: number;
|
||||
inTangentWeight?: number;
|
||||
outTangent?: number;
|
||||
outTangentWeight?: number;
|
||||
interpMode?: number;
|
||||
broken?: boolean;
|
||||
tangentWeightMode?: number;
|
||||
imgUrl?: string;
|
||||
easingMethod?: number;
|
||||
}
|
||||
|
||||
export interface IDumpType {
|
||||
value: string;
|
||||
extends?: string[];
|
||||
}
|
||||
|
||||
export interface IPropCurveDumpData {
|
||||
nodePath: string;
|
||||
keyframes: IKeyDumpData[];
|
||||
displayName: string;
|
||||
key: string;
|
||||
type?: IDumpType;
|
||||
preExtrap: number;
|
||||
postExtrap: number;
|
||||
isCurveSupport: boolean; // 是否支持贝塞尔曲线编辑
|
||||
}
|
||||
|
||||
export interface IAnimCopyKeySrcInfo {
|
||||
curvesDump: IPropCurveDumpData[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyNodeSrcInfo {
|
||||
curvesDump: IPropCurveDumpData[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyNodeDstInfo {
|
||||
nodePath: string;
|
||||
}
|
||||
|
||||
interface IEventDump {
|
||||
frame: number;
|
||||
func: string;
|
||||
params: string[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyEventSrcInfo {
|
||||
eventsDump: IEventDump[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyPropSrcInfo {
|
||||
curvesDump: IPropCurveDumpData[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyPropDstInfo {
|
||||
nodePath: string;
|
||||
propKeys?: string[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyKeyDstInfo {
|
||||
nodePath: string;
|
||||
propKeys?: string[];
|
||||
startFrame: number;
|
||||
}
|
||||
|
||||
export interface IAnimCopyEventDstInfo {
|
||||
startFrame: number;
|
||||
}
|
||||
// ---- 动画数据 ---- end
|
||||
|
||||
// ---- Contributions ---- start
|
||||
|
||||
export interface ContributionDropItem {
|
||||
type: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
// ---- Contributions ---- end
|
||||
|
||||
export interface UnitTestInfo {
|
||||
name: string;
|
||||
}
|
||||
27
TurntableDemoV3/@types/packages/server/@types/package.d.ts
vendored
Normal file
27
TurntableDemoV3/@types/packages/server/@types/package.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// 消息定义
|
||||
interface MessageInterface {
|
||||
params: any[],
|
||||
result: any;
|
||||
}
|
||||
|
||||
// host
|
||||
export interface HostInfo {
|
||||
host: string;
|
||||
ip: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
// 消息定义
|
||||
export interface main {
|
||||
scene: {
|
||||
[x: string]: MessageInterface;
|
||||
'query-port': {
|
||||
params: [],
|
||||
result: number,
|
||||
};
|
||||
'scan-lan': {
|
||||
params: [],
|
||||
result: HostInfo[],
|
||||
};
|
||||
}
|
||||
}
|
||||
19
TurntableDemoV3/@types/packages/shortcuts/@types/shortcut.d.ts
vendored
Normal file
19
TurntableDemoV3/@types/packages/shortcuts/@types/shortcut.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface ShortcutItem {
|
||||
when: string;
|
||||
message: string;
|
||||
shortcut: string;
|
||||
pkgName: string;
|
||||
rawShortcut?: string;
|
||||
key: string;
|
||||
missing?: boolean;
|
||||
}
|
||||
|
||||
export type IShortcutItemMap = Record<string, ShortcutItem>;
|
||||
|
||||
export interface IShortcutEditInfo {
|
||||
key: string;
|
||||
shortcut: string;
|
||||
searches: ShortcutItem[];
|
||||
conflict: boolean;
|
||||
when: string;
|
||||
}
|
||||
BIN
TurntableDemoV3/QQ图片20220115224557.jpg
Normal file
BIN
TurntableDemoV3/QQ图片20220115224557.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
12
TurntableDemoV3/assets/Movement.meta
Normal file
12
TurntableDemoV3/assets/Movement.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "ec6ef45c-8ca5-4c00-88d4-8276a1a3c67d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
12
TurntableDemoV3/assets/Turntable.meta
Normal file
12
TurntableDemoV3/assets/Turntable.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "5998563a-cf40-4879-ad5d-dc4881913dd1",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
12
TurntableDemoV3/assets/Turntable/scenes.meta
Normal file
12
TurntableDemoV3/assets/Turntable/scenes.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "7b9f25bc-52be-4432-979e-14fc809193c9",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
2558
TurntableDemoV3/assets/Turntable/scenes/Turntable.scene
Normal file
2558
TurntableDemoV3/assets/Turntable/scenes/Turntable.scene
Normal file
File diff suppressed because it is too large
Load Diff
11
TurntableDemoV3/assets/Turntable/scenes/Turntable.scene.meta
Normal file
11
TurntableDemoV3/assets/Turntable/scenes/Turntable.scene.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ver": "1.1.35",
|
||||
"importer": "scene",
|
||||
"imported": true,
|
||||
"uuid": "b9a698e0-c857-4b1b-aca0-41f017641ce6",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
12
TurntableDemoV3/assets/Turntable/scripts.meta
Normal file
12
TurntableDemoV3/assets/Turntable/scripts.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "d2e6545d-07e2-4942-a4e9-df9180546b5a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
57
TurntableDemoV3/assets/Turntable/scripts/MathTool.ts
Normal file
57
TurntableDemoV3/assets/Turntable/scripts/MathTool.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
|
||||
@ccclass('MathTool')
|
||||
export class MathTool {
|
||||
|
||||
/**
|
||||
* 一元二次方程
|
||||
* 求Y
|
||||
* @param x
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
* @returns
|
||||
*/
|
||||
public static calculateY(x, a, b, c) {
|
||||
return a * x * x + b * x + c;
|
||||
}
|
||||
/**
|
||||
* 一元二次方程
|
||||
* 求根(x)
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
*/
|
||||
public static calculateX(a, b, c) {
|
||||
let x1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
|
||||
let x2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
|
||||
return [x1, x2]
|
||||
}
|
||||
/**
|
||||
* 一元二次方程
|
||||
* 求x的最值(极大or极小)
|
||||
*/
|
||||
public static calculateExtremeX(a, b, c) {
|
||||
return -b / (2 * a * b);
|
||||
}
|
||||
/**
|
||||
* 一元二次方程
|
||||
* 求得y的最值(极大or极小)
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
* @returns
|
||||
*/
|
||||
public static calculateExtremeY(a, b, c) {
|
||||
return (4 * a * c - b * b) / (4 * a);
|
||||
}
|
||||
|
||||
// update (deltaTime: number) {
|
||||
// // [4]
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "17721f72-133a-45a7-b099-f0f543468c07",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
121
TurntableDemoV3/assets/Turntable/scripts/Turntalbe.ts
Normal file
121
TurntableDemoV3/assets/Turntable/scripts/Turntalbe.ts
Normal file
@@ -0,0 +1,121 @@
|
||||
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { MathTool } from './MathTool';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* 实现原理
|
||||
* 通过一元两次方程
|
||||
* y=a*x*x
|
||||
* 其中a=200
|
||||
* 来计算出y运行5*360=1800(5为圈数)的时间x=3
|
||||
* 通过输入endAngle来得到结束角度;
|
||||
* 在运动过程中把状态分成0==静止状态、1==加速状态、2==减速状态
|
||||
* 加速状态通过设置a=200,b=0,c=endAngle,x从0到maxX;
|
||||
* y = this.a * this.curTime * this.curTime;
|
||||
* 返回y的值
|
||||
* 减速状态则通过设置a=200,b=0,c=0,x=maxX到0倒放实现
|
||||
* y = this.a * this.curTime * this.curTime + this.b * this.curTime + this.c;
|
||||
* 返回 maxY+endAngle+y;
|
||||
*/
|
||||
enum State {
|
||||
/**静止状态 */
|
||||
stop,
|
||||
/**加速状态 */
|
||||
up,
|
||||
/**减速状态 */
|
||||
down
|
||||
}
|
||||
export class Turntalbe {
|
||||
/**设置a */
|
||||
private a = 200;
|
||||
/**没有用到 */
|
||||
private b = 0;
|
||||
/**开始角度 */
|
||||
private c = 0;
|
||||
/**运行圈数 */
|
||||
private turnTimer = 5;
|
||||
/**运行的距离 */
|
||||
private distanceY: number[] = [0, 0, 0];
|
||||
/**需要的时间 */
|
||||
private timeX: number[] = [0, 0, 0];
|
||||
|
||||
private startAngle: number = 0;
|
||||
private onUpdateUI: Function = null;
|
||||
private onFinish: Function = null;
|
||||
|
||||
/**状态 */
|
||||
private state: State = State.stop;
|
||||
|
||||
public ready() {
|
||||
return this.state == State.stop;
|
||||
}
|
||||
|
||||
public start(startAngle: number, endAngle: number) {
|
||||
this.distanceY[State.up] = this.distanceY[State.down] = 360 * this.turnTimer;
|
||||
this.startAngle = startAngle;
|
||||
|
||||
endAngle = (endAngle % 360 - startAngle % 360) % 360;
|
||||
this.distanceY[State.up] += endAngle;
|
||||
this.up();
|
||||
}
|
||||
|
||||
public setUpateUI(callback) {
|
||||
this.onUpdateUI = callback;
|
||||
}
|
||||
|
||||
public setFinish(callback) {
|
||||
this.onFinish = callback;
|
||||
}
|
||||
|
||||
private updateUI(angle) {
|
||||
this.onUpdateUI && this.onUpdateUI(angle)
|
||||
}
|
||||
|
||||
private down(delta: number) {
|
||||
this.a = -Math.abs(this.a);
|
||||
this.c = this.startAngle + this.distanceY[State.up] + this.distanceY[State.down];
|
||||
this.state = State.down;
|
||||
let list = MathTool.calculateX(this.a, 0, this.distanceY[State.down]);
|
||||
//取负
|
||||
let x = list[0] < 0 ? list[0] : list[1];
|
||||
this.timeX[State.down] = x;
|
||||
this.curTime = this.timeX[State.down] + delta;
|
||||
}
|
||||
|
||||
private up() {
|
||||
this.a = Math.abs(this.a);
|
||||
this.c = this.startAngle;
|
||||
this.state = State.up;
|
||||
let list = MathTool.calculateX(this.a, 0, -this.distanceY[State.up]);
|
||||
//取正
|
||||
let x = list[0] > 0 ? list[0] : list[1];
|
||||
this.timeX[State.up] = x;
|
||||
this.curTime = 0;
|
||||
}
|
||||
|
||||
private calcuate(x: number) {
|
||||
return this.a * x * x + this.b * x + this.c;
|
||||
}
|
||||
|
||||
private curTime = 0;
|
||||
public update(deltaTime: number) {
|
||||
if (this.state == State.stop) {
|
||||
return;
|
||||
}
|
||||
this.curTime += deltaTime;
|
||||
|
||||
if (this.state == State.up && this.curTime > this.timeX[State.up]) {//切换到减速状态
|
||||
let delta = this.curTime - this.timeX[State.up];
|
||||
this.down(delta);
|
||||
} else if (this.state == State.down && this.curTime > 0) {//切换到结束状态
|
||||
this.curTime = 0;
|
||||
this.state = State.stop;
|
||||
this.onFinish && this.onFinish();
|
||||
}
|
||||
|
||||
let y = this.calcuate(this.curTime);
|
||||
this.updateUI(y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0ec1297f-9b88-45c0-8f6d-d0b4f7103299",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
41
TurntableDemoV3/assets/Turntable/scripts/UILuckyBagPage.ts
Normal file
41
TurntableDemoV3/assets/Turntable/scripts/UILuckyBagPage.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { MathTool } from './MathTool';
|
||||
import { Turntalbe } from './Turntalbe';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@ccclass('UILuckyBagPage')
|
||||
export class UILuckyBagPage extends Component {
|
||||
|
||||
@property(Node)
|
||||
target: Node = null;
|
||||
private turntable: Turntalbe = new Turntalbe();
|
||||
|
||||
start() {
|
||||
this.turntable.setUpateUI((angle) => {
|
||||
this.target.angle = angle % 360;
|
||||
})
|
||||
this.turntable.setFinish(this.onFinish.bind(this));
|
||||
}
|
||||
|
||||
onFinish() {
|
||||
|
||||
}
|
||||
|
||||
onEventClick(event, custom: string) {
|
||||
if (custom == "1") {
|
||||
let index = Math.floor(Math.random() * 8);
|
||||
// index=4;
|
||||
console.log(index);
|
||||
if (this.turntable.ready()) {
|
||||
this.turntable.start(this.target.angle, (360 - 45 * index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
this.turntable.update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"9c9b3730-9717-4fee-af37-fa6bcdb00708","files":[],"subMetas":{},"userData":{}}
|
||||
12
TurntableDemoV3/assets/Turntable/texture.meta
Normal file
12
TurntableDemoV3/assets/Turntable/texture.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "24751517-4d2d-423f-8e5a-9235c0c939d2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_beiJing.png
Normal file
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_beiJing.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"ver": "1.0.22",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f",
|
||||
"files": [
|
||||
".png",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"GodWheel_beiJing": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "a1072739-b37d-4fbf-8007-c42bde45d9c6",
|
||||
"rawTextureUuid": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -0.5,
|
||||
"offsetY": -1,
|
||||
"trimX": 59,
|
||||
"trimY": 61,
|
||||
"width": 517,
|
||||
"height": 518,
|
||||
"rawWidth": 636,
|
||||
"rawHeight": 638,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {},
|
||||
"importer": "*",
|
||||
"imported": false,
|
||||
"files": [],
|
||||
"userData": {},
|
||||
"displayName": "",
|
||||
"id": "",
|
||||
"name": ""
|
||||
},
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f@6c48a",
|
||||
"displayName": "GodWheel_beiJing",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f"
|
||||
},
|
||||
"ver": "1.0.21",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f@f9941",
|
||||
"displayName": "GodWheel_beiJing",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -0.5,
|
||||
"offsetY": -1,
|
||||
"trimX": 59,
|
||||
"trimY": 61,
|
||||
"width": 517,
|
||||
"height": 518,
|
||||
"rawWidth": 636,
|
||||
"rawHeight": 638,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.9",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"hasAlpha": true,
|
||||
"type": "sprite-frame",
|
||||
"redirect": "e037175e-d2b3-494e-a6b5-a6f08ddfca5f@f9941",
|
||||
"compressSettings": {
|
||||
"useCompressTexture": false
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng1.png
Normal file
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
102
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng1.png.meta
Normal file
102
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng1.png.meta
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"ver": "1.0.22",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "4d1a7f02-d10c-4023-bb31-62e114f9a773",
|
||||
"files": [
|
||||
".png",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"GodWheel_deng1": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "48bcf3a1-b591-4c52-97f6-f48d42b8397a",
|
||||
"rawTextureUuid": "4d1a7f02-d10c-4023-bb31-62e114f9a773",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 8,
|
||||
"trimY": 1,
|
||||
"width": 608,
|
||||
"height": 622,
|
||||
"rawWidth": 624,
|
||||
"rawHeight": 624,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {},
|
||||
"importer": "*",
|
||||
"imported": false,
|
||||
"files": [],
|
||||
"userData": {},
|
||||
"displayName": "",
|
||||
"id": "",
|
||||
"name": ""
|
||||
},
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "4d1a7f02-d10c-4023-bb31-62e114f9a773@6c48a",
|
||||
"displayName": "GodWheel_deng1",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "4d1a7f02-d10c-4023-bb31-62e114f9a773"
|
||||
},
|
||||
"ver": "1.0.21",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "4d1a7f02-d10c-4023-bb31-62e114f9a773@f9941",
|
||||
"displayName": "GodWheel_deng1",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 8,
|
||||
"trimY": 1,
|
||||
"width": 608,
|
||||
"height": 622,
|
||||
"rawWidth": 624,
|
||||
"rawHeight": 624,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "4d1a7f02-d10c-4023-bb31-62e114f9a773@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.9",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"hasAlpha": true,
|
||||
"type": "sprite-frame",
|
||||
"redirect": "4d1a7f02-d10c-4023-bb31-62e114f9a773@f9941"
|
||||
}
|
||||
}
|
||||
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng2.png
Normal file
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
102
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng2.png.meta
Normal file
102
TurntableDemoV3/assets/Turntable/texture/GodWheel_deng2.png.meta
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"ver": "1.0.22",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "9ce20cec-5cad-408d-887a-b5a6c6fb586d",
|
||||
"files": [
|
||||
".png",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"GodWheel_deng2": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "bc5a6442-5f6a-41c2-b4fe-932352ccb6d4",
|
||||
"rawTextureUuid": "9ce20cec-5cad-408d-887a-b5a6c6fb586d",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": -1,
|
||||
"trimX": 1,
|
||||
"trimY": 10,
|
||||
"width": 622,
|
||||
"height": 606,
|
||||
"rawWidth": 624,
|
||||
"rawHeight": 624,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {},
|
||||
"importer": "*",
|
||||
"imported": false,
|
||||
"files": [],
|
||||
"userData": {},
|
||||
"displayName": "",
|
||||
"id": "",
|
||||
"name": ""
|
||||
},
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "9ce20cec-5cad-408d-887a-b5a6c6fb586d@6c48a",
|
||||
"displayName": "GodWheel_deng2",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "9ce20cec-5cad-408d-887a-b5a6c6fb586d"
|
||||
},
|
||||
"ver": "1.0.21",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "9ce20cec-5cad-408d-887a-b5a6c6fb586d@f9941",
|
||||
"displayName": "GodWheel_deng2",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": -1,
|
||||
"trimX": 1,
|
||||
"trimY": 10,
|
||||
"width": 622,
|
||||
"height": 606,
|
||||
"rawWidth": 624,
|
||||
"rawHeight": 624,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "9ce20cec-5cad-408d-887a-b5a6c6fb586d@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.9",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"hasAlpha": true,
|
||||
"type": "sprite-frame",
|
||||
"redirect": "9ce20cec-5cad-408d-887a-b5a6c6fb586d@f9941"
|
||||
}
|
||||
}
|
||||
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_zhuanPan.png
Normal file
BIN
TurntableDemoV3/assets/Turntable/texture/GodWheel_zhuanPan.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"ver": "1.0.22",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "8742f019-1cb4-431f-9a36-46f0e59500ea",
|
||||
"files": [
|
||||
".png",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "8742f019-1cb4-431f-9a36-46f0e59500ea@6c48a",
|
||||
"displayName": "GodWheel_zhuanPan",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "8742f019-1cb4-431f-9a36-46f0e59500ea"
|
||||
},
|
||||
"ver": "1.0.21",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "8742f019-1cb4-431f-9a36-46f0e59500ea@f9941",
|
||||
"displayName": "GodWheel_zhuanPan",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 600,
|
||||
"height": 600,
|
||||
"rawWidth": 600,
|
||||
"rawHeight": 600,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "8742f019-1cb4-431f-9a36-46f0e59500ea@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.9",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"hasAlpha": true,
|
||||
"type": "sprite-frame",
|
||||
"redirect": "8742f019-1cb4-431f-9a36-46f0e59500ea@f9941"
|
||||
}
|
||||
}
|
||||
9
TurntableDemoV3/package.json
Normal file
9
TurntableDemoV3/package.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "MovementDemo",
|
||||
"type": "3d",
|
||||
"uuid": "a061dcdb-2e0e-4a06-9a72-77273be06df0",
|
||||
"version": "3.4.0",
|
||||
"creator": {
|
||||
"version": "3.4.0"
|
||||
}
|
||||
}
|
||||
8
TurntableDemoV3/settings/v2/packages/project.json
Normal file
8
TurntableDemoV3/settings/v2/packages/project.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"general": {
|
||||
"designResolution": {
|
||||
"width": 720,
|
||||
"height": 1280
|
||||
}
|
||||
}
|
||||
}
|
||||
9
TurntableDemoV3/tsconfig.json
Normal file
9
TurntableDemoV3/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
/* Base configuration. Do not edit this field. */
|
||||
"extends": "./temp/tsconfig.cocos.json",
|
||||
|
||||
/* Add your custom configuration here. */
|
||||
"compilerOptions": {
|
||||
"strict": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user