123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- 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<Graphic>();
- this.m_CanvasGroup = base.GetComponent<CanvasGroup>();
- 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);
- }
- 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;
- }
|