Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bunni

Pages: [1]
1
First, I just want to say this is a really neat package.  I am definitely considering upgrading from the free version after I learn the ins and outs of the code more thoroughly.  Right now I am trying to implement two "left" and "right" buttons that scroll a panel when they are moused over.  I seem to have the scrolling part right, but I read that since NGUI does not continuously fire events (from this thread), I will have to assign isOver to a local variable which I named "pressed". 
  1. public class MouseOverScroll : UIButton {
  2.  
  3.         public enum Direction{Left, Right};
  4.         public Direction dir = Direction.Left;
  5.         public GameObject dragpanel;
  6.         UIDraggablePanel dps;
  7.         public bool pressed = false;
  8.  
  9.         void Start () {
  10.                 dps = dragpanel.GetComponent<UIDraggablePanel> ();
  11.         }
  12.         void Update() {
  13.                 if(pressed) {
  14.                         if (dir == Direction.Left) {
  15.                                 dps.SendMessage("Scroll", 0.5f);
  16.                         }
  17.                         else if (dir == Direction.Right) {
  18.                                 dps.SendMessage("Scroll", -0.5f);
  19.                         }
  20.                 }
  21.         }
  22.         public override void OnHover (bool isOver)
  23.         {
  24.                 base.OnHover (isOver);
  25.                 pressed = isOver;
  26.         }
  27. }
  28.  

However this started giving me the error: "The same field name is serialized multiple times in the class or its parent class.  This is not supported: Base(Monobehaviour) pressed".  I guess it doesn't like what I am doing in void OnHover(), but why?

Pages: [1]