Пример #1
0
        public void Draw(Frame frame, ref ImperativeRenderer renderer)
        {
            renderer.FillRectangle(Bounds.Expand(4, 4), Color.Black * 0.9f);
            renderer.Layer += 1;
            renderer.OutlineRectangle(Bounds.Expand(4, 4), Color.White);
            renderer.Layer += 1;

            int charactersLeft = DisplayedCharacterCount;

            foreach (var s in Strings) {
                int charactersToDraw = Math.Min(charactersLeft, s.Layout.Count);
                if (s.IsMu) {
                    var offset = new Vector2((float)BlippyRNG.NextDouble(-1, 1), (float)BlippyRNG.NextDouble(-1, 1));
                    var scale = (float)BlippyRNG.NextDouble(0.95f, 1.05f);
                    var rotation = (float)BlippyRNG.NextDouble(-0.04f, 0.04f);

                    var dc = s.Layout.DrawCalls.Array[s.Layout.DrawCalls.Offset];
                    dc.Position += offset;
                    dc.ScaleF = scale;
                    dc.Rotation = rotation;
                    dc.MultiplyColor *= (float)BlippyRNG.NextDouble(0.7f, 1.1f);

                    renderer.Draw(ref dc);
                } else {
                    renderer.DrawMultiple(s.Layout.Slice(0, charactersToDraw));
                }
                charactersLeft -= s.Length;
            }

            renderer.Layer += 1;

            if (AdvancePromptVisible) {
                var advancePromptPosition = Bounds.BottomRight;
                advancePromptPosition.Y -= Squared.Util.Arithmetic.PulseSine((float)(Squared.Util.Time.Seconds * 0.66), 0f, 24f);
                renderer.Draw(AdvancePromptIcon, advancePromptPosition, origin: new Vector2(0.85f, 0.8f));
            }

            renderer.Layer += 1;
        }
Пример #2
0
            public void Draw(ref ImperativeRenderer renderer)
            {
                if (Game.InputControls.MouseLocation.HasValue) {
                    var hotspot = State.HitTest(Game.InputControls.MouseLocation.Value).LastOrDefault();
                    if (hotspot == null)
                        return;

                    renderer.FillRectangle(hotspot.Bounds, Color.White * 0.1f);

                    var textLayout = Game.UIText.LayoutString(hotspot.ToString(), null);
                    var offset = ((hotspot.Bounds.Size - textLayout.Size) * 0.5f) + hotspot.Bounds.TopLeft;
                    offset.X = (float)Math.Floor(offset.X);
                    offset.Y = (float)Math.Floor(offset.Y);

                    renderer.DrawMultiple(textLayout, offset + Vector2.One, multiplyColor: Color.Black, sortKey: 0);
                    renderer.DrawMultiple(textLayout, offset, sortKey: 1);
                }
            }