Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 1x 1x 1x 1x 1x | import { Transform } from '@drecom/scene-graph-schema';
import CocosCreator from './CocosCreator';
import * as cc from '../../interface/CocosCreator';
/**
* CocosCreator v2.x scene exporter
*/
export default class CocosCreatorV2 extends CocosCreator {
/**
* Returns runtime identifier string.
*/
public getIdentifier(): string {
return 'cocoscreatorv2';
}
/**
* Returns object with Transform schema using Cocos Node data.
*/
protected createDefaultTransform(component: cc.ComponentBase): Transform {
const node = component as cc.NodeV2;
return {
width: node._contentSize.width,
height: node._contentSize.height,
x: node._position.x,
y: node._position.y,
rotation: node._rotationX,
scale: {
// V2 has scale as Vec3
x: node._scale.x,
y: node._scale.y
},
anchor: {
x: node._anchorPoint.x,
y: node._anchorPoint.y
}
};
}
}
|