diff --git a/UnityProject/Assets/Dependencies/BundleMaster/BundleMasterRuntime/AssetComponentTools.cs b/UnityProject/Assets/Dependencies/BundleMaster/BundleMasterRuntime/AssetComponentTools.cs index d3648e2a..cc88219f 100644 --- a/UnityProject/Assets/Dependencies/BundleMaster/BundleMasterRuntime/AssetComponentTools.cs +++ b/UnityProject/Assets/Dependencies/BundleMaster/BundleMasterRuntime/AssetComponentTools.cs @@ -248,7 +248,7 @@ public int[] GetVersion(string bundlePackageName) { if (AssetComponentConfig.AssetLoadMode != AssetLoadMode.Build) { - AssetLogHelper.LogError("仅Build模式可用获取版本索引"); + AssetLogHelper.Log("仅Build模式可用获取版本索引"); return null; } if (!PackageToVersion.TryGetValue(bundlePackageName, out int[] versionData)) diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterMethodRedirection.cs b/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterMethodRedirection.cs index 71ad7510..210984ad 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterMethodRedirection.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/RegisterMethodRedirection.cs @@ -1654,7 +1654,7 @@ private static async Task Wait(float time, CancellationToken token, GameObject g //当计时器的时间小于暂停时间转毫秒除以时间系数时,等待1帧 if (Time.timeScale == 0 || sw.ElapsedMilliseconds < (time * 1000) / Time.timeScale) { - await TimeMgr.Delay(1); + await Task.Delay(1); } else //不满足条件就结束了 { diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Localization/LocalizedText.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Localization/LocalizedText.cs index 9a611cc0..3d97fdf6 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Localization/LocalizedText.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Localization/LocalizedText.cs @@ -47,7 +47,7 @@ private void Start() public async void SetText() { - await TimeMgr.Delay(100); + await Task.Delay(100); text.text = Localization.GetString(key); } } diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs index 0c9b00a4..ab38a538 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/AssetMgr.cs @@ -169,11 +169,11 @@ public static async void LoadSceneAsync(string path, bool additive = false, stri while (!operation.isDone && operation.progress < 0.9f) { loadingCallback?.Invoke(operation.progress); - await TimeMgr.Delay(1); + await Task.Delay(1); } loadingCallback?.Invoke(1); - await TimeMgr.Delay(30);//1/30秒的时间去刷新UI + await Task.Delay(30);//1/30秒的时间去刷新UI operation.allowSceneActivation = true; operation.completed += asyncOperation => { diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/TimeMgr.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/TimeMgr.cs deleted file mode 100644 index 2d7b12de..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/TimeMgr.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// TimeMgr.cs -// -// Author: -// JasonXuDeveloper(傑) -// -// Copyright (c) 2020 JEngine -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using ET; -using System.Threading; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Threading.Tasks; -using Timer = System.Threading.Timer; - -namespace JEngine.Core -{ - /// - /// Time Manager - /// - public static partial class TimeMgr - { - /// - /// Delay for delay ms - /// - /// - /// - public static async Task Delay(int delayInMs) - { - //TODO 待重做 - await Task.Delay(delayInMs); - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/TimeMgr.cs.meta b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/TimeMgr.cs.meta deleted file mode 100644 index 590cd745..00000000 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/TimeMgr.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d9d5da5ab3ef4a11bb904c407af15e2b -timeCreated: 1657279884 \ No newline at end of file diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/ABTools/BuildBundles.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/ABTools/BuildBundles.cs index 3683b209..f575faee 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/ABTools/BuildBundles.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/ABTools/BuildBundles.cs @@ -54,7 +54,7 @@ private static void BuildAssetBundles() Setting.EncryptPassword = s; - await TimeMgr.Delay(3); + await Task.Delay(3); AssetDatabase.Refresh(); watch = new Stopwatch(); diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/ILRuntimeTools/SerializeILTypeInstance.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/ILRuntimeTools/SerializeILTypeInstance.cs index c0645acb..d5157d20 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/ILRuntimeTools/SerializeILTypeInstance.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/ILRuntimeTools/SerializeILTypeInstance.cs @@ -67,7 +67,7 @@ public static async Task OnEnable(AnimBool[] fadeGroup, UnityAction repaint) //ignored } - await TimeMgr.Delay(500); + await Task.Delay(500); } } diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/ClassBindEditor.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/ClassBindEditor.cs index da081eac..2facda43 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/ClassBindEditor.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/ClassBindEditor.cs @@ -138,7 +138,7 @@ public static async void CleanFields(ClassBind instance, bool toast = true) field.fieldName, data.fields.IndexOf(field), data.fields.Length), data.fields.IndexOf(field) / (float) data.fields.Length); - await TimeMgr.Delay(50); //延迟一下,动画更丝滑 + await Task.Delay(50); //延迟一下,动画更丝滑 } var f = data.fields.OrderBy(s => s.fieldName); @@ -211,7 +211,7 @@ public static async void DoFieldType(ClassBind instance, bool toast = true) field.fieldName, data.fields.IndexOf(field), data.fields.Length), data.fields.IndexOf(field) / (float) data.fields.Length); - await TimeMgr.Delay(50); //延迟一下,动画更丝滑 + await Task.Delay(50); //延迟一下,动画更丝滑 } } @@ -315,11 +315,11 @@ public static async void DoConvert(ClassBind instance, bool toast = true) affectCounts++; } - await TimeMgr.Delay(10); //延迟一下,动画更丝滑 + await Task.Delay(10); //延迟一下,动画更丝滑 } } - await TimeMgr.Delay(50); //延迟一下,动画更丝滑 + await Task.Delay(50); //延迟一下,动画更丝滑 EditorUtility.ClearProgressBar(); diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/ChangeScene.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/ChangeScene.cs index 531cb644..c35bc95f 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/ChangeScene.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/EditorUpdates/ChangeScene.cs @@ -29,7 +29,7 @@ private static async void DoChange() while (SceneManager.GetActiveScene().name != name) { if (!Application.isPlaying) return; - await TimeMgr.Delay(10); + await Task.Delay(10); } DynamicGI.UpdateEnvironment(); } diff --git a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Tools.cs b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Tools.cs index 97163ab5..64c95243 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Tools.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Tools.cs @@ -94,7 +94,7 @@ public static async Task Post(string url, Dictionary dic throw new TimeoutException("Post request time out"); } timeout--; - await TimeMgr.Delay(1); + await Task.Delay(1); } return result; } @@ -133,7 +133,7 @@ private static async void Pop(string title, string info) while (isPopping) { EditorUtility.DisplayProgressBar(title, info, Random.Range(0f, 1f)); - await TimeMgr.Delay(1); + await Task.Delay(1); } EditorUtility.ClearProgressBar(); diff --git a/UnityProject/Assets/Dependencies/JEngine/Net/JSocket/SocketIOComponent.cs b/UnityProject/Assets/Dependencies/JEngine/Net/JSocket/SocketIOComponent.cs index d174b7d3..dfdc40b1 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Net/JSocket/SocketIOComponent.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Net/JSocket/SocketIOComponent.cs @@ -427,7 +427,7 @@ private async void RunSocketThread(object obj) { if (webSocket.IsConnected || !inGame) { - await TimeMgr.Delay(config.reconnectDelay); + await Task.Delay(config.reconnectDelay); } else { @@ -451,7 +451,7 @@ private async void RunPingThread(object obj) { if (!wsConnected) { - await TimeMgr.Delay( + await Task.Delay( config.reconnectDelay); } else @@ -465,7 +465,7 @@ await TimeMgr.Delay( while (webSocket.IsConnected && thPinging && (DateTime.Now.Subtract(pingStart).TotalSeconds < timeoutMilis)) { - await TimeMgr.Delay(200); + await Task.Delay(200); } if (!thPong) @@ -473,7 +473,7 @@ await TimeMgr.Delay( webSocket.Close(); } - await TimeMgr.Delay(intervalMilis); + await Task.Delay(intervalMilis); } } } @@ -566,7 +566,7 @@ private async Task EmitPacketAsync(Packet packet) while (wsConnected && !complete) { - await TimeMgr.Delay(10); + await Task.Delay(10); } return result; diff --git a/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt b/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt index 0fa3e556..5405cec7 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt +++ b/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt @@ -32,7 +32,7 @@ { while (Application.isPlaying && !_destoryed && !gameObject.activeInHierarchy) { - await JEngine.Core.TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 @@ -92,7 +92,7 @@ { while (Application.isPlaying && !awaked) { - await TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 diff --git a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll index eea0c00d..cb984b48 100644 Binary files a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll and b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll differ diff --git a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb index 4883934c..58b7638a 100644 Binary files a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb and b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb differ diff --git a/UnityProject/Assets/Scripts/Adapters/ClassBindNonMonoBehaviourAdapter.cs b/UnityProject/Assets/Scripts/Adapters/ClassBindNonMonoBehaviourAdapter.cs index 47613309..23b15812 100644 --- a/UnityProject/Assets/Scripts/Adapters/ClassBindNonMonoBehaviourAdapter.cs +++ b/UnityProject/Assets/Scripts/Adapters/ClassBindNonMonoBehaviourAdapter.cs @@ -80,7 +80,7 @@ public async void Awake() { while (Application.isPlaying && !_destoryed && !gameObject.activeInHierarchy) { - await TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 diff --git a/UnityProject/Assets/Scripts/Adapters/GenericExampleAdapter.cs b/UnityProject/Assets/Scripts/Adapters/GenericExampleAdapter.cs index 811faf93..72442252 100644 --- a/UnityProject/Assets/Scripts/Adapters/GenericExampleAdapter.cs +++ b/UnityProject/Assets/Scripts/Adapters/GenericExampleAdapter.cs @@ -83,7 +83,7 @@ public async void Awake() { while (Application.isPlaying && !destoryed && !gameObject.activeInHierarchy) { - await JEngine.Core.TimeMgr.Delay(20); + await System.Threading.Tasks.Task.Delay(20); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 @@ -1400,7 +1400,7 @@ public async void Awake() { while (Application.isPlaying && !destoryed && !gameObject.activeInHierarchy) { - await JEngine.Core.TimeMgr.Delay(20); + await Task.Delay(20); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 diff --git a/UnityProject/Assets/Scripts/Adapters/MonoBehaviourAdapter.cs b/UnityProject/Assets/Scripts/Adapters/MonoBehaviourAdapter.cs index 40f7cf6a..0eccc93d 100644 --- a/UnityProject/Assets/Scripts/Adapters/MonoBehaviourAdapter.cs +++ b/UnityProject/Assets/Scripts/Adapters/MonoBehaviourAdapter.cs @@ -138,7 +138,7 @@ public async void Awake() { while (Application.isPlaying && !_destoryed && !gameObject.activeInHierarchy) { - await TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 @@ -198,7 +198,7 @@ async void OnEnable() { while (Application.isPlaying && !awaked) { - await TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 diff --git a/UnityProject/Assets/Scripts/Adapters/MonoMethods/ExampleAPIAdapter.MonoMethods.cs b/UnityProject/Assets/Scripts/Adapters/MonoMethods/ExampleAPIAdapter.MonoMethods.cs index b587f3f2..01486e40 100644 --- a/UnityProject/Assets/Scripts/Adapters/MonoMethods/ExampleAPIAdapter.MonoMethods.cs +++ b/UnityProject/Assets/Scripts/Adapters/MonoMethods/ExampleAPIAdapter.MonoMethods.cs @@ -47,7 +47,7 @@ public async void Awake() { while (Application.isPlaying && !_destoryed && !gameObject.activeInHierarchy) { - await JEngine.Core.TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 @@ -107,7 +107,7 @@ async void OnEnable() { while (Application.isPlaying && !awaked) { - await TimeMgr.Delay(1); + await System.Threading.Tasks.Task.Delay(1); } } catch (MissingReferenceException) //如果gameObject被删了,就会触发这个,这个时候就直接return了 diff --git a/UnityProject/HotUpdateScripts/JEngine/Core/JAction.cs b/UnityProject/HotUpdateScripts/JEngine/Core/JAction.cs index f12e5edb..95d836fe 100644 --- a/UnityProject/HotUpdateScripts/JEngine/Core/JAction.cs +++ b/UnityProject/HotUpdateScripts/JEngine/Core/JAction.cs @@ -403,7 +403,7 @@ private async ET.ETTask Do(bool onMainThread) //Delay if (_item.delays.ContainsKey(_index)) { - await JEngine.Core.TimeMgr.Delay((int)(_item.delays[_index] * 1000)); + await Task.Delay((int)(_item.delays[_index] * 1000)); continue; } @@ -413,7 +413,7 @@ private async ET.ETTask Do(bool onMainThread) //计算1帧时间(ms) var durationPerFrame = 1000 / (int)(Application.targetFrameRate <= 0 ? GameStats.FPS : Application.targetFrameRate); var duration = durationPerFrame * _item.delayFrames[_index]; - await JEngine.Core.TimeMgr.Delay(duration); + await Task.Delay(duration); continue; } @@ -435,7 +435,7 @@ private async ET.ETTask Do(bool onMainThread) throw new TimeoutException(); } - await JEngine.Core.TimeMgr.Delay((int)(_item.frequency[_index] * 1000)); + await Task.Delay((int)(_item.frequency[_index] * 1000)); time += _item.frequency[_index]; } continue; @@ -477,7 +477,7 @@ await Task.Run(() => await Task.Run(action, _item.cancellationTokenSource.Token); } - await JEngine.Core.TimeMgr.Delay((int)(frequency * 1000)); + await Task.Delay((int)(frequency * 1000)); time += frequency; } continue; diff --git a/UnityProject/HotUpdateScripts/JEngine/Core/JBehaviour.cs b/UnityProject/HotUpdateScripts/JEngine/Core/JBehaviour.cs index 8382835a..3709604c 100644 --- a/UnityProject/HotUpdateScripts/JEngine/Core/JBehaviour.cs +++ b/UnityProject/HotUpdateScripts/JEngine/Core/JBehaviour.cs @@ -29,6 +29,7 @@ using System.Threading; using System.Diagnostics; using System.Collections.Generic; +using System.Threading.Tasks; namespace JEngine.Core { @@ -155,7 +156,7 @@ private static async void JBehavioursLoop() for(; ; ) { if (!Application.isPlaying) break; - await TimeMgr.Delay(1); + await Task.Delay(1); int cnt = LoopJBehaviours.Count; for (int i = 0; i < cnt; i++) { @@ -549,7 +550,7 @@ public JBehaviour Activate() int duration; duration = (int)((1f / ((float)Application.targetFrameRate <= 0 ? GameStats.FPS : Application.targetFrameRate)) * 1000f); duration = (int)(duration / TimeScale); - await TimeMgr.Delay(duration); + await Task.Delay(duration); OnEnable(); Start(); }); @@ -572,7 +573,7 @@ private protected async void Launch() break; } - await JEngine.Core.TimeMgr.Delay(1); + await Task.Delay(1); } if (JBehaviours is null || _gameObject is null) diff --git a/UnityProject/HotUpdateScripts/JEngine/Core/JPrefab.cs b/UnityProject/HotUpdateScripts/JEngine/Core/JPrefab.cs index 52d7f315..23bc9f22 100644 --- a/UnityProject/HotUpdateScripts/JEngine/Core/JPrefab.cs +++ b/UnityProject/HotUpdateScripts/JEngine/Core/JPrefab.cs @@ -97,10 +97,10 @@ public async Task WaitForAsyncLoading() { if (!AssetMgr.RuntimeMode) { - await JEngine.Core.TimeMgr.Delay(1); + await Task.Delay(1); while (!Loaded) { - await JEngine.Core.TimeMgr.Delay(10); + await Task.Delay(10); } } else diff --git a/UnityProject/HotUpdateScripts/JEngine/Examples/Event/EventDemo.cs b/UnityProject/HotUpdateScripts/JEngine/Examples/Event/EventDemo.cs index ef20317b..2355e562 100644 --- a/UnityProject/HotUpdateScripts/JEngine/Examples/Event/EventDemo.cs +++ b/UnityProject/HotUpdateScripts/JEngine/Examples/Event/EventDemo.cs @@ -60,7 +60,7 @@ public override async void Init() //取消注册ExtensionManager,这样下次不会post到这个实例内的方法 JEvent.defaultEvent.Unregister(ExtensionManager); - await JEngine.Core.TimeMgr.Delay(3000); + await Task.Delay(3000); //创建独立的JEvent JEvent e = new JEvent();