コード例 #1
0
        private void Init(PaletteColorField color, string icon)
        {
            Color color2 = color.Color;

            color2.a                     = 1f;
            this.indicator.color         = color2;
            this.indicatorLighting.color = color2;
            this.icon.SpriteUid          = icon;
        }
コード例 #2
0
        private void Border(VertexHelper vh)
        {
            Rect    pixelAdjustedRect = base.GetPixelAdjustedRect();
            float   xMin            = pixelAdjustedRect.xMin;
            float   num2            = this.spacing / this.pixelsPerUnit;
            float   num3            = (pixelAdjustedRect.width - (num2 * (this.segmentsCount - 1))) / ((this.segmentsCount - 1) + this.currentSegmentScale);
            Vector4 outerUV         = DataUtility.GetOuterUV(this.sprite);
            Vector4 innerUV         = DataUtility.GetInnerUV(this.sprite);
            Vector2 size            = this.sprite.rect.size;
            Vector4 adjustedBorders = this.GetAdjustedBorders(this.sprite.border / this.pixelsPerUnit, pixelAdjustedRect);
            Vector2 tileSize        = new Vector2(((size.x - adjustedBorders.x) - adjustedBorders.z) / this.pixelsPerUnit, ((size.y - adjustedBorders.y) - adjustedBorders.w) / this.pixelsPerUnit);

            for (int i = 0; xMin < pixelAdjustedRect.xMax; i++)
            {
                float             num7       = (i != this.currentSegment) ? num3 : (num3 * this.currentSegmentScale);
                float             x          = Mathf.Min(xMin + num7, pixelAdjustedRect.xMax);
                float             num9       = xMin;
                Vector2           bottomLeft = base.PixelAdjustPoint(new Vector2(num9, pixelAdjustedRect.yMin));
                Vector2           topRight   = base.PixelAdjustPoint(new Vector2(x, pixelAdjustedRect.yMax));
                PaletteColorField field      = (i >= this.upgradedSegments) ? ((i > this.currentSegment) ? this.backgroundColor : this.upgradeColor) : this.filledColor;
                this.AddBar(vh, (i != this.currentSegment) ? 1f : this.currentSegmentProgress, this.FromVector2(bottomLeft, topRight), pixelAdjustedRect, adjustedBorders, tileSize, outerUV, innerUV, (Color)field);
                xMin += num7 + num2;
            }
        }