Esempio n. 1
0
        public override void AddComponents()
        {
            base.AddComponents();

            if (region != null)
            {
                Width  = region.Width;
                Height = region.Height;

                var component = new ScalableSliceComponent(region);
                AddComponent(component);

                component.Scale  = Vector2.Zero;
                component.Origin = new Vector2(Width / 2, Height / 2);
                task             = Tween.To(1f, component.Scale.X, x => component.Scale = new Vector2(x), 0.25f, Ease.BackOut);
            }
            else
            {
                var size = Font.Medium.MeasureString(text);

                Width  = size.Width;
                Height = size.Height;

                var component = new TextGraphicsComponent(text);
                AddComponent(component);

                component.Scale = 0;
                task            = Tween.To(component, new { Scale = 1.3f }, 0.25f, Ease.BackOut);
            }

            Depth   = Layers.InGameUi;
            CenterX = entity.CenterX + offset;
            Y       = entity.Y - Height;

            y = 12;
            Tween.To(0, y, x => y = x, 0.2f);

            UpdatePosition();
        }
Esempio n. 2
0
        public override void AddComponents()
        {
            base.AddComponents();

            string text;

            if (Locale.Current == "de" || Locale.Current == "it")
            {
                text = item.Hidden ? "???" : (item.Scourged ? $"{item.Name} ({Locale.Get("scourged")})" : item.Name);
            }
            else
            {
                text = item.Hidden ? "???" : (item.Scourged ? $"{Locale.Get("scourged")} {item.Name}" : item.Name);
            }

            var size = Font.Medium.MeasureString(text);

            Width  = size.Width;
            Height = size.Height;

            var component = new TextGraphicsComponent(text);

            AddComponent(component);

            component.Scale = 0;
            task            = Tween.To(component, new { Scale = 1.3f }, 0.25f, Ease.BackOut);

            y = 12;
            Tween.To(0, y, x => y = x, 0.2f);

            UpdatePosition();

            if (item.Scourged)
            {
                component.Color = Palette.Default[ItemGraphicsComponent.ScourgedColorId];
            }
        }