main
Yogi 2023-11-02 17:16:48 +08:00
parent f7ad436ebb
commit db9a952f40
4 changed files with 159 additions and 17 deletions

View File

@ -4,20 +4,55 @@
"type": "split",
"children": [
{
"id": "042c379e06e2a039",
"id": "1a16c3ad5e0f8c65",
"type": "tabs",
"dimension": 50.31645569620253,
"children": [
{
"id": "5c86638fbbec30d3",
"id": "88534f74aecd6c5e",
"type": "leaf",
"state": {
"type": "image",
"type": "markdown",
"state": {
"file": "Aseets/Dev.png"
"file": "TagSystem.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": "source",
"source": false
}
}
},
{
"id": "2aa94bc5067c8162",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Godot GDScript Trick.md",
"mode": "preview",
"source": false
}
}
}
],
"currentTab": 1
}
],
"direction": "vertical"
@ -83,7 +118,7 @@
"state": {
"type": "backlink",
"state": {
"file": "Aseets/Dev.png",
"file": "Godot GDScript Trick.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -100,7 +135,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "Aseets/Dev.png",
"file": "Godot GDScript Trick.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
@ -123,7 +158,7 @@
"state": {
"type": "outline",
"state": {
"file": "Aseets/Dev.png"
"file": "Godot GDScript Trick.md"
}
}
}
@ -131,7 +166,8 @@
}
],
"direction": "horizontal",
"width": 297.5
"width": 297.5,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
@ -147,10 +183,14 @@
"html-server:Turn Http Server Off": false
}
},
"active": "33a80322e8ef2125",
"active": "2aa94bc5067c8162",
"lastOpenFiles": [
"Aseets/vimEdit.png",
"Godot 中文教程.md",
"Today Todo.md",
"TagSystem.md",
"Aseets/TagSystem.drawio.png",
"Aseets/Dev.png",
"Aseets/vimEdit.png",
"Aseets/Procedure.jpeg",
"Aseets/PDAC2.png",
"Aseets/PDAC1.png",
@ -158,10 +198,7 @@
"Aseets/exapmle.png",
"软件工程.md",
"Aseets/dev2.png",
"Aseets/Dev.png",
"Godot GDScript Trick.md",
"TagSystem.md",
"Today Todo.md",
"TODO.md",
"Untitled Kanban.md",
"2023-11-01.md",
@ -175,7 +212,6 @@
"README.md",
"Git.md",
"Godot Shader.md",
"Godot 中文教程.md",
"TMP.md",
"lazygit.md",
"Linux Setup.md",

View File

@ -126,7 +126,85 @@ func asyns_tween_property(scene_tree : SceneTree, object:Object, tween_property:
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中使用继承与组合
- [How You can Easily Make Your Code Simpler in Godot4](https://www.youtube.com/watch?v=74y6zWZfQKk&t=2s)
- 这个视频挺好的 完美阐述了如何在godot中使用组合的方式替代继承 非常妙 子物体即是组件

View File

@ -1 +1,29 @@
![](./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

View File

@ -1,3 +1,3 @@
- [ ] 对UE的TagSystem进行分析
- [ ] 对UE的TagSystem进行分析 [TagSystem](TagSystem.md)
- [ ] 实现对应代码功能 (抄脚本)
- [ ] 实现配置编辑器功能