public void SetOutfit(Farmer who, Outfit outfit) { who.modData[ModDataKeys.CUSTOM_HAIR_ID] = String.IsNullOrEmpty(outfit.HairId) ? "None" : outfit.HairId; who.modData[ModDataKeys.CUSTOM_ACCESSORY_ID] = String.IsNullOrEmpty(outfit.AccessoryOneId) ? "None" : outfit.AccessoryOneId; who.modData[ModDataKeys.CUSTOM_ACCESSORY_SECONDARY_ID] = String.IsNullOrEmpty(outfit.AccessoryTwoId) ? "None" : outfit.AccessoryTwoId; who.modData[ModDataKeys.CUSTOM_ACCESSORY_TERTIARY_ID] = String.IsNullOrEmpty(outfit.AccessoryThreeId) ? "None" : outfit.AccessoryThreeId; who.modData[ModDataKeys.CUSTOM_HAT_ID] = String.IsNullOrEmpty(outfit.HatId) ? "None" : outfit.HatId; who.modData[ModDataKeys.CUSTOM_SHIRT_ID] = String.IsNullOrEmpty(outfit.ShirtId) ? "None" : outfit.ShirtId; who.modData[ModDataKeys.CUSTOM_SLEEVES_ID] = String.IsNullOrEmpty(outfit.SleevesId) ? "None" : outfit.SleevesId; who.modData[ModDataKeys.CUSTOM_PANTS_ID] = String.IsNullOrEmpty(outfit.PantsId) ? "None" : outfit.PantsId; who.modData[ModDataKeys.CUSTOM_SHOES_ID] = String.IsNullOrEmpty(outfit.ShoesId) ? "None" : outfit.ShoesId; who.changeHairColor(new Color() { PackedValue = uint.Parse(outfit.HairColor) }); who.modData[ModDataKeys.UI_HAND_MIRROR_ACCESSORY_COLOR] = outfit.AccessoryOneColor; who.modData[ModDataKeys.UI_HAND_MIRROR_ACCESSORY_SECONDARY_COLOR] = outfit.AccessoryTwoColor; who.modData[ModDataKeys.UI_HAND_MIRROR_ACCESSORY_TERTIARY_COLOR] = outfit.AccessoryThreeColor; who.modData[ModDataKeys.UI_HAND_MIRROR_HAT_COLOR] = outfit.HatColor; who.modData[ModDataKeys.UI_HAND_MIRROR_SHIRT_COLOR] = outfit.ShirtColor; who.modData[ModDataKeys.UI_HAND_MIRROR_SLEEVES_COLOR] = outfit.SleevesColor; who.modData[ModDataKeys.UI_HAND_MIRROR_PANTS_COLOR] = outfit.PantsColor; who.modData[ModDataKeys.UI_HAND_MIRROR_SHOES_COLOR] = outfit.ShoesColor; FashionSense.SetSpriteDirty(); }
public void UpdateDisplayFarmers() { for (int i = 0; i < availableTextures.Count; i++) { var textureIndex = i + _startingRow * _texturesPerRow; if (textureIndex < filteredTextureOptions.Count) { var targetPack = filteredTextureOptions[textureIndex]; string modDataKey = null; AppearanceModel appearanceModel = null; switch (_appearanceFilter) { case HandMirrorMenu.HAIR_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_HAIR_ID; appearanceModel = (targetPack as HairContentPack).GetHairFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.ACCESSORY_FILTER_BUTTON: modDataKey = _callbackMenu.GetCurrentAccessorySlotKey(); appearanceModel = (targetPack as AccessoryContentPack).GetAccessoryFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.HAT_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_HAT_ID; appearanceModel = (targetPack as HatContentPack).GetHatFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.SHIRT_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_SHIRT_ID; appearanceModel = (targetPack as ShirtContentPack).GetShirtFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.PANTS_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_PANTS_ID; appearanceModel = (targetPack as PantsContentPack).GetPantsFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.SLEEVES_FILTER_BUTTON: if (_callbackMenu.GetCurrentFeatureSlotKey() == ModDataKeys.CUSTOM_SHOES_ID) { modDataKey = ModDataKeys.CUSTOM_SHOES_ID; appearanceModel = (targetPack as ShoesContentPack).GetShoesFromFacingDirection(fakeFarmers[i].facingDirection); } else { modDataKey = ModDataKeys.CUSTOM_SLEEVES_ID; appearanceModel = (targetPack as SleevesContentPack).GetSleevesFromFacingDirection(fakeFarmers[i].facingDirection); } break; } fakeFarmers[i].modData[modDataKey] = targetPack.Id; FashionSense.ResetAnimationModDataFields(fakeFarmers[i], 0, AnimationModel.Type.Idle, fakeFarmers[i].facingDirection); FashionSense.SetSpriteDirty(); } } }
private bool SetFarmerAppearance(string appearanceId, AppearanceContentPack.Type packType) { string modDataKey = String.Empty; switch (packType) { case AppearanceContentPack.Type.Hat: modDataKey = ModDataKeys.CUSTOM_HAT_ID; break; case AppearanceContentPack.Type.Hair: modDataKey = ModDataKeys.CUSTOM_HAIR_ID; break; case AppearanceContentPack.Type.Accessory: modDataKey = ModDataKeys.CUSTOM_ACCESSORY_ID; break; case AppearanceContentPack.Type.AccessorySecondary: modDataKey = ModDataKeys.CUSTOM_ACCESSORY_SECONDARY_ID; break; case AppearanceContentPack.Type.AccessoryTertiary: modDataKey = ModDataKeys.CUSTOM_ACCESSORY_TERTIARY_ID; break; case AppearanceContentPack.Type.Shirt: modDataKey = ModDataKeys.CUSTOM_SHIRT_ID; break; case AppearanceContentPack.Type.Sleeves: modDataKey = ModDataKeys.CUSTOM_SLEEVES_ID; break; case AppearanceContentPack.Type.Pants: modDataKey = ModDataKeys.CUSTOM_PANTS_ID; break; case AppearanceContentPack.Type.Shoes: modDataKey = ModDataKeys.CUSTOM_SHOES_ID; break; } if (String.IsNullOrEmpty(modDataKey)) { return(false); } Game1.player.modData[modDataKey] = appearanceId; FashionSense.SetSpriteDirty(); return(true); }
private static void FaceDirectionPostfix(Farmer __instance) { ShirtModel shirtModel = null; if (__instance.modData.ContainsKey(ModDataKeys.CUSTOM_SHIRT_ID) && FashionSense.textureManager.GetSpecificAppearanceModel <ShirtContentPack>(__instance.modData[ModDataKeys.CUSTOM_SHIRT_ID]) is ShirtContentPack sPack && sPack != null) { shirtModel = sPack.GetShirtFromFacingDirection(__instance.FacingDirection); } if (shirtModel is null || !__instance.modData.ContainsKey(ModDataKeys.ANIMATION_FACING_DIRECTION) || __instance.modData[ModDataKeys.ANIMATION_FACING_DIRECTION] == __instance.FacingDirection.ToString()) { return; } FashionSense.SetSpriteDirty(); }
public override void receiveLeftClick(int x, int y, bool playSound = false) { base.receiveLeftClick(x, y, playSound); if (Game1.activeClickableMenu == null) { return; } for (int i = 0; i < availableTextures.Count; i++) { ClickableTextureComponent c = availableTextures[i]; var textureIndex = i + _startingRow * _texturesPerRow; if (textureIndex < filteredTextureOptions.Count && c.containsPoint(x, y)) { foreach (var key in fakeFarmers[i].modData.Keys) { _displayFarmer.modData[key] = fakeFarmers[i].modData[key]; } FashionSense.ResetAnimationModDataFields(_displayFarmer, 0, AnimationModel.Type.Idle, _displayFarmer.facingDirection); FashionSense.SetSpriteDirty(); base.exitThisMenu(); Game1.activeClickableMenu = _callbackMenu; return; } } if (_startingRow > 0 && backButton.containsPoint(x, y)) { _startingRow--; UpdateDisplayFarmers(); Game1.playSound("shiny4"); return; } if ((_maxRows + _startingRow) * _texturesPerRow < filteredTextureOptions.Count && forwardButton.containsPoint(x, y)) { _startingRow++; UpdateDisplayFarmers(); Game1.playSound("shiny4"); return; } }