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); }
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); }