12 KiB
Codely Structured Memories
User
Feedback
- [2026-07-23 10:59:26] User wants ALL UI text to translate in real-time when switching languages, including: static Text, Dropdown options, InputField placeholders, Toggle labels, popup/prompt windows, 3D text, VR controller tooltips, and operation messages. Any text that doesn't update on language switch is a bug. Why: user has tested every panel and reported missing translations repeatedly. How to apply: when adding any new UI text or popup, always use LocalizationManager.Get/Format/SetFormatted instead of raw strings. For popups with dynamic content, pass key+args (not pre-formatted string) so LanguageChanged can re-translate.
- [2026-07-27 10:16:48] User does NOT want AI-generated terrain textures to replace existing good ones. Why: AI-generated "seamless" textures had visible seams/tiling artifacts, and user felt replacing all existing textures was unnecessary when original ones were fine. How to apply: For terrain texture optimization, keep existing textures and only adjust parameters (tileSize, smoothness, splatmap distribution, basemap distance). Only generate new textures if user explicitly asks for a specific new texture.
- [2026-07-30 15:10:58] IconBase.SetName receives names with "(N)" suffix for duplicate vehicles (e.g. "5吨火炮拆装车(2)"). Must strip suffix, translate base name via LocalizationManager.Get(), then re-append suffix. Subscribe to LanguageChanged for real-time update. Why: user reported identical vehicles only translate first one. How to apply: any UI component displaying vehicle/equipment names must handle the "(N)" duplicate suffix pattern.
- [2026-07-31 10:44:19] When editing 想定文件 (scenario files) in teacher panel, MUST deep-copy selectRecord before passing to editor panel. Why: selectRecord is a reference type; passing it directly means edits modify the original object, polluting subsequent file selections and subject dispatches. How to apply: In TeacherMainPanel.EditorFile(), serialize→deserialize selectRecord to create independent copy before passing to Subject1EditorCtrl/Subject2EditorCtrl.Change().
- [2026-07-31 11:27:02] Old operation messages recorded before localization system (pre-InjectOperateMsgLocalized) lack the \x01 prefix. LocalizeOperateMsg now falls back to Get() for non-prefixed messages so they translate if the key exists in Localization.xml. Why: user reported history detail panel showing Chinese after language switch. How to apply: any old stored text that should translate but wasn't recorded with InjectOperateMsgLocalized will now attempt Get() translation as fallback.
- [2026-07-31 15:49:27] BasePanel is NOT a MonoBehaviour — Unity's OnEnable/OnDisable are NOT called. Must use BasePanel's own virtual methods: OnStart() (called every Push), OnDisable() (called when covered), OnDestroy() (called on Pop). For LanguageChanged subscription in BasePanel subclasses, subscribe in InitEvent() (first time only) + OnStart() (every Push), unsubscribe in OnDisable() + OnDestroy(). Why: RecordDetailPanel lost translation subscription after Pop→Push cycle because InitEvent only runs once and Unity lifecycle methods don't fire on non-MonoBehaviour classes.
- [2026-08-03 11:58:13] LocalizationManager was forcing verticalOverflow=Overflow on all Text components when applying fonts, overriding prefab's Truncate setting. Removed all 3 forced verticalOverflow assignments (in Localize(Text), Localize(Dropdown), Localize(InputField)). Must preserve prefab's original verticalOverflow setting. Why: user set Truncate on Image_person2 prefab Text but runtime showed Overflow because LocalizationManager overwrote it during font application.
- [2026-08-03 17:15:04] PromptTextCtrl now has SetPromptLocalized(key, color, time, args) for real-time translation during the 3-second display window. Existing SetPrompt(msg, ...) calls with pre-translated strings do NOT update on language switch. Must use SetPromptLocalized when the prompt should re-translate while still visible. Why: user reported planning prompt not translating during 3s window. How to apply: replace SetPrompt(LocalizationManager.Get("key"), color, time) with SetPromptLocalized("key", color, time). For format strings: SetPromptLocalized("存在未规划的车辆{0}!", color, time, carName).
- [2026-08-04 11:12:54] When editing scenario files (想定文件), InitCarIcon() must RemoveAll() then CreatChildren() to rebuild equipment icons from scratch — NOT SetInitMsg() which only updates existing icons. Panel is reused across sessions so stale icons from previous edits cause UI mismatch. Why: user reported equipment list UI different when editing saved scenario vs creating new one.
- [2026-08-04 14:31:17] TerrainChange must use ORIGINAL terrain names (from DB) not translated dropdown text to find _Map resources in SAMap. OnLanguageChanged replaces dropdown text with translations but TerrainChange needs original name. SubjectEditorBase now stores terrainOriginalNames[] array. Also InitCarIcon must NOT call CreatChildren with EquipIconCreatOver callback — that creates infinite recursion (EquipIconCreatOver calls InitCarIcon). Use SetInitMsg instead.
Project
-
[2026-07-23 10:59:21] User is building a multi-language localization system (Chinese/English/French/Russian) for a Unity 2019.4 military equipment repair simulation training app. Translations are stored in
Assets/StreamingAssets/Localization.xml(external XML, ~470 entries). Code fallback inLocalizationManager.cs. Key patterns:SetFormatted()for format strings,InjectOperateMsgLocalized()for operation records,IconBase.SetName()wrapsLocalizationManager.Get(),PromptWindowInitDatahas key+args constructor for real-time translation of popups. -
[2026-07-27 12:10:20] 海岛.unity terrain: custom
Custom/PuzzleTerrainshader (modified to single_MainTex), 9×9 satellite tiles stitched intoMountRainier_Stitched.png(8192×8192, DXT1). PermissibleArea MeshRenderer must be disabled (False) in all terrain scenes (山地/海岛/沙漠) — the green start area is shown by UI prefabImage_startArea, NOT by the 3D TOUMING material. Enabling MeshRenderer breaks it. Tile arrangement: x=0 west→x=8 east; y=0 south→y=8 north (NO Y-flip). Terrain registered in project: SQLiteAssetBundletable (Type=3),SAMap.txt(海岛=OutAssets/AB/Scenes/海岛.ab,海岛_Map=OutAssets/Map/海岛_Map.png), localization added. NavMesh baked toAssets/Scenes/海岛/NavMesh.asset. Map images:海岛_Map.png+海岛_temp.pngsaved as JPG (RGB24, ~13MB, marker at PermissibleArea pos). Scene structure mirrors 山地 (same root objects: Directional Light, Terrain+water children, Canvas, TooltipCanvas, EventSystem, CameraPos, PermissibleArea, VRCameraPos+VRTK).StudentWaitingPanel.cshardcoded "山地" fixed to use dynamicterrainName. -
[2026-07-24 18:03:18] Student app (VirtualRepairClient) is at
test/VirtualRepairClient_Data/. Built 2022, but DLL/resources can be hot-swapped. AB files are atStreamingAssets/OutAssets/AB/Scenes/. Student app loads scenes from AB, UI prefab from baked resources.assets. To deploy code fixes: copyLibrary/ScriptAssemblies/Assembly-CSharp.dlltotest/VirtualRepairClient_Data/Managed/. To deploy scene fixes: rebuild AB withBuildPipeline.BuildAssetBundlesand copy to both project's and student app's StreamingAssets. Dropdown options now built at runtime in StudentSub1EditorPanel.Change() to avoid dependency on prefab option order. -
[2026-07-27 11:06:13] New terrain scene registration process (e.g. 沙漠): 1) Set AssetBundle name via
AssetImporter.assetBundleName, 2) Build AB withBuildPipeline.BuildAssetBundles(output file has no .ab extension - rename to match SAMap path), 3) Add toStreamingAssets/SAMap.txt(both沙漠=OutAssets/AB/Scenes/沙漠.aband沙漠_Map=OutAssets/Map/沙漠_Map.png), 4) Add to SQLiteVirtualRepairSql.dbtableAssetBundle(Name, Type=3 for 地形, FilePath, ParentName=NULL) — use C# SqliteCommand with parameters, NOT sqlite3 CLI (CLI mangles Chinese chars), 5) Add localization entry toStreamingAssets/Localization.xml, 6) Generate map image (top-down terrain render with hillshade), 7) Copy AB + map + SAMap.txt + db + Localization.xml totest/VirtualRepairClient_Data/StreamingAssets/. Terrain dropdown reads fromDBManager.Instance.GetABNames(ABType.地形). -
[2026-07-29 09:49:08] Map images for 海岛 and 沙漠 must be 8192×8192 (matching 山地/MyDragMap expectation). Map must include the green PermissibleArea rectangle baked in (matching 山地's satellite map which naturally includes it). For 沙漠: generate from heightmap+splatmap with actual texture colors sampled via RenderTexture (not guessed). For 海岛: use satellite texture
MountRainier_Stitched.pngas base. PA position:mapX = worldX / terrainSize * res,mapY = worldZ / terrainSize * res(NO Y-flip). PA rotation on map:360 - paAngle(matching UI code360 - permissibleArea.angle). -
[2026-07-29 16:40:45] Terrain scenes registered: 山地 (original AB, old path), 海岛 (OutAssets/AB/Scenes/海岛.ab), 沙漠 (replaced 城市), 丘陵 (replaced 平原). Database
AssetBundletable Type=3 now has: 山地, 丘陵, 沙漠, 海岛. SAMap.txt has all 4 terrain AB + Map entries. Localization.xml has all 4 terrain names + map-related strings. 丘陵 terrain: 5 layers (forest ground/grass/dirt/rock/dark sand), 3 tree prototypes (poplar×2 + tree6), 2 grass details, NavMesh baked manually via Navigation window (C# API NavMeshBuilder.BuildNavMesh not available in codely bridge 1.0.73+). -
[2026-07-30 15:09:55] Student/teacher apps are at
学员/and教师/underC:\Users\27228\Desktop\0520Client\(NOTtest/). Server address config:StreamingAssets/TcpConfig/ServerAdress.txt=10.0.0.73,8087. Machine has 2 IPv4: 10.0.0.73 (physical) + 172.20.144.1 (WSL virtual). FixedNetHelper.GetAddressIPV4()to prefer 10.x/192.168.x over 172.x virtual adapters. Deploy DLL+XML to BOTH教师/and学员/directories. -
[2026-07-31 09:26:47] Desert (沙漠) terrain appears too bright/yellow at runtime vs editor. Root cause: Enviro weather system ("晴") deletes Directional Light and uses its own strong sun lighting. Desert sand textures are light-colored (avg RGB ~198,164,130), so under Enviro's full sun they look washed out. Mountain (山地) looks fine because its textures are darker (green/brown). This is a visual/aesthetic difference, not a code bug. EnviroSkyRendering + EnviroPostProcessing are added at runtime by MyEnviroManager.ChangeFocus to Camera.main. Camera prefab from Resources/GOPrefab/Camera.prefab does NOT have Enviro components - they're added dynamically.
-
[2026-07-31 10:44:15] Terrain names finalized: 山地 renamed to 林地 (Forest/Forêt/Лес). Scene file: Assets/Scenes/林地.unity (was 山地.unity), NavMesh folder: Assets/Scenes/林地/, AB name: 林地, DB Name: 林地. All 4 terrains: 林地, 丘陵, 沙漠, 海岛. Old names (山地/平原/城市) completely removed from DB, SAMap, Localization.
-
[2026-08-04 10:25:58] Continuous training flow (编队行军→修理所展开): SubStart() is called when entering Sub2 from Sub1 continuity. Cars may not be created yet when GetCarList() is accessed. Must fallback to CameraPos when carList is empty. AppraiseSliderCtrl pointName and WaitResultPanel appraiseLevel must use LocalizationManager.Get() for translation. EditorAppraiser.CheckAreaDistance/CheckAreaToWaterDistance must translate area names via Get() before Format().
-
[2026-08-04 11:53:15] EditorContentCtrl now uses unified sprite (carIcon.png in Resources/) for ALL equipment icons instead of loading individual _Tex sprites. GetUnifiedSprite() loads via Resources.Load("carIcon"). If null, falls back to original needSprite logic. Subject2EditorCtrl.CreatOnMapCar also falls back to equipContent.children sprites when _Tex not found. carIcon.png must be in Resources/ with textureType:8 (Sprite) in .meta. New Resources assets require exe rebuild to include in resources.assets for student/teacher apps.