Esempio n. 1
0
        public void setPercent(float value)
        {
            fillBarBackground.setCenter(base.getCenterX(), base.getCenterY());
            fillBarBackground.setSize(base.getWidth() - (edgeSize * 2.0f), base.getHeight() - (edgeSize * 2.0f));

            percent = value;

            if (fillBar == null)
            {
                fillBar           = new DrawRectangle();
                fillBar.fillColor = Color.Chartreuse;
                fillBar.edgeColor = Color.FromArgb(0, 0, 0, 0);
            }

            if (percent <= 0.0f)
            {
                percent = 0.0f;
                fillBar.rectangleVisible = false;
            }
            else
            {
                if (percent > 1.0f)
                {
                    percent = 1.0f;
                }
                fillBar.rectangleVisible = true;
            }

            float bufferSizeX = edgeSize;
            float bufferSizeY = edgeSize;

            float barSizeX = base.getWidth() - (bufferSizeX * 2.0f);
            float barSizeY = base.getHeight() - (bufferSizeY * 2.0f);

            if (fillOnX)
            {
                barSizeX *= percent;

                fillBar.setWidth(barSizeX);
                fillBar.setHeight(barSizeY);

                fillBar.setCenterX(base.getCenterX() - (base.getWidth() * 0.5f) + bufferSizeX +
                                   (barSizeX * 0.5f));
                fillBar.setCenterY(base.getCenterY());
            }
            else
            {
                barSizeY *= percent;

                fillBar.setWidth(barSizeX);
                fillBar.setHeight(barSizeY);

                fillBar.setCenterX(base.getCenterX());
                fillBar.setCenterY(base.getCenterY() + (base.getHeight() * 0.5f) - bufferSizeY -
                                   (barSizeY * 0.5f));
            }
        }
Esempio n. 2
0
 protected void setWebPositionSize()
 {
     if (hostSet != null && web != null && hangTop != null)
     {
         //updating web position and length
         web.setCenterX((hangTop.X + base.getCenterX()) / 2);
         web.setCenterY((hangTop.Y + base.getCenterY()) / 2);
         web.setWidth(1f);
         web.setHeight(dropStart.Y - base.getCenterY() + (hostSet.getRowSpacing() * (dropDistance - 1)));
         web.visible = true;
     }
 }
Esempio n. 3
0
 /**
  * Will scale this panel by the given amount in world coordinates
  * @param move the amount that this panel will be moved by
  * @param affectSubPanels If TRUE, all of this panels subPanels position settings will be set to match this Panels position settings.
  */
 public virtual void movePanel(float Xincrement, float Yincrement, bool effectSubPanels)
 {
     Background.setCenterX(Background.getCenterX() + Xincrement);
     Background.setCenterY(Background.getCenterY() + Yincrement);
     if (effectSubPanels && subPanels != null)
     {
         int panelsFound = 0;
         for (int loop = 0; loop < subPanels.Length && panelsFound < numberOfPanels; loop++)
         {
             if (subPanels[loop] != null)
             {
                 panelsFound++;
                 subPanels[loop].movePanel(Xincrement, Yincrement, effectSubPanels);
             }
         }
     }
 }