Exemplo n.º 1
0
        public override void PostInit()
        {
            base.PostInit();

            Tween.To(Display.UiHeight - 8 - Height, Y, x => Y = x, 0.7f, Ease.BackOut).OnEnd = () => {
                var t = Tween.To(Display.UiHeight + 2, Y, x => Y = x, 0.5f, Ease.BackIn);

                t.Delay   = 5f;
                t.OnStart = () => {
                    Current = null;
                    Depth--;

                    try {
                        if (isItem)
                        {
                            Achievements.ItemBuffer.RemoveAt(0);
                        }
                        else
                        {
                            Achievements.AchievementBuffer.RemoveAt(0);
                        }
                    } catch (Exception e) {
                    }
                };

                t.OnEnd = () => {
                    Done = true;
                };
            };
        }
Exemplo n.º 2
0
        public UiAchievement(string id, bool item = false)
        {
            Current = this;
            isItem  = item;

            title       = Locale.Get(item ? id : $"ach_{id}");
            description = Locale.Get(item ? "was_unlocked" : $"ach_{id}_desc");
            icon        = Animations.Get(item ? "items" : "achievements").GetSlice(id);
            iconBg      = CommonAse.Ui.GetSlice("item_bg");

            var titleSize       = Font.Small.MeasureString(title);
            var descriptionSize = Font.Small.MeasureString(description);

            bgOffset          = new Vector2(Padding);
            iconOffset        = new Vector2(Padding + (20 - icon.Width) / 2f, Padding + (20 - icon.Height) / 2f);
            titleOffset       = new Vector2(Padding * 2 + 20, Padding - 1);
            descriptionOffset = new Vector2(Padding * 2 + 20, Padding + 10);

            Width  = Math.Max(128, (Math.Max(titleSize.Width, descriptionSize.Width) + 22 + Padding * 3));
            Height = 20 + Padding * 2;
            Depth  = 32;

            if (!item)
            {
                Audio.PlaySfx("ui_achievement", 0.3f);
            }
        }
Exemplo n.º 3
0
        public override void Destroy()
        {
            base.Destroy();

            if (Current == this)
            {
                Current = null;
            }
        }