diff --git a/Content/ExampleMod/UiTextures.png b/Content/ExampleMod/UiTextures.png new file mode 100644 index 0000000..572184c Binary files /dev/null and b/Content/ExampleMod/UiTextures.png differ diff --git a/ExampleMod.cs b/ExampleMod.cs index aa363b7..f6a1bac 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -19,27 +19,31 @@ namespace ExampleMod { // visual data about this mod public override string Name => "Example Mod"; public override string Description => "This is the example mod for Tiny Life!"; + public override TextureRegion Icon => this.uiTextures[0, 0]; private UniformTextureAtlas customClothes; + private UniformTextureAtlas uiTextures; public override void AddGameContent(GameImpl game) { // adding a custom furniture item FurnitureType.Register(new FurnitureType.TypeSettings("ExampleMod.CustomTable", new Point(1, 1), ObjectCategory.Table, 150, ColorScheme.SimpleWood) { - Construct = (i, t, c, m, p) => new CustomTable(i, t, c, m, p) + ConstructedType = typeof(CustomTable), + Icon = this.Icon }); // adding custom clothing Clothes.Register(new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt, this.customClothes[0, 0], // the top left in-world region (the rest will be auto-gathered from the atlas) - ColorScheme.WarmDark)); + 100, this.Icon, false, ColorScheme.WarmDark)); } public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker) { Logger = logger; - + // loads a texture atlas with the given amount of separate texture regions in the x and y axes // we submit it to the texture packer to increase rendering performance. The callback is invoked once packing is completed texturePacker.Add(content.Load("CustomClothes"), r => this.customClothes = new UniformTextureAtlas(r, 4, 6)); + texturePacker.Add(content.Load("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8)); } public override IEnumerable GetCustomFurnitureTextures() { diff --git a/ExampleMod.csproj b/ExampleMod.csproj index c7386a7..28abf8f 100644 --- a/ExampleMod.csproj +++ b/ExampleMod.csproj @@ -5,7 +5,7 @@ - + diff --git a/Run.bat b/Run.bat index 2491be6..8b60283 100644 --- a/Run.bat +++ b/Run.bat @@ -4,7 +4,7 @@ cd /d "%~dp0" rem build the mod dotnet build rem copy the mod to the mods folder -robocopy ./bin/Debug/netcoreapp3.0/ "%LOCALAPPDATA%/Tiny Life/Mods" /e +robocopy ./bin/Debug/net5.0/ "%LOCALAPPDATA%/Tiny Life/Mods" /e /is rem run the game set /p dir=<"%LOCALAPPDATA%/Tiny Life/GameDir" cd /d %dir% diff --git a/Run.sh b/Run.sh index a72dc71..f98de87 100644 --- a/Run.sh +++ b/Run.sh @@ -4,7 +4,7 @@ cd "$(dirname "$0")" # build the mod dotnet build # copy the mod to the mods folder -cp ./bin/Debug/netcoreapp3.0/* "$LOCALAPPDATA/Tiny Life/Mods" -r +cp ./bin/Debug/net5.0/* "$LOCALAPPDATA/Tiny Life/Mods" -r # run the game dir=$(<"$LOCALAPPDATA/Tiny Life/GameDir") cd $dir