private void CheckDependencies() { foreach (Mod mod in ModManager.Instance.Mods.Where(x => x.Enabled)) { string errorMessage = ModManager.Instance.CheckModDependencies(mod); if (errorMessage != null) { string message = string.Format(ModManager.GetText("dependencyErrorMessage"), mod.Title, errorMessage); var messageBox = new DaggerfallMessageBox(uiManager, this, true); messageBox.ClickAnywhereToClose = true; messageBox.SetText(message); messageBox.SetText(new[] { message, ModManager.GetText("sortModsQuestion") }); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); messageBox.OnButtonClick += (_, button) => { if (button == DaggerfallMessageBox.MessageBoxButtons.Yes) { ModManager.Instance.AutoSortMods(); ModManager.WriteModSettings(); Debug.Log("Mods have been sorted automatically"); } }; uiManager.PushWindow(messageBox); Debug.LogError(message); } } }
/// <summary> /// preset confirmation. /// </summary> /// <param name="index">Preset index.</param> /// <param name="preset">Preset name.</param> private void HandlePresetPickEvent(int index, string preset) { // Selected preset currentPresetIndex = index; // Open confirmation message box DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this); string message = "Import settings from " + preset + " ?"; try { string description = presets[currentPresetIndex][ModSettingsReader.internalSection]["Description"]; if (description != null) { messageBox.SetText(new string[] { description, "", message }); } else { messageBox.SetText(message); } } catch { messageBox.SetText(message); } messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Cancel); messageBox.OnButtonClick += ConfirmPreset_OnButtonClick; uiManager.PushWindow(messageBox); }
private void AttemptAvoid() { int playerSkillRunning = playerEntity.Skills.GetLiveSkillValue(DFCareer.Skills.Running); int playerSkillStealth = playerEntity.Skills.GetLiveSkillValue(DFCareer.Skills.Stealth); int successChance = Mathf.Max(playerSkillRunning, playerSkillStealth); successChance = successChance * maxSuccessChance / 100; if (avoidEncounters == AvoidEncounterChoice.ALWAYS) { MakeAvoidAttempt(successChance); } else { DaggerfallMessageBox mb = new DaggerfallMessageBox(DaggerfallUI.Instance.UserInterfaceManager); mb.SetText("You approach a hostile encounter. Attempt to avoid it?"); mb.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes, true); mb.AddButton(DaggerfallMessageBox.MessageBoxButtons.No); mb.ParentPanel.BackgroundColor = Color.clear; mb.OnButtonClick += (_sender, button) => { _sender.CloseWindow(); if (button == DaggerfallMessageBox.MessageBoxButtons.Yes) { MakeAvoidAttempt(successChance); } }; mb.Show(); } }
private void CleanConfigurationDirectory() { var unknownDirectories = Directory.GetDirectories(ModManager.Instance.ModDataDirectory) .Select(x => new DirectoryInfo(x)) .Where(x => ModManager.Instance.GetModFromGUID(x.Name) == null) .ToArray(); if (unknownDirectories.Length > 0) { var cleanConfigMessageBox = new DaggerfallMessageBox(uiManager, this); cleanConfigMessageBox.ParentPanel.BackgroundTexture = null; cleanConfigMessageBox.SetText(ModManager.GetText("cleanConfigurationDir")); cleanConfigMessageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); cleanConfigMessageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); cleanConfigMessageBox.OnButtonClick += (messageBox, messageBoxButton) => { if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes) { foreach (var directory in unknownDirectories) { directory.Delete(true); } } messageBox.CancelWindow(); moveNextStage = true; }; uiManager.PushWindow(cleanConfigMessageBox); } else { moveNextStage = true; } }
private void AttemptAvoid() { int playerSkillRunning = playerEntity.Skills.GetLiveSkillValue(DFCareer.Skills.Running); int playerSkillStealth = playerEntity.Skills.GetLiveSkillValue(DFCareer.Skills.Stealth); int successChance = Mathf.Max(playerSkillRunning, playerSkillStealth); successChance = successChance * maxSuccessChance / 100; DaggerfallMessageBox mb = new DaggerfallMessageBox(DaggerfallUI.Instance.UserInterfaceManager); mb.SetText("You approach a hostile encounter. Attempt to avoid it?"); mb.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes, true); mb.AddButton(DaggerfallMessageBox.MessageBoxButtons.No); mb.ParentPanel.BackgroundColor = Color.clear; mb.OnButtonClick += (_sender, button) => { _sender.CloseWindow(); if (button == DaggerfallMessageBox.MessageBoxButtons.Yes) { if (Dice100.SuccessRoll(successChance)) { delayCombat = true; delayCombatTime = DaggerfallUnity.Instance.WorldTime.Now.ToClassicDaggerfallTime() + 10; StartFastTravel(destinationSummary); } else { DaggerfallUI.MessageBox("You failed to avoid the encounter!"); } } }; mb.Show(); }
public static void RestOrPackFire(RaycastHit hit) { DaggerfallMessageBox campPopUp = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow); if (Fire != null) { if (hit.transform.gameObject.GetInstanceID() == Fire.GetInstanceID()) { string[] message = { "Do you wish to rest?" }; campPopUp.SetText(message); campPopUp.OnButtonClick += CampPopUp_OnButtonClick; campPopUp.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); campPopUp.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); campPopUp.Show(); } else { ClimateCalories.camping = true; DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenRestWindow); } } else { ClimateCalories.camping = true; DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenRestWindow); } }
private void PlayerEntity_OnExhausted(DaggerfallEntity entity) { const int youDropToTheGround1 = 1071; const int youDropToTheGround2 = 1072; bool enemiesNearby = GameManager.Instance.AreEnemiesNearby(); ITextProvider textProvider = DaggerfallUnity.Instance.TextProvider; TextFile.Token[] tokens; GameManager.Instance.PlayerMotor.CancelMovement = true; DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager); if (GameManager.Instance.PlayerEnterExit.IsPlayerSwimming) { messageBox.SetText(HardStrings.exhaustedInWater); } else { if (!enemiesNearby) { tokens = textProvider.GetRSCTokens(youDropToTheGround1); } else { tokens = textProvider.GetRSCTokens(youDropToTheGround2); } if (tokens != null && tokens.Length > 0) { messageBox.SetTextTokens(tokens); } } messageBox.ClickAnywhereToClose = true; messageBox.ParentPanel.BackgroundColor = Color.clear; messageBox.Show(); if (!enemiesNearby && !GameManager.Instance.PlayerEnterExit.IsPlayerSwimming) { // TODO: Duplicates rest code in rest window. Should be unified. DaggerfallUnity.Instance.WorldTime.Now.RaiseTime(1 * DaggerfallDateTime.SecondsPerHour); int healthRecoveryRate = FormulaHelper.CalculateHealthRecoveryRate(this); int fatigueRecoveryRate = FormulaHelper.CalculateFatigueRecoveryRate(MaxFatigue); int spellPointRecoveryRate = FormulaHelper.CalculateSpellPointRecoveryRate(MaxMagicka); CurrentHealth += healthRecoveryRate; CurrentFatigue += fatigueRecoveryRate; CurrentMagicka += spellPointRecoveryRate; TallySkill(DFCareer.Skills.Medical, 1); } else { SetHealth(0); } }
public static DaggerfallMessageBox MessageBox(string[] message, IMacroContextProvider mds = null) { DaggerfallMessageBox messageBox = new DaggerfallMessageBox(Instance.uiManager, Instance.uiManager.TopWindow); messageBox.SetText(message); messageBox.ClickAnywhereToClose = true; messageBox.Show(); return(messageBox); }
public static DaggerfallMessageBox MessageBox(string message) { DaggerfallMessageBox messageBox = new DaggerfallMessageBox(Instance.uiManager, Instance.uiManager.TopWindow); messageBox.SetText(message); messageBox.ClickAnywhereToClose = true; messageBox.Show(); return(messageBox); }
public static void AdviceBuilder(bool encumbranceRPR) { DaggerfallMessageBox msgBox = DaggerfallUI.UIManager.TopWindow as DaggerfallMessageBox; if (msgBox != null && msgBox.ExtraProceedBinding == InputManager.Instance.GetBinding(InputManager.Actions.Status)) { // Setup next status info box. DaggerfallMessageBox newBox = new DaggerfallMessageBox(DaggerfallUI.UIManager, msgBox); List <string> messages = new List <string>(); messages.Add(TxtClimate()); if (!string.IsNullOrEmpty(TxtAdvice())) { messages.Add(TxtAdvice()); } messages.Add(string.Empty); if (encumbranceRPR) { messages.Add(TxtEncumbrance()); if (!string.IsNullOrEmpty(TxtEncAdvice())) { messages.Add(TxtEncAdvice()); } messages.Add(string.Empty); } if (!ClimateCalories.isVampire) { messages.Add(TxtWater()); messages.Add(TxtFood()); messages.Add(string.Empty); messages.Add(TxtSleep()); } else { messages.Add("You have no need for food or sleep."); } if (TavernWindow.drunk > playerEntity.Stats.LiveEndurance / 2) { messages.Add(string.Empty); if (TavernWindow.drunk > playerEntity.Stats.LiveEndurance - 10) { messages.Add("You are very drunk."); } else { messages.Add("You are drunk."); } } newBox.SetText(messages.ToArray()); newBox.ExtraProceedBinding = InputManager.Instance.GetBinding(InputManager.Actions.Status); // set proceed binding newBox.ClickAnywhereToClose = true; msgBox.AddNextMessageBox(newBox); statusClosed = false; } }
/// <summary> /// Ask confirmation for setting default values. /// </summary> private void ResetButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { // Open confirmation message box DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this); messageBox.SetText(ModManager.GetText("resetConfirmation")); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Cancel); messageBox.OnButtonClick += ConfirmReset_OnButtonClick; uiManager.PushWindow(messageBox); }
private static void NewWagonPopUp() { DaggerfallMessageBox newWagonPopup = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow); string[] message = { "Do you wish to abandon your old wagon and start using your new wagon?" }; newWagonPopup.SetText(message); newWagonPopup.OnButtonClick += NewWagonPopup_OnButtonClick; newWagonPopup.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); newWagonPopup.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); newWagonPopup.Show(); }
public static void DisplayMessage(string message) { DaggerfallMessageBox daggerfallMessageBox = new DaggerfallMessageBox(DaggerfallWorkshop.Game.DaggerfallUI.UIManager); daggerfallMessageBox.AllowCancel = true; daggerfallMessageBox.ClickAnywhereToClose = true; daggerfallMessageBox.ParentPanel.BackgroundColor = Color.clear; daggerfallMessageBox.SetText(message); DaggerfallUI.UIManager.PushWindow(daggerfallMessageBox); }
public static void PackOrLeaveCamp() { DaggerfallMessageBox packPopUp = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow); string[] message = { "Do you wish to pack up your camp?" }; packPopUp.SetText(message); packPopUp.OnButtonClick += PackPopUp_OnButtonClick; packPopUp.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); packPopUp.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); packPopUp.Show(); }
public static void StatusPopup(string[] message) { if (tempInfoBox == null) { tempInfoBox = new DaggerfallMessageBox(DaggerfallUI.UIManager); tempInfoBox.AllowCancel = true; tempInfoBox.ClickAnywhereToClose = true; tempInfoBox.ParentPanel.BackgroundColor = Color.clear; } tempInfoBox.SetText(message); DaggerfallUI.UIManager.PushWindow(tempInfoBox); }
public static void LocatorService(IUserInterfaceWindow window) { Debug.Log("Locator service."); // Get the guild instance. IGuild thisGuild = GameManager.Instance.GuildManager.GetGuild(FactionFile.GuildGroups.GGroup0); // Check how many holy items the player has. Offer 16 if no limit. int holyCount = 16; if (thisGuild.Rank < 6) { PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; List <DaggerfallUnityItem> tomes = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome); tomes.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome)); List <DaggerfallUnityItem> daggers = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger); daggers.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger)); holyCount = tomes.Count + daggers.Count; } if (thisGuild.Rank >= 6 || holyCount > 0) { // Show trade window and a popup message to inform player how many locators they can purchase. DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow) UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { DaggerfallUI.UIManager, null, DaggerfallTradeWindow.WindowModes.Buy, thisGuild }); tradeWindow.MerchantItems = GetLocatorDevices(holyCount, RankLocatorCosts[thisGuild.Rank]); DaggerfallUI.UIManager.PushWindow(tradeWindow); if (thisGuild.Rank < 6) { tradeWindow.OnTrade += LocatorPurchase_OnTrade; DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager, window, true); string[] message = { "We require that you provide the guild with either a holy tome", " or holy dagger for each locator device we supply you.", " At least until you reach the more senior ranks of the guild.", "", " You currently have " + holyCount + " holy items in your posession, so you", " can purchase up to that many locators at this time.", }; messageBox.SetText(message); messageBox.ClickAnywhereToClose = true; messageBox.Show(); } } else { DaggerfallUI.MessageBox(new string[] { "You need to provide the guild either a holy tome or holy dagger", " for each locator device we supply you with. You have neither." }); } }
void ExtractFilesButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { if (modSettings.Length < 1) { return; } Mod mod = ModManager.Instance.GetMod(modSettings[modList.SelectedIndex].modInfo.ModTitle); if (mod == null) { return; } string[] assets = mod.AssetNames; string path = Path.Combine(mod.DirPath, mod.Title + "_ExtractedFiles"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } for (int i = 0; i < assets.Length; i++) { string extension = assets[i].Substring(assets[i].LastIndexOf('.')); if (!ModManager.textExtensions.Contains(extension)) { continue; } TextAsset asset = mod.GetAsset <TextAsset>(assets[i]); if (asset == null) { continue; } File.WriteAllText(Path.Combine(path, asset.name + ".txt"), asset.ToString()); //append .txt at end of asset name so mod info file will never end in .dfmod //which would cause it to be tried to load by mod manager as an asset bundle if in mod directory Debug.Log(string.Format("asset type for asset : {0} {1}", asset.name, asset.GetType().Name)); } var messageBox = new DaggerfallMessageBox(uiManager, this, true); messageBox.AllowCancel = true; messageBox.ClickAnywhereToClose = true; messageBox.ParentPanel.BackgroundTexture = null; messageBox.SetText(string.Format(ModManager.GetText("extractTextConfirmation"), path)); uiManager.PushWindow(messageBox); }
public override bool CheckFastTravel(PlayerEntity playerEntity) { if (DaggerfallUnity.Instance.WorldTime.Now.IsDay) { DaggerfallMessageBox mb = new DaggerfallMessageBox(DaggerfallUI.Instance.UserInterfaceManager); mb.PreviousWindow = DaggerfallUI.Instance.UserInterfaceManager.TopWindow; mb.ClickAnywhereToClose = true; mb.SetText(TextManager.Instance.GetText(textDatabase, "sunlightDamageFastTravelDay")); mb.Show(); return(false); } return(true); }
public static void LocatorService(IUserInterfaceWindow window) { // Get the guild instance. IGuild thisGuild = GameManager.Instance.GuildManager.GetGuild(FactionFile.GuildGroups.GGroup0); // Check how many holy items the player has and offer that many discounted. PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; List <DaggerfallUnityItem> tomes = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome); tomes.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome)); List <DaggerfallUnityItem> daggers = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger); daggers.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger)); int holyCount = tomes.Count + daggers.Count; // Show trade window and a popup message to inform player how many discounted locators they can purchase. DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow) UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { DaggerfallUI.UIManager, null, DaggerfallTradeWindow.WindowModes.Buy, thisGuild }); tradeWindow.MerchantItems = GetLocatorDevices(holyCount, RankLocatorCosts[thisGuild.Rank]); DaggerfallUI.UIManager.PushWindow(tradeWindow); tradeWindow.OnTrade += LocatorPurchase_OnTrade; if (thisGuild.Rank < 8) { DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager, window); string[] message = { " If you can supply the guild with either a holy tome or holy dagger,", " then we can sell locator devices at a third of normal price per relic.", " Locator prices will reduce as you gain higher ranks in the guild.", "", " You currently have " + holyCount + " holy relics in your posession, so you can", " purchase up to that many discounted locators at this time.", "", " I also have a Scarab of Quiet Undead for sale that will help if you", " find you're having trouble with undead monstrosities in the field.", }; if (holyCount == 0) { message[4] = " You don't have any holy relics with you right now, so"; message[5] = " unfortunately we can't offer you any discounts this time."; } messageBox.SetText(message); messageBox.ClickAnywhereToClose = true; messageBox.Show(); } }
private void ConfirmButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { if (string.IsNullOrEmpty(titleTextBox.ResultText) || string.IsNullOrEmpty(descriptionTextBox.ResultText)) { var messageBox = new DaggerfallMessageBox(uiManager, this); messageBox.AllowCancel = true; messageBox.ClickAnywhereToClose = true; messageBox.SetText(ModManager.GetText("titleOrDescriptionMissing")); uiManager.PushWindow(messageBox); } else { createPresetCallback(titleTextBox.ResultText, descriptionTextBox.ResultText, authorTextBox.ResultText); uiManager.PopWindow(); } }
//general messagebox routine. Input a string, puts out a message. public static void DisplayMessage(string message) { if (messageBox == null) { messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager); messageBox.AllowCancel = true; messageBox.ClickAnywhereToClose = true; messageBox.ParentPanel.BackgroundColor = Color.clear; } //sets up messagebox. messageBox.SetText(message); //pushes messagebox to ui surface. DaggerfallUI.UIManager.PushWindow(messageBox); }
private static void WakeUp() { DaggerfallUI.Instance.FadeBehaviour.FadeHUDFromBlack(); DaggerfallMessageBox wakePopUp = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow); string[] message = { "You awake, disoriented and naked.", " ", "You have lost a day.", "", "What horrors did you commit during the full moon...?" }; wakePopUp.SetText(message); wakePopUp.Show(); wakePopUp.ClickAnywhereToClose = true; }
private static void BribePrompt() { string[] message = { "Halt! You are under arrest for " + playerEntity.CrimeCommitted.ToString() + ".", " ", "Do you attempt to bribe the guard?" }; DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager); messageBox.SetText(message); messageBox.ParentPanel.BackgroundColor = Color.clear; messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); messageBox.OnButtonClick += Bribe_OnButtonClick; messageBox.Show(); }
//generates pop-ups, either to indicate failed transaction //or to prompt with yes / no option void GeneratePopup(TransactionResult result, int amount = 0) { if (result == TransactionResult.NONE) { return; } DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this); messageBox.ClickAnywhereToClose = true; this.amount = amount; if (result == TransactionResult.TOO_HEAVY) { messageBox.SetText(TextManager.Instance.GetLocalizedText("cannotCarryGold")); } else { messageBox.SetTextTokens((int)result, this); } if (result == TransactionResult.DEPOSIT_LOC) //show messagebox window w/ yes no buttons { messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No); messageBox.ClickAnywhereToClose = false; messageBox.OnButtonClick += DepositLOC_messageBox_OnButtonClick; } else if (result == TransactionResult.SELL_HOUSE_OFFER) //show messagebox window w/ yes no buttons { messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No); messageBox.ClickAnywhereToClose = false; messageBox.OnButtonClick += SellHouse_messageBox_OnButtonClick; } else if (result == TransactionResult.SELL_SHIP_OFFER) { messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No); messageBox.ClickAnywhereToClose = false; messageBox.OnButtonClick += SellShip_messageBox_OnButtonClick; } messageBox.Show(); }
public static void RestOrPackTent(RaycastHit hit) { DaggerfallMessageBox campPopUp = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow); if (hit.transform.gameObject.GetInstanceID() == Tent.GetInstanceID()) { string[] message = { "Do you wish to rest?" }; campPopUp.SetText(message); campPopUp.OnButtonClick += CampPopUp_OnButtonClick; campPopUp.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); campPopUp.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); campPopUp.Show(); } else { DaggerfallUI.MessageBox("This is not your camp."); } }
void ShowModDescriptionPopUp_OnMouseClick(BaseScreenComponent sender, Vector2 position) { if (modSettings == null || modSettings.Length < 1) { return; } else if (string.IsNullOrEmpty(modSettings[currentSelection].modInfo.ModDescription)) { return; } ModDescriptionMessageBox = new DaggerfallMessageBox(uiManager, this); ModDescriptionMessageBox.AllowCancel = true; ModDescriptionMessageBox.ClickAnywhereToClose = true; ModDescriptionMessageBox.ParentPanel.BackgroundTexture = null; string[] modDescription = modSettings[currentSelection].modInfo.ModDescription.Split('\n'); ModDescriptionMessageBox.SetText(modDescription); uiManager.PushWindow(ModDescriptionMessageBox); }
private static void ShowMessageBox(string message, bool clickAnywhereToClose = true, string[] buttons = null) { DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager); messageBox.ClickAnywhereToClose = clickAnywhereToClose; messageBox.ParentPanel.BackgroundColor = Color.clear; messageBox.ScreenDimColor = new Color32(0, 0, 0, 0); messageBox.SetText(message); if (buttons != null) { for (int i = 0; i < buttons.Length; i++) { messageBox.AddCustomButton(99 + i, buttons[i], false); } messageBox.OnCustomButtonClick += Tent_messageBox_OnButtonClick; } messageBox.Show(); }
private void ExportButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { Preset preset = settings.Presets[listBox.SelectedIndex]; string fileName = string.Join("_", preset.Title.Split(Path.GetInvalidFileNameChars())) + ".json"; string dirPath = ModManager.CombinePaths(Application.persistentDataPath, "Mods", "ExportedPresets", mod.FileName); string filePath = Path.Combine(dirPath, fileName); var messageBox = new DaggerfallMessageBox(uiManager, this, true); messageBox.AllowCancel = true; messageBox.SetText(string.Format(ModManager.GetText("exportMessage"), preset.Title, filePath)); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.OK, true); messageBox.OnButtonClick += (source, messageBoxButton) => { Directory.CreateDirectory(dirPath); File.WriteAllText(filePath, SaveLoadManager.Serialize(typeof(Preset), preset, true)); source.PopWindow(); }; uiManager.PushWindow(messageBox); }
void ShowModDescriptionPopUp_OnMouseClick(BaseScreenComponent sender, Vector2 position) { if (modSettings == null || modSettings.Length < 1) { return; } else if (string.IsNullOrWhiteSpace(modSettings[currentSelection].modInfo.ModDescription)) { return; } ModDescriptionMessageBox = new DaggerfallMessageBox(uiManager, this, true); ModDescriptionMessageBox.AllowCancel = true; ModDescriptionMessageBox.ClickAnywhereToClose = true; ModDescriptionMessageBox.ParentPanel.BackgroundTexture = null; Mod mod = ModManager.Instance.GetMod(modSettings[currentSelection].modInfo.ModTitle); string[] modDescription = (mod.TryLocalize("Mod", "Description") ?? mod.ModInfo.ModDescription).Split('\n'); ModDescriptionMessageBox.SetText(modDescription); uiManager.PushWindow(ModDescriptionMessageBox); }
protected override void ExitButtonClickHandler(BaseScreenComponent sender, Vector2 position) { DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick); if (RegionSelected) { CloseRegionPanel(); } else if (changed) { DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this); messageBox.SetText("Do you want to save changes?"); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No); messageBox.OnButtonClick += SaveBoxClick; uiManager.PushWindow(messageBox); } else { CloseTravelWindows(); } }