WindowPartsMekureCheckBox.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. GravityControlWindow gravityControlWindow = this.mgr.GetWindow(PhotoWindowManager.WindowType.GravityContro) as GravityControlWindow;
  62. gravityControlWindow.OnChangeMekure();
  63. }
  64. private bool IsItemChangeEnabled(Maid maid)
  65. {
  66. bool result = false;
  67. string[] category_array = this.category_array;
  68. for (int i = 0; i < category_array.Length; i++)
  69. {
  70. if (maid.IsItemChangeEnabled(category_array[i], this.prop_value_name))
  71. {
  72. result = true;
  73. break;
  74. }
  75. }
  76. return result;
  77. }
  78. private bool IsItemChange(Maid maid)
  79. {
  80. bool result = false;
  81. string[] category_array = this.category_array;
  82. for (int i = 0; i < category_array.Length; i++)
  83. {
  84. if (maid.IsItemChange(category_array[i], this.prop_value_name))
  85. {
  86. result = true;
  87. break;
  88. }
  89. }
  90. return result;
  91. }
  92. private string[] category_array
  93. {
  94. get
  95. {
  96. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureFront)
  97. {
  98. return new string[]
  99. {
  100. "skirt",
  101. "onepiece"
  102. };
  103. }
  104. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureBack)
  105. {
  106. return new string[]
  107. {
  108. "skirt",
  109. "onepiece"
  110. };
  111. }
  112. return new string[]
  113. {
  114. "panz",
  115. "mizugi"
  116. };
  117. }
  118. }
  119. private string prop_value_name
  120. {
  121. get
  122. {
  123. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureFront)
  124. {
  125. return "めくれスカート";
  126. }
  127. if (this.CheckBoxMode == WindowPartsMekureCheckBox.Mode.MekureBack)
  128. {
  129. return "めくれスカート後ろ";
  130. }
  131. return "パンツずらし";
  132. }
  133. }
  134. public WindowPartsMekureCheckBox.Mode CheckBoxMode;
  135. public PhotoWindowManager mgr;
  136. private Maid maid_;
  137. public enum Mode
  138. {
  139. MekureFront,
  140. MekureBack,
  141. Zurasi
  142. }
  143. }