123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- 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<UIScrollView>();
- this.m_goSelectBtnParent = UTY.GetChildObject(goMessageWindowPanel, "SelectorViewer/Contents/SelectButtonParent", false);
- this.m_selectBtnScrollView = UTY.GetChildObject(this.m_goSelectorViewer, "Contents", false).GetComponent<UIScrollView>();
- this.m_selectBtnScrollBar = UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar", false).GetComponent<UIScrollBar>();
- GameObject childObject = UTY.GetChildObject(goMessageWindowPanel, "BacklogViewer/Contents/BacklogUnitParent", false);
- this.m_backlogScrollView = UTY.GetChildObject(this.m_goBacklogViewer, "Contents", false).GetComponent<UIScrollView>();
- this.m_backlogScrollBar = UTY.GetChildObject(this.m_goBacklogViewer, "Scroll Bar", false).GetComponent<UIScrollBar>();
- this.m_selectButtonCtrl = this.m_goSelectBtnParent.GetComponent<SelectButtonCtrl>();
- this.m_backlogCtrl = childObject.GetComponent<BacklogCtrl>();
- 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<UISprite>().enabled = false;
- UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Up", false).GetComponent<UISprite>().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<KeyValuePair<string, KeyValuePair<string, bool>>> listSelectBtn, Action<string, string> onClickCallBack)
- {
- UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Down", false).GetComponent<UISprite>().enabled = true;
- UTY.GetChildObject(this.m_goSelectorViewer, "Scroll Bar/Up", false).GetComponent<UISprite>().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<BacklogCtrl.BacklogUnit> 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;
- }
|