using System; using System.Collections.Generic; using UnityEngine; public class MessageWindowCtrl : MonoBehaviour { public void Init(GameObject goMessageWindowPanel) { this.m_goMessageViewer = UTY.GetChildObject(goMessageWindowPanel, "MessageViewer", false); this.m_goSelectorViewer = UTY.GetChildObject(goMessageWindowPanel, "SelectorViewer", false); this.m_goBacklogViewer = UTY.GetChildObject(goMessageWindowPanel, "BacklogViewer", false); this.m_goBacklogViewerScroll = UTY.GetChildObject(this.m_goBacklogViewer, "Contents", false).GetComponent(); this.m_goSelectBtnParent = UTY.GetChildObject(goMessageWindowPanel, "SelectorViewer/Contents/SelectButtonParent", false); this.m_selectBtnScrollView = UTY.GetChildObject(this.m_goSelectorViewer, "Contents", false).GetComponent(); this.m_selectBtnScrollBar = UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar", false).GetComponent(); GameObject childObject = UTY.GetChildObject(goMessageWindowPanel, "BacklogViewer/Contents/BacklogUnitParent", false); this.m_backlogScrollView = UTY.GetChildObject(this.m_goBacklogViewer, "Contents", false).GetComponent(); this.m_backlogScrollBar = UTY.GetChildObject(this.m_goBacklogViewer, "Scroll Bar", false).GetComponent(); this.m_selectButtonCtrl = this.m_goSelectBtnParent.GetComponent(); this.m_backlogCtrl = childObject.GetComponent(); this.m_goDragMat = UTY.GetChildObject(this.m_goSelectorViewer, "DragMat", false); this.m_goDragMat.SetActive(false); UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Down", false).GetComponent().enabled = false; UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Up", false).GetComponent().enabled = false; if (GameMain.Instance.VRMode) { this.m_vBackSelectorViewPos = this.m_goSelectorViewer.transform.localPosition; this.m_vBackSelectorViewScale = this.m_goSelectorViewer.transform.localScale; } } public void CreateSelectButtons(List>> listSelectBtn, Action onClickCallBack) { UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Down", false).GetComponent().enabled = true; UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Up", false).GetComponent().enabled = true; string text = (!Product.supportMultiLanguage) ? "SystemUI/MessageWindow/Main/Prefabs/SelectButton" : "SystemUI/MessageWindow/Main/Prefabs/SelectButtonDouble"; UnityEngine.Object @object = Resources.Load(text); if (@object == null) { Debug.LogError(string.Format("ロードされるプレハブが見つかりませんでした。パス={0}", text)); return; } this.m_selectButtonCtrl.CreateSelectButtons(listSelectBtn, onClickCallBack, @object); this.AdjustTargetPosInScrollView(this.m_selectBtnScrollView); if (listSelectBtn.Count > 4) { Debug.Log("スクロールバーのつまみの位置を初期化"); this.m_selectBtnScrollBar.value = 0f; this.m_goDragMat.SetActive(true); } } public void CreateBacklog(List dicBacklog) { string path; if (!Product.supportMultiLanguage) { path = "SystemUI/MessageWindow/Backlog/Prefabs/BacklogUnit"; } else { path = "SystemUI/MessageWindow/Backlog/Prefabs/BacklogSubtitleUnit"; } UnityEngine.Object @object = Resources.Load(path); if (@object == null) { Debug.LogError(string.Format("ロードされるプレハブが見つかりませんでした。パス={0}", "SystemUI/MessageWindow/Backlog/Prefabs/BacklogUnit")); return; } this.m_backlogCtrl.CreateBacklog(dicBacklog, @object); this.AdjustTargetPosInScrollView(this.m_backlogScrollView); int num = (dicBacklog == null) ? 0 : dicBacklog.Count; if (num > 5) { Debug.Log("スクロールバーのつまみの位置を初期化"); this.m_backlogScrollBar.value = 1f; } } private void AdjustTargetPosInScrollView(UIScrollView target) { target.ResetPosition(); } public bool IsSelectButtonPlayingEffect() { return this.m_selectButtonCtrl.IsPlayingEffect(); } public void DisplayBacklog(bool display) { this.m_goBacklogViewer.SetActive(display); display = !display; this.m_goMessageViewer.SetActive(display); this.m_goSelectorViewer.SetActive(display); } public void ScrollDisplayBackLog(float delta) { if (delta != 0f) { this.m_goBacklogViewerScroll.Press(false); this.m_goBacklogViewerScroll.Scroll(delta); } } public bool IsDisplayBackLog() { return this.m_goBacklogViewer.activeSelf; } public GameObject GetBacklogViewerObject() { return this.m_goBacklogViewer; } public void ClearSelectBtn() { this.m_selectButtonCtrl.ClearExistSelectButton(); this.m_selectBtnScrollView.ResetPosition(); } public SelectButtonCtrl GetSelectButtonCtrl() { return this.m_selectButtonCtrl; } public void VRUIModeCheck() { if (GameMain.Instance.VRMode && this.m_bVRControllerNew != GameMain.Instance.OvrMgr.OvrCamera.IsControllerModeNew) { if (GameMain.Instance.OvrMgr.OvrCamera.IsControllerModeNew) { this.m_goSelectorViewer.transform.localPosition = new Vector3(572f, -610f, 0f); this.m_goSelectorViewer.transform.localScale = new Vector3(1.6f, 1.6f, 1f); } else { this.m_goSelectorViewer.transform.localPosition = this.m_vBackSelectorViewPos; this.m_goSelectorViewer.transform.localScale = this.m_vBackSelectorViewScale; } this.m_bVRControllerNew = GameMain.Instance.OvrMgr.OvrCamera.IsControllerModeNew; } } [SerializeField] private const int maxSelectCnt = 4; [SerializeField] private const int maxBacklogUnitCnt = 5; private GameObject m_goMessageViewer; private GameObject m_goBacklogViewer; private UIScrollView m_goBacklogViewerScroll; private GameObject m_goSelectorViewer; private GameObject m_goSelectBtnParent; private GameObject m_goDragMat; private UIScrollView m_selectBtnScrollView; private UIScrollView m_backlogScrollView; private UIScrollBar m_selectBtnScrollBar; private UIScrollBar m_backlogScrollBar; private SelectButtonCtrl m_selectButtonCtrl; private BacklogCtrl m_backlogCtrl; private const string SELECT_BTN_PARENT_PATH = "SelectorViewer/Contents/SelectButtonParent"; private const string SELECT_BUTTON_PREFAB_PATH_EN = "SystemUI/MessageWindow/Main/Prefabs/SelectButtonDouble"; private const string SELECT_BUTTON_PREFAB_PATH = "SystemUI/MessageWindow/Main/Prefabs/SelectButton"; private const string BACKLOG_UNIT_PARENT_PATH = "BacklogViewer/Contents/BacklogUnitParent"; private const string BACKLOG_UNIT_PREFAB_PATH = "SystemUI/MessageWindow/Backlog/Prefabs/BacklogUnit"; private const string BACKLOG_UNIT_PREFAB_SUBTITLE_PATH = "SystemUI/MessageWindow/Backlog/Prefabs/BacklogSubtitleUnit"; private const int MIN_VALUE = 0; private const int MAX_VALUE = 1; private bool m_bVRControllerNew; private Vector3 m_vBackSelectorViewPos; private Vector3 m_vBackSelectorViewScale; }