-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34c4ba8
commit 93190db
Showing
8 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...e/3. 工具篇:QFramework.Toolkits/03. CodeGenKit 脚本生成/07. 如何设置 ViewController 的父类.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## 如何设置 ViewController 的父类 | ||
|
||
当我们给 GameObject 挂上 ViewController 之后,我们就会看到如下图: | ||
|
||
![image-20240508162552269](https://file.liangxiegame.com/59a62ce9-a4a9-4de0-b1b8-9d31e3a5ec72.png) | ||
|
||
图中我们默认继承了 ViewController。 | ||
|
||
在很多情况下,我们是有需要设置公共父类的需求的,要想设置公共父类非常简单。 | ||
|
||
只需要继承 ViewController 的同时,加上 ViewControllerChildAttribute 即可,代码如下: | ||
```csharp | ||
namespace QFramework.Gungeon | ||
{ | ||
[ViewControllerChild] | ||
public abstract class PowerUp : ViewController | ||
{ | ||
|
||
} | ||
} | ||
``` | ||
|
||
等待编译后,就可以选择了,结果如下: | ||
![img.png](https://file.liangxiegame.com/5fa3e200-832b-45a1-abf2-0c54e25fcc65.png) | ||
|
||
|
||
|
3 changes: 3 additions & 0 deletions
3
...deline/3. 工具篇:QFramework.Toolkits/03. CodeGenKit 脚本生成/07. 如何设置 ViewController 的父类.md.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.