TH1/Tools/Figma/TH1MainMenuStructure/MAIN_MENU_LOGIC.md

3.2 KiB

TH1 Main Menu Logic Summary

Entry

UIManager.OnGameStart() publishes ShowUIOutsideMenu.

UIEventManagerBinder.HandleShowUIOutsideMenu() receives it and calls:

UIOutsideManager.StartNewTask(new UIOutsideTask(ViewControllerManager.UIOutsideMenuController, evt))

UIOutsideManager.StartNewTask() closes the previous current Outside task, assigns the new task, and opens the controller.

UIOutsideMenuController.OnOpen() calls WindowScript.SetContent(evt) and hides the startup fallback image once.

Main Menu Setup

UIOutsideMenuView.SetContent() performs the runtime setup:

  • Randomizes ButtonList icons by selecting unique GiantType values from the implemented force/chess combinations.
  • Binds click listeners for every menu button.
  • Hides ResumeButton by default, then shows it only when GameArchiveManager.Instance.HasQuickResumeArchive(NetMode.Single) is true.
  • Sets QQHintVersion from ConfigManager.Instance.VersionCfg.CurVersionInfo.FullVersion.
  • Configures the Traditional Chinese Discord hint.
  • Plays the Main BGM through AudioManager.Instance.PlayMusic("Main", 1f, 2f, true).

Button Flow

Button Runtime action
StartButton Publishes ShowUIOutsideSelect.
ResumeButton Loads the quick single-player archive, opens loading UI, calls Main.Instance.ResumeMatch(record, preread), then hides menu/all outside UI.
MultiplayButton Publishes ShowUIOutsideMultiplay.
LibraryButton Publishes ShowUIOutsideLibrary.
HistoryButton Publishes ShowUIOutsideHistory.
TutorButton Publishes ShowUIOutsideTutor.
StoryButton Publishes ShowUIOutsideStory; binder opens the independent Story controller through UIOutsideManager.OpenStory().
TransReportButton Publishes ShowUIGlobalBugReport.
QuestionnaireButton Found or runtime-created, then publishes ShowUIOutsideQuestionnaire.
AnnouncementButton Opens AnnouncementPanel locally.
AboutButton Opens AboutPanel locally.
SettingButton Opens SettingPanel locally.
ShutdownButton Opens ShutdownPanel locally.

Local Child Panels

AnnouncementPanel:

  • Close by close button or blocking area.
  • Builds version tabs from ConfigManager.Instance.VersionCfg.Versions.
  • Shows selected version content through multilingual text.

AboutPanel:

  • Displays current version.
  • Binds external links: Bilibili, website, X, YouTube, Discord.
  • Builds staff rows from Table.Instance.StaffDataAssets.StaffList.

SettingPanel:

  • Initializes LanguageOptionGroup to the current language.
  • Treats ZH, TDZH, JP, EN, KR as primary language options.
  • Uses option index 5 for MoreLanguageModule.
  • ManageButton hides the local setting panel and publishes ShowUIOutsideMod.

ShutdownPanel:

  • Cancel and block close the panel.
  • Confirm calls Application.Quit() in build or stops Play Mode in editor.

Important UI Layer Behavior

Most Outside screens use UIOutsideManager.StartNewTask(), so opening another normal Outside screen closes the previous one.

Loading is separate from the current Outside task.

Story, Invited, and Wiki are independent controllers in UIOutsideManager and do not follow the ordinary single current-task replacement path.