Commit ac856bdf authored by rockyl's avatar rockyl

修改CameraController方便UI适配

parent 8148721c
{
"name": "scilla-core",
"version": "1.0.0",
"main": "./dist/bundle.js",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"license": "MIT",
"scripts": {
......
......@@ -25,6 +25,6 @@ export default {
useTsconfigDeclarationDir: true,
}),
commonjs(),
uglify({}),
//uglify({}),
]
};
......@@ -2,7 +2,7 @@
* Created by rockyl on 2018-12-04.
*/
import {destroyScene, setupScene, } from "./interpreter";
import {cleanEntity, setupScene, } from "./interpreter";
import {addLoader, cacheRes, destroyRes, getAllResUuids, loadJson5} from "../assets-manager";
import {getRoot, pause, Scene, start} from "../core";
......@@ -49,7 +49,7 @@ export function mountScene(scene){
*/
export function unmountScene(scene){
pause();
destroyScene(scene);
cleanEntity(scene.root);
destroyRes(resUUIDs);
}
......
......@@ -38,13 +38,12 @@ export function setupScene(scene: Scene, root: Entity): Scene {
}
/**
* 销毁场景
* @param scene
* 清空实体
* @param entity
*/
export function destroyScene(scene: Scene) {
const root = scene.root;
root.removeAllComponents();
root.removeChildren();
export function cleanEntity(entity: Entity) {
entity.removeAllComponents();
entity.removeChildren();
}
/**
......@@ -187,22 +186,27 @@ function injectComponents(entity: Entity, config: any, pid?) {
const components = entity.components;
for (let i = 0, li = config.components.length; i < li; i++) {
const component = config.components[i];
const {properties} = component;
if (properties) {
injectProperties(components[i], properties, pid);
}
injectComponentProperties(components[i], component, pid);
}
}
}
export function injectComponentProperties(component, config, pid?){
const {properties} = config;
if (properties) {
injectProperties(component, properties, pid);
}
}
/**
* 实例化组件
* @param entity
* @param config
*/
function instantiateComponent(entity: Entity, config: any) {
const {script, properties} = config;
export function instantiateComponent(entity: Entity, config: any) {
const {script, } = config;
let def = getDefByName(script);
......@@ -214,6 +218,7 @@ function instantiateComponent(entity: Entity, config: any) {
entity.addComponent(instance);
return instance;
}
/**
......
{
"compilerOptions": {
"target": "es5",
"outDir": "dist",
"experimentalDecorators": true,
"sourceMap": true,
"declarationDir": "./types",
"declarationDir": "types",
"declaration": true,
"lib": [
"es5",
......@@ -13,7 +14,6 @@
]
},
"include": [
"src",
"libs"
"src"
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment