/// <summary> /// Patches the hair texture. /// </summary> /// <param name="hair">Current hair patched</param> /// <param name="hairTextureX">X where texture is being patched</param> /// <param name="hairTextureY">Y where texture is being patched</param> private void PatchHairTexture(HairModel hair, int hairTextureX, int hairTextureY) { if (Entry.IsSpaceCoreInstalled) { Entry.HarmonyHelper.SpaceCorePatchExtendedTileSheet(Asset.AsImage(), hair.Texture, new Rectangle(hairTextureX, hairTextureY, SingleHairstyleWidth, SingleHairstyleHeight), new Rectangle(HairTextureWidth, HairTextureHeight, SingleHairstyleWidth, SingleHairstyleHeight)); } else { Asset.AsImage().PatchImage(hair.Texture, new Rectangle(hairTextureX, hairTextureY, SingleHairstyleWidth, SingleHairstyleHeight), new Rectangle(HairTextureWidth, HairTextureHeight, SingleHairstyleWidth, SingleHairstyleHeight)); } }
/// <summary> /// Changes hair location for patching on source texture. /// </summary> /// <param name="hairTextureX">X where the current hair is</param> /// <param name="hairTextureY">Y where the current hair is</param> private void ChangeHairLocationOnSourceTexture(HairModel hairModel, ref int hairTextureX, ref int hairTextureY) { if (hairTextureX + SingleHairstyleWidth == 128) { hairTextureX = 0; hairTextureY += hairModel.ModName.Equals("Hairstyles 2") ? SingleHairstyleHeight + 32 : SingleHairstyleHeight; } else { hairTextureX += SingleHairstyleWidth; } }
/// <summary> /// Creates a model for hairstyles2.png. /// </summary> public void LoadHairstyleTwo() { HairModel hairstyleTwo = new HairModel(); hairstyleTwo.Texture = Entry.Helper.Content.Load <Texture2D>("Characters\\Farmer\\hairstyles2", ContentSource.GameContent); hairstyleTwo.ModName = "Hairstyles 2"; hairstyleTwo.TextureHeight = hairstyleTwo.Texture.Height; hairstyleTwo.NumberOfHairstyles = 23; PackHelper.HairStyleSearch.Add("Default 1.5 Hair", PackHelper.NumberOfHairstlyesAdded); PackHelper.NumberOfHairstlyesAdded += hairstyleTwo.NumberOfHairstyles; PackHelper.HairList.Add(hairstyleTwo); }
internal HairInfo(HairModel model) => (Style, Color) = (model.Style, model.Color);
/// <summary> /// Creates a new Hair Model. /// </summary> private void CreateNewHairModel() { Hair = CurrentContentPack.ReadJsonFile <HairModel>("Hairstyles/hairstyles.json"); Hair.Texture = CurrentContentPack.LoadAsset <Texture2D>("Hairstyles/hairstyles.png"); }
public HairInfo(HairModel model) => (Style, Color) = (model.Style, model.Color);