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(); this.m_uiPanel = base.gameObject.GetComponent(); this.m_goBase = UTY.GetChildObject(base.gameObject, "Base", false); this.m_uiBase = this.m_goBase.GetComponent(); this.m_hitArea = this.m_goBase.GetComponent(); this.m_goBaseVR = UTY.GetChildObject(base.gameObject, "BaseVR", false); this.m_uiBaseVR = this.m_goBaseVR.GetComponent(); this.m_goBaseVR.SetActive(false); this.m_goGear = UTY.GetChildObject(base.gameObject, "Gear", false); this.m_uiGear = this.m_goGear.GetComponent(); 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 dictionary = new Dictionary(); 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(); EventDelegate.Add(this.m_uiBtn[i].onClick, this.m_aryDgOnClick[i]); if (dictionary.ContainsKey(i)) { UIEventTrigger component = this.m_goBtn[i].GetComponent(); 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(); this.m_labelExplanation = UTY.GetChildObject(this.m_spriteExplanation.gameObject, "Value", false).GetComponent(); 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().center; center.x += vector.x / 2f; center.y -= 50f; this.m_hitArea.center = center; UTY.GetChildObject(this.m_goBase, "Grid", false).GetComponent().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.Instance.IsOpenConfigPanel()) { return; } BaseMgr.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.Instance.IsOpenConfigPanel()) { BaseMgr.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(); 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(); 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(); return component.isEnabled; } set { GameObject childObject = UTY.GetChildObject(base.gameObject, this.m_aryObjPath[9], false); NDebug.Assert(childObject != null, "ヘルプ用ボタンの取得に失敗しました。"); UIButton component = childObject.GetComponent(); 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 dicBGSizeType = new Dictionary(); 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 } }