Esempio n. 1
0
        public override void InitializeRecursive(Screen screen)
        {
            if (TrackerSettings.IsPostExplorationUpdate)
            {
                Advancement = screen.AdvancementTracker.Advancement(AdvancementName);
            }
            else
            {
                Advancement = screen.AchievementTracker.Achievement(AdvancementName);
            }
            if (Advancement == null)
            {
                return;
            }

            Name = Advancement.ID;
            int textScale = scale < 3 ? 1 : 2;

            FlexWidth  *= Math.Min(scale + textScale - 1, 4);
            FlexHeight *= scale;

            if (TrackerSettings.IsPostExplorationUpdate)
            {
                Padding = new Margin(0, 0, 4 * scale, 0);
            }
            else
            {
                Padding = new Margin(0, 0, 6, 0);
            }

            frame = GetControlByName("frame", true) as UIPicture;
            if (frame != null)
            {
                frame.FlexWidth  *= scale;
                frame.FlexHeight *= scale;
            }

            icon = GetControlByName("icon", true) as UIPicture;
            if (icon != null)
            {
                icon.FlexWidth  *= scale;
                icon.FlexHeight *= scale;
                icon.SetTexture(Advancement.Icon);
                icon.SetLayer(Layer.Fore);
            }

            label = GetControlByName("label", true) as UITextBlock;
            if (label != null)
            {
                label.Margin = new Margin(0, 0, (int)frame.FlexHeight.InternalValue, 0);
                label.SetFont("minecraft", 12 * textScale);
                label.SetText(Advancement.Name);

                if (TrackerSettings.IsPreExplorationUpdate && screen is MainScreen)
                {
                    label.DrawBackground = true;
                }
            }
            base.InitializeRecursive(screen);
        }
Esempio n. 2
0
        public override void InitializeRecursive(Screen screen)
        {
            if (TrackerSettings.IsPostExplorationUpdate)
            {
                criterion = screen.AdvancementTracker.Advancement(AdvancementName).Criteria.TryGetValue(CriterionName, out var val) ? val : null;
            }
            else
            {
                criterion = screen.AchievementTracker.Achievement(AdvancementName).Criteria.TryGetValue(CriterionName, out var val) ? val : null;
            }
            if (criterion == null)
            {
                return;
            }

            icon = GetControlByName("icon", true) as UIPicture;
            if (icon != null)
            {
                icon.SetTexture(criterion.Icon);
                icon.FlexWidth  = new Size(imageSize, SizeMode.Absolute);
                icon.FlexHeight = new Size(imageSize, SizeMode.Absolute);
            }

            var label = GetControlByName("label", true) as UITextBlock;

            if (scale == 1)
            {
                label?.SetText(criterion.Name);
            }
            else
            {
                RemoveControl(label);
            }
            base.InitializeRecursive(screen);
        }
Esempio n. 3
0
        public override void InitializeRecursive(Screen screen)
        {
            itemCount = screen.StatisticsTracker.ItemCount(ItemName);
            if (itemCount == null)
            {
                return;
            }

            if (itemCount.IsEstimate)
            {
                DrawMode = DrawMode.ThisOnly;
            }

            int textScale = scale < 3 ? 1 : 2;

            //FlexWidth *= Math.Min(scale + textScale - 1, 4);
            FlexHeight *= scale;
            Padding     = new Margin(0, 0, 4 * scale, 0);

            frame = GetControlByName("frame", true) as UIPicture;
            if (frame != null)
            {
                frame.FlexWidth  *= scale;
                frame.FlexHeight *= scale;
            }

            icon = GetControlByName("icon", true) as UIPicture;
            if (icon != null)
            {
                icon.FlexWidth  *= scale;
                icon.FlexHeight *= scale;
                icon.SetTexture(itemCount.Icon);
                icon.SetLayer(Layer.Fore);
            }

            label = GetControlByName("label", true) as UITextBlock;
            if (label != null)
            {
                label.Margin = new Margin(0, 0, (int)frame.FlexHeight.InternalValue, 0);
                label.SetFont("minecraft", 12 * textScale);
            }

            base.InitializeRecursive(screen);
        }