Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: tora on January 14, 2015, 09:42:35 PM

Title: OnDragOut() simulating what stickyPress used to do/
Post by: tora on January 14, 2015, 09:42:35 PM
Hello, I am a noob at programming and never really used the stickyPress ability that NGUI had.
I am programming for touch devices with the latest versions of Unity and NGUI
My question is, How do i simulate what stickyPress use to do with OnDragOut() or force the release any button.

   #region NGUIFunction
   void OnPress (bool isPressed)
   {
      if(StaticVariables.isTheGamePaused == false)
      {
         if (isPressed)
         {   //if this is a jumping button
            if(jumpB)
            {   //tell the player to jump
               _pI.Jump ();
            }
            else if(magicB)
            {   //start the magic skill
               _pI.DoMagic ();
            }
            else if(shieldB)
            {   //start shield
               _pI.Shield(isPressed);
            }
         }
         else if(!isPressed && shieldB)
         {   //stop shield
            _pI.Shield(isPressed);
         }

      }
   }

   void OnDragOut()
   {   //Release this button
      //OnPress (false);
   }
   #endregion
Title: Re: OnDragOut() simulating what stickyPress used to do/
Post by: ArenMook on January 15, 2015, 09:02:45 PM
It's an option on the button... "Drag Over" field. UIButton simply adds two functions -- OnDragOver and OnDragOut with one line of code in each. Just check the source code.
Title: Re: OnDragOut() simulating what stickyPress used to do/
Post by: tora on January 18, 2015, 03:48:44 AM
Thank you, I did not see that. The solution was right in my face...  :-[