public ActorShopScreen(Game game) : base("Actor Shop") { this.game = game; Title.Position = new CPos(0, -4096, 0); Add(new Panel(new MPos(8 * 1024, 2 * 1024), "wooden") { Position = new CPos(0, 920, 0) }); actors = new PanelList(new MPos(8120, 1024), new MPos(1024, 1024), "stone") { Position = new CPos(0, -2048, 0) }; foreach (var a in ActorCache.Types.Values) { if (a.Playable == null) { continue; } var sprite = a.GetPreviewSprite(); var scale = MasterRenderer.PixelSize / (float)Math.Max(sprite.Width, sprite.Height) - 0.1f; var item = new PanelListItem(new BatchObject(sprite), new MPos(1024, 1024), a.Playable.Name, new string[0], () => selectActor(a)) { Scale = scale * 2 }; if (!game.Stats.ActorAvailable(a.Playable)) { item.SetColor(Color.Black); } actors.Add(item); actorTypes.Add(a.Playable.InternalName); } Add(actors); Add(new Button("Buy", "wooden", () => buyActor(selected)) { Position = new CPos(-6144, 3072, 0) }); Add(new Button("Resume", "wooden", () => game.ShowScreen(ScreenType.DEFAULT, false)) { Position = new CPos(0, 6144, 0) }); information = new UITextBlock(FontManager.Default, TextOffset.LEFT, "Select an actor for further information.", "", "", "Cost: -") { Position = new CPos(-7900, 0, 0) }; Add(information); Add(new MoneyDisplay(game) { Position = new CPos(Left + 2048, Bottom - 1024, 0) }); }
public MessageBox(CPos position) { Position = position; background = new Panel(new MPos(6144, 1152), "wooden") { Position = position }; text = new UITextBlock(FontManager.Default, WarriorsSnuggery.Objects.TextOffset.LEFT, new[] { "", "", "", "" }) { Position = position - new CPos(6144 - FontManager.Default.WidthGap, FontManager.Default.HeightGap + FontManager.Default.MaxHeight, 0) }; Bounds = background.Bounds; SelectableBounds = Bounds; }
public TrophyScreen(Game game) : base("Trophy Collection") { this.game = game; Title.Position = new CPos(0, -4096, 0); trophies = new PanelList(new MPos(8120, 1024), new MPos(512, 1024), "wooden") { Position = new CPos(0, -1024, 0) }; foreach (var key in TrophyCache.Trophies.Keys) { var value = TrophyCache.Trophies[key]; var sprite = value.Image.GetTextures()[0]; var scale = MasterRenderer.PixelSize / (float)Math.Max(sprite.Width, sprite.Height) - 0.1f; var item = new PanelListItem(new BatchObject(sprite), new MPos(512, 1024), value.Name, new string[0], () => selectTrophy(key, value)) { Scale = scale * 2f }; if (!game.Stats.TrophyUnlocked(key)) { item.SetColor(Color.Black); } trophies.Add(item); } Add(trophies); Add(new Panel(new MPos(8 * 1024, 1024), "stone") { Position = new CPos(0, 1024, 0) }); information = new UITextBlock(FontManager.Default, TextOffset.LEFT, "Select a trophy for further information.", "", "", "") { Position = new CPos(-7900, 512 - 128, 0) }; Add(information); Add(new Button("Resume", "wooden", () => game.ShowScreen(ScreenType.DEFAULT, false)) { Position = new CPos(0, 6144, 0) }); }
private void ReloadLayout() { //clear and load layout if window just opened or game version changed Children.Clear(); if (!LoadXml(Paths.GetLayoutFor("overlay"))) { Main.ForceQuit(this); } progress = new UITextBlock("minecraft", 24); progress.Margin = new Margin(12, 0, 8, 0); progress.HorizontalAlign = HorizontalAlign.Left; progress.VerticalAlign = VerticalAlign.Top; progress.ResizeRecursive(Rectangle); AddControl(progress); //find named controls advancements = GetControlByName("advancements") as UICarousel; criteria = GetControlByName("criteria") as UICarousel; counts = GetControlByName("counts") as UIFlowPanel; }
private void ReloadLayout() { Children.Clear(); if (!LoadXml(Paths.GetLayoutFor("main"))) { Main.ForceQuit(this); } //find named controls saveLabel = GetControlByName("label_save", true) as UITextBlock; progressLabel = GetControlByName("label_progress", true) as UITextBlock; progressBar = GetControlByName("progress_bar", true) as UIProgressBar; progressBar?.SetMin(0); if (TrackerSettings.IsPostExplorationUpdate) { progressBar?.SetMax(AdvancementTracker.AdvancementCount); } else { progressBar?.SetMax(AchievementTracker.AchievementCount); } status = GetControlByName("enchantment_table", true) as UIEnchantmentTable; status?.SetTint(Color.White * 0.85f); settingsButton = GetControlByName("button_settings", true) as UIButton; if (settingsButton != null) { settingsButton.Click += OnClick; } patreonButton = GetControlByName("button_patreon", true) as UIButton; if (patreonButton != null) { patreonButton.UseCustomColor = true; patreonButton.SetTextColor(Color.Black); patreonButton.Click += OnClick; } grid = GetFirstOfType(typeof(UIGrid)) as UIGrid; UpdateCollapsedState(); }