123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class VRMainMenu : MonoBehaviour, InterfaceVRCanvas
- {
- private void Awake()
- {
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Edit, this.m_ButtonEdit);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Yotogi, this.m_ButtonYotogi);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Nei, this.m_ButtonNei);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.ChangeBG, this.m_ButtonChangeBG);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Time, this.m_ButtonTime);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Config, this.m_ButtonConfig);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.VRConfig, this.m_ButtonVRConfig);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Trohy, this.m_ButtonTrohy);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Manual, this.m_ButtonManual);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.EndButton, this.m_ButtonEnd);
- this.m_ButtonArray.Add(VRMainMenu.ButtonType.Skip, this.m_ButtonSkip);
- }
- private void Start()
- {
- this.MainMenuUpdate();
- }
- public void Event_SetButtonEnabled(VRMainMenu.ButtonType type, bool flag)
- {
- if (!this.m_ButtonArray.ContainsKey(type))
- {
- return;
- }
- Button button = this.m_ButtonArray[type];
- if (button == null)
- {
- return;
- }
- button.interactable = flag;
- }
- public void Event_SetButtonActive(VRMainMenu.ButtonType type, bool flag)
- {
- if (!this.m_ButtonArray.ContainsKey(type))
- {
- return;
- }
- Button button = this.m_ButtonArray[type];
- if (button == null)
- {
- return;
- }
- button.gameObject.SetActive(flag);
- }
- public void ButtonEvent_OpenDialogEndVacation()
- {
- VRDialogMenu dialogMenu = VRDialogMenu.CreateDialog();
- VRDialogMenu.TYPE_STYLE style = (VRDialogMenu.TYPE_STYLE)12;
- dialogMenu.OpenDialog("本当にバカンスを終了する?", style, delegate(VRDialogMenu.TYPE_STYLE buttonType)
- {
- dialogMenu.CloseDialog();
- if (buttonType == VRDialogMenu.TYPE_STYLE.OK)
- {
- VRExternalFileLoader.Event_CloseMovie();
- SceneVRCommunication.Instance.OnEnd();
- }
- });
- }
- public void ButtonEvent_NextTime()
- {
- SceneVRCommunication sceneVRCom = SceneVRCommunication.Instance;
- if (sceneVRCom == null)
- {
- return;
- }
- VRExternalFileLoader.Event_CloseMovie();
- SceneVRCommunication.VR_TIME nowTime = sceneVRCom.GetNowTime();
- if (nowTime != SceneVRCommunication.VR_TIME.NIGHT)
- {
- sceneVRCom.KagDoNextTime();
- }
- else
- {
- VRSelectorMenu selector = VRSelectorMenu.CreateSelector();
- selector.SetSelectType(VRChoices.SelectPair.Type.Text);
- List<VRChoices.SelectPair> list = new List<VRChoices.SelectPair>();
- list.Add(new VRChoices.SelectPair("VIPへ進む", "0", 0, VRChoices.SelectPair.Type.Text, 0, -1f));
- list.Add(new VRChoices.SelectPair("翌日ヘ進む", "1", 0, VRChoices.SelectPair.Type.Text, 0, -1f));
- selector.SelectStart(list, delegate(VRChoices.SelectPair choice)
- {
- selector.SelectFinalize(null);
- if (choice.strLabel == "0")
- {
- VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.VIP);
- }
- else
- {
- VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.MainMenu);
- sceneVRCom.KagDoNextTime();
- }
- });
- }
- }
- public void ButtonEvent_OpenConfig()
- {
- if (BaseMgr<ConfigMgr>.Instance != null)
- {
- BaseMgr<ConfigMgr>.Instance.OpenConfigPanel();
- }
- }
- public void ButtonEvent_OpenEdit()
- {
- VRDialogMenu dialog = VRDialogMenu.CreateDialog();
- VRDialogMenu.TYPE_STYLE style = (VRDialogMenu.TYPE_STYLE)12;
- dialog.OpenDialog("エディット画面を開きます。", style, delegate(VRDialogMenu.TYPE_STYLE type)
- {
- dialog.CloseDialog();
- if (type == VRDialogMenu.TYPE_STYLE.OK)
- {
- VRExternalFileLoader.Event_CloseMovie();
- SceneVRCommunication.Instance.MaidEditStart();
- }
- else
- {
- VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.MainMenu);
- }
- });
- }
- public void ButtonEvent_OpenYotogi()
- {
- VRCanvasManager.Instance.IsYotogiSelecting = true;
- VRCanvasManager.Instance.CloseVRCanvas();
- VRCanvasManager.Instance.ClearCanvasStack();
- SceneVRCommunication.Instance.YotogiStart(delegate
- {
- VRExternalFileLoader.Event_CloseMovie();
- VRCanvasManager.Instance.IsYotogiSelecting = false;
- }, delegate
- {
- Canvas vrcanvas = VRCanvasManager.Instance.GetVRCanvas(VRCanvasManager.VRCanvasType.VRConfig);
- if (vrcanvas)
- {
- if (VRCanvasManager.Instance.m_CallbackCloseVRConfig != null)
- {
- VRCanvasManager.Instance.m_CallbackCloseVRConfig();
- }
- Transform transform = vrcanvas.transform.Find("Button return");
- Button component = transform.GetComponent<Button>();
- UICanvasFade component2 = vrcanvas.GetComponent<UICanvasFade>();
- component.onClick.RemoveAllListeners();
- }
- VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.MainMenu);
- VRCanvasManager.Instance.IsYotogiSelecting = false;
- });
- }
- public void OnUpdateCanvas()
- {
- this.MainMenuUpdate();
- }
- private void MainMenuUpdate()
- {
- SceneVRCommunication instance = SceneVRCommunication.Instance;
- if (instance == null)
- {
- return;
- }
- Text componentInChildren = this.m_ButtonTime.GetComponentInChildren<Text>();
- if (componentInChildren != null)
- {
- SceneVRCommunication.VR_TIME nowTime = instance.GetNowTime();
- if (nowTime == SceneVRCommunication.VR_TIME.MONING)
- {
- componentInChildren.text = "昼へ進む";
- }
- else if (nowTime == SceneVRCommunication.VR_TIME.DAY)
- {
- componentInChildren.text = "夜へ進む";
- }
- else if (nowTime == SceneVRCommunication.VR_TIME.NIGHT)
- {
- componentInChildren.text = "翌日へ進む";
- }
- else
- {
- Debug.LogError("[VRMainMenu]ゲーム内の時間指定が分かりません");
- }
- }
- bool flag = false;
- if (GameMain.Instance.CharacterMgr.GetMaid(0) != null)
- {
- string text = "vrcom_nei_letter.nei";
- if (!GameUty.FileSystem.IsExistentFile(text))
- {
- NDebug.Assert("表がありません。" + text, false);
- }
- using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
- {
- using (CsvParser csvParser = new CsvParser())
- {
- bool condition = csvParser.Open(afileBase);
- NDebug.Assert(condition, text + "\nopen failed.");
- for (int i = 1; i < csvParser.max_cell_y; i++)
- {
- string cellAsString = csvParser.GetCellAsString(2, i);
- if (GameMain.Instance.CharacterMgr.GetMaid(0).status.GetFlag(cellAsString) == 1)
- {
- flag = true;
- break;
- }
- }
- }
- }
- }
- this.Event_SetButtonEnabled(VRMainMenu.ButtonType.Nei, flag);
- }
- [SerializeField]
- [Tooltip("ボタン「エディット」")]
- private Button m_ButtonEdit;
- [SerializeField]
- [Tooltip("ボタン「夜伽」")]
- private Button m_ButtonYotogi;
- [SerializeField]
- [Tooltip("ボタン「ねい人形からの手紙」")]
- private Button m_ButtonNei;
- [SerializeField]
- [Tooltip("ボタン「背景移動」")]
- private Button m_ButtonChangeBG;
- [SerializeField]
- [Tooltip("ボタン「時間」")]
- private Button m_ButtonTime;
- [SerializeField]
- [Tooltip("ボタン「コンフィグ」")]
- private Button m_ButtonConfig;
- [SerializeField]
- [Tooltip("ボタン「VRコンフィグ」")]
- private Button m_ButtonVRConfig;
- [SerializeField]
- [Tooltip("ボタン「トロフィー」")]
- private Button m_ButtonTrohy;
- [SerializeField]
- [Tooltip("ボタン「マニュアル」")]
- private Button m_ButtonManual;
- [SerializeField]
- [Tooltip("ボタン「終了」")]
- private Button m_ButtonEnd;
- [SerializeField]
- [Tooltip("ボタン「SKIP」")]
- private Button m_ButtonSkip;
- private Dictionary<VRMainMenu.ButtonType, Button> m_ButtonArray = new Dictionary<VRMainMenu.ButtonType, Button>();
- public enum ButtonType
- {
- Edit,
- Yotogi,
- Nei,
- ChangeBG,
- Time,
- Config,
- VRConfig,
- Trohy,
- Manual,
- EndButton,
- Skip
- }
- }
|