コード例 #1
0
        protected override void RenderImpl(AptRenderingContext renderingContext)
        {
            if (!Visible)
            {
                return;
            }

            renderingContext.PushTransform(Transform);

            switch (Character)
            {
            case Shape s:
                var geometry = Context.GetGeometry(s.Geometry, Character);
                if (RenderCallback != null)
                {
                    RenderCallback(renderingContext, geometry, Texture);
                }
                else
                {
                    renderingContext.RenderGeometry(geometry, Texture);
                }

                if (Highlight)
                {
                    renderingContext.RenderOutline(geometry);
                }
                break;

            case Text t:
                renderingContext.RenderText(t, TextValue.Localized);
                break;
            }

            renderingContext.PopTransform();
        }
コード例 #2
0
        protected override void RenderImpl(AptRenderingContext renderingContext)
        {
            if (!Visible)
            {
                return;
            }

            renderingContext.PushTransform(Transform);

            switch (Character)
            {
            case Shape s:
                var geometry = Context.GetGeometry(s.Geometry, Character);
                if (RenderCallback != null)
                {
                    RenderCallback(renderingContext, geometry, Texture);
                }
                else
                {
                    renderingContext.RenderGeometry(geometry, Texture);
                }

                if (Highlight)
                {
                    renderingContext.RenderOutline(geometry);
                }
                break;

            case Text t:
                if (t.Value.Length > 0)
                {
                    var val = ScriptObject.ResolveValue(t.Value, ScriptObject);
                    if (val.Type != ValueType.Undefined)
                    {
                        t.Content = val.ToString();
                    }
                }

                //localize our content
                t.Content = t.Content.Replace("$", "APT:");     // All string values begin with $
                t.Content = t.Content.Split('&').First();       // Query strings after ampersand
                t.Content = t.Content.Translate();

                renderingContext.RenderText(t);
                break;
            }

            renderingContext.PopTransform();
        }