123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace MaidExtension
- {
- public class MaidCostumeChangeController
- {
- public MaidCostumeChangeController(Maid maid)
- {
- this.manager = new MaidCostumeChangeController.MaidCostumeChangeManager(maid);
- }
- public Maid maid
- {
- get
- {
- return this.manager.maid;
- }
- set
- {
- this.manager.maid = value;
- }
- }
- public MaidCostumeChangeController.MaidCostumeChangeManager manager { get; private set; }
- public bool IsSupportedCostumeType(MaidCostumeChangeController.CostumeType type)
- {
- switch (type)
- {
- case MaidCostumeChangeController.CostumeType.MekureFront:
- return this.manager.IsSupportedCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureFront);
- case MaidCostumeChangeController.CostumeType.MekureBack:
- return this.manager.IsSupportedCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureBack);
- case MaidCostumeChangeController.CostumeType.Zurasi:
- return this.manager.IsSupportedCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Zurasi);
- case MaidCostumeChangeController.CostumeType.Hadake:
- return this.manager.IsSupportedCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Hadake);
- default:
- return false;
- }
- }
- public void SetEnabledCostumeType(MaidCostumeChangeController.CostumeType type, bool enabled, string targetMpnName = null)
- {
- this.SetEnabledCostumeType(new MaidCostumeChangeController.CostumeType[]
- {
- type
- }, enabled, targetMpnName);
- }
- public void SetEnabledCostumeType(MaidCostumeChangeController.CostumeType[] types, bool enabled, string targetMpnName = null)
- {
- if (this.maid == null)
- {
- Debug.LogWarning("MaidCostumeChangeController::SetEnabledCostumeType\n maid is null.");
- return;
- }
- if (types == null || types.Length == 0)
- {
- return;
- }
- HashSet<MaidCostumeChangeController.CostumeType> hashSet = new HashSet<MaidCostumeChangeController.CostumeType>();
- foreach (MaidCostumeChangeController.CostumeType item in types)
- {
- hashSet.Add(item);
- }
- if (enabled && hashSet.Contains(MaidCostumeChangeController.CostumeType.MekureFront) && hashSet.Contains(MaidCostumeChangeController.CostumeType.MekureBack))
- {
- hashSet.Remove(MaidCostumeChangeController.CostumeType.MekureBack);
- }
- bool flag = (!hashSet.Contains(MaidCostumeChangeController.CostumeType.Hadake)) ? this.IsEnabledCostumeType(MaidCostumeChangeController.CostumeType.Hadake) : enabled;
- bool flag2 = (!hashSet.Contains(MaidCostumeChangeController.CostumeType.MekureFront)) ? this.IsEnabledCostumeType(MaidCostumeChangeController.CostumeType.MekureFront) : enabled;
- bool flag3 = (!hashSet.Contains(MaidCostumeChangeController.CostumeType.MekureBack)) ? this.IsEnabledCostumeType(MaidCostumeChangeController.CostumeType.MekureBack) : enabled;
- bool flag4 = (!hashSet.Contains(MaidCostumeChangeController.CostumeType.Zurasi)) ? this.IsEnabledCostumeType(MaidCostumeChangeController.CostumeType.Zurasi) : enabled;
- if (flag2 && flag3)
- {
- if (hashSet.Contains(MaidCostumeChangeController.CostumeType.MekureFront))
- {
- flag3 = !enabled;
- }
- else
- {
- flag2 = !enabled;
- }
- }
- this.Reset(targetMpnName);
- bool flag5 = false;
- if (flag)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Hadake, true, false);
- }
- if (flag2)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureFront, true, false);
- if (flag)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureFront, true, false);
- }
- }
- if (flag3)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureBack, true, false);
- if (flag)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureBack, true, false);
- }
- }
- if (flag4)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Zurasi, true, false);
- if (flag)
- {
- flag5 |= this.manager.SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndZurasi, true, false);
- }
- }
- if (flag5)
- {
- this.maid.AllProcProp();
- }
- }
- public bool IsEnabledCostumeType(MaidCostumeChangeController.CostumeType type)
- {
- switch (type)
- {
- case MaidCostumeChangeController.CostumeType.MekureFront:
- return this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureFront) || this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureFront);
- case MaidCostumeChangeController.CostumeType.MekureBack:
- return this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureBack) || this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureBack);
- case MaidCostumeChangeController.CostumeType.Zurasi:
- return this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Zurasi) || this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndZurasi);
- case MaidCostumeChangeController.CostumeType.Hadake:
- return this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Hadake) || this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureFront) || this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureBack) || this.manager.IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndZurasi);
- default:
- return false;
- }
- }
- public void Reset(string targetMpnName = null)
- {
- this.manager.Reset(targetMpnName);
- }
- public class MaidCostumeChangeManager
- {
- public MaidCostumeChangeManager(Maid maid)
- {
- this.maid = maid;
- }
- public static string[] GetTargetMpnNames(Maid maid, MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType type)
- {
- if (maid == null)
- {
- Debug.LogWarning("MaidCostumeChangeManager::GetTargetMpnNames\n maid is null.");
- return new string[0];
- }
- switch (type)
- {
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureFront:
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureBack:
- return new string[]
- {
- "skirt",
- "onepiece"
- };
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Zurasi:
- {
- string[] result;
- if (maid.IsCrcBody)
- {
- string[] array = new string[4];
- array[0] = "mizugi_buttom";
- array[1] = "mizugi";
- array[2] = "panz";
- result = array;
- array[3] = "slip";
- }
- else
- {
- string[] array2 = new string[2];
- array2[0] = "panz";
- result = array2;
- array2[1] = "mizugi";
- }
- return result;
- }
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Hadake:
- {
- string[] result2;
- if (maid.IsCrcBody)
- {
- string[] array3 = new string[6];
- array3[0] = "wear";
- array3[1] = "onepiece";
- array3[2] = "mizugi_top";
- array3[3] = "mizugi";
- array3[4] = "bra";
- result2 = array3;
- array3[5] = "slip";
- }
- else
- {
- result2 = new string[0];
- }
- return result2;
- }
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureFront:
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureBack:
- {
- string[] result3;
- if (maid.IsCrcBody)
- {
- (result3 = new string[1])[0] = "onepiece";
- }
- else
- {
- result3 = new string[0];
- }
- return result3;
- }
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndZurasi:
- {
- string[] result4;
- if (maid.IsCrcBody)
- {
- (result4 = new string[1])[0] = "mizugi";
- }
- else
- {
- result4 = new string[0];
- }
- return result4;
- }
- default:
- return new string[0];
- }
- }
- public static string GetItemChangeNames(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType type)
- {
- switch (type)
- {
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureFront:
- return "めくれスカート";
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.MekureBack:
- return "めくれスカート後ろ";
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Zurasi:
- return "パンツずらし";
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.Hadake:
- return "はだけ";
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureFront:
- return "めくれスカートはだけ";
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndMekureBack:
- return "めくれスカート後ろはだけ";
- case MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType.HadakeAndZurasi:
- return "パンツずらしはだけ";
- default:
- return string.Empty;
- }
- }
- public bool IsSupportedCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType type)
- {
- if (this.maid == null)
- {
- Debug.LogWarning("MaidCostumeChangeManager::IsSupportedCostumeType\n maid is null.");
- return false;
- }
- if (Product.isPublic)
- {
- return false;
- }
- string itemChangeNames = MaidCostumeChangeController.MaidCostumeChangeManager.GetItemChangeNames(type);
- foreach (string mpn in MaidCostumeChangeController.MaidCostumeChangeManager.GetTargetMpnNames(this.maid, type))
- {
- if (this.maid.IsItemChangeEnabled(mpn, itemChangeNames))
- {
- return true;
- }
- }
- return false;
- }
- public bool SetEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType type, bool enabled, bool runAllProcProp = true)
- {
- if (this.maid == null)
- {
- Debug.LogWarning("MaidCostumeChangeManager::SetEnabledCostumeType\n maid is null.");
- return false;
- }
- bool flag = false;
- string[] targetMpnNames = MaidCostumeChangeController.MaidCostumeChangeManager.GetTargetMpnNames(this.maid, type);
- if (enabled)
- {
- string itemChangeNames = MaidCostumeChangeController.MaidCostumeChangeManager.GetItemChangeNames(type);
- foreach (string mpn in targetMpnNames)
- {
- if (this.maid.IsItemChangeEnabled(mpn, itemChangeNames) && !this.maid.IsItemChange(mpn, itemChangeNames))
- {
- this.maid.ItemChangeTemp(mpn, itemChangeNames);
- flag = true;
- }
- }
- }
- else
- {
- flag = true;
- foreach (string mpn2 in targetMpnNames)
- {
- this.maid.ResetProp(mpn2, true);
- }
- }
- if (!flag)
- {
- return false;
- }
- if (!enabled || runAllProcProp)
- {
- this.maid.AllProcProp();
- }
- return true;
- }
- public bool IsEnabledCostumeType(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType type)
- {
- if (this.maid == null)
- {
- Debug.LogWarning("MaidCostumeChangeManager::IsEnabledCostumeType\n maid is null.");
- return false;
- }
- if (Product.isPublic)
- {
- return false;
- }
- string itemChangeNames = MaidCostumeChangeController.MaidCostumeChangeManager.GetItemChangeNames(type);
- foreach (string mpn in MaidCostumeChangeController.MaidCostumeChangeManager.GetTargetMpnNames(this.maid, type))
- {
- if (this.maid.IsItemChange(mpn, itemChangeNames))
- {
- return true;
- }
- }
- return false;
- }
- public void Reset(string targetMpnName = null)
- {
- if (this.maid == null)
- {
- Debug.LogWarning("MaidCostumeChangeManager::Reset\n maid is null.");
- return;
- }
- if (targetMpnName == null)
- {
- HashSet<string> hashSet = new HashSet<string>();
- IEnumerator enumerator = Enum.GetValues(typeof(MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType)).GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType type = (MaidCostumeChangeController.MaidCostumeChangeManager.CostumeType)obj;
- foreach (string item in MaidCostumeChangeController.MaidCostumeChangeManager.GetTargetMpnNames(this.maid, type))
- {
- hashSet.Add(item);
- }
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- foreach (string mpn in hashSet)
- {
- this.maid.ResetProp(mpn, false);
- }
- }
- else
- {
- this.maid.ResetProp(targetMpnName, false);
- }
- this.maid.AllProcProp();
- }
- public Maid maid;
- public enum CostumeType
- {
- MekureFront,
- MekureBack,
- Zurasi,
- Hadake,
- HadakeAndMekureFront,
- HadakeAndMekureBack,
- HadakeAndZurasi
- }
- }
- public enum CostumeType
- {
- MekureFront,
- MekureBack,
- Zurasi,
- Hadake
- }
- }
- }
|