Prechádzať zdrojové kódy

updates about factory (CN) (#341)

* update physics

* update input

* update

* update code sharing in getting-help.md

* Export Compliance

* update on file i/o

* pi / 4

* inputs

* forum url

* read only user

* html5 gamepad

* sdk api update

* update

* image properties

* update editor

* defold sdk update

* animation updates

* animation fix

* run as admin

* update bob

* update about AndroidX support

* software render

* linux-faq.md update

* 4.28.2021 updates

* Basis Universal format

* sound & mesh

* gamepad event mapping

* admob url

* Minor edit to building blocks intro text

* update gamepad & ios

* project settings

* libffi version

* scaling

* image compression

* update gamepads

* increase memory

* caching assets

* update 2021/10/6

* update 2021/10/16
blend-modes.md

* update 2021/11/12

* allow dynamic transforms update

* Bundle update

* update faq

* bullet & bob

* script properties update

* editor-styling

* build server url

* editor templates

* spine extension update

* Fix typo in the "optimizations" word in Chinese docs

* Update to material.md - Constants buffers

* Verify Graphics Calls

* H5 parameters

* OpenJDK downloads

* cn update corresponds to [pull 259](https://github.com/defold/doc/pull/259)

* application security

* porting guidelines

* update for 8f1651f

* cn update for 094bf6f

* cn update for 20fdfc5 & 6263317

* cn update for 7/19/2022

* title

* profiling update

* update editor.md

* update bob.md

* update shortcuts

* update fixed update note

* Update properties.md

* Update material.md

* Updates links

* Update bob help with the latest info

* camera & renderer

* Updated android keystore info zh_cn

* bundling.md release vs debug zh_cn

* update bob.md & gui-clipping.md

* contentless bundle

* consoles update

* model animation link

* gamepad & faq

* remove a camera lib

* font shadow render mode fix

* updates about app-manifest and others

* Update script.md

* includes in shaders

* editor scripts

* material updates

* Added dynamic atlas and texture creation

* fixes for atlas and some others

* update screenshots and add explanations (CN)

* add a line about Dynamic Prototype (CN)

* remove "inline" marks in pics

* de-translate the subtitle "Running the debugger" & images fix

* bundle identifier restrictions

* node properties Enabled and Visible (CN)

* release checklist & slice-9

* Update project-settings.md (CN)

* Update camera.md (CN)

* Update project-settings.md (CN)

* culling of meshes (CN)

* Update project-settings.md (CN)

* gltf model file support (CN)

* updates about factory (CN)
COCO 2 rokov pred
rodič
commit
4bc1833c0a

+ 20 - 1
docs/zh/manuals/factory.md

@@ -235,13 +235,32 @@ end
   end
   ```
 
+## 动态 Prototype
+
+factory 组件里有 *Dynamic Prototype* 选项, 点选之后可以在运行时更改 factory 的原型.
+
+![动态 prototype](images/factory/dynamic_prototype.png)
+
+factory 组件 *Dynamic Prototype* 被点选之后可以使用 `factory.set_prototype()` 函数更改其原型. 例如:
+
+```lua
+factory.unload("#factory") -- 卸载之前的资源
+factory.set_prototype("#factory", "/main/levels/enemyA.goc")
+local enemy_id = factory.create("#factory")
+```
+
+::: important
+当 *Dynamic Prototype* 被点选后, 集合组件数目将失去限制, factory 所在的集合将使用 *game.project* 文件指定的默认组件限制数目.
+:::
+
+
 ## 实例限制
 
 项目设置 *Collection related settings* 部分 *max_instances* 限制了游戏世界 (启动集合 main.collection 或者通过集合代理加载的集合) 中游戏对象的最大数目. 不论是子编辑器里创建的还是用脚本动态创建的游戏对象综合不得超过这个最大值.
 
 ![Max instances](images/factory/factory_max_instances.png)
 
-比如如果把 *max_instances* 设置为 1024 然后手动拖放 24 游戏对象到主集合, 那么最多还能创建 1000 个游戏对象. 如果删除一个对象, 就能再创建一个对象.
+如果把 *max_instances* 设置为 1024 然后手动拖放 24 游戏对象到主集合, 那么最多还能创建 1000 个游戏对象. 如果删除一个对象, 就能再创建一个对象.
 
 ## 游戏对象池
 

+ 1 - 9
docs/zh/manuals/project-settings.md

@@ -616,16 +616,8 @@ $ dmengine --config=test.my_value=4711 --config=test2.my_value2=1234
 local my_value = tonumber(sys.get_config("test.my_value"))
 ```
 
-## 最大组件数优化
-配置文件 *game.project* 包含针对各种资源同时存在的最大数目的配置项, 容器大都是每个载入的集合 (也叫做游戏世界). Defold 引擎使用这些最大值来预分配内存以避免游戏运行时内存动态分配及内存碎片化.
 
-用于表示组件和其他资源的 Defold 数据结构优化为尽可能少用内存, 但当配置这些最大值时仍要留意是否保证了满足游戏运行的需求.
-
-另一方面 Defold 编译处理会分析游戏内容, 如果明确分析出必要的内存需求则会覆盖最大值设置:
-
-* 如果集合不含工厂组件则仅分配各个组件必须的内存忽略最大值设置.
-* 如果集合包含工厂组件则分析工厂可实例化的游戏对象组件的必要内存并为其实例化分配足够内存.
-* 如果集合里包含了工厂或者集合工厂, 并且这些工厂开启了 "Dynamic Prototype" 选项, 则该集合自动使用最大组件数.
+:[Component max count optimizations](../shared/component-max-count-optimizations.md)
 
 
 ## 自定义项目配置文件

+ 10 - 0
docs/zh/shared/component-max-count-optimizations.md

@@ -0,0 +1,10 @@
+## 最大组件数优化限制
+配置文件 *game.project* 包含针对各种资源同时存在的最大数目的配置项, 容器大都是每个载入的集合 (也叫做游戏世界). Defold 引擎使用这些最大值来预分配内存以避免游戏运行时内存动态分配及内存碎片化.
+
+用于表示组件和其他资源的 Defold 数据结构优化为尽可能少用内存, 但当配置这些最大值时仍要留意是否保证了满足游戏运行的需求.
+
+另一方面 Defold 编译处理会分析游戏内容, 如果明确分析出必要的内存需求则会覆盖最大值设置:
+
+* 如果集合不含工厂组件则仅分配各个组件必须的内存忽略最大值设置.
+* 如果集合包含工厂组件则分析工厂可实例化的游戏对象组件的必要内存并为其实例化分配足够内存.
+* 如果集合里包含了工厂或者集合工厂, 并且这些工厂开启了 "Dynamic Prototype" 选项, 则该集合自动使用最大组件数.