/********* ** Private methods *********/ /// <summary>The method to call before <see cref="FarmerRenderer.ApplyShoeColor"/>.</summary> /// <returns>Returns whether to run the original method.</returns> private static bool Before_ApplyShoeColor(FarmerRenderer __instance, string texture_name, Color[] pixels) { var this_shoes = Mod.instance.Helper.Reflection.GetField <NetInt>(__instance, "shoes").GetValue(); if (Mod.itemLookup.ContainsKey(this_shoes.Value)) { BootsPackData data = Mod.Find(Mod.itemLookup[this_shoes.Value]) as BootsPackData; var this__SwapColor = Mod.instance.Helper.Reflection.GetMethod(__instance, "_SwapColor"); var currTex = data.pack.GetTexture(data.FarmerColors, 4, 1); int which = this_shoes.Value; Texture2D shoeColors = currTex.Texture; Color[] shoeColorsData = new Color[shoeColors.Width * shoeColors.Height]; shoeColors.GetData(0, currTex.Rect, shoeColorsData, 0, 4); Color darkest = shoeColorsData[0]; Color medium = shoeColorsData[1]; Color lightest = shoeColorsData[2]; Color lightest2 = shoeColorsData[3]; this__SwapColor.Invoke(texture_name, pixels, 268, darkest); this__SwapColor.Invoke(texture_name, pixels, 269, medium); this__SwapColor.Invoke(texture_name, pixels, 270, lightest); this__SwapColor.Invoke(texture_name, pixels, 271, lightest2); return(false); } return(true); }
partial void DoInit(BootsPackData data) { this.Name = this.Id; this.reloadData(); }