using System; using PlayerStatus; using UnityEngine; using UnityEngine.UI; public class VRRentalMaidMenu : MonoBehaviour { private void Start() { Status status = GameMain.Instance.CharacterMgr.status; this.m_ButtonMaid01.onClick.RemoveAllListeners(); this.m_ButtonMaid01.onClick.AddListener(delegate() { this.m_NowFlagName = "バケーションレンタルお掃除大作戦_1"; this.m_VoiceFileName = "N21_00540"; this.m_ImageTargetFrame.gameObject.SetActive(true); this.m_ImageTargetFrame.SetParent(this.m_ButtonMaid01.transform, true); }); this.m_ButtonMaid02.onClick.RemoveAllListeners(); this.m_ButtonMaid02.onClick.AddListener(delegate() { this.m_NowFlagName = "バケーションレンタルお掃除大作戦_2"; this.m_VoiceFileName = "N22_00543"; this.m_ImageTargetFrame.gameObject.SetActive(true); this.m_ImageTargetFrame.SetParent(this.m_ButtonMaid02.transform, true); }); this.m_ButtonMaid03.onClick.RemoveAllListeners(); this.m_ButtonMaid03.onClick.AddListener(delegate() { this.m_NowFlagName = "バケーションレンタルお掃除大作戦_3"; this.m_VoiceFileName = "N23_00301"; this.m_ImageTargetFrame.gameObject.SetActive(true); this.m_ImageTargetFrame.SetParent(this.m_ButtonMaid03.transform, true); }); this.m_GraphicTargetFrame = this.m_ImageTargetFrame.GetComponent(); this.m_CanvasGroup = base.GetComponent(); this.Refresh(); } private void Update() { if (this.m_ImageTargetFrame && this.m_ImageTargetFrame.gameObject.activeInHierarchy) { Vector3 anchoredPosition3D = this.m_ImageTargetFrame.anchoredPosition3D; this.m_ImageTargetFrame.anchoredPosition3D = Vector3.Lerp(anchoredPosition3D, Vector3.zero, 0.3f); } if (this.m_GraphicTargetFrame != null && this.m_CanvasGroup.blocksRaycasts) { Color color = this.m_GraphicTargetFrame.color; color.a = Mathf.Repeat(color.a + Time.deltaTime, 1f); this.m_GraphicTargetFrame.color = color; } } private void Refresh() { if (this.m_CanvasGroup == null) { return; } this.m_CanvasGroup.blocksRaycasts = true; this.m_NowFlagName = string.Empty; this.m_VoiceFileName = string.Empty; this.m_ImageTargetFrame.gameObject.SetActive(false); Status status = GameMain.Instance.CharacterMgr.status; int flag = status.GetFlag("バケーションレンタルメイド雇用フラグ_1"); int flag2 = status.GetFlag("バケーションレンタルメイド雇用フラグ_2"); int flag3 = status.GetFlag("バケーションレンタルメイド雇用フラグ_3"); this.m_ButtonMaid01.interactable = (flag == 1); this.m_ButtonMaid02.interactable = (flag2 == 1); this.m_ButtonMaid03.interactable = (flag3 == 1); } public void ButtonEvent_OK() { if (string.IsNullOrEmpty(this.m_NowFlagName)) { return; } this.m_CanvasGroup.blocksRaycasts = false; Color color = this.m_GraphicTargetFrame.color; color.a = 1f; this.m_GraphicTargetFrame.color = color; GameMain.Instance.CharacterMgr.status.SetFlag(this.m_NowFlagName, 1); if (!string.IsNullOrEmpty(this.m_VoiceFileName)) { GameMain.Instance.SoundMgr.PlayDummyVoice(this.m_VoiceFileName + ".ogg", 0f, false, false, 50, AudioSourceMgr.Type.Voice); } GameMain.Instance.ScriptMgr.LoadAdvScenarioScript("HAN_main_0004.ks", string.Empty); GameMain.Instance.ScriptMgr.adv_kag.JumpLabel("*rentalmaid_ok"); GameMain.Instance.ScriptMgr.adv_kag.Exec(); VRCanvasManager.Instance.ClearCanvasStack(); } public void ButtonEvent_Cancel() { VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.MainMenu); VRCanvasManager.Instance.ClearCanvasStack(); GameMain.Instance.ScriptMgr.LoadAdvScenarioScript("HAN_main_0004.ks", string.Empty); GameMain.Instance.ScriptMgr.adv_kag.JumpLabel("*rentalmaid_cancel"); GameMain.Instance.ScriptMgr.adv_kag.Exec(); } private void OnEnable() { this.Refresh(); } [SerializeField] [Tooltip("メイド「まこ」のボタン")] private Button m_ButtonMaid01; [SerializeField] [Tooltip("メイド「ひなな」のボタン")] private Button m_ButtonMaid02; [SerializeField] [Tooltip("メイド「レオ」のボタン")] private Button m_ButtonMaid03; [Space(16f)] [SerializeField] [Tooltip("メイドのボタンの縁取り用の画像")] private RectTransform m_ImageTargetFrame; private Graphic m_GraphicTargetFrame; private string m_NowFlagName = string.Empty; private string m_VoiceFileName = string.Empty; private CanvasGroup m_CanvasGroup; }