mirror of
https://github.com/Ellpeck/TinyLifeExampleMod.git
synced 2024-12-22 15:39:22 +01:00
update!
This commit is contained in:
parent
01a02b6df7
commit
468e72a071
5 changed files with 10 additions and 6 deletions
BIN
Content/ExampleMod/UiTextures.png
Normal file
BIN
Content/ExampleMod/UiTextures.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 211 B |
|
@ -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<Texture2D>("CustomClothes"), r => this.customClothes = new UniformTextureAtlas(r, 4, 6));
|
||||
texturePacker.Add(content.Load<Texture2D>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetCustomFurnitureTextures() {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TinyLifeApi" Version="0.6.0" />
|
||||
<PackageReference Include="TinyLifeApi" Version="0.7.0" />
|
||||
|
||||
<PackageReference Include="ExtremelySimpleLogger" Version="1.2.1" />
|
||||
<PackageReference Include="MLEM.Data" Version="4.3.0" />
|
||||
|
|
2
Run.bat
2
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%
|
||||
|
|
2
Run.sh
2
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
|
||||
|
|
Loading…
Reference in a new issue