From a07d8ba5c77c185fd817f05d515f7cb0cc7fd836 Mon Sep 17 00:00:00 2001 From: jpiolho <783467+jpiolho@users.noreply.github.com> Date: Sat, 27 Jan 2024 13:50:18 +0100 Subject: [PATCH] Custom tile example (#2) * Added custom tile example * Fixed whitespace --- Content/ExampleMod/Localization/en.json | 3 ++- Content/ExampleMod/Tiles.png | Bin 0 -> 535 bytes ExampleMod.cs | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 Content/ExampleMod/Tiles.png diff --git a/Content/ExampleMod/Localization/en.json b/Content/ExampleMod/Localization/en.json index 3f87a5c..e5fa4b0 100644 --- a/Content/ExampleMod/Localization/en.json +++ b/Content/ExampleMod/Localization/en.json @@ -1,7 +1,8 @@ { "BuildMode": { "ExampleMod.CustomTable": "Custom Table", - "ExampleMod.CrossedWallpaper": "Crossed Wallpaper" + "ExampleMod.CrossedWallpaper": "Crossed Wallpaper", + "ExampleMod.CustomTile": "Custom Tile" }, "Clothes": { "ExampleMod.DarkShirt": "Dark Shirt", diff --git a/Content/ExampleMod/Tiles.png b/Content/ExampleMod/Tiles.png new file mode 100644 index 0000000000000000000000000000000000000000..1f1c337684930975bfd25381c05ebe762f11e4d2 GIT binary patch literal 535 zcmeAS@N?(olHy`uVBq!ia0vp^4M6O`!3-pya`gKGDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(ehe9sxcft{XONxOwyD)2C0bU%!6)_U-%k?>~F??9rn~_wL=ha^=e1yLWHg zxbfu4lRJ0r+`4t^@#Du=uU@@&?b?F}4=!H3`0(Mw%a<>|c<};gSZ}i4WFRF`666>B zA3I<;E3EelsD`t^BeIx*f$ty)Gwzs}{TAp@6Hgb%kPPRyQ%~o$81T5}AIP&g$Lx{$ z{Qv(g%L2|CY*w57E3adc$MX{#S>HW>Q2O}QoJt1?D{Y(04HJJTx2@yi7gHz^_T3rs zZp8<8rdKRS3{HnQ$L7?^#LS(`EU?{7EMbwzGmbNRS8WJf^VP1g==ABN_x79y8v=Y| zMG}6@43oQJvgyhXRufL;b`h_)3pOOazTqJq`7rtRhcMo##VaPYo#x%fC7~(kop^Y9 zT-{+H`-XiS^;O3lm(U)_i+s++A>9^T*$& zj>*SnU6D(=Y{|FoTyyf<>qU#coxPLJ@ZDx|j#9|=4Ccz5FDGWQE}8egQFr~8b3e)( m-xV^77vM!d-ZOpw&A&zAtW>ImY9BCA89ZJ6T-G@yGywoP1_Lwz literal 0 HcmV?d00001 diff --git a/ExampleMod.cs b/ExampleMod.cs index dc2b3e2..39ae03c 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -41,6 +41,7 @@ public class ExampleMod : Mod { private Dictionary customBottoms; private Dictionary uiTextures; private Dictionary wallpaperTextures; + private Dictionary tileTextures; public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) { ExampleMod.Logger = logger; @@ -53,6 +54,7 @@ public class ExampleMod : Mod { texturePacker.Add(new UniformTextureAtlas(content.Load("CustomHairs"), 4, 5), r => this.customHairs = r, 1, true); texturePacker.Add(new UniformTextureAtlas(content.Load("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r, 1, true); texturePacker.Add(new UniformTextureAtlas(content.Load("UiTextures"), 8, 8), r => this.uiTextures = r, 1, true); + texturePacker.Add(new UniformTextureAtlas(content.Load("Tiles"), 4, 2), r => this.tileTextures = r, 1, true); // wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor WallMode.ApplyMasks(content.Load("Wallpapers"), 4, 5, texturePacker, r => this.wallpaperTextures = r); } @@ -130,6 +132,9 @@ public class ExampleMod : Mod { // 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); + + // adding a custom tile + Tile.Register("ExampleMod.CustomTile", 8, this.tileTextures, new Point(0, 0), ColorScheme.Bricks, icon: this.Icon); } public override IEnumerable GetCustomFurnitureTextures(ModInfo info) {