added some more clothes to the example mod

This commit is contained in:
Ell 2021-06-25 23:40:01 +02:00
parent 018a4cf656
commit 45c21080c5
5 changed files with 15 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -3,7 +3,10 @@
"ExampleMod.CustomTable": "Custom Table" "ExampleMod.CustomTable": "Custom Table"
}, },
"Clothes": { "Clothes": {
"ExampleMod.DarkShirt": "Dark Shirt" "ExampleMod.DarkShirt": "Dark Shirt",
"ExampleMod.PastelPants": "Pastel Pants",
"ExampleMod.PastelShoes": "Pastel Shoes",
"ExampleMod.WeirdHair": "Weird Hair"
}, },
"Emotions": { "Emotions": {
"ExampleMod.GrassSitting": "Comfy Green Ground" "ExampleMod.GrassSitting": "Comfy Green Ground"

View file

@ -26,7 +26,9 @@ namespace ExampleMod {
public override string Description => "This is the example mod for Tiny Life!"; public override string Description => "This is the example mod for Tiny Life!";
public override TextureRegion Icon => this.uiTextures[0, 0]; public override TextureRegion Icon => this.uiTextures[0, 0];
private UniformTextureAtlas customClothes; private UniformTextureAtlas customTops;
private UniformTextureAtlas customHairs;
private UniformTextureAtlas customBottoms;
private UniformTextureAtlas uiTextures; private UniformTextureAtlas uiTextures;
public override void AddGameContent(GameImpl game) { public override void AddGameContent(GameImpl game) {
@ -40,11 +42,15 @@ namespace ExampleMod {
// adding custom clothing // adding custom clothing
var darkShirt = new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt, var darkShirt = 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) this.customTops[0, 0], // the top left in-world region (the rest will be auto-gathered from the atlas)
100, // the price 100, // the price
ClothesIntention.Everyday | ClothesIntention.Workout, // the clothes item's use cases ClothesIntention.Everyday | ClothesIntention.Workout, // the clothes item's use cases
this.Icon, false, ColorScheme.WarmDark); this.Icon, false, ColorScheme.WarmDark);
Clothes.Register(darkShirt); Clothes.Register(darkShirt);
// adding some more custom clothing
Clothes.Register(new Clothes("ExampleMod.PastelPants", ClothesLayer.Pants, this.customBottoms[4, 0], 100, ClothesIntention.Everyday, this.Icon, false, ColorScheme.Pastel));
Clothes.Register(new Clothes("ExampleMod.PastelShoes", ClothesLayer.Shoes, this.customBottoms[0, 0], 100, ClothesIntention.Everyday, this.Icon, false, ColorScheme.Pastel));
Clothes.Register(new Clothes("ExampleMod.WeirdHair", ClothesLayer.Hair, this.customHairs[0, 0], 0, ClothesIntention.None, this.Icon, false, ColorScheme.Modern));
// adding an event subscription to people // adding an event subscription to people
MapObject.OnEventsAttachable += o => { MapObject.OnEventsAttachable += o => {
@ -79,7 +85,9 @@ namespace ExampleMod {
// loads a texture atlas with the given amount of separate texture regions in the x and y axes // 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 // 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, 8)); texturePacker.Add(content.Load<Texture2D>("CustomTops"), r => this.customTops = new UniformTextureAtlas(r, 4, 8));
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>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8)); texturePacker.Add(content.Load<Texture2D>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8));
} }