Author Topic: Handling Key input based on current open window?  (Read 1454 times)

Majicpanda

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
Handling Key input based on current open window?
« on: February 12, 2014, 12:15:25 PM »
How do you manage a complex UI where hitting 1 could mean execute skill 1 if you're in combat or it could also mean select party 1 if you're in a party menu?  I have a really complex UI game and I also need to get the focused window so that ESC closes out the most recently opened window, so I assume I'll have to add a hasFocus bool to my CloseWindow script that is checking for ESC and manage a List<> of all the windows that are open....

If there's an easier way I'd love to know.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Handling Key input based on current open window?
« Reply #1 on: February 13, 2014, 12:54:31 AM »
You wouldn't use NGUI for this. Just stick to default Unity functionality.
  1. void Update()
  2. {
  3.     if (Input.GetKeyDown(KeyCode.Alpha1))
  4.     {
  5.         // some logic to determine if it should be one or the other
  6.     }
  7. }