Compare commits

...

2 Commits

Author SHA1 Message Date
Yogi 41224d8ba8 dev 2023-11-02 22:19:17 +08:00
Yogi db9a952f40 gd技巧 2023-11-02 17:16:48 +08:00
5 changed files with 166 additions and 18 deletions

View File

@ -4,16 +4,50 @@
"type": "split", "type": "split",
"children": [ "children": [
{ {
"id": "042c379e06e2a039", "id": "1a16c3ad5e0f8c65",
"type": "tabs", "type": "tabs",
"dimension": 50.31645569620253,
"children": [ "children": [
{ {
"id": "5c86638fbbec30d3", "id": "88534f74aecd6c5e",
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "image", "type": "markdown",
"state": { "state": {
"file": "Aseets/Dev.png" "file": "Game Dev Common Web.md",
"mode": "source",
"source": false
}
}
}
]
},
{
"id": "2afdaf4448e53ac9",
"type": "tabs",
"dimension": 49.68354430379747,
"children": [
{
"id": "d75287d25025d4a1",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Today Todo.md",
"mode": "preview",
"source": false
}
}
},
{
"id": "8a553b917481f881",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Godot GDScript Trick.md",
"mode": "source",
"source": false
} }
} }
} }
@ -83,7 +117,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "Aseets/Dev.png", "file": "Game Dev Common Web.md",
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@ -100,7 +134,7 @@
"state": { "state": {
"type": "outgoing-link", "type": "outgoing-link",
"state": { "state": {
"file": "Aseets/Dev.png", "file": "Game Dev Common Web.md",
"linksCollapsed": false, "linksCollapsed": false,
"unlinkedCollapsed": true "unlinkedCollapsed": true
} }
@ -123,7 +157,7 @@
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {
"file": "Aseets/Dev.png" "file": "Game Dev Common Web.md"
} }
} }
} }
@ -131,7 +165,8 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 297.5 "width": 297.5,
"collapsed": true
}, },
"left-ribbon": { "left-ribbon": {
"hiddenItems": { "hiddenItems": {
@ -147,10 +182,16 @@
"html-server:Turn Http Server Off": false "html-server:Turn Http Server Off": false
} }
}, },
"active": "33a80322e8ef2125", "active": "88534f74aecd6c5e",
"lastOpenFiles": [ "lastOpenFiles": [
"Aseets/vimEdit.png", "TagSystem.md",
"Game Dev Common Web.md",
"Today Todo.md",
"Godot GDScript Trick.md",
"Godot 中文教程.md",
"Aseets/TagSystem.drawio.png", "Aseets/TagSystem.drawio.png",
"Aseets/Dev.png",
"Aseets/vimEdit.png",
"Aseets/Procedure.jpeg", "Aseets/Procedure.jpeg",
"Aseets/PDAC2.png", "Aseets/PDAC2.png",
"Aseets/PDAC1.png", "Aseets/PDAC1.png",
@ -158,10 +199,6 @@
"Aseets/exapmle.png", "Aseets/exapmle.png",
"软件工程.md", "软件工程.md",
"Aseets/dev2.png", "Aseets/dev2.png",
"Aseets/Dev.png",
"Godot GDScript Trick.md",
"TagSystem.md",
"Today Todo.md",
"TODO.md", "TODO.md",
"Untitled Kanban.md", "Untitled Kanban.md",
"2023-11-01.md", "2023-11-01.md",
@ -175,7 +212,6 @@
"README.md", "README.md",
"Git.md", "Git.md",
"Godot Shader.md", "Godot Shader.md",
"Godot 中文教程.md",
"TMP.md", "TMP.md",
"lazygit.md", "lazygit.md",
"Linux Setup.md", "Linux Setup.md",

1
Game Dev Common Web.md Normal file
View File

@ -0,0 +1 @@
[开源免费Icon(编辑器开发用)](https://feathericons.com/)

View File

@ -126,7 +126,85 @@ func asyns_tween_property(scene_tree : SceneTree, object:Object, tween_property:
await tween.finished await tween.finished
``` ```
### 使用类似switch的分支语句
基础样例
``` python
extends Node
func _ready():
var x = 3
match x:
1:
print("1")
2:
print("2")
"test":
print("test")
_:
print("others")
```
match多类型 与 match方法样例
``` python
extends Node
func _ready():
var x = "ss"
match x:
1, 2, 3:
print("numbers")
"String1", "String2", "String3":
print("strings")
var default:
print(default)
match test(x):
TYPE_INT:
print("numbers")
TYPE_STRING:
print("strings")
TYPE_FLOAT:
print("floats")
func test(a):
return typeof(a)
```
match 数组与字典样例
```python
extends Node
func _ready():
var x = [1, 0, 3, 4, null, "test"]
match x:
[]:
print("empty")
[1, 2, 3, 4, null, "test"]:
print("case1")
[1, 2, ..]:
print("case2")
[var start, _, 3, ..]:
print(start)
x = {
"name" : "TsaiShuku",
"hobby" : "Sing, dance, rap and dance",
"test" : ""
}
match x:
{}:
print("case1")
{"name" : "TsaiShuk", ..}:
print("case2")
{"name", "hobby"}:
print("case3")
{"test", "hobby": var hobby, ..}:
print(hobby)
{"test": _,"name"}:
print("case4")
```
### 在Godot中使用继承与组合 ### 在Godot中使用继承与组合
- [How You can Easily Make Your Code Simpler in Godot4](https://www.youtube.com/watch?v=74y6zWZfQKk&t=2s) - [How You can Easily Make Your Code Simpler in Godot4](https://www.youtube.com/watch?v=74y6zWZfQKk&t=2s)
- 这个视频挺好的 完美阐述了如何在godot中使用组合的方式替代继承 非常妙 子物体即是组件 - 这个视频挺好的 完美阐述了如何在godot中使用组合的方式替代继承 非常妙 子物体即是组件

View File

@ -1 +1,33 @@
![](./Aseets/TagSystem.drawio.png) ![](./Aseets/TagSystem.drawio.png)
Tag System 主要是基于UE的那一套, 我自己模仿的. 主要就是为了在游戏中使用关键字tag.
在我的分析下, 一共有两个地方需要注意, 一个是TagSystem的配置功能, 需要在配置的时候配置游戏中有那些Tag, 并且配置Tag对应的描述方便调试, 所以还需要实现一个编辑器功能
第二方面主要是在游戏中实际运行时, 他刚可以是字符串, 也可以是TagTree的索引, 从而方便我去修改Tag的名字(这里我需要考量, 怎么做才是好的, 因为我如果单纯的以Idnex 作为索引就会不正确, 我觉得需要用一个ID系统进行处理. 比如每新增一个TAG会给予一个ID).
## Plan
- TagTree
- `TagData root`
- GetByID(int id)
- TagData
- ID 自增且不重复
- Name 名字
- Des 开发者用的描述信息
- `Array[TagData] Child`
- `TagData Parent`
- 编辑器
- RowData: ID + String + Des
- Add Btn 构造新的 RowData
- Remove Btn 删除 RowData
- GetEnum()->Array[ID]
- GetName(int id) -> String
- 保存成什么数据格式?
## Do
- [x] 在我的Godot Tools 项目中成功实现了Tag的编辑器
- [ ] 接下来需要实现的是Tag模块的配置数据的IO
- [ ] 游戏中的Tag ID配置, 能够方便的直接索引到我的Tag配置文件中去
- [ ] 游戏的 Tag 搜索或检索功能

View File

@ -1,3 +1,4 @@
- [ ] 对UE的TagSystem进行分析 - [x] 对UE的TagSystem进行分析 [TagSystem](TagSystem.md)
- [ ] 实现配置编辑器功能 完成50%
- [ ] 类似实现一个检索搜索功能
- [ ] 实现对应代码功能 (抄脚本) - [ ] 实现对应代码功能 (抄脚本)
- [ ] 实现配置编辑器功能