Add prototype gameplay loop with character/battlefield assets and server game APIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
udx
2026-10-20 18:50:00 +08:00
co-authored by Cursor
parent 79369e4473
commit 6c64210331
833 changed files with 998079 additions and 1042 deletions
+101
View File
@@ -0,0 +1,101 @@
"""Remove retired theme source files. Unity Assets are deleted separately via Pipeline."""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def edit(rel, fn):
path = ROOT / rel
text = path.read_text(encoding='utf-8')
path.write_text(fn(text), encoding='utf-8')
def remove(rel):
path = (ROOT / rel).resolve()
assert path.is_relative_to(ROOT.resolve()) and not path.is_relative_to((ROOT / 'AIClient/Assets').resolve())
if not path.exists():
return
if path.is_dir():
for child in sorted(path.rglob('*'), key=lambda p: len(p.parts), reverse=True):
child.unlink() if child.is_file() else child.rmdir()
path.rmdir()
else:
path.unlink()
def main():
# Exact retired source paths; no wildcard deletion or Assets/.meta manipulation.
for rel in [
'Doc/UIPrefabCreater/UI_MainHUD_Studio.json', 'Doc/UIPrefabCreater/UI_ConfirmDialog_Studio.json',
'Doc/UIPrefabCreater/UI_MainHUD_Mint.json', 'Doc/UIPrefabCreater/UI_ConfirmDialog_Mint.json',
'Doc/UIPrefabCreater/UI_ThemeSwitcher.json',
'Doc/Config/version.studio.example.json', 'Doc/Config/version.mint.example.json',
'Doc/Design/UI/Studio', 'Doc/Design/UI/Mint', 'Doc/Design/UI/mint_sources.json',
'Doc/Design/UI/Home/UI_MainHUD_Studio.png', 'Doc/Design/UI/Home/UI_MainHUD_Mint.png',
'TempResource/commonv30_reference_sheet.png',
'AIClient/AgentScripts/BuildStudioUi.cs', 'AIClient/AgentScripts/BuildMintUi.cs', 'AIClient/AgentScripts/BuildUiAccess.cs',
'Tools/generate_studio_ui.py', 'Tools/generate_mint_ui.py', 'Tools/generate_mint_docs.py', 'Tools/generate_theme_switcher.py',
]:
remove(rel)
def generator(s):
if "def generate(theme='candy'):" not in s:
return s
start = s.index("def generate(theme='candy'):")
end = s.index(' nodes, events = [], []', start)
s = s[:start] + '''def generate():
theme = 'candy'
name = 'UI_MainHUD'
panel, primary, secondary, ink, muted, light = ('ui_panel_content', 'btn_primary_normal', 'btn_secondary_normal', '#5A4632', '#687C8C', '#F6F8FF')
''' + s[end:]
s = s.replace("theme == 'candy' and sprite", "sprite")
s = s.replace("panel_color = '#FFFFEF' if theme == 'mint' else '#FFFFFF'", "panel_color = '#FFFFFF'")
s = s.replace("primary_color = '#32DE92' if theme == 'mint' else '#FFFFFF'", "primary_color = '#FFFFFF'")
s = s.replace("'ui_panel_header' if theme == 'candy' else panel", "'ui_panel_header'")
s = s.replace("light if theme == 'candy' else ink", "light")
s = s.replace("theme == 'candy'", 'True')
s = s.replace("key == 'Home' and True", "key == 'Home'")
s = s.replace("folder = 'Home' if s.startswith('home_') else 'Mint' if s.startswith('mint_') else 'Studio' if s.startswith('studio_') else 'Common'", "folder = 'Home' if s.startswith('home_') else 'Common'")
s = s.replace(" for theme in ['candy', 'studio', 'mint']:\n generate(theme)", " generate()")
return s
edit('Tools/generate_home_ui.py', generator)
edit('AIClient/AgentScripts/BuildHomeUi.cs', lambda s: s.replace('static readonly string[] Names = { "UI_MainHUD", "UI_MainHUD_Studio", "UI_MainHUD_Mint" };', 'static readonly string[] Names = { "UI_MainHUD" };').replace('built 3 home HUD prefabs from JSON.', 'built Candy home HUD prefab from JSON.').replace('Rendered 3 theme previews, a tall-screen preview and reconnect preview:', 'Rendered Candy, tall-screen and reconnect previews:'))
def manager(s):
if ' /// <summary>预加载全部主题面板' not in s:
return s
start = s.index(' /// <summary>预加载全部主题面板')
end = s.index(' public void Close(', start)
return (s[:start] + s[end:]).replace(' public bool IsSwitchingTheme { get; private set; }\n', '')
edit('AIClient/Assets/HotUpdate/Scripts/UI/UiManager.cs', manager)
edit('AIClient/Assets/AOT/Scripts/Boot/BootSettings.cs', lambda s: s.replace('业务 UI 主题:candy(糖果风)/ studio(深绿工作室)/ mint(奶油薄荷绿);version.json 的 uiTheme 非空时覆盖。重新启动生效。', '业务 UI 当前仅支持 candy(糖果风);保留该字段兼容旧配置,其他值回退到 Candy。'))
edit('AIClient/Assets/AOT/Scripts/Boot/BootContext.cs', lambda s: s.replace('启动时选定的业务 UI 主题:candy / studio / mint。', '业务 UI 当前仅使用 candy;字段保留用于旧启动配置兼容。'))
edit('AIClient/Assets/AOT/Scripts/Patch/VersionInfo.cs', lambda s: s.replace('空值沿用 BootSettings;candy / studio / mint,重新启动生效。', '兼容旧版本字段;当前 UI 仅支持 candy,其他主题值回退到 Candy。'))
edit('AIClient/Assets/Editor/UI/SetupUiBundleCollector.cs', lambda s: s.replace('把所有主题的 UI Prefab 收进 Art', '把 Candy UI Prefab 收进 Art').replace('Candy + Studio + Mint UI themes', 'Candy UI').replace('Art/UI collects all three themes by prefab name', 'Art/UI collects Candy UI by prefab name'))
def overview(s):
if '并列主题:' not in s:
return s
start = s.index('并列主题:')
end = s.index('## 2.', start)
return s[:start] + '当前仅使用 **Candy 糖果风**。Studio / Mint 已按用户要求删除;保留旧 `uiTheme` 字段的读取兼容,其他值回退 Candy。当前主界面继续走 JSON→Prefab,详见 `Doc/Design/UI/UI_Themes.md`。\n\n' + s[end:]
edit('Doc/UI_AutoGen_Overview.md', overview)
def project(s):
if '## 并列 UI 主题' not in s:
return s
start = s.index('## 并列 UI 主题')
end = s.index('## 与图集方案关系', start)
return s[:start] + '## UI 风格\n\n- 当前仅使用 Candy 糖果风;Studio / Mint 主题与停用的切换入口已删除。\n- `BootSettings.UiTheme` / 远程 `version.json.uiTheme` 保留用于旧配置兼容,其他值回退 Candy。\n- 业务按逻辑名异步打开:`UiManager.OpenAsync`。\n- UI Prefab 收集进 Art/UI,图片与字体作为依赖进入资源包。\n\n' + s[end:]
edit('Doc/Rule/UnityUIProject.md', project)
generation = ROOT / 'Doc/Design/UI/Home/home_generation.json'
doc = json.loads(generation.read_text(encoding='utf-8'))
doc['ui']['prefabs'] = ['UI_MainHUD']
doc['validation']['previews'] = ['UI_MainHUD.png', 'UI_MainHUD_tall.png', 'UI_MainHUD_reconnect.png']
doc['themeRemoval'] = {'date': '2026-10-14', 'activeTheme': 'candy', 'removed': ['Studio', 'Mint', 'ThemeSwitcher'], 'note': 'Earlier multi-theme checks are historical; current builder only generates Candy.'}
generation.write_text(json.dumps(doc, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
print('Removed retired source/preview/config files; updated Candy-only generation and runtime compatibility.')
if __name__ == '__main__':
main()