Beispiel #1
0
        private void GenerateNewTip()
        {
            exitTweenDone = false;

            // TODO: Increase tip chance when more tips are added.
            var tip = new Random().NextDouble() > 0.2 ? LoadScreenJokes.Generate() : LoadScreenTips.Generate();

            Tween.To(Display.UiWidth + 150, tipLabel.CenterX, x => tipLabel.CenterX = x, 1.5f, Ease.QuadIn).OnEnd += () => {
                tipLabel.Label = tip;
                tipLabel.FinishTyping();
                tipLabel.Center = new Vector2(-150, Display.UiHeight - 55);

                var t = Tween.To(Display.UiWidth / 2f, tipLabel.CenterX, x => tipLabel.CenterX = x, 1.5f, Ease.QuadOut);
                t.OnEnd = () => exitTweenDone = true;
            };
        }
Beispiel #2
0
        private void RenderTop()
        {
            var show = Run.Depth > 0;

            if (show && Player != null)
            {
                if (UiItem.Hovered != null)
                {
                    var item = UiItem.Hovered;

                    if (lastItem != UiItem.Hovered)
                    {
                        lastItem          = UiItem.Hovered;
                        description.Label = item.Description;
                        description.FinishTyping();
                    }

                    var x = MathUtils.Clamp(item.OnTop ? 40 : 4,
                                            Display.UiWidth - 6 - Math.Max(item.DescriptionSize.X, item.NameSize.X), item.Position.X);

                    var y = item.OnTop
                                                ? MathUtils.Clamp(8 + item.NameSize.Y, Display.UiHeight - 6 - item.DescriptionSize.Y, item.Y)
                                                : MathUtils.Clamp(4, Display.UiHeight - 6 - item.DescriptionSize.Y - item.NameSize.Y - 4, item.Y - 7);

                    Graphics.Color = new Color(1f, 1f, 1f, item.TextA);
                    Graphics.Print(item.Name, Font.Small, new Vector2(x, y - item.DescriptionSize.Y + 2));

                    // Graphics.Print(item.Description, Font.Small, new Vector2(x, y));

                    description.X  = x;
                    description.Y  = y - 2;
                    Graphics.Color = ColorUtils.WhiteColor;

                    description.Tint.A = (byte)(item.TextA * 255f);
                    description.RenderString();
                }
            }
        }