diff --git a/.tools/BannerLib.ReleasePackager/ReleasePackager.cs b/.tools/BannerLib.ReleasePackager/ReleasePackager.cs index 553c652..21fd1e3 100644 --- a/.tools/BannerLib.ReleasePackager/ReleasePackager.cs +++ b/.tools/BannerLib.ReleasePackager/ReleasePackager.cs @@ -23,7 +23,7 @@ internal class ReleasePackager // Run this project. private const string c_MODULE_NAME = "BannerLib"; - private const string c_RELEASE_VER = "v0.0.5"; // v is required, major.minor.revision format. + private const string c_RELEASE_VER = "v0.0.6"; // v is required, major.minor.revision format. private const bool c_IS_SINGLEPLAYER_ONLY = true; // if this is false, the module can also be used in multiplayer, leave it false for now. private const string c_BIN_DIR = "bin/Release"; diff --git a/BannerLib.Gameplay/Models/GameModelLedgerEntry.cs b/BannerLib.Gameplay/Models/GameModelLedgerEntry.cs index 9694269..a238c67 100644 --- a/BannerLib.Gameplay/Models/GameModelLedgerEntry.cs +++ b/BannerLib.Gameplay/Models/GameModelLedgerEntry.cs @@ -2,13 +2,25 @@ namespace BannerLib.Gameplay.Models { + /// + /// Describes a replacement, addition or decoration operation that took place via BannerLib. + /// public class GameModelLedgerEntry { + /// + /// The base type of the replacement in question. + /// public Type BaseType { get; } + /// + /// The original type that was replaced. + /// public Type Original { get; } + /// + /// The replacement type. + /// public Type Replacement { get; } - public GameModelLedgerEntry(Type original, Type replacement) + internal GameModelLedgerEntry(Type original, Type replacement) { Original = original; Replacement = replacement; diff --git a/BannerLib.Gameplay/Models/GameModels.cs b/BannerLib.Gameplay/Models/GameModels.cs index 0cd506d..b1c0661 100644 --- a/BannerLib.Gameplay/Models/GameModels.cs +++ b/BannerLib.Gameplay/Models/GameModels.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.SandBox.GameComponents; using TaleWorlds.Core; namespace BannerLib.Gameplay.Models @@ -30,8 +32,8 @@ public static GameModelLedgerEntry IsModelReplaced() where TModelBas /// Check if a model implementation exists for a given base type. /// /// Object. - /// - /// + /// Derived base class to check for. + /// True if a model that derives from the given type exists in the current models. public static bool ModelExistsFor(this IGameStarter starter) where TModelBase : GameModel { return starter.Models.Any(x => x is TModelBase); @@ -41,8 +43,8 @@ public static bool ModelExistsFor(this IGameStarter starter) where T /// Replace a specific GameModel implementation with another. /// /// Object. - /// - /// + /// Specific instance of a derived type to use as the replacement. + /// derived type to use as the replace. /// derived type to use as the replacement. public static void Replace(this IGameStarter starter, TReplacement replacement) where TReplace : GameModel where TReplacement : GameModel @@ -66,7 +68,7 @@ public static void Replace(this IGameStarter starter, TRe /// Replace a specific GameModel implementation with another. /// /// Object. - /// + /// Derived base class to replace E.G.: /// derived type to use as the replacement. public static void Replace(this IGameStarter starter) where TReplace : GameModel where TReplacement : GameModel, new() => @@ -77,7 +79,7 @@ public static void Replace(this IGameStarter starter) /// /// Object. /// Instance of a derived type to use as the replacement. - /// + /// Derived base class to replace E.G.: /// derived type to use as the replacement. public static void ReplaceAll(this IGameStarter starter, TReplacement replacement) where TBaseReplace : GameModel where TReplacement : GameModel @@ -106,9 +108,9 @@ public static void ReplaceAll(this IGameStarter star /// /// Decorates an existing model with a given decorator that is produced by the given function /// - /// - /// - /// + /// derived type to decorate. + /// derived type that will decorate it. + /// Object. /// Functions which creates the decorator from the given model public static void Decorate(this IGameStarter starter, Func decoraterCtor) where TDecoratee : GameModel where TDecorater : TDecoratee @@ -121,6 +123,7 @@ public static void Decorate(this IGameStarter starter, F throw new ArgumentException($"No model or multiple models registered with type '{baseType.Name}'. It must be exactly ONE model with this type to decorate it!"); var decorater = decoraterCtor(model); starter.Replace(decorater); + m_ledger.Add(new GameModelLedgerEntry(typeof(TDecoratee), typeof(TDecorater))); } ///