Author Topic: Display tooltip for a disabled box collider  (Read 2520 times)

slims

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Display tooltip for a disabled box collider
« on: May 04, 2014, 06:07:29 PM »
My game is a turn based game where the player has control of various units, each of which have abilities that can be used by pressing corresponding buttons.  Hovering over the buttons will display a tool tip describing what the ability does.  When it's not a player's turn, I disable the ability buttons, so that they kind of grey out.  However, I still want the player to be able to view the tooltips for the ability buttons when it's not their turn.

I've tried adding another box collider on top of each button that never gets deactivated that serves at the collider for the tooltip, however, you can't have box colliders on top of each other since only the top one will ever receive events.

Does anyone know of a way I can achieve what I'm trying to do here in a non-complicated way using existing NGUI code? Specifically, always be able to view tooltips when hovering over a button, regardless of whether or not the button is disabled.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Display tooltip for a disabled box collider
« Reply #1 on: May 05, 2014, 10:24:00 PM »
Instead of disabling the buttons, just change their default color so they look disabled. Also in your On Click notifications check to see if the user can actually perform the action or not.

I frequently do this in other places. For example in Windward, the action bar abilities had cooldown timers on them, and although the buttons were technically not clickable, I didn't use UIButton.isDisabled on them. Instead I had an 'if' statement that would activate the ability if possible, or play an error sound if it's not.