VRRentalMaidMenu.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using PlayerStatus;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class VRRentalMaidMenu : MonoBehaviour
  6. {
  7. private void Start()
  8. {
  9. Status status = GameMain.Instance.CharacterMgr.status;
  10. this.m_ButtonMaid01.onClick.RemoveAllListeners();
  11. this.m_ButtonMaid01.onClick.AddListener(delegate
  12. {
  13. this.m_NowFlagName = "バケーションレンタルお掃除大作戦_1";
  14. this.m_VoiceFileName = "N21_00540";
  15. this.m_ImageTargetFrame.gameObject.SetActive(true);
  16. this.m_ImageTargetFrame.SetParent(this.m_ButtonMaid01.transform, true);
  17. });
  18. this.m_ButtonMaid02.onClick.RemoveAllListeners();
  19. this.m_ButtonMaid02.onClick.AddListener(delegate
  20. {
  21. this.m_NowFlagName = "バケーションレンタルお掃除大作戦_2";
  22. this.m_VoiceFileName = "N22_00543";
  23. this.m_ImageTargetFrame.gameObject.SetActive(true);
  24. this.m_ImageTargetFrame.SetParent(this.m_ButtonMaid02.transform, true);
  25. });
  26. this.m_ButtonMaid03.onClick.RemoveAllListeners();
  27. this.m_ButtonMaid03.onClick.AddListener(delegate
  28. {
  29. this.m_NowFlagName = "バケーションレンタルお掃除大作戦_3";
  30. this.m_VoiceFileName = "N23_00301";
  31. this.m_ImageTargetFrame.gameObject.SetActive(true);
  32. this.m_ImageTargetFrame.SetParent(this.m_ButtonMaid03.transform, true);
  33. });
  34. this.m_GraphicTargetFrame = this.m_ImageTargetFrame.GetComponent<Graphic>();
  35. this.m_CanvasGroup = base.GetComponent<CanvasGroup>();
  36. this.Refresh();
  37. }
  38. private void Update()
  39. {
  40. if (this.m_ImageTargetFrame && this.m_ImageTargetFrame.gameObject.activeInHierarchy)
  41. {
  42. Vector3 anchoredPosition3D = this.m_ImageTargetFrame.anchoredPosition3D;
  43. this.m_ImageTargetFrame.anchoredPosition3D = Vector3.Lerp(anchoredPosition3D, Vector3.zero, 0.3f);
  44. }
  45. if (this.m_GraphicTargetFrame != null && this.m_CanvasGroup.blocksRaycasts)
  46. {
  47. Color color = this.m_GraphicTargetFrame.color;
  48. color.a = Mathf.Repeat(color.a + Time.deltaTime, 1f);
  49. this.m_GraphicTargetFrame.color = color;
  50. }
  51. }
  52. private void Refresh()
  53. {
  54. if (this.m_CanvasGroup == null)
  55. {
  56. return;
  57. }
  58. this.m_CanvasGroup.blocksRaycasts = true;
  59. this.m_NowFlagName = string.Empty;
  60. this.m_VoiceFileName = string.Empty;
  61. this.m_ImageTargetFrame.gameObject.SetActive(false);
  62. Status status = GameMain.Instance.CharacterMgr.status;
  63. int flag = status.GetFlag("バケーションレンタルメイド雇用フラグ_1");
  64. int flag2 = status.GetFlag("バケーションレンタルメイド雇用フラグ_2");
  65. int flag3 = status.GetFlag("バケーションレンタルメイド雇用フラグ_3");
  66. this.m_ButtonMaid01.interactable = (flag == 1);
  67. this.m_ButtonMaid02.interactable = (flag2 == 1);
  68. this.m_ButtonMaid03.interactable = (flag3 == 1);
  69. }
  70. public void ButtonEvent_OK()
  71. {
  72. if (string.IsNullOrEmpty(this.m_NowFlagName))
  73. {
  74. return;
  75. }
  76. this.m_CanvasGroup.blocksRaycasts = false;
  77. Color color = this.m_GraphicTargetFrame.color;
  78. color.a = 1f;
  79. this.m_GraphicTargetFrame.color = color;
  80. GameMain.Instance.CharacterMgr.status.SetFlag(this.m_NowFlagName, 1);
  81. if (!string.IsNullOrEmpty(this.m_VoiceFileName))
  82. {
  83. GameMain.Instance.SoundMgr.PlayDummyVoice(this.m_VoiceFileName + ".ogg", 0f, false, false, 50);
  84. }
  85. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript("HAN_main_0004.ks", string.Empty);
  86. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel("*rentalmaid_ok");
  87. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  88. VRCanvasManager.Instance.ClearCanvasStack();
  89. }
  90. public void ButtonEvent_Cancel()
  91. {
  92. VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.MainMenu);
  93. VRCanvasManager.Instance.ClearCanvasStack();
  94. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript("HAN_main_0004.ks", string.Empty);
  95. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel("*rentalmaid_cancel");
  96. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  97. }
  98. private void OnEnable()
  99. {
  100. this.Refresh();
  101. }
  102. [SerializeField]
  103. [Tooltip("メイド「まこ」のボタン")]
  104. private Button m_ButtonMaid01;
  105. [SerializeField]
  106. [Tooltip("メイド「ひなな」のボタン")]
  107. private Button m_ButtonMaid02;
  108. [SerializeField]
  109. [Tooltip("メイド「レオ」のボタン")]
  110. private Button m_ButtonMaid03;
  111. [Space(16f)]
  112. [SerializeField]
  113. [Tooltip("メイドのボタンの縁取り用の画像")]
  114. private RectTransform m_ImageTargetFrame;
  115. private Graphic m_GraphicTargetFrame;
  116. private string m_NowFlagName = string.Empty;
  117. private string m_VoiceFileName = string.Empty;
  118. private CanvasGroup m_CanvasGroup;
  119. }