From 468e72a0716a3b2cb6bebf38c961383b21da4d37 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 18 Feb 2021 19:12:01 +0100 Subject: [PATCH] update! --- Content/ExampleMod/UiTextures.png | Bin 0 -> 211 bytes ExampleMod.cs | 10 +++++++--- ExampleMod.csproj | 2 +- Run.bat | 2 +- Run.sh | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 Content/ExampleMod/UiTextures.png diff --git a/Content/ExampleMod/UiTextures.png b/Content/ExampleMod/UiTextures.png new file mode 100644 index 0000000000000000000000000000000000000000..572184c9fe46c24ee37292f3158ed87abf0750d0 GIT binary patch literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|dOcknLn`LH zy>XC}K~aF&!S>Dm)Z7OSAC+g#T)ydna?8=6jFv$oslsuqk#Bj}mS#G73l|IM-Pgg&ebxsLQ08Cyq A{{R30 literal 0 HcmV?d00001 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