using System; using UnityEngine; namespace MaidExtension { public class MaidMekureController { public MaidMekureController(Maid maid) { this.maid = maid; } public MaidMekureController() { } public static string[] GetTargetMpnNames(Maid maid, MaidMekureController.MekureType type) { if (maid == null) { Debug.LogWarning("MaidMekureController::GetTargetMpnNames\n maid is null."); return new string[0]; } if (type == MaidMekureController.MekureType.MekureSkirtFront || type == MaidMekureController.MekureType.MekureSkirtBack) { return new string[] { "skirt", "onepiece" }; } if (type != MaidMekureController.MekureType.ZurasiPants) { return new string[0]; } return new string[] { "panz", "mizugi" }; } public static string GetItemChangeNames(MaidMekureController.MekureType type) { if (type == MaidMekureController.MekureType.MekureSkirtFront) { return "めくれスカート"; } if (type == MaidMekureController.MekureType.MekureSkirtBack) { return "めくれスカート後ろ"; } if (type != MaidMekureController.MekureType.ZurasiPants) { return string.Empty; } return "パンツずらし"; } public bool IsSupportedMekure(MaidMekureController.MekureType type) { if (this.maid == null) { Debug.LogWarning("MaidMekureController::IsSupportedMekure\n maid is null."); return false; } if (Product.isPublic) { return false; } string itemChangeNames = MaidMekureController.GetItemChangeNames(type); foreach (string mpn in MaidMekureController.GetTargetMpnNames(this.maid, type)) { if (this.maid.IsItemChangeEnabled(mpn, itemChangeNames)) { return true; } } return false; } public bool SetEnabledMekure(MaidMekureController.MekureType type, bool enabled, bool runAllProcProp = true) { if (this.maid == null) { Debug.LogWarning("MaidMekureController::SetEnabledMekure\n maid is null."); return false; } if (!this.IsSupportedMekure(type) || enabled == this.IsEnabledMekure(type)) { return false; } string[] targetMpnNames = MaidMekureController.GetTargetMpnNames(this.maid, type); if (enabled) { string itemChangeNames = MaidMekureController.GetItemChangeNames(type); foreach (string mpn in targetMpnNames) { this.maid.ItemChangeTemp(mpn, itemChangeNames); } } else { foreach (string mpn2 in targetMpnNames) { this.maid.ResetProp(mpn2, false); } } if (runAllProcProp) { this.maid.AllProcProp(); } return true; } public bool IsEnabledMekure(MaidMekureController.MekureType type) { if (this.maid == null) { Debug.LogWarning("MaidMekureController::IsEnabledMekure\n maid is null."); return false; } if (Product.isPublic) { return false; } string itemChangeNames = MaidMekureController.GetItemChangeNames(type); foreach (string mpn in MaidMekureController.GetTargetMpnNames(this.maid, type)) { if (this.maid.IsItemChange(mpn, itemChangeNames)) { return true; } } return false; } public Maid maid; public enum MekureType { MekureSkirtFront, MekureSkirtBack, ZurasiPants } } }