完善 docs

This commit is contained in:
SmallMain 2022-06-21 18:09:15 +08:00
parent dec6f5b84a
commit 3c3245f0a9
16 changed files with 3026 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "a9ecf19b-0a3b-4d8e-bfe1-614049509de9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 306,
"height": 262,
"platformSettings": {},
"subMetas": {
"1655799093442": {
"ver": "1.0.4",
"uuid": "345a6df9-6652-4102-980a-cadc95156857",
"rawTextureUuid": "a9ecf19b-0a3b-4d8e-bfe1-614049509de9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 306,
"height": 262,
"rawWidth": 306,
"rawHeight": 262,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because it is too large Load Diff

92
demo/assets/home/home.ts Normal file
View File

@ -0,0 +1,92 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class Home extends cc.Component {
@property(cc.Label)
objectNumLabel: cc.Label = null;
@property(cc.Slider)
objectNumSlider: cc.Slider = null;
@property(cc.Node)
enbaleMultiNode: cc.Node = null;
@property(cc.Node)
objects: cc.Node = null;
nums = [10, 10000];
num = this.nums[0];
enableMultiRender = true;
prefabs: cc.Node[] = [];
protected onLoad(): void {
this.prefabs = this.objects.children.concat();
this.objects.removeAllChildren(false);
this.objectNumSlider.node.on('slide', (slider: cc.Slider) => {
const offset = (this.nums[1] - this.nums[0]) * slider.progress;
this.num = this.nums[0] + Math.ceil(offset);
this.numUpdate();
});
this.enbaleMultiNode.on('toggle', (toggle: cc.Toggle) => {
this.enableMultiRender = toggle.isChecked;
this.multiRenderUpdate();
});
this.numUpdate();
this.multiRenderUpdate();
}
numUpdate() {
this.objectNumLabel.string = `对象数量:${this.num}`;
let offset = this.num - this.objects.children.length;
if (offset > 0) {
for (let i = 0; i < offset; i++) {
this.createObject();
}
} else {
offset = -offset;
for (let i = 0; i < offset; i++) {
this.objects.children[i].destroy();
}
}
}
multiRenderUpdate() {
this.reCreateObjects();
}
reCreateObjects() {
this.objects.destroyAllChildren();
for (let i = 0; i < this.num; i++) {
this.createObject();
}
}
createObject() {
const random = Math.floor(Math.random() * this.prefabs.length);
const node = cc.instantiate(this.prefabs[random]);
if (this.enableMultiRender) {
const comp = node.getComponent(cc.Label) ?? node.getComponent(cc.Sprite) ?? node.getComponent(cc.RichText) ?? node.getComponent(sp.Skeleton);
comp.autoSwitchMaterial = cc.RenderComponent.EnableType.ENABLE;
comp.allowDynamicAtlas = cc.RenderComponent.EnableType.ENABLE;
}
this.objects.addChild(node);
node.position = cc.v3(Math.floor(Math.random() * this.objects.width), Math.floor(Math.random() * this.objects.height));
cc.tween(node).by(1, { angle: 360 }).repeatForever().start();
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "fae4abc1-6681-4884-b234-b65d986d909e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -1104,7 +1104,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 32,
"width": 64,
"height": 40
},
"_anchorPoint": {
@ -1154,8 +1154,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "首页",
"_N$string": "首页",
"_string": "压力测试",
"_N$string": "压力测试",
"_fontSize": 16,
"_lineHeight": 40,
"_enableWrapText": true,

View File

@ -31,8 +31,8 @@ export default class SpineSkin extends cc.Component {
this.addBoyBtn.on('click', () => {
const newBoy = cc.instantiate(this.boy);
const newBoySpine = newBoy.getComponentInChildren(sp.Skeleton);
boySpine.skeletonData = newBoySpine.skeletonData.clone();
boySpine.animation = 'attack';
newBoySpine.skeletonData = boySpine.skeletonData.clone();
newBoySpine.animation = 'attack';
this.boy.parent.addChild(newBoy);
newBoy.setPosition(this.boys[this.boys.length - 1].position);

View File

@ -1,12 +0,0 @@
{
"ver": "1.1.2",
"uuid": "4650da5c-d240-4ce6-b314-9e896888dd88",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -19,7 +19,6 @@
"PageViewIndicator",
"ProgressBar",
"ParticleSystem",
"Slider",
"StudioComponent",
"TiledMap",
"VideoPlayer",

View File

@ -103,4 +103,13 @@ description: "需掌握一定的自定义引擎知识。"
Git Patch 存储了我们所有的源码提交信息,所以你可以只挑选你想要的提交进行应用,在引擎目录去打补丁文件就等同于应用了我们对引擎的改动,之后就可以按照官方的自定义引擎文档去使用了。
打补丁一般使用两种命令:
- 直接提交使用 `git am`
- 只将改动保留到工作区使用 `git apply`
最好在打补丁时加上输出详细信息的命令参数以更好地确认补丁应用的情况。
常见的问题是我们在仓库的 `engine`、`jsb-adapter`、`cocos2d-x` 文件夹存放源码,那么提供的补丁文件对源码的应用路径也会是 `./engine` 这样的二级目录,如果你直接在引擎目录应用补丁,可能会发生没反应、补丁被跳过的问题,需要使用相应的命令参数来修正补丁应用的路径。
在完成自定义引擎的工作后,请别忘了安装引擎扩展哦。(可参考[标准安装的第 2 步](#2安装引擎扩展)进行操作)。