public static FloatMenuOption SavedModListOption(ModList list)
        {
            var options = Utilities.NewOptionsList;

            options.Add(new FloatMenuOption(I18n.ExportModList, () => { GUIUtility.systemCopyBuffer = list.ToYaml(); Messages.Message(I18n.ModListCopiedToClipboard(list.Name), MessageTypeDefOf.TaskCompletion, false); }));
            options.Add(new FloatMenuOption(I18n.LoadModList, () => list.Apply(false)));
            options.Add(new FloatMenuOption(I18n.AddModList, () => list.Apply(true)));
            options.Add(new FloatMenuOption(I18n.RenameModList, () => Find.WindowStack.Add(new Dialog_Rename_ModList(list))));
            options.Add(new FloatMenuOption(I18n.ChangeListColour, () => Find.WindowStack.Add(new Dialog_ColourPicker(list.Color, color => list.Color = color))));
            options.Add(new FloatMenuOption(I18n.DeleteModList, () => TryDelete(list)));
            return(new FloatMenuOption(list.Name, () => Utilities.FloatMenu(options)));
        }
        private static void DrawCrossPromotions(ref Rect canvas, IEnumerable <CrossPromotion> promotions)
        {
            var backgroundRect = new Rect(
                canvas.xMin,
                canvas.yMin,
                canvas.width,
                PromotionsHeight);
            var outRect = backgroundRect.ContractedBy(SmallMargin / 2);
            var height  = (int)outRect.height;
            var width   = promotions.Sum(p => p.NormalizedWidth(height)) + (promotions.Count() - 1) * SmallMargin;

            if (width > outRect.width)
            {
                height -= 16;
                // recalculate total width
                width = promotions.Sum(p => p.NormalizedWidth(height)) + (promotions.Count() - 1) * SmallMargin;
            }
            var viewRect = new Rect(
                canvas.xMin,
                canvas.yMin,
                width,
                height);
            var pos = viewRect.min;

            canvas.yMin += PromotionsHeight + SmallMargin;

            Widgets.DrawBoxSolid(backgroundRect, SlightlyDarkBackground);
            if (Mouse.IsOver(outRect) && Event.current.type == EventType.ScrollWheel)
            {
                _scrollPosition.x += Event.current.delta.y * Constants.ScrollSpeed;
            }
            Widgets.BeginScrollView(outRect, ref _scrollPosition, viewRect);
            foreach (var promotion in promotions)
            {
                var normalizedWidth = promotion.NormalizedWidth(height);
                var rect            = new Rect(pos.x, pos.y, normalizedWidth, height);
                if (Widgets.ButtonImage(rect, promotion.Preview, new Color(.9f, .9f, .9f), Color.white))
                {
                    if (!promotion.Installed)
                    {
                        var options = Utilities.NewOptionsList;
                        options.Add(new FloatMenuOption(I18n.Subscribe(promotion.Name),
                                                        () => Workshop.Subscribe(promotion.FileId)));
                        options.Add(new FloatMenuOption(I18n.WorkshopPage(promotion.Name),
                                                        () => SteamUtility.OpenWorkshopPage(promotion.FileId)));
                        Utilities.FloatMenu(options);
                    }
                    else
                    {
                        var button = ModButtonManager.AllButtons.FirstOrDefault(b => b.Name == promotion.Name);
                        if (button != null)
                        {
                            Page_BetterModConfig.Instance.Selected = button;
                        }
                    }
                }
                TooltipHandler.TipRegion(rect, promotion.Name + "\n\n" + promotion.Description);
                pos.x += normalizedWidth + SmallMargin;
            }
            Widgets.EndScrollView();
        }
Exemplo n.º 3
0
 public static ModIssue MissingMod(ModButton_Missing button)
 {
     return(new ModIssue(Severity.Major, Subject.Other, button, button.Identifier,
                         I18n.MissingMod(button.Name, button.Identifier),
                         () => Resolvers.ResolveFindMod(button.Name, button, replace: true)));
 }
Exemplo n.º 4
0
 public static ModIssue InvalidVersion(ModButton_Installed button)
 {
     return(new ModIssue(Severity.Minor, Subject.Version, button, button.Identifier,
                         I18n.InvalidVersion(button.Selected.TargetVersion)));
 }
Exemplo n.º 5
0
 public static ModIssue DifferentVersion(ModButton_Installed button)
 {
     return(new ModIssue(Severity.Critical, Subject.Version, button, button.Identifier,
                         I18n.DifferentVersion(button.Selected)));
 }
Exemplo n.º 6
0
 public static ModIssue UpdateAvailable(ModButton_Installed button)
 {
     return(new ModIssue(Severity.Minor, Subject.Version, button, button.Identifier,
                         I18n.UpdateAvailable(button.Manifest.Version, button.Manifest.Version)));
 }