Exemple #1
0
 public void setBackground(myUGUIObject background)
 {
     mBackground = background;
     mBackground.setOnMouseDown(onMouseDown);
     mBackground.setOnScreenMouseUp(onScreenMouseUp);
     mBackground.setOnMouseMove(onMouseMove);
     mBackground.setOnMouseStay(onMouseStay);
     mScript.registeCollider(mBackground, true);
 }
 public void init(myUGUIObject background, myUGUIObject foreground, myUGUIObject thumb = null, SLIDER_MODE mode = SLIDER_MODE.FILL)
 {
     mName       = "UGUISlider";
     mMode       = mode;
     mBackground = background;
     mForeground = foreground;
     mThumb      = thumb;
     if (mThumb != null && mThumb.getParent() != mForeground)
     {
         logError("Foreground must be parent of Thumb");
         return;
     }
     if (mMode == SLIDER_MODE.SIZING)
     {
         mOriginForegroundSize     = mForeground.getWindowSize();
         mOriginForegroundPosition = mForeground.getPosition();
         if (mBackground == null)
         {
             logError("Background can not be null while slider mode is SIZING");
             return;
         }
         if (mForeground.getParent() != mBackground)
         {
             logError("Background must be parent of Foreground");
             return;
         }
     }
     if (mBackground != null)
     {
         mBackground.setOnMouseDown(onMouseDown);
         mBackground.setOnScreenMouseUp(onScreenMouseUp);
         mBackground.setOnMouseMove(onMouseMove);
         if (mBackground.getCollider() != null)
         {
             mScript.registeCollider(mBackground);
         }
     }
 }