123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670 |
- using System;
- using System.Collections.Generic;
- using I2.Loc;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class SystemShortcut : MonoBehaviour
- {
- private void Awake()
- {
- this.m_uiCam = base.gameObject.transform.parent.Find("Camera").GetComponent<Camera>();
- this.m_uiPanel = base.gameObject.GetComponent<UIPanel>();
- this.m_goBase = UTY.GetChildObject(base.gameObject, "Base", false);
- this.m_uiBase = this.m_goBase.GetComponent<UISprite>();
- this.m_hitArea = this.m_goBase.GetComponent<BoxCollider>();
- this.m_goBaseVR = UTY.GetChildObject(base.gameObject, "BaseVR", false);
- this.m_uiBaseVR = this.m_goBaseVR.GetComponent<UISprite>();
- this.m_goBaseVR.SetActive(false);
- this.m_goGear = UTY.GetChildObject(base.gameObject, "Gear", false);
- this.m_uiGear = this.m_goGear.GetComponent<UIButton>();
- EventDelegate.Add(this.m_uiGear.onClick, new EventDelegate.Callback(this.OnClick_Gear));
- this.m_aryDgOnClick[0] = new EventDelegate(new EventDelegate.Callback(this.OnClick_Config));
- this.m_aryDgOnClick[1] = new EventDelegate(new EventDelegate.Callback(this.OnClick_Exit));
- this.m_aryDgOnClick[2] = new EventDelegate(new EventDelegate.Callback(this.OnClick_Info));
- this.m_aryDgOnClick[3] = new EventDelegate(new EventDelegate.Callback(this.OnClick_Ss));
- this.m_aryDgOnClick[4] = new EventDelegate(new EventDelegate.Callback(this.OnClick_SsUi));
- this.m_aryDgOnClick[5] = new EventDelegate(new EventDelegate.Callback(this.OnClick_ToTitle));
- this.m_aryDgOnClick[6] = new EventDelegate(new EventDelegate.Callback(this.OnClick_Shop));
- this.m_aryDgOnClick[7] = new EventDelegate(new EventDelegate.Callback(this.OnClick_VRCommHome));
- this.m_aryDgOnClick[8] = new EventDelegate(new EventDelegate.Callback(this.OnClick_VRHelp));
- this.m_aryDgOnClick[9] = new EventDelegate(new EventDelegate.Callback(this.OnClick_Help));
- this.m_aryDgOnClick[10] = new EventDelegate(new EventDelegate.Callback(this.OnClick_VRAvatar));
- this.m_aryDgOnClick[11] = new EventDelegate(new EventDelegate.Callback(this.OnClickDictionary));
- Dictionary<int, string> dictionary = new Dictionary<int, string>();
- dictionary.Add(0, "System/ショートカット/コンフィグ");
- dictionary.Add(3, "System/ショートカット/UI無し スクリーンショット");
- dictionary.Add(4, "System/ショートカット/UI有り スクリーンショット");
- dictionary.Add(6, "System/ショートカット/ショップ");
- dictionary.Add(5, "System/ショートカット/タイトルへ");
- dictionary.Add(2, "System/ショートカット/ゲーム情報");
- dictionary.Add(1, "System/ショートカット/終了");
- dictionary.Add(7, "System/ショートカット/エンパイアクラブに帰る");
- dictionary.Add(8, "System/ショートカット/VRヘルプ");
- dictionary.Add(9, "System/ショートカット/シーンのヘルプ");
- dictionary.Add(10, "System/ショートカット/バーチャル アバター スタジオ");
- dictionary.Add(11, "System/ショートカット/辞書");
- for (int i = 0; i < this.m_aryObjPath.Length; i++)
- {
- this.m_goBtn[i] = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[i], false);
- this.m_uiBtn[i] = this.m_goBtn[i].GetComponent<UIButton>();
- EventDelegate.Add(this.m_uiBtn[i].onClick, this.m_aryDgOnClick[i]);
- if (dictionary.ContainsKey(i))
- {
- UIEventTrigger component = this.m_goBtn[i].GetComponent<UIEventTrigger>();
- string text = dictionary[i];
- EventDelegate.Add(component.onHoverOver, delegate()
- {
- this.VisibleExplanation(text, true);
- });
- EventDelegate.Add(component.onHoverOut, delegate()
- {
- this.VisibleExplanation(text, false);
- });
- EventDelegate.Add(component.onDragStart, delegate()
- {
- this.VisibleExplanation(text, false);
- });
- }
- }
- UIWidget uiBaseVR = this.m_uiBaseVR;
- Color color = new Color(1f, 1f, 1f, 0f);
- this.m_uiBase.color = color;
- uiBaseVR.color = color;
- this.m_uiGear.defaultColor = new Color(1f, 1f, 1f, 0.3f);
- this.m_spriteExplanation = UTY.GetChildObject(base.gameObject, "Explanation", false).GetComponent<UISprite>();
- this.m_labelExplanation = UTY.GetChildObject(this.m_spriteExplanation.gameObject, "Value", false).GetComponent<UILabel>();
- this.m_spriteExplanation.gameObject.SetActive(false);
- this.dicBGSizeType.Add(SystemShortcut.BGSizeType.Long, 380);
- this.dicBGSizeType.Add(SystemShortcut.BGSizeType.Short, 340);
- int num = 0;
- if (Product.isJapan)
- {
- GameObject childObject = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[11], false);
- if (childObject != null)
- {
- childObject.SetActive(false);
- num++;
- }
- }
- if (GameMain.Instance.CMSystem.NetUse)
- {
- int num2 = this.dicBGSizeType[SystemShortcut.BGSizeType.Long];
- }
- else
- {
- int num2 = this.dicBGSizeType[SystemShortcut.BGSizeType.Short];
- GameObject childObject2 = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[6], false);
- childObject2.SetActive(false);
- num++;
- }
- this.m_uiBase.width = 420 - num * 40;
- Vector2 vector = new Vector2(700f, 110f);
- this.m_hitArea.size = new Vector3((float)this.m_uiBase.width + vector.x, (float)this.m_uiBase.height + vector.y, 0f);
- Vector3 center = this.m_uiBase.GetComponent<BoxCollider>().center;
- center.x += vector.x / 2f;
- center.y -= 50f;
- this.m_hitArea.center = center;
- UTY.GetChildObject(this.m_goBase, "Grid", false).GetComponent<UIGrid>().repositionNow = true;
- SceneManager.activeSceneChanged += this.OnActiveSceneChanged;
- SceneManager.sceneUnloaded += this.OnSceneUnloaded;
- }
- private void OnClick_Gear()
- {
- if (this.m_bEnableBase)
- {
- this.BaseClose();
- }
- else if (!this.m_bEnableBase)
- {
- this.BaseOpen();
- }
- }
- private void BaseClose()
- {
- if (this.m_bEnableBase)
- {
- this.m_bEnableBase = false;
- iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
- {
- "from",
- this.m_uiBase.color.a,
- "to",
- 0f,
- "time",
- 0.25f,
- "onUpdate",
- "UpdateBase"
- }));
- this.m_uiGear.defaultColor = new Color(1f, 1f, 1f, 0.3f);
- }
- }
- private void BaseOpen()
- {
- if (!this.m_bEnableBase)
- {
- this.m_bEnableBase = true;
- iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
- {
- "from",
- this.m_uiBase.color.a,
- "to",
- 1f,
- "time",
- 0.25f,
- "onUpdate",
- "UpdateBase"
- }));
- this.m_uiGear.defaultColor = new Color(1f, 1f, 1f, 1f);
- }
- }
- private void UpdateBase(float f_fValue)
- {
- UIWidget uiBaseVR = this.m_uiBaseVR;
- Color color = new Color(1f, 1f, 1f, f_fValue);
- this.m_uiBase.color = color;
- uiBaseVR.color = color;
- }
- private void PanelClose()
- {
- if (this.m_bEnablePanel)
- {
- this.m_bEnablePanel = false;
- iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
- {
- "from",
- this.m_uiPanel.alpha,
- "to",
- 0f,
- "time",
- 0.25f,
- "onUpdate",
- "UpdatePanel"
- }));
- }
- }
- private void PanelOpen()
- {
- if (!this.m_bEnablePanel)
- {
- this.m_bEnablePanel = true;
- iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
- {
- "from",
- this.m_uiPanel.alpha,
- "to",
- 1f,
- "time",
- 0.25f,
- "onUpdate",
- "UpdatePanel"
- }));
- }
- }
- private void UpdatePanel(float f_fValue)
- {
- this.m_uiPanel.alpha = f_fValue;
- }
- private void OnClick_Config()
- {
- if (!this.m_bEnablePanel || BaseMgr<ConfigMgr>.Instance.IsOpenConfigPanel())
- {
- return;
- }
- BaseMgr<ConfigMgr>.Instance.OpenConfigPanel();
- if (ConfigVRCtrl.IsOpen())
- {
- ConfigVRCtrl.Close(true);
- }
- this.BaseClose();
- }
- private void OnClick_Exit()
- {
- if (!this.m_bEnablePanel)
- {
- return;
- }
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/終了しますか?", null, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.OnToEnd), new SystemDialog.OnClick(this.OnCancel));
- this.BaseClose();
- }
- private void OnClick_Info()
- {
- if (!this.m_bEnablePanel)
- {
- return;
- }
- string text = Product.gameTitle;
- if (text.IndexOf("It's") != -1)
- {
- text = text.Replace("It's", "\nIt's");
- }
- string text2 = "カスタムメイド3D 2";
- string text3 = string.Concat(new string[]
- {
- text,
- "\nVersion ",
- GameUty.GetGameVersionText(),
- " (BuildVersion : ",
- GameUty.GetBuildVersionText(),
- ")"
- });
- if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
- {
- string text4 = text3;
- text3 = string.Concat(new string[]
- {
- text4,
- "\n",
- text2,
- "\nVersion ",
- GameUty.GetLegacyGameVersionText()
- });
- }
- GameMain.Instance.SysDlg.Show(text3, SystemDialog.TYPE.OK, new SystemDialog.OnClick(this.OnCancel), null);
- this.BaseClose();
- }
- private void OnClick_Ss()
- {
- GameMain.Instance.MainCamera.ScreenShot(true);
- }
- private void OnClick_SsUi()
- {
- this.VisibleExplanation(string.Empty, false);
- GameMain.Instance.MainCamera.ScreenShot(false);
- }
- private void OnClick_ToTitle()
- {
- if (!this.m_bEnablePanel)
- {
- return;
- }
- if (Application.loadedLevelName != "SceneTitle")
- {
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/タイトルに戻りますか?", null, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.OnToTitle), new SystemDialog.OnClick(this.OnCancel));
- }
- else
- {
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/現在タイトルに戻れません。", null, SystemDialog.TYPE.OK, new SystemDialog.OnClick(this.OnCancel), null);
- }
- this.BaseClose();
- }
- private void OnClick_Shop()
- {
- Application.OpenURL(GameMain.Instance.CMSystem.ShopURL);
- }
- private void OnClick_VRCommHome()
- {
- GameMain.Instance.SysDlg.Show("エンパイアクラブに帰りますか?", SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.OnToHome), new SystemDialog.OnClick(this.OnCancel));
- this.BaseClose();
- }
- private void OnToHome()
- {
- }
- private void OnClick_VRHelp()
- {
- }
- private void OnClick_Help()
- {
- if (!this.m_bEnablePanel)
- {
- return;
- }
- if (uGUITutorialPanel.IsOpened())
- {
- return;
- }
- string text = this.strSceneHelpName;
- if (string.IsNullOrEmpty(text))
- {
- text = GameMain.Instance.GetNowSceneName();
- if (string.IsNullOrEmpty(text))
- {
- text = SceneManager.GetActiveScene().name;
- }
- }
- if (uGUITutorialPanel.IsExistTutorial(text))
- {
- uGUITutorialPanel.OpenTutorial(text, null, true);
- }
- else
- {
- NDebug.Warning(string.Format("シーン名「{0}」のチュートリアルは存在しません", text));
- }
- this.BaseClose();
- }
- private void OnClick_VRAvatar()
- {
- ControllerShortcutWindow controllerShortcutWindow = OvrIK.CreateUI();
- controllerShortcutWindow.Open();
- this.BaseClose();
- }
- private void OnClick_VRConfig()
- {
- if (!this.m_bEnablePanel)
- {
- return;
- }
- if (ConfigVRCtrl.IsOpen())
- {
- return;
- }
- ConfigVRCtrl.Open(null);
- if (BaseMgr<ConfigMgr>.Instance.IsOpenConfigPanel())
- {
- BaseMgr<ConfigMgr>.Instance.CloseConfigPanel();
- }
- this.BaseClose();
- }
- private void OnClickDictionary()
- {
- if (!uGUITutorialPanel.IsOpened())
- {
- uGUITutorialPanel.OpenTutorial("WordDictionary", null, true);
- }
- }
- private void OnToEnd()
- {
- GameMain.Instance.ToApplicationQuit(true);
- }
- private void OnToTitle()
- {
- GameMain.Instance.SysDlg.Close();
- GameMain.Instance.LoadScene("SceneToTitle");
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- }
- private void OnCancel()
- {
- GameMain.Instance.SysDlg.Close();
- }
- private void Start()
- {
- this.m_sys = GameMain.Instance.CMSystem;
- this.m_bEnablePanel = (this.m_bAlways = this.m_sys.SysButtonShowAlways);
- if (this.m_bAlways)
- {
- this.m_uiPanel.alpha = 1f;
- }
- else
- {
- this.m_uiPanel.alpha = 0f;
- }
- this.SetVRAvatarButtonInteractable();
- }
- private void Update()
- {
- if (this.m_sys.SysButtonShowAlways != this.m_bAlways)
- {
- if (this.m_sys.SysButtonShowAlways)
- {
- this.m_uiPanel.alpha = 1f;
- this.PanelOpen();
- }
- else
- {
- this.PanelClose();
- }
- this.m_bAlways = this.m_sys.SysButtonShowAlways;
- }
- if (!this.m_bAlways)
- {
- if (!GameMain.Instance.VRMode)
- {
- Ray ray = this.m_uiCam.ScreenPointToRay(Input.mousePosition);
- RaycastHit raycastHit = default(RaycastHit);
- if (this.m_hitArea.Raycast(ray, out raycastHit, 3.40282347E+38f))
- {
- if (!this.m_bEnablePanel)
- {
- this.PanelOpen();
- }
- }
- else if (this.m_bEnablePanel)
- {
- this.PanelClose();
- }
- }
- else
- {
- Vector3 ovrVirtualMousePos = GameMain.Instance.OvrMgr.SystemUICamera.GetOvrVirtualMousePos(true);
- Vector3 ovrVirtualMousePos2 = GameMain.Instance.OvrMgr.SystemUICamera.GetOvrVirtualMousePos(false);
- Ray ray2 = this.m_uiCam.ScreenPointToRay(ovrVirtualMousePos);
- Ray ray3 = this.m_uiCam.ScreenPointToRay(ovrVirtualMousePos2);
- RaycastHit raycastHit2 = default(RaycastHit);
- if (this.m_hitArea.Raycast(ray2, out raycastHit2, 3.40282347E+38f) || this.m_hitArea.Raycast(ray3, out raycastHit2, 3.40282347E+38f))
- {
- if (!this.m_bEnablePanel)
- {
- this.PanelOpen();
- }
- }
- else if (this.m_bEnablePanel)
- {
- this.PanelClose();
- }
- }
- }
- }
- public void VisibleExplanation(string text, bool visible)
- {
- if (visible)
- {
- this.m_labelExplanation.text = LocalizationManager.GetTranslation(text, true, 0, true, false, null, null);
- this.m_labelExplanation.width = 0;
- this.m_labelExplanation.MakePixelPerfect();
- UISprite component = this.m_spriteExplanation.GetComponent<UISprite>();
- component.width = this.m_labelExplanation.width + 15;
- }
- this.m_spriteExplanation.gameObject.SetActive(visible);
- }
- private void OnActiveSceneChanged(Scene beforeScene, Scene activeScene)
- {
- this.SetHelpButtonInteractable();
- uGUITutorialPanel.CloseTutorial(true, false);
- this.SetVRAvatarButtonInteractable();
- }
- private void OnSceneUnloaded(Scene unloadedScene)
- {
- this.strSceneHelpName = string.Empty;
- }
- public string strSceneHelpName
- {
- get
- {
- return this.m_strSceneHelpName;
- }
- set
- {
- if (string.IsNullOrEmpty(value))
- {
- this.m_strSceneHelpName = string.Empty;
- this.SetHelpButtonInteractable();
- return;
- }
- if (!uGUITutorialPanel.IsExistTutorial(value))
- {
- this.m_strSceneHelpName = string.Empty;
- this.SetHelpButtonInteractable();
- NDebug.Warning(string.Format("チュートリアル「{0}」は存在しないので、\nシーン名を利用します。", value));
- return;
- }
- this.m_strSceneHelpName = value;
- this.SetHelpButtonInteractable();
- }
- }
- private void SetHelpButtonInteractable()
- {
- GameObject childObject = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[9], false);
- NDebug.Assert(childObject != null, "ヘルプ用ボタンの取得に失敗しました。");
- UIButton component = childObject.GetComponent<UIButton>();
- string text = this.strSceneHelpName;
- if (string.IsNullOrEmpty(text))
- {
- text = GameMain.Instance.GetNowSceneName();
- if (string.IsNullOrEmpty(text))
- {
- text = SceneManager.GetActiveScene().name;
- }
- }
- if (uGUITutorialPanel.IsExistTutorial(text))
- {
- component.isEnabled = true;
- }
- else
- {
- component.isEnabled = false;
- }
- }
- public bool helpButtonInteractable
- {
- get
- {
- GameObject childObject = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[9], false);
- NDebug.Assert(childObject != null, "ヘルプ用ボタンの取得に失敗しました。");
- UIButton component = childObject.GetComponent<UIButton>();
- return component.isEnabled;
- }
- set
- {
- GameObject childObject = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[9], false);
- NDebug.Assert(childObject != null, "ヘルプ用ボタンの取得に失敗しました。");
- UIButton component = childObject.GetComponent<UIButton>();
- component.isEnabled = value;
- }
- }
- private void SetVRAvatarButtonInteractable()
- {
- GameObject childObject = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[10], false);
- NDebug.Assert(childObject != null, "VRアバターボタンの取得に失敗しました。");
- if (GameMain.Instance == null)
- {
- return;
- }
- GameMain.VRDeviceType vrdeviceTypeID = GameMain.Instance.VRDeviceTypeID;
- if (vrdeviceTypeID != GameMain.VRDeviceType.VIVE && vrdeviceTypeID != GameMain.VRDeviceType.RIFT_TOUCH)
- {
- childObject.SetActive(false);
- return;
- }
- string nowSceneName = GameMain.Instance.GetNowSceneName();
- if (string.IsNullOrEmpty(nowSceneName) || GameMain.Instance.CMSystem.SConfig.OvrIkAllSceneEnable || nowSceneName == "SceneEdit" || nowSceneName == "ScenePhotoMode" || nowSceneName.IndexOf("SceneDance_") == 0)
- {
- childObject.SetActive(true);
- }
- else
- {
- childObject.SetActive(false);
- }
- }
- private string[] m_aryObjPath = new string[]
- {
- "Base/Grid/Config",
- "Base/Grid/Exit",
- "Base/Grid/Info",
- "Base/Grid/Ss",
- "Base/Grid/SsUi",
- "Base/Grid/ToTitle",
- "Base/Grid/Shop",
- "BaseVR/Grid/VRCommHome",
- "BaseVR/Grid/VRHelp",
- "Base/Grid/Help",
- "Base/VR Avatar",
- "Base/Grid/Dic"
- };
- private UIPanel m_uiPanel;
- private BoxCollider m_hitArea;
- private GameObject m_goBase;
- private UISprite m_uiBase;
- private GameObject m_goBaseVR;
- private UISprite m_uiBaseVR;
- private GameObject m_goGear;
- private UIButton m_uiGear;
- private GameObject[] m_goBtn = new GameObject[12];
- private UIButton[] m_uiBtn = new UIButton[12];
- private Camera m_uiCam;
- private UISprite m_spriteExplanation;
- private UILabel m_labelExplanation;
- private bool m_bEnablePanel;
- private bool m_bEnableBase;
- private Dictionary<SystemShortcut.BGSizeType, int> dicBGSizeType = new Dictionary<SystemShortcut.BGSizeType, int>();
- private EventDelegate[] m_aryDgOnClick = new EventDelegate[12];
- private bool m_bAlways = true;
- private CMSystem m_sys;
- private string m_strSceneHelpName = string.Empty;
- private enum Btn
- {
- Config,
- Exit,
- Info,
- Ss,
- SsUi,
- ToTitle,
- Shop,
- VRCommHome,
- VRHelp,
- Help,
- VRAvatar,
- Dic,
- Max
- }
- private enum BGSizeType
- {
- Long,
- Short
- }
- }
|