/// <summary> /// Updates the status-information for the sprite that is currently /// selected. /// </summary> internal void PrintStatusSpriteSelected() { string selected = (SelectedId != -1) ? SelectedId.ToString(System.Globalization.CultureInfo.InvariantCulture) : None; _sbpTileSelected.Text = String.Format( System.Globalization.CultureInfo.InvariantCulture, "Selected {0}", selected); }
public string ReturnId() { return(SelectedId.ToString()); }
public LateJoinGui() { IoCManager.InjectDependencies(this); Title = Loc.GetString("Late Join"); var jobList = new VBoxContainer(); var vBox = new VBoxContainer { Children = { new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand, Children = { jobList } } } }; Contents.AddChild(vBox); foreach (var job in _prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name)) { var jobButton = new JobButton { JobId = job.ID }; var jobSelector = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; var icon = new TextureRect { TextureScale = (2, 2), Stretch = TextureRect.StretchMode.KeepCentered }; if (job.Icon != null) { var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"), job.Icon); icon.Texture = specifier.Frame0(); } jobSelector.AddChild(icon); var jobLabel = new Label { Text = job.Name }; jobSelector.AddChild(jobLabel); jobButton.AddChild(jobSelector); jobList.AddChild(jobButton); jobButton.OnPressed += args => { SelectedId?.Invoke(jobButton.JobId); }; } SelectedId += jobId => { Logger.InfoS("latejoin", $"Late joining as ID: {jobId}"); _console.ProcessCommand($"joingame {CommandParsing.Escape(jobId)}"); Close(); }; }