Exemple #1
0
 // Token: 0x06004679 RID: 18041 RVA: 0x001084CC File Offset: 0x001066CC
 public static global::dfFontRendererBase Obtain(global::dfDynamicFont font)
 {
     global::dfDynamicFont.DynamicFontRenderer dynamicFontRenderer = (global::dfDynamicFont.DynamicFontRenderer.objectPool.Count <= 0) ? new global::dfDynamicFont.DynamicFontRenderer() : global::dfDynamicFont.DynamicFontRenderer.objectPool.Dequeue();
     dynamicFontRenderer.Reset();
     dynamicFontRenderer.Font = font;
     return(dynamicFontRenderer);
 }
Exemple #2
0
    // Token: 0x060042ED RID: 17133 RVA: 0x000F69D8 File Offset: 0x000F4BD8
    private void renderItems(global::dfRenderData buffer)
    {
        if (this.font == null || this.items == null || this.items.Length == 0)
        {
            return;
        }
        float   num = base.PixelsToUnits();
        Vector2 maxSize;

        maxSize..ctor(this.size.x - (float)this.itemPadding.horizontal - (float)this.listPadding.horizontal, (float)(this.itemHeight - this.itemPadding.vertical));
        Vector3 vector       = this.pivot.TransformToUpperLeft(base.Size);
        Vector3 vectorOffset = new Vector3(vector.x + (float)this.itemPadding.left + (float)this.listPadding.left, vector.y - (float)this.itemPadding.top - (float)this.listPadding.top, 0f) * num;

        vectorOffset.y += this.scrollPosition * num;
        Color32 defaultColor = (!base.IsEnabled) ? base.DisabledColor : this.ItemTextColor;
        float   num2         = vector.y * num;
        float   num3         = num2 - this.size.y * num;

        for (int i = 0; i < this.items.Length; i++)
        {
            using (global::dfFontRendererBase dfFontRendererBase = this.font.ObtainRenderer())
            {
                dfFontRendererBase.WordWrap             = false;
                dfFontRendererBase.MaxSize              = maxSize;
                dfFontRendererBase.PixelRatio           = num;
                dfFontRendererBase.TextScale            = this.ItemTextScale * this.getTextScaleMultiplier();
                dfFontRendererBase.VectorOffset         = vectorOffset;
                dfFontRendererBase.MultiLine            = false;
                dfFontRendererBase.TextAlign            = this.ItemAlignment;
                dfFontRendererBase.ProcessMarkup        = true;
                dfFontRendererBase.DefaultColor         = defaultColor;
                dfFontRendererBase.OverrideMarkupColors = false;
                dfFontRendererBase.Opacity              = base.CalculateOpacity();
                dfFontRendererBase.Shadow       = this.Shadow;
                dfFontRendererBase.ShadowColor  = this.ShadowColor;
                dfFontRendererBase.ShadowOffset = this.ShadowOffset;
                global::dfDynamicFont.DynamicFontRenderer dynamicFontRenderer = dfFontRendererBase as global::dfDynamicFont.DynamicFontRenderer;
                if (dynamicFontRenderer != null)
                {
                    dynamicFontRenderer.SpriteAtlas  = base.Atlas;
                    dynamicFontRenderer.SpriteBuffer = this.renderData;
                }
                if (vectorOffset.y - (float)this.itemHeight * num <= num2)
                {
                    dfFontRendererBase.Render(this.items[i], buffer);
                }
                vectorOffset.y -= (float)this.itemHeight * num;
                dfFontRendererBase.VectorOffset = vectorOffset;
                if (vectorOffset.y < num3)
                {
                    break;
                }
            }
        }
    }
    // Token: 0x06004252 RID: 16978 RVA: 0x000F3FA8 File Offset: 0x000F21A8
    private global::dfFontRendererBase obtainRenderer()
    {
        bool    flag    = base.Size.sqrMagnitude <= float.Epsilon;
        Vector2 vector  = base.Size - new Vector2((float)this.padding.horizontal, (float)this.padding.vertical);
        Vector2 maxSize = (!this.autoSize && !flag) ? vector : this.getAutoSizeDefault();

        if (this.autoHeight)
        {
            maxSize..ctor(vector.x, 2.14748365E+09f);
        }
        float   num     = base.PixelsToUnits();
        Vector3 vector2 = (this.pivot.TransformToUpperLeft(base.Size) + new Vector3((float)this.padding.left, (float)(-(float)this.padding.top))) * num;
        float   num2    = this.TextScale * this.getTextScaleMultiplier();
        global::dfFontRendererBase dfFontRendererBase = this.Font.ObtainRenderer();

        dfFontRendererBase.WordWrap             = this.WordWrap;
        dfFontRendererBase.MaxSize              = maxSize;
        dfFontRendererBase.PixelRatio           = num;
        dfFontRendererBase.TextScale            = num2;
        dfFontRendererBase.CharacterSpacing     = this.CharacterSpacing;
        dfFontRendererBase.VectorOffset         = vector2.Quantize(num);
        dfFontRendererBase.MultiLine            = true;
        dfFontRendererBase.TabSize              = this.TabSize;
        dfFontRendererBase.TabStops             = this.TabStops;
        dfFontRendererBase.TextAlign            = ((!this.autoSize) ? this.TextAlignment : 0);
        dfFontRendererBase.ColorizeSymbols      = this.ColorizeSymbols;
        dfFontRendererBase.ProcessMarkup        = this.ProcessMarkup;
        dfFontRendererBase.DefaultColor         = ((!base.IsEnabled) ? base.DisabledColor : base.Color);
        dfFontRendererBase.BottomColor          = ((!this.enableGradient) ? null : new Color32?(this.BottomColor));
        dfFontRendererBase.OverrideMarkupColors = !base.IsEnabled;
        dfFontRendererBase.Opacity              = base.CalculateOpacity();
        dfFontRendererBase.Outline              = this.Outline;
        dfFontRendererBase.OutlineSize          = this.OutlineSize;
        dfFontRendererBase.OutlineColor         = this.OutlineColor;
        dfFontRendererBase.Shadow       = this.Shadow;
        dfFontRendererBase.ShadowColor  = this.ShadowColor;
        dfFontRendererBase.ShadowOffset = this.ShadowOffset;
        global::dfDynamicFont.DynamicFontRenderer dynamicFontRenderer = dfFontRendererBase as global::dfDynamicFont.DynamicFontRenderer;
        if (dynamicFontRenderer != null)
        {
            dynamicFontRenderer.SpriteAtlas  = this.Atlas;
            dynamicFontRenderer.SpriteBuffer = this.renderData;
        }
        if (this.vertAlign != global::dfVerticalAlignment.Top)
        {
            dfFontRendererBase.VectorOffset = this.getVertAlignOffset(dfFontRendererBase);
        }
        return(dfFontRendererBase);
    }
    // Token: 0x06004053 RID: 16467 RVA: 0x000EBA00 File Offset: 0x000E9C00
    private void renderText(global::dfRenderData buffer)
    {
        if (this.selectedIndex < 0 || this.selectedIndex >= this.items.Length)
        {
            return;
        }
        string  text = this.items[this.selectedIndex];
        float   num  = base.PixelsToUnits();
        Vector2 maxSize;

        maxSize..ctor(this.size.x - (float)this.textFieldPadding.horizontal, this.size.y - (float)this.textFieldPadding.vertical);
        Vector3 vector       = this.pivot.TransformToUpperLeft(base.Size);
        Vector3 vectorOffset = new Vector3(vector.x + (float)this.textFieldPadding.left, vector.y - (float)this.textFieldPadding.top, 0f) * num;
        Color32 defaultColor = (!base.IsEnabled) ? base.DisabledColor : this.TextColor;

        using (global::dfFontRendererBase dfFontRendererBase = this.font.ObtainRenderer())
        {
            dfFontRendererBase.WordWrap             = false;
            dfFontRendererBase.MaxSize              = maxSize;
            dfFontRendererBase.PixelRatio           = num;
            dfFontRendererBase.TextScale            = this.TextScale;
            dfFontRendererBase.VectorOffset         = vectorOffset;
            dfFontRendererBase.MultiLine            = false;
            dfFontRendererBase.TextAlign            = 0;
            dfFontRendererBase.ProcessMarkup        = true;
            dfFontRendererBase.DefaultColor         = defaultColor;
            dfFontRendererBase.OverrideMarkupColors = false;
            dfFontRendererBase.Opacity              = base.CalculateOpacity();
            dfFontRendererBase.Shadow       = this.Shadow;
            dfFontRendererBase.ShadowColor  = this.ShadowColor;
            dfFontRendererBase.ShadowOffset = this.ShadowOffset;
            global::dfDynamicFont.DynamicFontRenderer dynamicFontRenderer = dfFontRendererBase as global::dfDynamicFont.DynamicFontRenderer;
            if (dynamicFontRenderer != null)
            {
                dynamicFontRenderer.SpriteAtlas  = base.Atlas;
                dynamicFontRenderer.SpriteBuffer = buffer;
            }
            dfFontRendererBase.Render(text, buffer);
        }
    }
    // Token: 0x06003EDE RID: 16094 RVA: 0x000E4ED4 File Offset: 0x000E30D4
    private global::dfFontRendererBase obtainTextRenderer()
    {
        Vector2 vector       = base.Size - new Vector2((float)this.padding.horizontal, (float)this.padding.vertical);
        Vector2 maxSize      = (!this.autoSize) ? vector : (Vector2.one * 2.14748365E+09f);
        float   num          = base.PixelsToUnits();
        Vector3 vector2      = (this.pivot.TransformToUpperLeft(base.Size) + new Vector3((float)this.padding.left, (float)(-(float)this.padding.top))) * num;
        float   num2         = this.TextScale * this.getTextScaleMultiplier();
        Color32 defaultColor = base.ApplyOpacity(this.getTextColorForState());
        global::dfFontRendererBase dfFontRendererBase = this.Font.ObtainRenderer();

        dfFontRendererBase.WordWrap             = this.WordWrap;
        dfFontRendererBase.MultiLine            = this.WordWrap;
        dfFontRendererBase.MaxSize              = maxSize;
        dfFontRendererBase.PixelRatio           = num;
        dfFontRendererBase.TextScale            = num2;
        dfFontRendererBase.CharacterSpacing     = 0;
        dfFontRendererBase.VectorOffset         = vector2.Quantize(num);
        dfFontRendererBase.TabSize              = 0;
        dfFontRendererBase.TextAlign            = ((!this.autoSize) ? this.TextAlignment : 0);
        dfFontRendererBase.ProcessMarkup        = true;
        dfFontRendererBase.DefaultColor         = defaultColor;
        dfFontRendererBase.OverrideMarkupColors = false;
        dfFontRendererBase.Opacity              = base.CalculateOpacity();
        dfFontRendererBase.Shadow       = this.Shadow;
        dfFontRendererBase.ShadowColor  = this.ShadowColor;
        dfFontRendererBase.ShadowOffset = this.ShadowOffset;
        global::dfDynamicFont.DynamicFontRenderer dynamicFontRenderer = dfFontRendererBase as global::dfDynamicFont.DynamicFontRenderer;
        if (dynamicFontRenderer != null)
        {
            dynamicFontRenderer.SpriteAtlas  = base.Atlas;
            dynamicFontRenderer.SpriteBuffer = this.renderData;
        }
        if (this.vertAlign != global::dfVerticalAlignment.Top)
        {
            dfFontRendererBase.VectorOffset = this.getVertAlignOffset(dfFontRendererBase);
        }
        return(dfFontRendererBase);
    }