public static DaggerfallMessageBox CreateBankingStatusBox(IUserInterfaceWindow previous = null) { const string textDatabase = "DaggerfallUI"; DaggerfallMessageBox bankingBox = new DaggerfallMessageBox(DaggerfallUI.Instance.UserInterfaceManager, previous); bankingBox.SetHighlightColor(DaggerfallUI.DaggerfallUnityStatDrainedTextColor); List <TextFile.Token> messages = new List <TextFile.Token>(); bool found = false; messages.AddRange(GetLoansLine( TextManager.Instance.GetText(textDatabase, "region"), TextManager.Instance.GetText(textDatabase, "account"), TextManager.Instance.GetText(textDatabase, "loan"), TextManager.Instance.GetText(textDatabase, "dueDate"))); messages.Add(TextFile.NewLineToken); for (int regionIndex = 0; regionIndex < DaggerfallBankManager.BankAccounts.Length; regionIndex++) { if (DaggerfallBankManager.GetAccountTotal(regionIndex) > 0 || DaggerfallBankManager.HasLoan(regionIndex)) { TextFile.Formatting formatting = DaggerfallBankManager.HasDefaulted(regionIndex) ? TextFile.Formatting.TextHighlight : TextFile.Formatting.Text; messages.AddRange(GetLoansLine(ShortenName(MapsFile.RegionNames[regionIndex], 12), DaggerfallBankManager.GetAccountTotal(regionIndex).ToString(), DaggerfallBankManager.GetLoanedTotal(regionIndex).ToString(), DaggerfallBankManager.GetLoanDueDateString(regionIndex), formatting)); found = true; } } if (!found) { TextFile.Token noneToken = TextFile.CreateTextToken(TextManager.Instance.GetText(textDatabase, "noAccount")); messages.Add(noneToken); messages.Add(TextFile.NewLineToken); } bankingBox.SetTextTokens(messages.ToArray()); bankingBox.ClickAnywhereToClose = true; return(bankingBox); }
internal void DisplayLocationInfo() { if (LocationSummary.LocationType == DFRegion.LocationTypes.Coven || LocationSummary.LocationType == DFRegion.LocationTypes.DungeonKeep || LocationSummary.LocationType == DFRegion.LocationTypes.DungeonLabyrinth || LocationSummary.LocationType == DFRegion.LocationTypes.DungeonRuin || LocationSummary.LocationType == DFRegion.LocationTypes.Graveyard || LocationSummary.LocationType == DFRegion.LocationTypes.None) { return; } Dictionary <int, PlayerGPS.DiscoveredLocation> discoveryData = GameManager.Instance.PlayerGPS.GetDiscoverySaveData(); if (discoveryData.ContainsKey(LocationSummary.ID)) { PlayerGPS.DiscoveredLocation discoveredLocation = discoveryData[locationSummary.ID]; Dictionary <int, PlayerGPS.DiscoveredBuilding> locBuildings = discoveredLocation.discoveredBuildings; if (locBuildings != null && locBuildings.Count > 0) { IDictionary <DFLocation.BuildingTypes, int> buildingTypeCounts = new SortedDictionary <DFLocation.BuildingTypes, int>(); List <string> guildNames = new List <string>(); foreach (PlayerGPS.DiscoveredBuilding building in locBuildings.Values) { if (RMBLayout.IsNamedBuilding(building.buildingType)) { string guildName = building.displayName.StartsWith("The ") ? building.displayName.Substring(4) : building.displayName; if (building.buildingType == DFLocation.BuildingTypes.GuildHall && !guildNames.Contains(guildName)) { guildNames.Add(guildName); } if (building.buildingType != DFLocation.BuildingTypes.GuildHall) { if (buildingTypeCounts.ContainsKey(building.buildingType)) { buildingTypeCounts[building.buildingType]++; } else { buildingTypeCounts.Add(building.buildingType, 1); } } } } List <TextFile.Token> tokens = new List <TextFile.Token>(); tokens.Add(new TextFile.Token() { text = GetLocationNameInCurrentRegion(locationSummary.MapIndex, true), formatting = TextFile.Formatting.TextHighlight }); tokens.Add(newLine); tokens.Add(newLine); guildNames.Sort(); string guilds = ""; foreach (string guildName in guildNames) { if (!string.IsNullOrWhiteSpace(guilds)) { guilds += ", "; } guilds += guildName; } TextFile.Token tab1 = TextFile.TabToken; tab1.x = 45; TextFile.Token tab2 = TextFile.TabToken; tab2.x = 100; TextFile.Token tab3 = TextFile.TabToken; tab3.x = 145; if (!string.IsNullOrWhiteSpace(guilds)) { tokens.Add(TextFile.CreateTextToken("Guild Halls: " + guilds)); } tokens.Add(newLine); tokens.Add(TextFile.NewLineToken); bool secondColumn = false; foreach (DFLocation.BuildingTypes buildingType in buildingTypeCounts.Keys) { tokens.Add(TextFile.CreateTextToken(buildingType.ToString())); tokens.Add(!secondColumn ? tab1 : tab3); tokens.Add(TextFile.CreateTextToken(buildingTypeCounts[buildingType].ToString())); if (!secondColumn) { tokens.Add(tab2); } else { tokens.Add(TextFile.NewLineToken); } secondColumn = !secondColumn; } infoBox = new DaggerfallMessageBox(uiManager, this); infoBox.ClickAnywhereToClose = true; infoBox.SetHighlightColor(Color.white); infoBox.SetTextTokens(tokens.ToArray()); infoBox.OnClose += InfoBox_Close; infoBox.Show(); return; } } DaggerfallUI.MessageBox("You have no knowledge of " + GetLocationNameInCurrentRegion(locationSummary.MapIndex, true) + "."); }