/// <summary> /// Triggered when the Mod Options button is clicked. /// </summary> public void OnModOptions(GameObject _) { if (path != null) { // Close current dialog if open CloseDialog(); // Ensure that it is on top of other screens (which may be +100 modal) var pDialog = new PDialog("ModOptions") { Title = POptions.DIALOG_TITLE.text.F(modSpec.title), Size = POptions. SETTINGS_DIALOG_SIZE, SortKey = 150.0f, DialogBackColor = PUITuning.Colors. OptionsBackground, DialogClosed = OnOptionsSelected }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, POptions.TOOLTIP_OK). AddButton(PDialog.DIALOG_KEY_CLOSE, STRINGS.UI.CONFIRMDIALOG.CANCEL, POptions.TOOLTIP_CANCEL); // For each option, add its UI component to panel pDialog.Body.Spacing = 3; pDialog.Body.BackColor = PUITuning.Colors.DialogDarkBackground; foreach (var entry in optionEntries) { pDialog.Body.AddChild(entry.GetUIEntry()); } options = POptions.ReadSettings(path, optionsType); if (options == null) { CreateOptions(); } // Manually build the dialog so the options can be updated after realization var obj = pDialog.Build(); UpdateOptions(); dialog = obj.GetComponent <KScreen>(); dialog.Activate(); } }
public static void VerifyTranslationModSubscription(GameObject context) { if (GetSelectedLanguageType() == SelectedLanguageType.UGC && SteamManager.Initialized && !LanguageOptionsScreen.HasInstalledLanguage()) { PublishedFileId_t invalid = PublishedFileId_t.Invalid; PublishedFileId_t publishedFileId_t = new PublishedFileId_t((uint)KPlayerPrefs.GetInt("InstalledLanguage", (int)invalid.m_PublishedFileId)); Label label = default(Label); label.distribution_platform = Label.DistributionPlatform.Steam; label.id = publishedFileId_t.ToString(); Label rhs = label; string arg = UI.FRONTEND.TRANSLATIONS_SCREEN.UNKNOWN; foreach (Mod mod in Global.Instance.modManager.mods) { if (mod.label.Match(rhs)) { arg = mod.title; break; } } ClearLanguage(); GameObject gameObject = KScreenManager.AddChild(context, ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject); KScreen component = gameObject.GetComponent <KScreen>(); component.Activate(); ConfirmDialogScreen component2 = component.GetComponent <ConfirmDialogScreen>(); ConfirmDialogScreen confirmDialogScreen = component2; string title_text = UI.CONFIRMDIALOG.DIALOG_HEADER; string text = string.Format(UI.FRONTEND.TRANSLATIONS_SCREEN.MISSING_LANGUAGE_PACK, arg); string confirm_text = UI.FRONTEND.TRANSLATIONS_SCREEN.RESTART; System.Action on_confirm = App.instance.Restart; confirmDialogScreen.PopupConfirmDialog(text, on_confirm, null, null, null, title_text, confirm_text, null, null, true); } }
public KScreen StartScreen(GameObject screenPrefab, GameObject parent) { GameObject gameObject = AddChild(parent, screenPrefab); KScreen component = gameObject.GetComponent <KScreen>(); component.Activate(); return(component); }
public GameObject ActivateScreen(GameObject screen, GameObject parent) { AddExistingChild(parent, screen); KScreen component = screen.GetComponent <KScreen>(); component.Activate(); return(screen); }
private ConfirmDialogScreen GetConfirmDialog() { GameObject gameObject = KScreenManager.AddChild(base.transform.parent.gameObject, ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject); KScreen component = gameObject.GetComponent <KScreen>(); component.Activate(); return(component.GetComponent <ConfirmDialogScreen>()); }
public KScreen SetSecondarySideScreen(KScreen secondaryPrefab, string title) { ClearSecondarySideScreen(); activeSideScreen2 = KScreenManager.Instance.InstantiateScreen(secondaryPrefab.gameObject, sideScreen2ContentBody); activeSideScreen2.Activate(); sideScreen2Title.text = title; sideScreen2.SetActive(true); return(activeSideScreen2); }
private static void ActivateScreen(LoreBearer loreBearer, KScreen screen) { var demolishable = loreBearer?.GetComponent <Demolishable>(); if (demolishable != null && isMarkedForDemolition.Get(demolishable)) { screen.Deactivate(); return; } screen.Activate(); }
public KScreen StartScreen(GameObject screenPrefab, GameObject parent = null, UIRenderTarget target = UIRenderTarget.ScreenSpaceOverlay) { if ((Object)parent == (Object)null) { parent = GetParent(target); } GameObject gameObject = KScreenManager.AddChild(parent, screenPrefab); KScreen component = gameObject.GetComponent <KScreen>(); component.Activate(); return(component); }
public GameObject ActivateScreen(GameObject screen, GameObject parent = null, UIRenderTarget target = UIRenderTarget.ScreenSpaceOverlay) { if ((Object)parent == (Object)null) { parent = GetParent(target); } KScreenManager.AddExistingChild(parent, screen); KScreen component = screen.GetComponent <KScreen>(); component.Activate(); return(screen); }
/// <summary> /// Triggered when the Mod Options button is clicked. /// </summary> public void OnModOptions(GameObject _) { if (path != null) { // Close current dialog if open CloseDialog(); // Ensure that it is on top of other screens (which may be +100 modal) var pDialog = new PDialog("ModOptions") { Title = POptions.DIALOG_TITLE.text.F(modSpec.title), Size = POptions. SETTINGS_DIALOG_SIZE, SortKey = 150.0f, DialogBackColor = PUITuning.Colors. OptionsBackground, DialogClosed = OnOptionsSelected }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, POptions.TOOLTIP_OK); pDialog.AddButton("manual", POptions.BUTTON_MANUAL, POptions.TOOLTIP_MANUAL). AddButton(PDialog.DIALOG_KEY_CLOSE, STRINGS.UI.CONFIRMDIALOG.CANCEL, POptions.TOOLTIP_CANCEL); PPanel body = pDialog.Body, current; var margin = body.Margin; // For each option, add its UI component to panel body.Spacing = 10; body.Margin = new RectOffset(0, 0, 0, 0); // Display all categories foreach (var catEntries in optionCategories) { string category = catEntries.Key; current = new PPanel("Entries_" + category) { Alignment = TextAnchor.UpperCenter, Spacing = 5, BackColor = PUITuning.Colors.DialogDarkBackground, FlexSize = new Vector2(1.0f, 0.0f), Margin = margin }; AddCategoryHeader(current, catEntries.Key); foreach (var entry in catEntries.Value) { current.AddChild(entry.GetUIEntry()); } body.AddChild(current); } options = POptions.ReadSettings(path, optionsType); if (options == null) { CreateOptions(); } // Manually build the dialog so the options can be updated after realization var obj = pDialog.Build(); UpdateOptions(); dialog = obj.GetComponent <KScreen>(); dialog.Activate(); } }
/// <summary> /// Triggered when the Mod Options button is clicked. /// </summary> public void ShowDialog() { string title; if (string.IsNullOrEmpty(displayInfo.Title)) { title = PLibStrings.BUTTON_OPTIONS; } else { title = string.Format(PLibStrings.DIALOG_TITLE, OptionsEntry.LookInStrings( displayInfo.Title)); } // Close current dialog if open CloseDialog(); // Ensure that it is on top of other screens (which may be +100 modal) var pDialog = new PDialog("ModOptions") { Title = title, Size = SETTINGS_DIALOG_SIZE, SortKey = 150.0f, DialogBackColor = PUITuning.Colors.OptionsBackground, DialogClosed = OnOptionsSelected, MaxSize = SETTINGS_DIALOG_MAX_SIZE, RoundToNearestEven = true }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, PLibStrings.TOOLTIP_OK, PUITuning.Colors.ButtonPinkStyle).AddButton(PDialog.DIALOG_KEY_CLOSE, STRINGS.UI.CONFIRMDIALOG.CANCEL, PLibStrings.TOOLTIP_CANCEL, PUITuning.Colors.ButtonBlueStyle); options = POptions.ReadSettings(POptions.GetConfigFilePath(optionsType), optionsType); if (options == null) { options = CreateOptions(optionsType); } AddModInfoScreen(pDialog); FillModOptions(pDialog); // Manually build the dialog so the options can be updated after realization var obj = pDialog.Build(); UpdateOptions(); dialog = obj.GetComponent <KScreen>(); dialog.Activate(); }
/// <summary> /// Triggered when the Mod Options button is clicked. /// </summary> public void OnModOptions(GameObject _) { if (path != null) { string title = handler.GetTitle(OptionsEntry.LookInStrings(infoAttr?.Title)); if (string.IsNullOrEmpty(title)) { title = PUIStrings.BUTTON_OPTIONS; } // Close current dialog if open CloseDialog(); // Ensure that it is on top of other screens (which may be +100 modal) var pDialog = new PDialog("ModOptions") { Title = title, Size = SETTINGS_DIALOG_SIZE, SortKey = 150.0f, DialogBackColor = PUITuning.Colors.OptionsBackground, DialogClosed = OnOptionsSelected, MaxSize = SETTINGS_DIALOG_MAX_SIZE, RoundToNearestEven = true }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, PUIStrings.TOOLTIP_OK, PUITuning.Colors.ButtonPinkStyle).AddButton(PDialog.DIALOG_KEY_CLOSE, STRINGS.UI.CONFIRMDIALOG.CANCEL, PUIStrings.TOOLTIP_CANCEL, PUITuning.Colors.ButtonBlueStyle); options = POptions.ReadSettings(path, optionsType); if (options == null) { CreateOptions(); } if (infoAttr != null) { AddModInfoScreen(pDialog); } FillModOptions(pDialog); // Manually build the dialog so the options can be updated after realization var obj = pDialog.Build(); UpdateOptions(); dialog = obj.GetComponent <KScreen>(); dialog.Activate(); } }