WindowPartsMekureCheckBox.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. public class WindowPartsMekureCheckBox : WFCheckBox
  3. {
  4. public override void Awake()
  5. {
  6. base.Awake();
  7. this.onClick.Add(delegate(WFCheckBox check_box)
  8. {
  9. this.Apply();
  10. this.UpdateGui();
  11. });
  12. }
  13. public void SetMaid(Maid maid)
  14. {
  15. this.maid_ = maid;
  16. this.UpdateGui();
  17. }
  18. public void UpdateGui()
  19. {
  20. if (this.maid_ == null)
  21. {
  22. bool flag = false;
  23. base.check = flag;
  24. base.enabled = flag;
  25. }
  26. else if (!this.IsItemChangeEnabled(this.maid_))
  27. {
  28. bool flag = false;
  29. base.check = flag;
  30. base.enabled = flag;
  31. }
  32. else
  33. {
  34. base.enabled = true;
  35. base.check = this.IsItemChange(this.maid_);
  36. }
  37. }
  38. public void Apply()
  39. {
  40. if (this.maid_ == null || !this.IsItemChangeEnabled(this.maid_))
  41. {
  42. return;
  43. }
  44. if (!base.check)
  45. {
  46. string[] category_array = this.category_array;
  47. for (int i = 0; i < category_array.Length; i++)
  48. {
  49. this.maid_.ResetProp(category_array[i], false);
  50. }
  51. }
  52. else
  53. {
  54. string[] category_array2 = this.category_array;
  55. for (int j = 0; j < category_array2.Length; j++)
  56. {
  57. this.maid_.ItemChangeTemp(category_array2[j], this.prop_value_name);
  58. }
  59. }
  60. this.maid_.AllProcProp();
  61. }
  62. private bool IsItemChangeEnabled(Maid maid)
  63. {
  64. bool result = false;
  65. string[] category_array = this.category_array;
  66. for (int i = 0; i < category_array.Length; i++)
  67. {
  68. if (maid.IsItemChangeEnabled(category_array[i], this.prop_value_name))
  69. {
  70. result = true;
  71. break;
  72. }
  73. }
  74. return result;
  75. }
  76. private bool IsItemChange(Maid maid)
  77. {
  78. bool result = false;
  79. string[] category_array = this.category_array;
  80. for (int i = 0; i < category_array.Length; i++)
  81. {
  82. if (maid.IsItemChange(category_array[i], this.prop_value_name))
  83. {
  84. result = true;
  85. break;
  86. }
  87. }
  88. return result;
  89. }
  90. private string[] category_array
  91. {
  92. get
  93. {
  94. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureFront)
  95. {
  96. return new string[]
  97. {
  98. "skirt",
  99. "onepiece"
  100. };
  101. }
  102. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureBack)
  103. {
  104. return new string[]
  105. {
  106. "skirt",
  107. "onepiece"
  108. };
  109. }
  110. return new string[]
  111. {
  112. "panz",
  113. "mizugi"
  114. };
  115. }
  116. }
  117. private string prop_value_name
  118. {
  119. get
  120. {
  121. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureFront)
  122. {
  123. return "めくれスカート";
  124. }
  125. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureBack)
  126. {
  127. return "めくれスカート後ろ";
  128. }
  129. return "パンツずらし";
  130. }
  131. }
  132. public WindowPartsMekureCheckBox.Mode CheckBoxMode;
  133. private Maid maid_;
  134. public enum Mode
  135. {
  136. MekureFront,
  137. MekureBack,
  138. Zurasi
  139. }
  140. }