重新实现对象系统

This commit is contained in:
2025-10-18 00:01:56 +08:00
parent 76b715d8d2
commit e77210efc6
6 changed files with 115 additions and 90 deletions

View File

@@ -1,39 +1,30 @@
from electron import Electron
from nucleon import Nucleon
class Atom:
class Atom():
"""
一个静态类, 包含一个原子对象的所有信息:
关联电子 (算法数据)
关联核子 (内容数据)
关联轨道 (策略数据)
关联路径 ()
"""
def __init__(self, ident = ""):
self.ident = ident
self.register = {
"nucleon": None,
"nucleon_path": None,
"electron": None,
"electron_path": None,
"orbital": None,
}
def link(self, key, value):
self.register[key] = value
@staticmethod
def placeholder():
return (Electron.placeholder(), Nucleon.placeholder(), {})
@staticmethod
def advanced_placeholder():
return (
Electron("两只黄鹤鸣翠柳", {}),
Nucleon(
"两只黄鹤鸣翠柳",
{
"note": [],
"translation": "臣子李密陈言:我因命运不好,小时候遭遇到了不幸",
"keyword_note": {
"险衅": "凶险祸患(这里指命运不好)",
"": "早时,这里指年幼的时候",
"": "'',指可忧患的事",
"": "不幸,指丧父"
}
}
),
{
"keydata": {
"note": "笔记",
"keyword_note": "关键词翻译",
"translation": "语句翻译"
},
"testdata": {
"additional_inf": ["translation", "note", "keyword_note"],
"fill_blank_test": ["translation"],
"draw_card_test": ["keyword_note"]
},
"is_new_activation": 0
}
)