diff --git a/Assets/Art/UIPrefab/UICameraSwitch.prefab b/Assets/Art/UIPrefab/UICameraSwitch.prefab index 92fbe6e1..d287323b 100644 --- a/Assets/Art/UIPrefab/UICameraSwitch.prefab +++ b/Assets/Art/UIPrefab/UICameraSwitch.prefab @@ -17,7 +17,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3411569463940388114 RectTransform: m_ObjectHideFlags: 0 @@ -226,7 +226,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &7775706862032139777 RectTransform: m_ObjectHideFlags: 0 @@ -826,7 +826,7 @@ MonoBehaviour: onValueChanged: m_PersistentCalls: m_Calls: [] - m_IsOn: 1 + m_IsOn: 0 --- !u!1 &8974889932437628810 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/UIPrefab/UIModuleSelect.prefab b/Assets/Art/UIPrefab/UIModuleSelect.prefab index 33238870..e300a7d2 100644 --- a/Assets/Art/UIPrefab/UIModuleSelect.prefab +++ b/Assets/Art/UIPrefab/UIModuleSelect.prefab @@ -403,7 +403,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: -30, y: -30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7870331819941572208 CanvasRenderer: @@ -433,7 +433,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "\u6A21\u5757\u540D\u79F0" + m_text: m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 9bbfb1bdb0251664eb0932e39724900e, type: 2} m_sharedMaterial: {fileID: 5103963756306747964, guid: 9bbfb1bdb0251664eb0932e39724900e, type: 2} diff --git a/Assets/Art/UIPrefab/UIOperationList.prefab b/Assets/Art/UIPrefab/UIOperationList.prefab index 004eae42..e387fe22 100644 --- a/Assets/Art/UIPrefab/UIOperationList.prefab +++ b/Assets/Art/UIPrefab/UIOperationList.prefab @@ -763,7 +763,7 @@ MonoBehaviour: m_ScrollSensitivity: 1 m_Viewport: {fileID: 8731652694218410629} m_HorizontalScrollbar: {fileID: 0} - m_VerticalScrollbar: {fileID: 1945366071212582513} + m_VerticalScrollbar: {fileID: 0} m_HorizontalScrollbarVisibility: 2 m_VerticalScrollbarVisibility: 2 m_HorizontalScrollbarSpacing: -3 @@ -1068,7 +1068,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &6772576175566796072 RectTransform: m_ObjectHideFlags: 0 @@ -1248,9 +1248,9 @@ RectTransform: m_Father: {fileID: 2192231524565599668} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: -12, y: 0} m_Pivot: {x: 0, y: 1} --- !u!222 &1726614218311108045 CanvasRenderer: @@ -1336,7 +1336,7 @@ RectTransform: m_Father: {fileID: 1644315794790874757} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} diff --git a/Assets/Art/UIPrefab/UIRightTop.prefab b/Assets/Art/UIPrefab/UIRightTop.prefab index 887a2420..4e719eef 100644 --- a/Assets/Art/UIPrefab/UIRightTop.prefab +++ b/Assets/Art/UIPrefab/UIRightTop.prefab @@ -429,9 +429,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 2505519175557592291} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 16, y: -16} m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1402148308183576929 @@ -838,7 +838,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &2505519175557592291 RectTransform: m_ObjectHideFlags: 0 @@ -855,10 +855,10 @@ RectTransform: - {fileID: 3064490650672719453} m_Father: {fileID: 906599229421366858} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 583.3438, y: -35.5} + m_SizeDelta: {x: 68, y: 32} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &4014962916602461336 MonoBehaviour: @@ -1507,9 +1507,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 2505519175557592291} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50, y: -16} m_SizeDelta: {x: 36, y: 18} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7242127381975158959 diff --git a/Assets/Art/UIPrefab/UISetting.prefab b/Assets/Art/UIPrefab/UISetting.prefab index 85d8035d..b8c81173 100644 --- a/Assets/Art/UIPrefab/UISetting.prefab +++ b/Assets/Art/UIPrefab/UISetting.prefab @@ -1690,10 +1690,10 @@ MonoBehaviour: m_FillRect: {fileID: 4260347516208239176} m_HandleRect: {fileID: 8825168004229886871} m_Direction: 0 - m_MinValue: 0.01 + m_MinValue: 0 m_MaxValue: 0.1 m_WholeNumbers: 0 - m_Value: 0.0983 + m_Value: 0.05 m_OnValueChanged: m_PersistentCalls: m_Calls: [] @@ -2088,7 +2088,7 @@ MonoBehaviour: m_MinValue: 0 m_MaxValue: 1 m_WholeNumbers: 0 - m_Value: 0.36 + m_Value: 0.5 m_OnValueChanged: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Art/UIPrefab/UITextTip.prefab b/Assets/Art/UIPrefab/UITextTip.prefab index f68b2cf5..1e66446d 100644 --- a/Assets/Art/UIPrefab/UITextTip.prefab +++ b/Assets/Art/UIPrefab/UITextTip.prefab @@ -378,9 +378,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: ' - -' + m_text: m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 97936a7b3a86809479ac89371e95b079, type: 2} m_sharedMaterial: {fileID: 168401102475399263, guid: 97936a7b3a86809479ac89371e95b079, type: 2} @@ -519,7 +517,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4085354983340029108} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: @@ -907,10 +905,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 + m_Left: 5 + m_Right: 5 + m_Top: 5 + m_Bottom: 5 m_ChildAlignment: 1 m_Spacing: 0 m_ChildForceExpandWidth: 1 diff --git a/Assets/QFramework/Toolkits/AudioKit/Scripts/AudioKitSettings.cs b/Assets/QFramework/Toolkits/AudioKit/Scripts/AudioKitSettings.cs index f3a3de5a..0b03f74a 100644 --- a/Assets/QFramework/Toolkits/AudioKit/Scripts/AudioKitSettings.cs +++ b/Assets/QFramework/Toolkits/AudioKit/Scripts/AudioKitSettings.cs @@ -45,11 +45,11 @@ namespace QFramework } ); - SoundVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_SOUND_VOLUME, 1.0f); + SoundVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_SOUND_VOLUME, 0.5f); - MusicVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_MUSIC_VOLUME, 1.0f); + MusicVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_MUSIC_VOLUME, 0.5f); - VoiceVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_VOICE_VOLUME, 1.0f); + VoiceVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_VOICE_VOLUME, 0.5f); } diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index d5a6a328..813c31c2 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -172,8 +172,8 @@ public class ActionHelper } case "LoadRes": { - var strAction = (XMLTool.StringListAction)act; - return LoadResAction.Allocate(act.Value, strAction.args[0]); + var dictAction = (XMLTool.DictionaryAction)act; + return LoadResAction.Allocate(act.Value, dictAction.args); } case "Audio": { diff --git a/Assets/Scripts/Actions/LoadResAction.cs b/Assets/Scripts/Actions/LoadResAction.cs index ceaa950e..a164d8c4 100644 --- a/Assets/Scripts/Actions/LoadResAction.cs +++ b/Assets/Scripts/Actions/LoadResAction.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Xml.Linq; using UnityEngine; using XMLTool; @@ -21,14 +22,16 @@ namespace QFramework string fileName; string type; - public static LoadResAction Allocate(string fileName, string type, System.Action OnFinished = null) + string index; + public static LoadResAction Allocate(string fileName, Dictionary datas, System.Action OnFinished = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); retNode.fileName = fileName; - retNode.type = type; + retNode.type = datas.ContainsKey("resType") ? datas["resType"] : string.Empty; + retNode.index = datas.ContainsKey("index") ? datas["index"] : string.Empty; retNode.OnFinished = OnFinished; return retNode; } @@ -55,7 +58,15 @@ namespace QFramework XDocument doc = XDocument.Parse(xmlStr); // 获取根元素 XElement moduleXml = doc.Root; - XmlParser.LoadModule(moduleXml, Global.Instance.appData); + if (string.IsNullOrEmpty(index)) + { + // 无序加载 + XmlParser.LoadModule(moduleXml, Global.Instance.appData); + } + else + { + Global.moduleDict.Add(index, moduleXml); + } } } }); diff --git a/Assets/Scripts/Controller/DeviceController.cs b/Assets/Scripts/Controller/DeviceController.cs index 09a22be4..1d9444a7 100644 --- a/Assets/Scripts/Controller/DeviceController.cs +++ b/Assets/Scripts/Controller/DeviceController.cs @@ -30,7 +30,6 @@ public class DeviceController : MonoSingleton private void OnQuit(OnModuleQuit quit) { deviceDict.Clear(); - deviceDict.Clear(); } private void OnStart(OnModuleStart start) diff --git a/Assets/Scripts/Controller/OperationController.cs b/Assets/Scripts/Controller/OperationController.cs index cbeb9eab..156f24ad 100644 --- a/Assets/Scripts/Controller/OperationController.cs +++ b/Assets/Scripts/Controller/OperationController.cs @@ -46,6 +46,7 @@ public class OperationController : MonoSingleton { Refresh(); }).UnRegisterWhenGameObjectDestroyed(gameObject); + } public void Refresh() @@ -66,18 +67,24 @@ public class OperationController : MonoSingleton } TypeEventSystem.Global.Register(OnExecute); TypeEventSystem.Global.Register(OnNext); - TypeEventSystem.Global.Register(arg => Clear()); + TypeEventSystem.Global.Register(OnModuleQuitHandler); } } } + private void OnModuleQuitHandler(OnModuleQuit quit) + { + Clear(); + } + public void Clear() { + index = -1; curAction.Deinit(); steps.Clear(); - TypeEventSystem.Global.UnRegister(arg => Clear()); + TypeEventSystem.Global.UnRegister(OnModuleQuitHandler); TypeEventSystem.Global.UnRegister(OnExecute); TypeEventSystem.Global.UnRegister(OnNext); diff --git a/Assets/Scripts/Controller/VarController.cs b/Assets/Scripts/Controller/VarController.cs index 48234840..d69ae194 100644 --- a/Assets/Scripts/Controller/VarController.cs +++ b/Assets/Scripts/Controller/VarController.cs @@ -1,4 +1,5 @@ using QFramework; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -12,9 +13,15 @@ public class VarController : MonoSingleton { base.OnSingletonInit(); varDict = new Dictionary(); + TypeEventSystem.Global.Register(OnQuit).UnRegisterWhenGameObjectDestroyed(gameObject); } + private void OnQuit(OnModuleQuit quit) + { + varDict.Clear(); + } + public void Set(string key, float value) { if (varDict.ContainsKey(key)) diff --git a/Assets/Scripts/Global/Global.cs b/Assets/Scripts/Global/Global.cs index 339953fd..10063865 100644 --- a/Assets/Scripts/Global/Global.cs +++ b/Assets/Scripts/Global/Global.cs @@ -2,6 +2,7 @@ using QFramework; using System; using System.Collections; using System.Collections.Generic; +using System.Xml.Linq; using UnityEngine; using XMLTool; @@ -35,6 +36,6 @@ public class Global : Singleton public static AppType appTpe = AppType.UnKnow; - + public static Dictionary moduleDict = new Dictionary(); } diff --git a/Assets/Scripts/Launch.cs b/Assets/Scripts/Launch.cs index ed089f65..cfe71e87 100644 --- a/Assets/Scripts/Launch.cs +++ b/Assets/Scripts/Launch.cs @@ -41,7 +41,21 @@ public class Launch : MonoBehaviour yield return new WaitUntil(() => isLoadFinished == true); if (Global.Instance.appData.preLoad != null && Global.Instance.appData.preLoad.action != null) { - yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this); + yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this, () => + { + // 暂时放在这里 + if (Global.moduleDict.Count > 0) + { + for (int i = 0; i < Global.moduleDict.Count; i++) + { + string index = (i + 1).ToString(); + if (Global.moduleDict.ContainsKey(index)) + { + XmlParser.LoadModule(Global.moduleDict[index], Global.Instance.appData); + } + } + } + }); } yield return UIKit.OpenPanelAsync(); UIKit.HidePanel(); diff --git a/Assets/Scripts/UI/UIBtns.cs b/Assets/Scripts/UI/UIBtns.cs index d55ca9a4..4b9414ca 100644 --- a/Assets/Scripts/UI/UIBtns.cs +++ b/Assets/Scripts/UI/UIBtns.cs @@ -19,6 +19,7 @@ namespace QFramework.Example mData = uiData as UIBtnsData ?? new UIBtnsData(); // please add init code here TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) diff --git a/Assets/Scripts/UI/UICameraSwitch.cs b/Assets/Scripts/UI/UICameraSwitch.cs index dd2893cf..4020e826 100644 --- a/Assets/Scripts/UI/UICameraSwitch.cs +++ b/Assets/Scripts/UI/UICameraSwitch.cs @@ -22,6 +22,7 @@ namespace QFramework.Example { protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); // please add init code here Near.onValueChanged.AddListener(isOn => @@ -33,7 +34,7 @@ namespace QFramework.Example Near.transform.Find("Bg/Line").gameObject.SetActive(isOn); }); Far.onValueChanged.AddListener(isOn => - { + { if (isOn) { SetNormal(); @@ -68,6 +69,21 @@ namespace QFramework.Example } } + private void Update() + { +#if UNITY_STANDALONE_WIN + if (Near.isOn == true || Far.isOn == true) + { + if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D)) + { + Near.isOn = false; + Far.isOn = false; + } + } + +#endif + } + protected override void OnShow() { } diff --git a/Assets/Scripts/UI/UIDeviceTip.cs b/Assets/Scripts/UI/UIDeviceTip.cs index 1724395a..1b94bf72 100644 --- a/Assets/Scripts/UI/UIDeviceTip.cs +++ b/Assets/Scripts/UI/UIDeviceTip.cs @@ -13,6 +13,7 @@ namespace QFramework.Example { mData = uiData as UIDeviceTipData ?? new UIDeviceTipData(); // please add init code here + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } protected override void OnOpen(IUIData uiData = null) diff --git a/Assets/Scripts/UI/UIHint.cs b/Assets/Scripts/UI/UIHint.cs index 73deb610..6a30db99 100644 --- a/Assets/Scripts/UI/UIHint.cs +++ b/Assets/Scripts/UI/UIHint.cs @@ -23,6 +23,7 @@ namespace QFramework.Example mData = uiData as UIHintData ?? new UIHintData(); SetItem(0); TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) diff --git a/Assets/Scripts/UI/UIInstruction.cs b/Assets/Scripts/UI/UIInstruction.cs index 8ba88f6c..aa7d6981 100644 --- a/Assets/Scripts/UI/UIInstruction.cs +++ b/Assets/Scripts/UI/UIInstruction.cs @@ -12,6 +12,7 @@ namespace QFramework.Example { protected override void OnInit(IUIData uiData = null) { + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); mData = uiData as UIInstructionData ?? new UIInstructionData(); // please add init code here Training.onValueChanged.AddListener(isOn => diff --git a/Assets/Scripts/UI/UILoading.cs b/Assets/Scripts/UI/UILoading.cs index e65ab0cd..6d7ed682 100644 --- a/Assets/Scripts/UI/UILoading.cs +++ b/Assets/Scripts/UI/UILoading.cs @@ -14,6 +14,7 @@ namespace QFramework.Example protected override void OnInit(IUIData uiData = null) { mData = uiData as UILoadingData ?? new UILoadingData(); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register(arg => Show()).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } diff --git a/Assets/Scripts/UI/UIOperationList.cs b/Assets/Scripts/UI/UIOperationList.cs index 7e4a9d18..12ab9209 100644 --- a/Assets/Scripts/UI/UIOperationList.cs +++ b/Assets/Scripts/UI/UIOperationList.cs @@ -20,7 +20,7 @@ namespace QFramework.Example protected override void OnInit(IUIData uiData = null) { mData = uiData as UIOperationListData ?? new UIOperationListData(); - TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg)=>Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) @@ -67,7 +67,7 @@ namespace QFramework.Example break; case StepStatus.Finished: // TODO:实现方式过于耦合 后期优化 - if (Global.Instance.curModule.type=="Exam") + if (Global.Instance.curModule.type == "Exam") { stepLabel.color = highColor; } @@ -82,6 +82,8 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(this); + btns.Clear(); op = OperationController.Instance.operation; StepContent.RemoveAllChildren(); foreach (var item in op.Steps) @@ -138,13 +140,9 @@ namespace QFramework.Example protected override void OnShow() { } - - protected override void OnHide() - { - } - protected override void OnClose() { + TypeEventSystem.Global.UnRegister(OnStepChanged); } } } diff --git a/Assets/Scripts/UI/UIPointQuestion.cs b/Assets/Scripts/UI/UIPointQuestion.cs index cb8ba3e3..8f60f828 100644 --- a/Assets/Scripts/UI/UIPointQuestion.cs +++ b/Assets/Scripts/UI/UIPointQuestion.cs @@ -18,6 +18,7 @@ namespace QFramework.Example mData = uiData as UIPointQuestionData ?? new UIPointQuestionData(); // please add init code here TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) diff --git a/Assets/Scripts/UI/UIResultTip.cs b/Assets/Scripts/UI/UIResultTip.cs index 8e613038..288574e1 100644 --- a/Assets/Scripts/UI/UIResultTip.cs +++ b/Assets/Scripts/UI/UIResultTip.cs @@ -21,6 +21,7 @@ namespace QFramework.Example Right.gameObject.SetActive(false); Wrong.gameObject.SetActive(false); TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) diff --git a/Assets/Scripts/UI/UIRightTop.cs b/Assets/Scripts/UI/UIRightTop.cs index c4af2640..af5b0951 100644 --- a/Assets/Scripts/UI/UIRightTop.cs +++ b/Assets/Scripts/UI/UIRightTop.cs @@ -13,8 +13,6 @@ namespace QFramework.Example protected override void OnInit(IUIData uiData = null) { mData = uiData as UIRightTopData ?? new UIRightTopData(); - - setBtn.onClick.AddListener(() => { UIKit.OpenPanelAsync(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(); @@ -23,28 +21,12 @@ namespace QFramework.Example { UITipWindowData data = new UITipWindowData(); data.txt = "是否关闭软件?"; - data.btns.Add(new UITipWindowData.ItemData() { txt = "确定", OnClick = () => Application.Quit() }); - data.btns.Add(new UITipWindowData.ItemData() { txt = "取消" }); - UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(); - }); - - homeBtn.onClick.AddListener(() => - { - UITipWindowData data = new UITipWindowData(); - data.txt = "是否退出当前模块?"; - data.btns.Add(new UITipWindowData.ItemData() - { - txt = "确定", - OnClick = () => - { - Hide(); - TypeEventSystem.Global.Send(); - UIKit.OpenPanelAsync().ToAction().StartGlobal(); - } - }); - data.btns.Add(new UITipWindowData.ItemData() { txt = "取消" }); + data.btns.Add(new UITipWindowData.ItemData() { txt = "是", OnClick = () => Application.Quit() }); + data.btns.Add(new UITipWindowData.ItemData() { txt = "否" }); UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(); }); + backBtn.onClick.AddListener(Home); + homeBtn.onClick.AddListener(Home); desBtn.onClick.AddListener(() => { @@ -57,19 +39,39 @@ namespace QFramework.Example }); } + public void Home() + { + UITipWindowData data = new UITipWindowData(); + data.txt = "是否退出当前模块?"; + data.btns.Add(new UITipWindowData.ItemData() + { + txt = "是", + OnClick = () => + { + Hide(); + TypeEventSystem.Global.Send(); + UIKit.OpenPanelAsync().ToAction().StartGlobal(); + } + }); + data.btns.Add(new UITipWindowData.ItemData() { txt = "否" }); + UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(); + } + protected override void OnOpen(IUIData uiData = null) { Title.text = Global.Instance.curModule.ModuleName; - - switch (Global.Instance.curModule.type) + switch (Global.appTpe) { - case "All": - case "Exam": + case Global.AppType.UnKnow: + break; + case Global.AppType.Study: Score.gameObject.SetActive(true); break; - default: + case Global.AppType.Exam: Score.gameObject.SetActive(false); break; + case Global.AppType.All: + break; } } diff --git a/Assets/Scripts/UI/UIScore.cs b/Assets/Scripts/UI/UIScore.cs index c3995dcd..4856c51e 100644 --- a/Assets/Scripts/UI/UIScore.cs +++ b/Assets/Scripts/UI/UIScore.cs @@ -12,6 +12,7 @@ namespace QFramework.Example protected override void OnInit(IUIData uiData = null) { mData = uiData as UIScoreData ?? new UIScoreData(); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); DownLoad.onClick.AddListener(() => { if (string.IsNullOrEmpty(InputName.text) || string.IsNullOrEmpty(InputId.text)) diff --git a/Assets/Scripts/UI/UISetting.cs b/Assets/Scripts/UI/UISetting.cs index 800525b9..1e4199b8 100644 --- a/Assets/Scripts/UI/UISetting.cs +++ b/Assets/Scripts/UI/UISetting.cs @@ -14,7 +14,6 @@ namespace QFramework.Example { mData = uiData as UISettingData ?? new UISettingData(); - AudioKit.Settings.MusicVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this); VoiceSlider.onValueChanged.AddListener(volume => { diff --git a/Assets/Scripts/UI/UITextQuestion.cs b/Assets/Scripts/UI/UITextQuestion.cs index b1e6d874..3069230a 100644 --- a/Assets/Scripts/UI/UITextQuestion.cs +++ b/Assets/Scripts/UI/UITextQuestion.cs @@ -35,6 +35,7 @@ namespace QFramework.Example mData = uiData as UITextQuestionData ?? new UITextQuestionData(); // please add init code here TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) diff --git a/Assets/Scripts/UI/UITextTip.cs b/Assets/Scripts/UI/UITextTip.cs index b7738738..154c5dec 100644 --- a/Assets/Scripts/UI/UITextTip.cs +++ b/Assets/Scripts/UI/UITextTip.cs @@ -4,6 +4,8 @@ using QFramework; using System.Collections.Generic; using TMPro; using System.Text.RegularExpressions; +using static OperationController; +using System; namespace QFramework.Example { @@ -20,7 +22,14 @@ namespace QFramework.Example { mData = uiData as UITextTipData ?? new UITextTipData(); + TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenGameObjectDestroyed(this); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); + } + + private void OnStepChanged(StepStatusOnChange change) + { + Hide(); } protected override void OnOpen(IUIData uiData = null) diff --git a/Assets/Scripts/UI/UITimeTip.cs b/Assets/Scripts/UI/UITimeTip.cs index 9fe6fc39..5cb20689 100644 --- a/Assets/Scripts/UI/UITimeTip.cs +++ b/Assets/Scripts/UI/UITimeTip.cs @@ -36,11 +36,13 @@ namespace QFramework.Example public List sprites; bool isRun = false; List> dotwens = new List>(); + TweenerCore imgTwen; int index = 0; protected override void OnInit(IUIData uiData = null) { mData = uiData as UITimeTipData ?? new UITimeTipData(); // please add init code here + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void Update() @@ -74,18 +76,21 @@ namespace QFramework.Example mData = uiData as UITimeTipData ?? new UITimeTipData(); index = 0; isRun = true; - int endIndex = sprites.Count; + int endIndex = sprites.Count - 1; if (mData.reverse) { index = sprites.Count; endIndex = 0; } - DOTween.To(() => index, v => + imgTwen = DOTween.To(() => index, v => { index = v; Img.sprite = sprites[index]; Img.SetNativeSize(); - }, endIndex, mData.time).SetEase(Ease.Linear).onComplete = () => + + }, endIndex, mData.time); + + imgTwen.SetEase(Ease.Linear).onComplete = () => { if (string.IsNullOrEmpty(mData.finishedEvent) == false) { @@ -129,6 +134,11 @@ namespace QFramework.Example item.Kill(); } dotwens.Clear(); + if (imgTwen != null) + { + imgTwen.Kill(); + imgTwen = null; + } } protected override void OnClose() diff --git a/Assets/Scripts/UI/UITipWindow.cs b/Assets/Scripts/UI/UITipWindow.cs index 6dde5a40..0ed8613c 100644 --- a/Assets/Scripts/UI/UITipWindow.cs +++ b/Assets/Scripts/UI/UITipWindow.cs @@ -28,6 +28,7 @@ namespace QFramework.Example // please add init code here TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) diff --git a/Assets/Scripts/UI/UITools.cs b/Assets/Scripts/UI/UITools.cs index 666c3b14..49bc1571 100644 --- a/Assets/Scripts/UI/UITools.cs +++ b/Assets/Scripts/UI/UITools.cs @@ -31,6 +31,7 @@ namespace QFramework.Example mData = uiData as UIToolsData ?? new UIToolsData(); // please add init code here TypeEventSystem.Global.Register(OnStepChanged); + TypeEventSystem.Global.Register(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject); } private void OnStepChanged(StepStatusOnChange change) @@ -40,7 +41,6 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { - TypeEventSystem.Global.Register(OnModuleQuit).UnRegisterWhenDisabled(gameObject); mResLoader = ResLoader.Allocate(); mData = uiData as UIToolsData ?? new UIToolsData(); if (string.IsNullOrEmpty(mData.answer) == false) diff --git a/Assets/Scripts/UI/UIVideo.cs b/Assets/Scripts/UI/UIVideo.cs index 4cc5a1cf..0c617ca8 100644 --- a/Assets/Scripts/UI/UIVideo.cs +++ b/Assets/Scripts/UI/UIVideo.cs @@ -24,30 +24,14 @@ namespace QFramework.Example protected override void OnInit(IUIData uiData = null) { mData = uiData as UIVideoData ?? new UIVideoData(); + TypeEventSystem.Global.Register((arg) => Close()).UnRegisterWhenGameObjectDestroyed(gameObject); // please add init code here Progress.onValueChanged.AddListener(OnSliderValueChanged); Progress.OnBeginDragEvent(OnProgressBeginDrag); Progress.OnEndDragEvent(OnProgressEndDrag); player.loopPointReached += VideoPlayer_loopPointReached; player.prepareCompleted += OnPrepareCompleted; - CloseBtn.onClick.AddListener(() => - { - if (player.isPlaying) - { - player.Stop(); - - } - if (string.IsNullOrEmpty(mData.finishedEvent) == false) - { - StringEventSystem.Global.Send(mData.finishedEvent); - } - if (string.IsNullOrEmpty(mData.closeEvent) == false) - { - StringEventSystem.Global.Send(mData.closeEvent); - } - player.targetTexture.Release(); - Hide(); - }); + CloseBtn.onClick.AddListener(Close); VideoPlayBtn.onClick.AddListener(() => { player.Pause(); @@ -80,6 +64,26 @@ namespace QFramework.Example } } + public void Close() + { + if (player.isPlaying) + { + player.Stop(); + + } + if (string.IsNullOrEmpty(mData.finishedEvent) == false) + { + StringEventSystem.Global.Send(mData.finishedEvent); + } + if (string.IsNullOrEmpty(mData.closeEvent) == false) + { + StringEventSystem.Global.Send(mData.closeEvent); + } + player.targetTexture.Release(); + Hide(); + + } + private void OnPrepareCompleted(VideoPlayer source) { Progress.maxValue = (float)player.length; diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index b3446f46..b894aabf 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -362,7 +362,7 @@ namespace XMLTool var animName = action.Attribute("animName"); if (animName != null) { - act.args.Add("animName",animName.Value); + act.args.Add("animName", animName.Value); } var frame = action.Attribute("frame"); if (frame != null) @@ -585,7 +585,7 @@ namespace XMLTool XAttribute isShow = action.Attribute("isShow"); if (isShow != null) { - act.args.Add("isShow",isShow.Value); + act.args.Add("isShow", isShow.Value); } XAttribute isDevice = action.Attribute("isDevice"); @@ -784,15 +784,16 @@ namespace XMLTool break; case "LoadRes": { - var act = new StringListAction(); + var act = new DictionaryAction(); XAttribute resType = action.Attribute("resType"); if (resType != null) { - act.args.Add(resType.Value); + act.args.Add("resType", resType.Value); } - else + XAttribute index = action.Attribute("index"); + if (index != null) { - act.args.Add(""); + act.args.Add("index", index.Value); } newAction = act; }