TraitPanelUI

Overview

Detail panel for the selected trait. Shows title, description, icon, and swaps the description panel frame based on the trait’s cost type. Integrates with I2 Localization and updates when the selection changes.

Serialized

  • ChairmanTraitVariable selectedTrait
  • TraitNode startingSelectedTrait
  • UI: TextMeshProUGUI titleText, descText, Image traitIcon
  • Frame: Image traitDescriptionPanel, and sprites for Logistics (Mobster), Influence (Schemer), Authority (Subterfuge).

Flow

  • Start()
    • selectedTrait.Changed.Register(UpdateUI) and LocalizationManager.OnLocalizeEvent += Localize.
    • Seed selection from startingSelectedTrait.TraitData.
  • UpdateUI(ChairmanTrait t)
    • Set raw titleText, descText, and traitIcon.sprite from t.
    • Choose frame by t.costType:
      • AFFINITY_MOBSTER → Logistics frame
      • AFFINITY_SCHEMER → Influence frame
      • AFFINITY_SUBTERFUGE → Authority frame
    • Call Localize() to swap to localized strings.
  • Localize()
    • Uses t.GetLocalizedTitle() and t.GetLocalizedDesc().
  • OnDestroy() — unregisters both handlers.