mirror of
https://github.com/Ellpeck/TinyLifeExampleMod.git
synced 2024-11-22 12:03:28 +01:00
added a custom wallpaper example
This commit is contained in:
parent
f0a4bf01d6
commit
04a745703b
3 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"BuildMode": {
|
"BuildMode": {
|
||||||
"ExampleMod.CustomTable": "Custom Table"
|
"ExampleMod.CustomTable": "Custom Table",
|
||||||
|
"ExampleMod.CrossedWallpaper": "Crossed Wallpaper"
|
||||||
},
|
},
|
||||||
"Clothes": {
|
"Clothes": {
|
||||||
"ExampleMod.DarkShirt": "Dark Shirt",
|
"ExampleMod.DarkShirt": "Dark Shirt",
|
||||||
|
|
BIN
Content/ExampleMod/Wallpapers.png
Normal file
BIN
Content/ExampleMod/Wallpapers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 706 B |
|
@ -12,6 +12,7 @@ using TinyLife.Emotions;
|
||||||
using TinyLife.Mods;
|
using TinyLife.Mods;
|
||||||
using TinyLife.Objects;
|
using TinyLife.Objects;
|
||||||
using TinyLife.Utilities;
|
using TinyLife.Utilities;
|
||||||
|
using TinyLife.World;
|
||||||
|
|
||||||
namespace ExampleMod;
|
namespace ExampleMod;
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ public class ExampleMod : Mod {
|
||||||
private UniformTextureAtlas customHairs;
|
private UniformTextureAtlas customHairs;
|
||||||
private UniformTextureAtlas customBottoms;
|
private UniformTextureAtlas customBottoms;
|
||||||
private UniformTextureAtlas uiTextures;
|
private UniformTextureAtlas uiTextures;
|
||||||
|
private UniformTextureAtlas wallpaperTextures;
|
||||||
|
|
||||||
public override void AddGameContent(GameImpl game, ModInfo info) {
|
public override void AddGameContent(GameImpl game, ModInfo info) {
|
||||||
// adding a custom furniture item
|
// adding a custom furniture item
|
||||||
|
@ -92,6 +94,9 @@ public class ExampleMod : Mod {
|
||||||
// we use this emotion modifier in SitDownOnGrassAction
|
// we use this emotion modifier in SitDownOnGrassAction
|
||||||
GrassSittingModifier = EmotionModifier.Register(
|
GrassSittingModifier = EmotionModifier.Register(
|
||||||
new EmotionModifier("ExampleMod.GrassSitting", this.uiTextures[1, 0], EmotionType.Happy));
|
new EmotionModifier("ExampleMod.GrassSitting", this.uiTextures[1, 0], EmotionType.Happy));
|
||||||
|
|
||||||
|
// adding a custom wallpaper (we're using the top left texture region, which is why we pass 0, 0 as the texture coordinate)
|
||||||
|
Wallpaper.Register("ExampleMod.CrossedWallpaper", 15, this.wallpaperTextures, new Point(0, 0), ColorScheme.Modern, this.Icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) {
|
public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) {
|
||||||
|
@ -103,6 +108,8 @@ public class ExampleMod : Mod {
|
||||||
texturePacker.Add(content.Load<Texture2D>("CustomHairs"), r => this.customHairs = new UniformTextureAtlas(r, 4, 6));
|
texturePacker.Add(content.Load<Texture2D>("CustomHairs"), r => this.customHairs = new UniformTextureAtlas(r, 4, 6));
|
||||||
texturePacker.Add(content.Load<Texture2D>("CustomBottomsShoes"), r => this.customBottoms = new UniformTextureAtlas(r, 8, 6));
|
texturePacker.Add(content.Load<Texture2D>("CustomBottomsShoes"), r => this.customBottoms = new UniformTextureAtlas(r, 8, 6));
|
||||||
texturePacker.Add(content.Load<Texture2D>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8));
|
texturePacker.Add(content.Load<Texture2D>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8));
|
||||||
|
// wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor
|
||||||
|
TextureHandler.ApplyWallpaperMasks(content.Load<Texture2D>("Wallpapers"), 4, 5, r => this.wallpaperTextures = r);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetCustomFurnitureTextures(ModInfo info) {
|
public override IEnumerable<string> GetCustomFurnitureTextures(ModInfo info) {
|
||||||
|
|
Loading…
Reference in a new issue