mirror of
https://github.com/Ellpeck/TinyLifeExampleMod.git
synced 2024-11-30 07:28:33 +01:00
Compare commits
No commits in common. "0a018706e4a0eaf0359ba7d2e6132684f080e081" and "485e86342d841f57302c014ea64a8ca70a83c7f0" have entirely different histories.
0a018706e4
...
485e86342d
2 changed files with 10 additions and 18 deletions
|
@ -49,17 +49,10 @@ public class ExampleMod : Mod {
|
||||||
|
|
||||||
// adding custom clothing
|
// adding custom clothing
|
||||||
var darkShirt = new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt,
|
var darkShirt = new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt,
|
||||||
// the top left in-world region
|
this.customTops, new Point(0, 0), // the top left in-world region (the rest will be auto-gathered from the atlas)
|
||||||
// additional regions will be auto-gathered from the atlas according to the rules described in https://docs.tinylifegame.com/articles/creating_textures.html
|
100, // the price
|
||||||
this.customTops, new Point(0, 0),
|
ClothesIntention.Everyday | ClothesIntention.Workout, // the clothes item's use cases
|
||||||
// the price
|
ColorScheme.WarmDark) {Icon = this.Icon};
|
||||||
100,
|
|
||||||
// the clothes item's use cases
|
|
||||||
ClothesIntention.Everyday | ClothesIntention.Workout,
|
|
||||||
// the clothes item's color scheme
|
|
||||||
// if the item should have multiple layers, multiple color schemes can be supplied here (see docs above)
|
|
||||||
ColorScheme.WarmDark
|
|
||||||
) {Icon = this.Icon};
|
|
||||||
Clothes.Register(darkShirt);
|
Clothes.Register(darkShirt);
|
||||||
// adding some more custom clothing
|
// adding some more custom clothing
|
||||||
Clothes.Register(new Clothes("ExampleMod.PastelPants", ClothesLayer.Pants, this.customBottoms, new Point(4, 0), 100, ClothesIntention.Everyday, ColorScheme.Pastel) {Icon = this.Icon});
|
Clothes.Register(new Clothes("ExampleMod.PastelPants", ClothesLayer.Pants, this.customBottoms, new Point(4, 0), 100, ClothesIntention.Everyday, ColorScheme.Pastel) {Icon = this.Icon});
|
||||||
|
@ -113,11 +106,10 @@ public class ExampleMod : Mod {
|
||||||
|
|
||||||
// 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
|
||||||
// additionally, we pad all texture regions by 1 pixel, so that rounding errors during rendering don't cause visual artifacts
|
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomTops"), 4, 11), r => this.customTops = r);
|
||||||
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomTops"), 4, 11), r => this.customTops = r, 1, true);
|
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomHairs"), 4, 5), r => this.customHairs = r);
|
||||||
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomHairs"), 4, 5), r => this.customHairs = r, 1, true);
|
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r);
|
||||||
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r, 1, true);
|
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("UiTextures"), 8, 8), r => this.uiTextures = r);
|
||||||
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("UiTextures"), 8, 8), r => this.uiTextures = r, 1, true);
|
|
||||||
// wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor
|
// wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor
|
||||||
WallMode.ApplyMasks(content.Load<Texture2D>("Wallpapers"), 4, 5, texturePacker, r => this.wallpaperTextures = r);
|
WallMode.ApplyMasks(content.Load<Texture2D>("Wallpapers"), 4, 5, texturePacker, r => this.wallpaperTextures = r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ Task("Run").IsDependentOn("CopyToMods").Does(() => {
|
||||||
using (var stream = new FileStream(log, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
|
using (var stream = new FileStream(log, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
|
||||||
using (var reader = new StreamReader(stream)) {
|
using (var reader = new StreamReader(stream)) {
|
||||||
var lastPos = 0L;
|
var lastPos = 0L;
|
||||||
do {
|
while (!process.HasExited) {
|
||||||
if (reader.BaseStream.Length > lastPos) {
|
if (reader.BaseStream.Length > lastPos) {
|
||||||
reader.BaseStream.Seek(lastPos, SeekOrigin.Begin);
|
reader.BaseStream.Seek(lastPos, SeekOrigin.Begin);
|
||||||
string line;
|
string line;
|
||||||
|
@ -52,7 +52,7 @@ Task("Run").IsDependentOn("CopyToMods").Does(() => {
|
||||||
lastPos = reader.BaseStream.Position;
|
lastPos = reader.BaseStream.Position;
|
||||||
}
|
}
|
||||||
Thread.Sleep(10);
|
Thread.Sleep(10);
|
||||||
} while (!process.HasExited);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue