PrivateMaidTouchTouchPointViewer.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using PrivateMaidMode;
  4. using UnityEngine;
  5. public class PrivateMaidTouchTouchPointViewer : MonoBehaviour
  6. {
  7. private void Awake()
  8. {
  9. this.manAlphaSlider.value = (float)GameMain.Instance.CMSystem.ManAlpha / 100f;
  10. this.settingManAlpha = GameMain.Instance.CMSystem.ManAlpha;
  11. EventDelegate.Add(this.manAlphaSlider.onChange, new EventDelegate.Callback(this.OnChangeSliderValue));
  12. }
  13. public void Setup(TouchDataBase.Data data)
  14. {
  15. foreach (UIButton uibutton in this.touchButtons)
  16. {
  17. if (uibutton != null)
  18. {
  19. uibutton.isEnabled = false;
  20. uibutton.onClick.Clear();
  21. }
  22. }
  23. if (data == null)
  24. {
  25. return;
  26. }
  27. List<TouchDataBase.PointData> allPointData = data.GetAllPointData();
  28. for (int j = 0; j < allPointData.Count; j++)
  29. {
  30. if (allPointData[j] != null && j < this.touchButtons.Length && this.touchButtons[j] != null)
  31. {
  32. this.SetButtonData(this.touchButtons[j], allPointData[j].point);
  33. }
  34. }
  35. }
  36. private void SetButtonData(UIButton button, TouchDataBase.TouchPoint point)
  37. {
  38. if (button == null)
  39. {
  40. return;
  41. }
  42. button.isEnabled = true;
  43. string normalSprite = string.Empty;
  44. switch (point)
  45. {
  46. case TouchDataBase.TouchPoint.Head:
  47. normalSprite = "customview_icon_head";
  48. goto IL_A7;
  49. case TouchDataBase.TouchPoint.Bust:
  50. normalSprite = "customview_icon_brest";
  51. goto IL_A7;
  52. case TouchDataBase.TouchPoint.Back:
  53. normalSprite = "customview_icon_back";
  54. goto IL_A7;
  55. case TouchDataBase.TouchPoint.Hip:
  56. normalSprite = "customview_icon_butt";
  57. goto IL_A7;
  58. case TouchDataBase.TouchPoint.SecretPart:
  59. normalSprite = "customview_icon_betweenlegs";
  60. goto IL_A7;
  61. case TouchDataBase.TouchPoint.Hand:
  62. normalSprite = "customview_icon_arm";
  63. goto IL_A7;
  64. }
  65. normalSprite = "customview_icon_leg";
  66. IL_A7:
  67. button.normalSprite = normalSprite;
  68. EventDelegate.Add(button.onClick, delegate()
  69. {
  70. this.OnClickTouchPoint(point);
  71. });
  72. }
  73. private void OnClickTouchPoint(TouchDataBase.TouchPoint point)
  74. {
  75. if (PrivateMaidTouchManager.instance == null)
  76. {
  77. return;
  78. }
  79. PrivateMaidTouchManager.instance.OnTouchPoint(point);
  80. }
  81. private void OnChangeSliderValue()
  82. {
  83. this.settingManAlpha = (int)Math.Ceiling((double)(UIProgressBar.current.value * 100f));
  84. GameMain.Instance.CMSystem.ManAlpha = this.settingManAlpha;
  85. GameMain.Instance.CharacterMgr.ManAlphaUpdate();
  86. }
  87. private void Update()
  88. {
  89. if (GameMain.Instance.CMSystem.ManAlpha != this.settingManAlpha)
  90. {
  91. this.manAlphaSlider.value = (float)GameMain.Instance.CMSystem.ManAlpha / 100f;
  92. this.settingManAlpha = GameMain.Instance.CMSystem.ManAlpha;
  93. }
  94. }
  95. [SerializeField]
  96. private UIButton[] touchButtons;
  97. [SerializeField]
  98. private UISlider manAlphaSlider;
  99. private int settingManAlpha;
  100. }