Author Topic: why compare function return the same value  (Read 2835 times)

loverains

  • Guest
why compare function return the same value
« on: September 17, 2012, 01:07:17 AM »
in updatemanager.cs,
   static int Compare (UpdateEntry a, UpdateEntry b)
   {
      if (a.index < b.index) return 1;
      if (a.index > b.index) return 1;
      return 0;
   }
this is comparer for sorting,why return the same value on differrent situation?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: why compare function return the same value
« Reply #1 on: September 17, 2012, 03:29:42 AM »
Bug! Thanks for pointing it out.

loverains

  • Guest
Re: why compare function return the same value
« Reply #2 on: September 17, 2012, 03:40:50 AM »
in uibuttonkeys.cs

case KeyCode.Tab:
            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
               if (selectOnLeft != null) UICamera.selectedObject = selectOnLeft.gameObject;
               else if (selectOnUp != null) UICamera.selectedObject = selectOnUp.gameObject;
               else if (selectOnDown != null) UICamera.selectedObject = selectOnDown.gameObject;
               else if (selectOnRight != null) UICamera.selectedObject = selectOnRight.gameObject;
            }
            else
            {
               if (selectOnRight != null) UICamera.selectedObject = selectOnRight.gameObject;
               else if (selectOnDown != null) UICamera.selectedObject = selectOnDown.gameObject;
               else if (selectOnUp != null) UICamera.selectedObject = selectOnUp.gameObject;
               else if (selectOnRight != null) UICamera.selectedObject = selectOnRight.gameObject;
            }
            break;

i think this one also a bug,we should replace the last selectonright to left

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: why compare function return the same value
« Reply #3 on: September 17, 2012, 03:43:55 AM »
Good eye.

loverains

  • Guest
Re: why compare function return the same value
« Reply #4 on: September 17, 2012, 03:54:32 AM »
i'm learning unity programming from ur ngui and ship war package,really great works.