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)
        {
            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);
        }
Esempio n. 3
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;
            }

            goalName = advancement.CriteriaGoal;

            var adv = GetFirstOfType(typeof(UIAdvancement), true) as UIAdvancement;

            if (adv != null)
            {
                adv.AdvancementName = AdvancementName;
            }

            var flow = GetFirstOfType(typeof(UIFlowPanel), true) as UIFlowPanel;

            if (flow != null)
            {
                foreach (var criterion in advancement.Criteria)
                {
                    var crit = new UICriterion();
                    crit.AdvancementName = AdvancementName;
                    crit.CriterionName   = criterion.Key;
                    flow.AddControl(crit);
                }
            }

            label = GetControlByName("progress", true) as UITextBlock;
            bar   = GetControlByName("bar", true) as UIProgressBar;
            bar?.SetMax(advancement.Criteria.Count);

            base.InitializeRecursive(screen);
        }
Esempio n. 4
0
 public UIButton()
 {
     textBlock = new UITextBlock();
     AddControl(textBlock);
 }