private void DoScenarioListEntry(Rect rect, Scenario scen) { bool flag = this.curScen == scen; Widgets.DrawOptionBackground(rect, flag); MouseoverSounds.DoRegion(rect); Rect rect2 = rect.ContractedBy(4f); Text.Font = GameFont.Small; Rect rect3 = rect2; rect3.height = Text.CalcHeight(scen.name, rect3.width); Widgets.Label(rect3, scen.name); Text.Font = GameFont.Tiny; Rect rect4 = rect2; rect4.yMin = rect3.yMax; Widgets.Label(rect4, scen.GetSummary()); if (scen.enabled) { WidgetRow widgetRow = new WidgetRow(rect.xMax, rect.y, UIDirection.LeftThenDown, 99999f, 4f); if (scen.Category == ScenarioCategory.CustomLocal && widgetRow.ButtonIcon(TexButton.DeleteX, "Delete".Translate(), new Color?(GenUI.SubtleMouseoverColor))) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDelete".Translate(scen.File.Name), delegate { scen.File.Delete(); ScenarioLister.MarkDirty(); }, true, null)); } if (scen.Category == ScenarioCategory.SteamWorkshop && widgetRow.ButtonIcon(TexButton.DeleteX, "Unsubscribe".Translate(), new Color?(GenUI.SubtleMouseoverColor))) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmUnsubscribe".Translate(scen.File.Name), delegate { scen.enabled = false; if (this.curScen == scen) { this.curScen = null; this.EnsureValidSelection(); } Workshop.Unsubscribe(scen); }, true, null)); } if (scen.GetPublishedFileId() != PublishedFileId_t.Invalid) { if (widgetRow.ButtonIcon(ContentSource.SteamWorkshop.GetIcon(), "WorkshopPage".Translate(), null)) { SteamUtility.OpenWorkshopPage(scen.GetPublishedFileId()); } if (scen.CanToUploadToWorkshop()) { widgetRow.Icon(Page_SelectScenario.CanUploadIcon, "CanBeUpdatedOnWorkshop".Translate()); } } if (!flag && Widgets.ButtonInvisible(rect, false)) { this.curScen = scen; SoundDefOf.Click.PlayOneShotOnCamera(null); } } }
private bool CanEditScenario(Scenario scen) { if (scen.Category == ScenarioCategory.CustomLocal) { return(true); } if (scen.CanToUploadToWorkshop()) { return(true); } return(false); }
private bool CanEditScenario(Scenario scen) { return(scen.Category == ScenarioCategory.CustomLocal || scen.CanToUploadToWorkshop()); }