using System; using System.Collections.Generic; using PrivateMaidMode; using UnityEngine; public class PrivateMaidTouchTouchPointViewer : MonoBehaviour { private void Awake() { this.manAlphaSlider.value = (float)GameMain.Instance.CMSystem.ManAlpha / 100f; this.settingManAlpha = GameMain.Instance.CMSystem.ManAlpha; EventDelegate.Add(this.manAlphaSlider.onChange, new EventDelegate.Callback(this.OnChangeSliderValue)); } public void Setup(TouchDataBase.Data data) { foreach (UIButton uibutton in this.touchButtons) { if (uibutton != null) { uibutton.isEnabled = false; uibutton.onClick.Clear(); } } if (data == null) { return; } List allPointData = data.GetAllPointData(); for (int j = 0; j < allPointData.Count; j++) { if (allPointData[j] != null && j < this.touchButtons.Length && this.touchButtons[j] != null) { this.SetButtonData(this.touchButtons[j], allPointData[j].point); } } } private void SetButtonData(UIButton button, TouchDataBase.TouchPoint point) { if (button == null) { return; } button.isEnabled = true; string normalSprite = string.Empty; switch (point) { case TouchDataBase.TouchPoint.Head: normalSprite = "customview_icon_head"; goto IL_A7; case TouchDataBase.TouchPoint.Bust: normalSprite = "customview_icon_brest"; goto IL_A7; case TouchDataBase.TouchPoint.Back: normalSprite = "customview_icon_back"; goto IL_A7; case TouchDataBase.TouchPoint.Hip: normalSprite = "customview_icon_butt"; goto IL_A7; case TouchDataBase.TouchPoint.SecretPart: normalSprite = "customview_icon_betweenlegs"; goto IL_A7; case TouchDataBase.TouchPoint.Hand: normalSprite = "customview_icon_arm"; goto IL_A7; } normalSprite = "customview_icon_leg"; IL_A7: button.normalSprite = normalSprite; EventDelegate.Add(button.onClick, delegate() { this.OnClickTouchPoint(point); }); } private void OnClickTouchPoint(TouchDataBase.TouchPoint point) { if (PrivateMaidTouchManager.instance == null) { return; } PrivateMaidTouchManager.instance.OnTouchPoint(point); } private void OnChangeSliderValue() { this.settingManAlpha = (int)Math.Ceiling((double)(UIProgressBar.current.value * 100f)); GameMain.Instance.CMSystem.ManAlpha = this.settingManAlpha; GameMain.Instance.CharacterMgr.ManAlphaUpdate(); } private void Update() { if (GameMain.Instance.CMSystem.ManAlpha != this.settingManAlpha) { this.manAlphaSlider.value = (float)GameMain.Instance.CMSystem.ManAlpha / 100f; this.settingManAlpha = GameMain.Instance.CMSystem.ManAlpha; } } [SerializeField] private UIButton[] touchButtons; [SerializeField] private UISlider manAlphaSlider; private int settingManAlpha; }