Skip to content

refactor(ui): extract close button construction out of TouchUIBindings #144

@f1cklepickle

Description

@f1cklepickle

Why

  • TouchUIBindings is a bindings class responsible for wiring UI elements to input events. It currently also contains a factory method CreateCloseButton that constructs and styles a button GameObject at runtime.
  • Factory/construction logic does not belong in a bindings class. This violates single responsibility and makes TouchUIBindings harder to test and extend.
  • Flagged during the code audit of feat/android-touch-controls.

Proposed Change

  • Extract CreateCloseButton into a dedicated CloseButtonFactory (or similar small utility) responsible solely for constructing the button GameObject
  • TouchUIBindings calls the factory rather than building the button inline
  • No behaviour change — this is a pure structural refactor

Acceptance Criteria

  • TouchUIBindings contains no GameObject construction or styling logic
  • Close button construction lives in its own class with a clear, single responsibility
  • TouchUIBindingsTests passes unchanged
  • Upgrade panel close button still appears and functions correctly in MainPrototype

Testing / Validation

  • Manual:
    • Open MainPrototype, open upgrade panel, confirm close button renders and dismisses the panel
  • Automated:
    • EditMode: TouchUIBindingsTests (must stay green)
    • PlayMode: N/A

Context (Optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtCleanup, refactor, or restructuring of code/assetsuiUI menus, HUD, game over screen changes.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions