public UGUISlider(LayoutScript script)
     : base("Slider")
 {
     mScript    = script;
     mDirection = DRAG_DIRECTION.DD_HORIZONTAL;
     mMode      = SLIDER_MODE.SM_FILL;
 }
Beispiel #2
0
 public override void resetProperty()
 {
     base.resetProperty();
     // mScript不重置
     //mScript = null;
     mBackground          = null;
     mForeground          = null;
     mThumb               = null;
     mSliderStartCallback = null;
     mSliderEndCallback   = null;
     mSliderCallback      = null;
     mDirection           = DRAG_DIRECTION.HORIZONTAL;
     mMode = SLIDER_MODE.FILL;
     mOriginForegroundSize     = Vector2.zero;
     mOriginForegroundPosition = Vector3.zero;
     mSliderValue = 0.0f;
     mDraging     = false;
 }
Beispiel #3
0
 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);
         }
     }
 }
 public void setSliderMode(SLIDER_MODE mode)
 {
     mMode = mode;
 }
Beispiel #5
0
 public UGUISlider(LayoutScript script)
 {
     mScript    = script;
     mDirection = DRAG_DIRECTION.HORIZONTAL;
     mMode      = SLIDER_MODE.FILL;
 }