Beispiel #1
0
        internal override void Render()
        {
            if (config.Enabled && (outerTexture != null) && (UIStyleValues.Background.solidTexture != null) && (innerTexture != null))
            {
                UIUtils.AnchorToScreen(config.ScreenAnchor, config.Position.Item1, config.Position.Item2, out int anchor_x, out int anchor_y);
                UIUtils.AnchorToObject(config.Anchor, anchor_x, anchor_y, config.Size.Item1, config.Size.Item2, out anchor_x, out anchor_y);

                Graphics.DrawTexture(new Rect(anchor_x, anchor_y, config.Size.Item1, config.Size.Item2), outerTexture);
                Graphics.DrawTexture(new Rect(anchor_x + 6, anchor_y + 6, config.Size.Item1 - 12, config.Size.Item2 - 12), UIStyleValues.Background.solidTexture);
                Graphics.DrawTexture(new Rect(anchor_x + 9, anchor_y + 9, (int)((config.Size.Item1 - 18) * Math.Min(1.0f, progress)), config.Size.Item2 - 18), innerTexture);
            }

            text?.Render();
        }
Beispiel #2
0
        internal void Render(int x, int y)
        {
            if (!config.Enabled)
            {
                return;
            }

            UpdateMesh();
            UIStyleValues.TextFont.material.SetPass(0);
            if (mesh == null)
            {
                return;
            }

            UIUtils.AnchorToScreen(config.ScreenAnchor, x, y, out int anchor_x, out int anchor_y);
            Graphics.DrawMeshNow(mesh, new Vector3(anchor_x, anchor_y, 0), Quaternion.identity);
        }