private void DoModRowDownloading(Listing_Standard listing, int index) { Rect rect = new Rect(0f, (float)index * 26f, listing.ColumnWidth, 26f); ContentSourceUtility.DrawContentSource(rect, ContentSource.SteamWorkshop); rect.xMin += 28f; Widgets.Label(rect, "Downloading".Translate() + GenText.MarchingEllipsis()); }
private void DoModRowDownloading(Listing_Standard listing, int index) { Rect rect = listing.GetRect(26f); ContentSourceUtility.DrawContentSource(rect, ContentSource.SteamWorkshop, null); rect.xMin += 28f; Widgets.Label(rect, "Downloading".Translate() + GenText.MarchingEllipsis(0f)); }
private void DoModRow(Rect r, ModMetaData mod, int index, int reorderableGroup) { bool active = mod.Active; Action clickAction = null; if (mod.Source == ContentSource.SteamWorkshop) { clickAction = delegate { SteamUtility.OpenWorkshopPage(mod.GetPublishedFileId()); }; } ContentSourceUtility.DrawContentSource(r, mod.Source, clickAction); r.xMin += 28f; bool selected = mod == selectedMod; Rect rect = r; if (mod.enabled) { string text = ""; if (active) { text += "DragToReorder".Translate() + ".\n"; } if (!mod.VersionCompatible) { GUI.color = Color.yellow; if (!text.NullOrEmpty()) { text += "\n"; } text = ((!mod.MadeForNewerVersion) ? ((string)(text + "ModNotMadeForThisVersion".Translate())) : ((string)(text + "ModNotMadeForThisVersion_Newer".Translate()))); } if (active && !modWarningsCached.NullOrEmpty() && !modWarningsCached[index].NullOrEmpty()) { GUI.color = Color.red; if (!text.NullOrEmpty()) { text += "\n"; } text += modWarningsCached[index]; } GUI.color = FilteredColor(GUI.color, mod.Name); if (!text.NullOrEmpty()) { TooltipHandler.TipRegion(rect, new TipSignal(text, mod.GetHashCode() * 3311)); } float num = rect.width - 24f; if (active) { GUI.DrawTexture(new Rect(rect.xMax - 48f + 2f, rect.y, 24f, 24f), TexButton.DragHash); num -= 24f; } Text.Font = GameFont.Small; string label = mod.Name.Truncate(num, truncatedModNamesCache); bool checkOn = active; if (Widgets.CheckboxLabeledSelectable(rect, label, ref selected, ref checkOn)) { selectedMod = mod; RecacheSelectedModRequirements(); } if (active && !checkOn && mod.IsCoreMod) { ModMetaData coreMod = mod; Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDisableCoreMod".Translate(), delegate { coreMod.Active = false; truncatedModNamesCache.Clear(); })); } else { if (!active && checkOn) { foreach (ModMetaData item in ModsConfig.ActiveModsInLoadOrder) { if (item.PackageIdNonUnique.Equals(mod.PackageIdNonUnique, StringComparison.InvariantCultureIgnoreCase)) { Find.WindowStack.Add(new Dialog_MessageBox("MessageModWithPackageIdAlreadyEnabled".Translate(mod.PackageIdPlayerFacing, item.Name))); return; } } } if (checkOn != active) { mod.Active = checkOn; } truncatedModNamesCache.Clear(); } } else { GUI.color = FilteredColor(Color.gray, mod.Name); Widgets.Label(rect, mod.Name); } GUI.color = Color.white; }
private void DoModRow(Listing_Standard listing, ModMetaData mod, int index, int reorderableGroup) { Rect rect = listing.GetRect(26f); if (mod.Active) { ReorderableWidget.Reorderable(reorderableGroup, rect, false); } Action clickAction = null; if (mod.Source == ContentSource.SteamWorkshop) { clickAction = delegate { SteamUtility.OpenWorkshopPage(mod.GetPublishedFileId()); }; } ContentSourceUtility.DrawContentSource(rect, mod.Source, clickAction); rect.xMin += 28f; bool flag = mod == this.selectedMod; bool active = mod.Active; Rect rect2 = rect; if (mod.enabled) { string text = string.Empty; if (mod.Active) { text = text + "DragToReorder".Translate() + ".\n\n"; } if (!mod.VersionCompatible) { GUI.color = Color.red; if (mod.MadeForNewerVersion) { text += "ModNotMadeForThisVersion_Newer".Translate(); } else { text += "ModNotMadeForThisVersion".Translate(); } } GUI.color = this.FilteredColor(GUI.color, mod.Name); if (!text.NullOrEmpty()) { TooltipHandler.TipRegion(rect2, new TipSignal(text, mod.GetHashCode() * 3311)); } float num = rect2.width - 24f; if (mod.Active) { Rect position = new Rect(rect2.xMax - 48f + 2f, rect2.y, 24f, 24f); GUI.DrawTexture(position, TexButton.DragHash); num -= 24f; } Text.Font = GameFont.Small; string label = mod.Name.Truncate(num, this.truncatedModNamesCache); if (Widgets.CheckboxLabeledSelectable(rect2, label, ref flag, ref active)) { this.selectedMod = mod; } if (mod.Active && !active && mod.IsCoreMod) { ModMetaData coreMod = mod; Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDisableCoreMod".Translate(), delegate { coreMod.Active = false; this.truncatedModNamesCache.Clear(); }, false, null)); } else { mod.Active = active; this.truncatedModNamesCache.Clear(); } } else { GUI.color = this.FilteredColor(Color.gray, mod.Name); Widgets.Label(rect2, mod.Name); } GUI.color = Color.white; }
private static void DoModRow(Listing_Standard listing, ModMetaDataEnhanced mod, int index, int reorderableGroup = -1) { Rect rect = listing.GetRect(26f); if (mod.Active && !SearchInProgress) { ReorderableWidget.Reorderable(reorderableGroup, rect); } Action clickAction = null; if (mod.Source == ContentSource.SteamWorkshop) { clickAction = CreateModRowActionSteam(mod); } else { clickAction = CreateModRowActionLocal(mod); } ContentSourceUtility.DrawContentSource(rect, mod.Source, clickAction); rect.xMin += 28f; bool active = mod.Active; bool isSelected = mod.OriginalMetaData == selectedMod.OriginalMetaData; Rect rect2 = rect; if (mod.Enabled && RenameInProgress == false) { string text = string.Empty; if (mod.Active) { text = text + "DragToReorder".Translate() + ".\n\n"; } if (!text.NullOrEmpty()) { TooltipHandler.TipRegion(rect2, new TipSignal(text, mod.GetHashCode() * 3311)); } Color origColor = GUI.color; GUI.color = mod.TextColor; if (Widgets.CheckboxLabeledSelectable(rect2, mod.Name, ref isSelected, ref active)) { selectedMod = mod; } GUI.color = origColor; if (mod.Active && reorderableGroup >= 0) { Rect texRect = new Rect(rect2.xMax - 48f + 2f, rect2.y, 24f, 24f); GUI.DrawTexture(texRect, Textures.DragHash); } if (mod.HasNotifications) { Color notifColour = Color.gray; string tooltipString = string.Empty; foreach (NotificationBase notification in mod.Notifications) { if (notification.MessageType == NotificationType.Error) { notifColour = Color.red; } else if (notification.MessageType == NotificationType.Warning && notifColour != Color.red) { notifColour = Color.yellow; } tooltipString += notification.MessageText + "\n\n"; } Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Medium; GUI.color = notifColour; Rect dupRect = new Rect(rect2.xMax - 72f + 2f, rect.y, 24f, 24f); Widgets.Label(dupRect, "!"); TooltipHandler.ClearTooltipsFrom(dupRect); TooltipHandler.TipRegion(dupRect, tooltipString.Trim()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; GUI.color = Color.white; } if (mod.Active && !active && mod.Name == ModContentPack.CoreModIdentifier) { ModMetaData coreMod = mod.OriginalMetaData; Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDisableCoreMod".Translate(), delegate { coreMod.Active = false; truncatedModNamesCache.Clear(); }, false, null)); } else { mod.Active = active; truncatedModNamesCache.Clear(); } } else if (RenameInProgress == true && isSelected) { renameBuf = Widgets.TextField(rect2, renameBuf); } else { GUI.color = Color.gray; Widgets.Label(rect2, mod.Name); } GUI.color = Color.white; }