From 0fa617a09eedf6bdb25eda55fac1d3344859fd93 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 31 三月 2026 19:46:31 +0800
Subject: [PATCH] webgl
---
Main/System/AssetVersion/InGameDownLoad.cs | 9
Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs | 9
Main/System/Qunying/QYBattleWin.cs | 3
Main/System/Chat/ChatPlayerMineCell.cs | 3
Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs | 2
Main/Common/Jace/JaceOptions.cs | 4
Main/System/OSActivity/OSActivityBaseWin.cs | 15
Main/System/Arena/ArenaPlayerRankCell.cs | 5
Main/System/InternalAffairs/GoldRushLeader.cs | 2
Main/System/Video/UIVideoPlayer.cs | 2
Main/System/HappyXB/HeroCallResultWin.cs | 6
Main/System/Store/SkinStoreWin.cs | 3
Main/System/Qunying/QunyingManager.cs | 3
Main/ResModule/UILoader.cs | 13
Main/System/Guild/GuildBossWin.cs | 2
Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs | 2
Main/Utility/ComponentExtersion.cs | 8
Main/Utility/RunTimeExceptionUtility.cs | 6
Main/System/Guild/GuildApplyListCell.cs | 3
Main/System/HeroDebut/HeroDebutSkinWin.cs | 7
Main/System/Main/HeroFightingCardCell.cs | 18
Main/System/Battle/BattleField/QYBattleField.cs | 12
Main/System/HeroUI/HeroScenePosCell.cs | 2
Main/System/TianziBillborad/TianziBillboradWin.cs | 2
Main/System/AssetVersion/InGameDownTestUtility.cs | 2
Main/System/OSActivity/OSMinggeBaseWin.cs | 7
Main/System/SpineUpdateManager.cs.meta | 11
Main/System/TimeRush/TimeRushGiftCell.cs | 5
Main/System/HeroDebut/HeroDebutCheckInWin.cs | 3
Main/System/PlayerProfile/PlayerProfileWin.cs | 7
Main/System/ClientVersion/VersionConfig.cs | 34 -
Main/System/Store/SkinStoreCell.cs | 5
Main/System/BillboardRank/PlayerRankCell.cs | 5
Main/System/HeroDebut/HeroDebutShopCell.cs | 5
Main/System/HeroUI/HeroGiftEatSuccessWin.cs | 3
Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs | 2
Main/System/Debug/DebugUtility.cs | 6
Main/System/HappyXB/HeroCallResultCell.cs | 2
Main/System/OSActivity/OSRankHeroTrainWin.cs | 3
Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs | 2
Main/System/HeroUI/HeroSkinWin.cs | 9
Main/System/Battle/BattleField/PriviewBattleField.cs | 10
Main/Core/Platform/DeviceProfile.cs | 5
Main/System/WarlordPavilion/WarlordPavilionNPCItem.cs | 3
Main/System/LineupRecommend/LineupRecommendItem.cs | 13
Main/System/HeroDebut/HeroDebutRankTop3Cell.cs | 5
Main/System/TianziBillborad/TianziBillboradPlayerRankCell.cs | 5
Main/System/AssetVersion/AssetVersion.cs | 30 +
Main/System/OSActivity/OSRankHeroCallGiftCell.cs | 5
Main/System/Login/LoginWin.cs | 17
Main/System/SpineUpdateManager.cs | 109 ++++
Main/System/BillboardRank/PlayerTop3Cell.cs | 2
Main/System/FirstCharge/FirstChargeWin.cs | 4
Main/System/UIBase/UIJumpManager.cs | 2
Main/System/Guild/GuildMemberCell.cs | 3
Main/System/Qunying/QYFighterCell.cs | 9
Main/System/OSActivity/OSMainLevelBaseWin.cs | 7
Main/SDK/SDKUtils.cs | 6
Main/System/HeroUI/HeroTrainWin.cs | 8
Main/System/Guild/GuildBossHurtRankCell.cs | 3
Main/System/Horse/HorseController.cs | 21
Main/Core/GameEngine/Launch/AssetCopyTask.cs | 5
Main/System/OSActivity/OSBeautyMMBaseWin.cs | 7
Main/System/HeroDebut/HeroDebutStarUpWin.cs | 5
Main/System/HeroUI/HeroCollectionCardCell.cs | 29 +
Main/System/HeroFates/HeroFatesIHItem.cs | 7
Main/System/HeroDebut/HeroDebutManager.cs | 10
Main/System/OfficialRank/OfficialTitleCell.cs | 24
Main/Utility/UIHelper.cs | 5
Main/System/Main/RightFuncInHome.cs | 2
Main/System/OSActivity/OSGalaGiftCell.cs | 5
Main/System/HeroDebut/HeroDebutCallRateItem.cs | 3
Main/System/Main/MainWin.cs | 6
Main/System/ChallengeTab/QunyingTabHandler.cs | 7
Main/System/HeroDebut/HeroDebutCallChangeWin.cs | 5
Main/System/HeroDebut/HeroDebutPopWin.cs | 5
Main/System/InternalAffairs/GoldRushWorkerCell.cs | 3
Main/System/Qunying/QYPlayerTop3Cell.cs | 5
Main/System/AssetVersion/DownLoadWin.cs | 4
Main/System/Arena/ArenaRecordCell.cs | 3
Main/System/ClientVersion/VersionUtility.cs | 2
Main/System/HappyXB/HappyXBModel.cs | 4
Main/System/Invest/InvestModel.cs | 3
Main/Utility/DeviceUtility.cs | 41
Main/System/Language/Language.cs | 8
Main/System/Settlement/BattleSettlementManager.cs | 4
Main/System/PhantasmPavilion/PhantasmPavilionManager.cs | 6
Main/System/Store/StoreModel.cs | 4
Main/System/Arena/ArenaPlayerTop3Cell.cs | 2
Main/System/HeroDebut/HeroDebutCell.cs | 3
Main/System/ItemTip/ItemTipWayWin.cs | 7
Main/System/HeroUI/HeroSkinRoleCell.cs | 3
Main/Manager/UIManager.cs | 131 -----
Main/System/HeroDebut/HeroDebutWin.cs | 17
Main/Utility/WebGLDebug.cs | 18
Main/System/OtherPlayerDetail/BuffInfoWin.cs | 12
Main/System/ClientVersion/RequestSecretWin.cs | 2
Main/System/HeroUI/HeroCollectionWin.cs | 9
Main/System/OSActivity/OSHeroTrainBaseWin.cs | 7
Main/System/PhantasmPavilion/PhantasmPavilionModelWin.cs | 5
Main/System/UIBase/UIBase.cs | 2
Main/System/OSActivity/OSHeroCallBaseWin.cs | 9
Main/System/Guild/GuildPreviewWin.cs | 3
Main/System/HeroDebut/HeroDebutRankCell.cs | 5
Main/System/OSActivity/OSRankMinggeWin.cs | 3
Main/System/AssetVersion/DownloadHotMgr.cs | 43 +
Main/System/Guild/GuildDonateDetailCell.cs | 3
Main/System/WarlordPavilion/WarlordPavilionPlayerRankCell.cs | 7
Main/Utility/WebGLDebug.cs.meta | 11
Main/Config/ConfigManager.cs | 34
Main/System/HeroUI/HeroCardCell.cs | 5
Main/System/MainLevel/MainBossEnterWin.cs | 9
Main/System/Arena/ArenaChallengeCell.cs | 3
Main/System/HeroUI/HeroBestBaseWin.cs | 7
Main/Utility/OperationLogCollect.cs | 10
Main/System/HeroUI/HeroTrainBaseWin.cs | 9
Main/System/HeroDebut/HeroDebutCallResultWin.cs | 3
Main/System/Main/HomeWin.cs | 6
Main/System/InternalAffairs/GoldRushWorkCell.cs | 3
Main/System/ItemTip/OwnMoneyCell.cs | 7
Main/System/PhantasmPavilion/AvatarCell.cs | 7
Main/Core/NetworkPackage/NetPkgCtl.cs | 2
Main/System/AssetVersion/AssetVersionUtility.cs | 6
Main/System/Qunying/QYBattleFailWin.cs | 2
Main/System/Hero/UIHeroController.cs | 90 ++-
Main/System/HeroDebut/HeroDebutCallWin.cs | 19
Main/System/HeroUI/HeroBestWin.cs | 4
Main/System/Chat/ChatPlayerOtherCell.cs | 3
Main/System/Qunying/QYWin.cs | 10
Main/System/ViewNPC/ViewBuffManager.cs | 3
Main/Utility/SystemCMD.cs | 5
Main/System/Store/StoreBaseWin.cs | 2
Main/System/OSActivity/OSRankGiftBaseCell.cs | 5
Main/System/HeroDebut/HeroDebutGiftCell.cs | 5
134 files changed, 775 insertions(+), 517 deletions(-)
diff --git a/Main/Common/Jace/JaceOptions.cs b/Main/Common/Jace/JaceOptions.cs
index a360e70..f1cc0ff 100644
--- a/Main/Common/Jace/JaceOptions.cs
+++ b/Main/Common/Jace/JaceOptions.cs
@@ -14,7 +14,11 @@
public JaceOptions()
{
CultureInfo = CultureInfo.CurrentCulture;
+#if UNITY_WEBGL
+ ExecutionMode = ExecutionMode.Interpreted;
+#else
ExecutionMode = ExecutionMode.Compiled;
+#endif
CacheEnabled = true;
OptimizerEnabled = true;
CaseSensitive = false;
diff --git a/Main/Config/ConfigManager.cs b/Main/Config/ConfigManager.cs
index 049c450..982cff8 100644
--- a/Main/Config/ConfigManager.cs
+++ b/Main/Config/ConfigManager.cs
@@ -556,12 +556,18 @@
/// </summary>
private async UniTask<string[]> LoadConfigTextAsync(Type configType)
{
-<<<<<<< HEAD
string configName = configType.Name;
if (configName.EndsWith("Config"))
configName = configName.Substring(0, configName.Length - 6);
return await ResManager.Instance.LoadConfigAsync(configName);
-=======
+ }
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// Editor 鑷锛氬弽灏勫姞杞芥墍鏈夐厤缃被骞惰褰曡�楁椂銆�
+ /// </summary>
+ public async void SelfCheckAllConfigs()
+ {
// 鑾峰彇 Editor Assembly
var editorAsm = System.AppDomain.CurrentDomain.GetAssemblies()
.FirstOrDefault(a => a.FullName.Contains("Editor"));
@@ -601,8 +607,8 @@
foreach (var className in checkClasses)
{
// 杩欓噷涔熻鐢� Editor Assembly 鑾峰彇绫诲瀷
- var configType = editorAsm.GetType(className) ?? Type.GetType(className);
- if (configType == null)
+ var cfgType = editorAsm.GetType(className) ?? Type.GetType(className);
+ if (cfgType == null)
{
Debug.LogWarning($"[鑷] 鏈壘鍒扮被鍨�: {className}");
continue;
@@ -611,15 +617,15 @@
var sw = System.Diagnostics.Stopwatch.StartNew();
// 鍙嶅皠璋冪敤闈欐�両nit鏂规硶
- string configName = configType.Name;
+ string configName = cfgType.Name;
if (configName.EndsWith("Config"))
configName = configName.Substring(0, configName.Length - 6);
- string[] texts = ResManager.Instance.LoadConfig(configName);
+ string[] texts = await ResManager.Instance.LoadConfigAsync(configName);
if (texts != null)
{
string[] lines = texts;
- var methodInfo = configType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
+ var methodInfo = cfgType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
if (methodInfo != null)
{
methodInfo.Invoke(null, new object[] { lines });
@@ -630,21 +636,21 @@
if (sw.ElapsedMilliseconds >= 500)
{
- Debug.LogError($"[鑷] 鍔犺浇閰嶇疆 {configType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms");
+ Debug.LogError($"[鑷] 鍔犺浇閰嶇疆 {cfgType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms");
}
else if (sw.ElapsedMilliseconds <= 5)
{
- fastName.Add(configType.Name);
+ fastName.Add(cfgType.Name);
}
- Debug.Log($"[鑷] 鍔犺浇閰嶇疆: {configType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms");
+ Debug.Log($"[鑷] 鍔犺浇閰嶇疆: {cfgType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms");
}
// 閲婃斁鎵�鏈夊凡鍔犺浇鐨勯厤缃�
foreach (var className in checkClasses)
{
- var configType = editorAsm.GetType(className) ?? Type.GetType(className);
- if (configType == null) continue;
- var methodInfo = configType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
+ var cfgType = editorAsm.GetType(className) ?? Type.GetType(className);
+ if (cfgType == null) continue;
+ var methodInfo = cfgType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
if (methodInfo != null)
{
methodInfo.Invoke(null, null);
@@ -653,8 +659,8 @@
System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
Debug.Log($"[鑷] fastConfig.txt 鐢熸垚瀹屾瘯锛屽揩閫熻〃鏈夛細{string.Join(", ", fastName)}");
->>>>>>> origin/master
}
+#endif
/// <summary>
/// 浠庡凡鍔犺浇鐨勬枃鏈垵濮嬪寲閰嶇疆锛堢函鍐呭瓨鎿嶄綔锛屾棤缃戠粶锛夈��
diff --git a/Main/Core/GameEngine/Launch/AssetCopyTask.cs b/Main/Core/GameEngine/Launch/AssetCopyTask.cs
index 6bbe36a..3b865b0 100644
--- a/Main/Core/GameEngine/Launch/AssetCopyTask.cs
+++ b/Main/Core/GameEngine/Launch/AssetCopyTask.cs
@@ -27,6 +27,11 @@
{
done = true;
}
+ else if (Application.platform == RuntimePlatform.WebGLPlayer)
+ {
+ // WebGL骞冲彴鏃犻渶鎷疯礉鏂囦欢锛岃祫婧愮敱 YooAsset WebPlayMode 鍔犺浇
+ done = true;
+ }
else
{
switch (Application.platform)
diff --git a/Main/Core/NetworkPackage/NetPkgCtl.cs b/Main/Core/NetworkPackage/NetPkgCtl.cs
index fa6b2cd..0289816 100644
--- a/Main/Core/NetworkPackage/NetPkgCtl.cs
+++ b/Main/Core/NetworkPackage/NetPkgCtl.cs
@@ -59,6 +59,7 @@
public static void WriteAllNetLog(bool @details)
{
+#if !UNITY_WEBGL
if (packages != null)
{
var count = 0;
@@ -88,6 +89,7 @@
File.WriteAllLines(Application.dataPath + "/PackageLogs_" + (@details ? "details" : "abstract") + "_" + DateTime.Now.ToString("HH_mm_ss") + ".txt", lines.ToArray());
}
+#endif
}
}
diff --git a/Main/Core/Platform/DeviceProfile.cs b/Main/Core/Platform/DeviceProfile.cs
index d907b64..2ebecea 100644
--- a/Main/Core/Platform/DeviceProfile.cs
+++ b/Main/Core/Platform/DeviceProfile.cs
@@ -59,12 +59,17 @@
};
// 鏍规嵁鍐呭瓨鍒ゅ畾鎬ц兘妗f
+#if UNITY_WEBGL
+ // WebGL涓媠ystemMemorySize涓嶅噯纭紝榛樿涓
+ profile.PerformanceLevel = PerformanceLevel.Medium;
+#else
if (profile.TotalMemory < 2048)
profile.PerformanceLevel = PerformanceLevel.Low;
else if (profile.TotalMemory < 4096)
profile.PerformanceLevel = PerformanceLevel.Medium;
else
profile.PerformanceLevel = PerformanceLevel.High;
+#endif
return profile;
}
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index 4ae6aeb..12a2402 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -775,6 +775,16 @@
/// </summary>
public async UniTask<T> OpenWindowAsync<T>(int functionOrder = 0) where T : UIBase
{
+ if (typeof(T).Name == "MainWin")
+ {
+ //MainWin 姣旇緝鍏抽敭涓斿敮涓�锛屽仛瀹夊叏闃茶寖
+ var ui = GetUI<MainWin>();
+ if (ui != null)
+ {
+ ui.ClickFunc(0);
+ return ui as T;
+ }
+ }
string uiName = typeof(T).Name;
var result = await OpenWindowAsync(uiName, functionOrder);
return result as T;
@@ -976,127 +986,6 @@
return null;
}
- public async UniTask<UIBase> OpenWindow(string uiName, int functionOrder = 0)
- {
- // 浼樺厛浠巆losedUIDict涓幏鍙�
- UIBase parentUI = null;
-
- UIBase returnValue = null;
-
- List<UIBase> closedUIList = new List<UIBase>();
-
- if (closedUIDict.TryGetValue(uiName, out closedUIList) && closedUIList.Count > 0)
- {
- #if UNITY_EDITOR
- Debug.Log("OpenWindow getFromClosedDict " + uiName);
- #endif
-
- returnValue = closedUIList[0] as UIBase;
- closedUIList.RemoveAt(0);
-
- if (closedUIList.Count == 0)
- {
- closedUIDict.Remove(uiName);
- }
- }
- else
- {
- #if UNITY_EDITOR
- Debug.Log("OpenWindow getNewLoad " + uiName);
- #endif
- returnValue = await LoadUIResourceAsync(uiName);
- if (returnValue == null)
- {
- // 璁板綍閿欒鏃ュ織
- Debug.LogError($"鎵撳紑UI澶辫触: {uiName}");
- return null;
- }
- }
-
- returnValue.gameObject.SetActive(true);
-
- // 鑷姩璁剧疆鐖剁骇UI, 濡傛灉鍕鹃�変簡ismainui 鍒欎笉闇�瑕佹壘鐖剁骇UI
- if (returnValue.supportParentChildRelation && uiStack.Count > 0 && !returnValue.isMainUI)
- {
- // 鑾峰彇鏍堥《UI
- parentUI = GetLastSupportParentChildRelationUI();
- }
-
- // 璁剧疆鐖剁骇UI
- if (parentUI != null)
- {
- // 璁剧疆鐖跺瓙鍏崇郴
- returnValue.parentUI = parentUI;
- if (parentUI.childrenUI == null)
- {
- // 鍒濆鍖栫埗绾I鐨勫瓙UI鍒楄〃
- parentUI.childrenUI = new List<UIBase>();
- }
- // 娣诲姞鍒扮埗绾I鐨勫瓙UI鍒楄〃
- parentUI.childrenUI.Add(returnValue);
- }
-
- // 鏇存柊鍥炲悎鏁�
- currentRound++;
- // 璁剧疆UI鐨勬渶鍚庝娇鐢ㄥ洖鍚堟暟
- returnValue.lastUsedRound = currentRound;
- // 鏇存柊鐖剁骇UI鐨勫洖鍚堟暟
- UpdateParentUIRounds(returnValue);
-
- // 灏哢I娣诲姞鍒板瓧鍏镐腑
- if (!uiDict.ContainsKey(uiName))
- {
- // 濡傛灉瀛楀吀涓笉瀛樺湪璇ョ被鍨嬬殑UI锛屽垱寤烘柊鍒楄〃
- uiDict[uiName] = new List<UIBase>();
- }
- // 娣诲姞鍒癠I鍒楄〃
- uiDict[uiName].Add(returnValue);
-
-#if UNITY_EDITOR
- if (uiDict[uiName].Count > 5)
- {
- Debug.LogError("宸叉墦寮�" + uiDict[uiName].Count + "涓晫闈�:" + uiName);
- }
-#endif
-
- // 灏哢I娣诲姞鍒版爤涓�
- uiStack.Push(returnValue);
-
- // 鏇存柊UI鎺掑簭椤哄簭
- UpdateUISortingOrder();
-
- // 鎵撳紑UI
- returnValue.functionOrder = functionOrder;
- returnValue.HandleOpen();
-
- OnOpenWindow?.Invoke(returnValue);
-
- // 妫�鏌ュ苟鍏抽棴闀挎椂闂存湭浣跨敤鐨刄I
- CheckAndCloseIdleUI();
-
- return returnValue;
- }
-
- /// <summary>
- /// 鎵撳紑UI
- /// </summary>
- public T OpenWindow<T>(int functionOrder = 0) where T : UIBase
- {
- if (typeof(T).Name == "MainWin")
- {
- //MainWin 姣旇緝鍏抽敭涓斿敮涓�锛屽仛瀹夊叏闃茶寖
- var ui = GetUI<MainWin>();
- if (ui != null)
- {
- ui.ClickFunc(0);
- return ui as T;
- }
- }
- // 鑾峰彇UI绫诲瀷鍚嶇О
- string uiName = typeof(T).Name;
- return OpenWindow(uiName, functionOrder) as T;
- }
-
/// <summary>
/// 鍏抽棴UI
/// </summary>
diff --git a/Main/ResModule/UILoader.cs b/Main/ResModule/UILoader.cs
index 71b3ab3..7cb52fa 100644
--- a/Main/ResModule/UILoader.cs
+++ b/Main/ResModule/UILoader.cs
@@ -31,12 +31,10 @@
public static async UniTask LoadSprite(string directory, string name, Image image, string failureName)
{
var sprite = await LoadSpriteAsync(directory, name);
+ if (image == null) return;
if (sprite != null)
{
- if (image != null)
- {
- image.overrideSprite = sprite;
- }
+ image.overrideSprite = sprite;
}
else
{
@@ -80,9 +78,10 @@
StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/" + iconConfig.folder), iconConfig.sprite, ct: ct);
}
- public static UniTask<Texture2D> LoadTexture2DPNGAsync(string name, CancellationToken ct = default)
+ public static async UniTask<Texture2D> LoadTexture2DPNGAsync(string name, CancellationToken ct = default)
{
- return ResManager.Instance.LoadAssetAsync<Texture2D>(
- StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/FullScreenBg"), name + ".png", false, ct);
+ var path = StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/FullScreenBg");
+ var result = await ResManager.Instance.LoadAssetAsync<Texture2D>(path, name + ".png", false, ct);
+ return result;
}
}
diff --git a/Main/SDK/SDKUtils.cs b/Main/SDK/SDKUtils.cs
index 218b2ec..b43896b 100644
--- a/Main/SDK/SDKUtils.cs
+++ b/Main/SDK/SDKUtils.cs
@@ -426,7 +426,7 @@
}
#elif UNITY_IOS
AotSdkUtility.IOSUniyMessageHandle(json.ToJson());
-#elif UNITY_STANDALONE
+#elif UNITY_STANDALONE || UNITY_WEBGL
InitFinished=true;
#endif
@@ -640,7 +640,11 @@
// else
{
//榛樿閮芥槸閫�鍑烘父鎴�
+#if UNITY_WEBGL
+ Application.OpenURL("about:blank");
+#else
Application.Quit();
+#endif
}
break;
case CodeA2U.GetAdAward:
diff --git a/Main/System/Arena/ArenaChallengeCell.cs b/Main/System/Arena/ArenaChallengeCell.cs
index 01f3435..85788b7 100644
--- a/Main/System/Arena/ArenaChallengeCell.cs
+++ b/Main/System/Arena/ArenaChallengeCell.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class ArenaChallengeCell : MonoBehaviour
@@ -45,7 +46,7 @@
txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaMatchInfo.FightPower);
txtAddScore.text = Language.Get("Arena16", ArenaManager.Instance.GetChallengePoints(index));
- officialTitleCell.InitUI(arenaMatchInfo.RealmLV, (int)arenaMatchInfo.TitleID, 0.55f);
+ officialTitleCell.InitUI(arenaMatchInfo.RealmLV, (int)arenaMatchInfo.TitleID, 0.55f).Forget();
int[][] rewards = ArenaManager.Instance.fixedChallengeRewards;
for (int i = 0; i < itemCells.Count; i++)
diff --git a/Main/System/Arena/ArenaPlayerRankCell.cs b/Main/System/Arena/ArenaPlayerRankCell.cs
index 1c65ba4..71aad77 100644
--- a/Main/System/Arena/ArenaPlayerRankCell.cs
+++ b/Main/System/Arena/ArenaPlayerRankCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -32,7 +33,7 @@
rankText.text = Language.Get("L1045");
rankValueText.text = ArenaManager.Instance.score.ToString();
nameText.text = PlayerDatas.Instance.baseData.PlayerName;
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
return;
}
rank = rankData.rank;
@@ -48,7 +49,7 @@
{
viewPlayerId = (int)rankData.id;
officialTitleCell.SetActive(true);
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
avatarCell.SetActive(true);
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
avatarCell.SetOnLoaded(() =>
diff --git a/Main/System/Arena/ArenaPlayerTop3Cell.cs b/Main/System/Arena/ArenaPlayerTop3Cell.cs
index 9e9e306..842cf2b 100644
--- a/Main/System/Arena/ArenaPlayerTop3Cell.cs
+++ b/Main/System/Arena/ArenaPlayerTop3Cell.cs
@@ -24,7 +24,7 @@
officialTitleCell.SetActive(true);
rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue));
nameText.text = rankData.name1;
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 1).Forget();
queryPlayerBtn.SetListener(() =>
{
diff --git a/Main/System/Arena/ArenaRecordCell.cs b/Main/System/Arena/ArenaRecordCell.cs
index 3e1f4dc..4c6714b 100644
--- a/Main/System/Arena/ArenaRecordCell.cs
+++ b/Main/System/Arena/ArenaRecordCell.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using System;
@@ -74,7 +75,7 @@
});
txtName.text = arenaGameRec.Name;
txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaGameRec.FightPower);
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 0.55f);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 0.55f).Forget();
imgMoneyIcon.SetIconWithMoneyType(ArenaManager.Instance.ChallengeMoneyType);
txtNeedCount.text = ArenaManager.Instance.NeedChallengeMoneyCnt.ToString();
}
diff --git a/Main/System/AssetVersion/AssetVersion.cs b/Main/System/AssetVersion/AssetVersion.cs
index 0a34c54..84c1b7f 100644
--- a/Main/System/AssetVersion/AssetVersion.cs
+++ b/Main/System/AssetVersion/AssetVersion.cs
@@ -81,6 +81,10 @@
public bool CheckLocalFileValid(bool _completeFile)
{
+#if UNITY_WEBGL
+ // WebGL鏃犳湰鍦版枃浠剁郴缁燂紝璧勬簮鐢盰ooAsset WebPlayMode绠$悊
+ return true;
+#else
if (_completeFile)
{
var path = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, m_RelativePath);
@@ -139,6 +143,7 @@
}
return true;
+#endif
}
// 妫�鏌ュ閮ㄥ瓨鍌ㄦ枃浠舵槸鍚﹀瓨鍦�
@@ -148,6 +153,29 @@
{
string path = string.Concat(ResourcesPath.Instance.ExternalStorePath, m_RelativePath);
+#if UNITY_WEBGL
+ // WebGL鏃犳湰鍦版枃浠剁郴缁燂紝鐩存帴璧版祦寮忓姞杞借矾寰�
+ if (!m_RelativePath.Contains(".txt"))
+ {
+ if (otherAssetInfo == null || string.IsNullOrEmpty(otherAssetInfo.relativePath))
+ return false;
+
+ if (otherAssetInfo.size != size)
+ {
+ Debug.LogFormat("StreamingAssetPath 鏂囦欢澶у皬涓嶅{0}-{1}", size, otherAssetInfo.size);
+ return false;
+ }
+
+ if (otherAssetInfo.md5 != md5)
+ {
+ Debug.LogFormat("StreamingAssetPath 鏂囦欢md5涓嶅{0}-{1}", md5, otherAssetInfo.md5);
+ return false;
+ }
+
+ return true;
+ }
+ return true;
+#else
if (!File.Exists(path) && !m_RelativePath.Contains(".txt"))
{
//Debug.LogFormat("杞煡StreamingAssetPath - 鏂囦欢涓嶅瓨鍦� {0} ", path);
@@ -170,7 +198,7 @@
}
return CheckLocalFileValid(false);
-
+#endif
}
diff --git a/Main/System/AssetVersion/AssetVersionUtility.cs b/Main/System/AssetVersion/AssetVersionUtility.cs
index d46bce3..d4a0d95 100644
--- a/Main/System/AssetVersion/AssetVersionUtility.cs
+++ b/Main/System/AssetVersion/AssetVersionUtility.cs
@@ -394,11 +394,12 @@
if (reverse)
_assetKey = EncodeFileName(_assetKey);
var path = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, _assetKey);
+#if !UNITY_WEBGL
if (!File.Exists(path))
{
path = StringUtility.Concat(ResourcesPath.Instance.StreamingAssetPath, _assetKey);
}
-
+#endif
return path;
}
@@ -407,11 +408,12 @@
if (reverse)
_assetKey = EncodeFileName(_assetKey);
var path = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, _assetKey);
+#if !UNITY_WEBGL
if (!File.Exists(path))
{
path = StringUtility.Concat(ResourcesPath.Instance.StreamingAssetPath, _assetKey);
}
-
+#endif
return path;
}
diff --git a/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs b/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
index 8d0be2a..d42ea66 100644
--- a/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
+++ b/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
@@ -45,6 +45,15 @@
public void Prepare(List<AssetVersion> _downLoadTasks, Action _downLoadOkCallBack)
{
+#if UNITY_WEBGL
+ // WebGL 涓嬫枃浠朵笅杞界敱 YooAsset WebPlayMode 澶勭悊锛岃烦杩囨棫鐨勬枃浠朵笅杞芥祦绋�
+ Debug.Log("[DownLoadAndDiscompressHotTask] WebGL 骞冲彴璺宠繃鏂囦欢涓嬭浇锛孻ooAsset 璐熻矗璧勬簮鍔犺浇");
+ foreach (var asset in _downLoadTasks)
+ asset.localValid = true;
+ step = Step.Completed;
+ _downLoadOkCallBack?.Invoke();
+ return;
+#endif
tasks = _downLoadTasks;
downLoadOkCallBack = _downLoadOkCallBack;
diff --git a/Main/System/AssetVersion/DownLoadWin.cs b/Main/System/AssetVersion/DownLoadWin.cs
index 1fe58f3..c15bd51 100644
--- a/Main/System/AssetVersion/DownLoadWin.cs
+++ b/Main/System/AssetVersion/DownLoadWin.cs
@@ -142,7 +142,11 @@
private void Cancel()
{
+#if UNITY_WEBGL
+ Application.OpenURL("about:blank");
+#else
Application.Quit();
+#endif
}
}
diff --git a/Main/System/AssetVersion/DownloadHotMgr.cs b/Main/System/AssetVersion/DownloadHotMgr.cs
index 98221dd..497331e 100644
--- a/Main/System/AssetVersion/DownloadHotMgr.cs
+++ b/Main/System/AssetVersion/DownloadHotMgr.cs
@@ -223,10 +223,26 @@
public string SpeedFormat { get { return StringUtility.FormatSpeed(downloadedSpeed); } }
//鏈湴鏂囦欢澶у皬
- public long LocalLength { get { return (File.Exists(tempFile)) ? (new FileInfo(tempFile)).Length : 0L; } }
+ public long LocalLength {
+ get {
+#if UNITY_WEBGL
+ return 0L;
+#else
+ return (File.Exists(tempFile)) ? (new FileInfo(tempFile)).Length : 0L;
+#endif
+ }
+ }
//鏈湴鏂囦欢鏈�鍚庝慨鏀规椂闂�
- private System.DateTime LocalLastModified { get { return File.Exists(tempFile) ? File.GetLastWriteTime(tempFile) : DateTime.MinValue; } }
+ private System.DateTime LocalLastModified {
+ get {
+#if UNITY_WEBGL
+ return DateTime.MinValue;
+#else
+ return File.Exists(tempFile) ? File.GetLastWriteTime(tempFile) : DateTime.MinValue;
+#endif
+ }
+ }
public bool IsWorking { get { return state == TaskState.Working; } }
public bool IsDone { get { return state == TaskState.Succeed; } }
@@ -250,9 +266,13 @@
private bool IsOutdated //鏈湴鏂囦欢鏄惁宸茶繃鏃�
{
get {
+#if UNITY_WEBGL
+ return false;
+#else
if (File.Exists(tempFile))
return remoteLastModified > LocalLastModified;
return false;
+#endif
}
}
@@ -279,15 +299,19 @@
public bool BeginDownload(Action<DownloadHotTask> onCompleted)
{
- if ((IsWorking && requestHeaderOk) || IsDone)//宸茬粡鍦ㄤ笅杞戒换鍔′腑鎴栧凡缁忎笅杞藉畬鎴愪簡
+#if UNITY_WEBGL
+ Debug.LogWarning("DownloadHotTask: 鏂囦欢涓嬭浇鍦╓ebGL涓婁笉鏀寔");
+ return false;
+#else
+ if ((IsWorking && requestHeaderOk) || IsDone)
return false;
- if (state == TaskState.Wait)//绗竴娆″皾璇�
+ if (state == TaskState.Wait)
failedTimes = 0;
this.onCompleted = onCompleted;
this.isStop = false;
Co_DownloadFile().Forget();
- // SnxxzGame.Instance.StartCoroutine(Co_DownloadFile());
return true;
+#endif
}
//鍋滄涓嬭浇
@@ -450,8 +474,12 @@
private async UniTask Move(string sourceFile, string destFile)
{
-
- var copyState = 0;//澶嶅埗鏂囦欢鐘舵�侊紝0绛夊緟锛�1鎴愬姛锛�2澶辫触
+#if UNITY_WEBGL
+ SetFailed("WebGL涓嶆敮鎸佹枃浠舵搷浣�");
+ await UniTask.CompletedTask;
+ return;
+#else
+ var copyState = 0;
try
{
if (File.Exists(destFile))
@@ -474,6 +502,7 @@
SetFailed("涓存椂鏂囦欢鏀瑰悕鍑洪敊");
await UniTask.CompletedTask;
+#endif
}
}
diff --git a/Main/System/AssetVersion/InGameDownLoad.cs b/Main/System/AssetVersion/InGameDownLoad.cs
index 6fbdfeb..f4a1f92 100644
--- a/Main/System/AssetVersion/InGameDownLoad.cs
+++ b/Main/System/AssetVersion/InGameDownLoad.cs
@@ -136,6 +136,15 @@
//寮�濮嬪垎閰嶄换鍔�
public void AssignTasks(List<AssetVersion> assets, Action _onDownLoadOk)
{
+#if UNITY_WEBGL
+ // WebGL 涓嬫枃浠朵笅杞界敱 YooAsset WebPlayMode 澶勭悊锛岃烦杩囨棫鐨勬枃浠朵笅杞芥祦绋�
+ Debug.Log("[InGameDownLoad] WebGL 骞冲彴璺宠繃鏂囦欢涓嬭浇锛孻ooAsset 璐熻矗璧勬簮鍔犺浇");
+ foreach (var asset in assets)
+ asset.localValid = true;
+ state = State.Completed;
+ _onDownLoadOk?.Invoke();
+ return;
+#endif
this.inGameDownLoadAllow = false;
this.assets = assets;
diff --git a/Main/System/AssetVersion/InGameDownTestUtility.cs b/Main/System/AssetVersion/InGameDownTestUtility.cs
index caa503a..6d531cc 100644
--- a/Main/System/AssetVersion/InGameDownTestUtility.cs
+++ b/Main/System/AssetVersion/InGameDownTestUtility.cs
@@ -45,7 +45,9 @@
public static void ClearAssets()
{
+#if !UNITY_WEBGL
Directory.Delete(Application.persistentDataPath, true);
+#endif
LocalSave.DeleteKey("HasDownLoadFullAsset");
}
diff --git a/Main/System/Battle/BattleField/PriviewBattleField.cs b/Main/System/Battle/BattleField/PriviewBattleField.cs
index 5e496a9..8a0c613 100644
--- a/Main/System/Battle/BattleField/PriviewBattleField.cs
+++ b/Main/System/Battle/BattleField/PriviewBattleField.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using LitJson;
using System.Collections.Generic;
using System.Linq;
@@ -9,10 +10,10 @@
}
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
- base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
SetBattleMode(BattleMode.Record);
}
@@ -60,13 +61,14 @@
BattleManager.Instance.DistributeNextReportPackage(guid);
}
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
PreviewBattleWin fsBattleWin = UIManager.Instance.GetUI<PreviewBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<PreviewBattleWin>();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<PreviewBattleWin>();
}
+ if (fsBattleWin == null) return;
fsBattleWin.SetBattleField(this);
}
diff --git a/Main/System/Battle/BattleField/QYBattleField.cs b/Main/System/Battle/BattleField/QYBattleField.cs
index 23fd32b..1514dea 100644
--- a/Main/System/Battle/BattleField/QYBattleField.cs
+++ b/Main/System/Battle/BattleField/QYBattleField.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using System;
using LitJson;
using UnityEngine;
@@ -13,10 +14,10 @@
}
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
- base.Init(MapID, FuncLineID, _extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, _extendData, _redTeamList, _blueTeamList, turnMax);
SetBattleMode(BattleMode.Record);
}
@@ -65,7 +66,7 @@
{
UIManager.Instance.CloseWindow<QYBattleWin>();
QunyingManager.Instance.openQYWinNeedRoll = false;
- UIManager.Instance.OpenWindow<QYWin>();
+ UIManager.Instance.OpenWindowAsync<QYWin>().Forget();
}
}
@@ -90,13 +91,14 @@
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
QYBattleWin fsBattleWin = UIManager.Instance.GetUI<QYBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<QYBattleWin>();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<QYBattleWin>();
}
+ if (fsBattleWin == null) return;
fsBattleWin.SetBattleField(this);
if (UIManager.Instance.IsOpened<QYWin>())
{
diff --git a/Main/System/BillboardRank/PlayerRankCell.cs b/Main/System/BillboardRank/PlayerRankCell.cs
index a0ca0d4..c10d122 100644
--- a/Main/System/BillboardRank/PlayerRankCell.cs
+++ b/Main/System/BillboardRank/PlayerRankCell.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Wednesday, September 26, 2018
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -47,7 +48,7 @@
rankText.text = Language.Get("L1045");
rankValueText.text = "";//Language.Get("L1125");
nameText.text = PlayerDatas.Instance.baseData.PlayerName;
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
return;
}
rank = rankData.rank;
@@ -62,7 +63,7 @@
else
{
officialTitleCell.SetActive(true);
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
avatarCell.SetActive(true);
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
viewPlayerId = (int)rankData.id;
diff --git a/Main/System/BillboardRank/PlayerTop3Cell.cs b/Main/System/BillboardRank/PlayerTop3Cell.cs
index 0b7a7fb..43df966 100644
--- a/Main/System/BillboardRank/PlayerTop3Cell.cs
+++ b/Main/System/BillboardRank/PlayerTop3Cell.cs
@@ -44,7 +44,7 @@
rankValueText.text = RankModel.Instance.GetCmpValueStr(rankType, rankData.cmpValue);
}
nameText.text = rankData.name1;
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
{
diff --git a/Main/System/ChallengeTab/QunyingTabHandler.cs b/Main/System/ChallengeTab/QunyingTabHandler.cs
index 289f9c8..205d7cc 100644
--- a/Main/System/ChallengeTab/QunyingTabHandler.cs
+++ b/Main/System/ChallengeTab/QunyingTabHandler.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class QunyingTabHandler : BaseChallengeTabHandler
{
@@ -20,7 +21,7 @@
return HandleNavigation;
}
- private void HandleNavigation()
+ private async void HandleNavigation()
{
if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true))
return;
@@ -32,7 +33,7 @@
QYBattleWin battleWin;
if (!UIManager.Instance.IsOpened<QYBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindow<QYBattleWin>();
+ battleWin = await UIManager.Instance.OpenWindowAsync<QYBattleWin>();
}
else
{
@@ -43,7 +44,7 @@
else
{
QunyingManager.Instance.openQYWinNeedRoll = true;
- UIManager.Instance.OpenWindow<QYWin>();
+ UIManager.Instance.OpenWindowAsync<QYWin>().Forget();
}
}
diff --git a/Main/System/Chat/ChatPlayerMineCell.cs b/Main/System/Chat/ChatPlayerMineCell.cs
index fe5eb28..e72673f 100644
--- a/Main/System/Chat/ChatPlayerMineCell.cs
+++ b/Main/System/Chat/ChatPlayerMineCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class ChatPlayerMineCell : MonoBehaviour
@@ -24,7 +25,7 @@
PlayerDatas.Instance.baseData.face,
PlayerDatas.Instance.baseData.facePic));
- title.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ title.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
if (manager.nowChatTab == ChatChannel.World)
{
string serverName = ServerListCenter.Instance.GetServerName(UIHelper.GetServerIDByAccount(PlayerDatas.Instance.baseData.AccID));
diff --git a/Main/System/Chat/ChatPlayerOtherCell.cs b/Main/System/Chat/ChatPlayerOtherCell.cs
index f00372f..4a49d9e 100644
--- a/Main/System/Chat/ChatPlayerOtherCell.cs
+++ b/Main/System/Chat/ChatPlayerOtherCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -23,7 +24,7 @@
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)data.PlayerID, (int)data.Face, (int)data.FacePic, data.Job));
- title.InitUI(data.RealmLV, (int)data.TitleID);
+ title.InitUI(data.RealmLV, (int)data.TitleID).Forget();
int bubbleID = ChatBubbleHelper.GetOtherChatBubbleID(data.Job, (int)data.BubbleBox);
m_ChatBubble.DisplayBubble(bubbleID, (int)data.PlayerID);
diff --git a/Main/System/ClientVersion/RequestSecretWin.cs b/Main/System/ClientVersion/RequestSecretWin.cs
index 8610d00..84b74f8 100644
--- a/Main/System/ClientVersion/RequestSecretWin.cs
+++ b/Main/System/ClientVersion/RequestSecretWin.cs
@@ -26,6 +26,8 @@
CloseWindow();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
+#elif UNITY_WEBGL
+ Application.OpenURL("about:blank");
#else
Application.Quit();
#endif
diff --git a/Main/System/ClientVersion/VersionConfig.cs b/Main/System/ClientVersion/VersionConfig.cs
index c9f8c69..d4d949a 100644
--- a/Main/System/ClientVersion/VersionConfig.cs
+++ b/Main/System/ClientVersion/VersionConfig.cs
@@ -244,36 +244,10 @@
}
public static VersionConfig config = null;
- // public static VersionConfig Get()
- // {
- // if (config == null)
- // {
- // if (Application.isEditor)
- // {
- // config = Resources.Load<VersionConfig>("VersionConfig");
- // //debug鐧诲綍鍚庣浜屾鍚姩榛樿鎭㈠test
- // if (LocalSave.GetBool("RestoreTest"))
- // {
- // config.m_AppId = "test";
- // LocalSave.SetBool("RestoreTest", false);
- // Debug.Log("appid 鎭㈠test");
- // }
-
- // }
- // else
- // {
- // var text = Resources.Load<TextAsset>("VersionConfigEx");
- // if (text != null)
- // {
- // config = ScriptableObject.CreateInstance<VersionConfig>();
- // var json = JsonMapper.ToObject(text.text);
- // ReadJson(json); //閫愪竴瑙f瀽锛屼笉鐢╒ersionConfig绫荤粨鏋勮鍙栵紝鍥犱负鍙橀噺瀹氫箟鏄寜asset鐨勭粨鏋勫畾涔夌殑
- // }
- // }
- // }
-
- // return config;
- // }
+ public static VersionConfig Get()
+ {
+ return config;
+ }
public static void ReadJson(JsonData _data)
{
diff --git a/Main/System/ClientVersion/VersionUtility.cs b/Main/System/ClientVersion/VersionUtility.cs
index 664d822..433fe22 100644
--- a/Main/System/ClientVersion/VersionUtility.cs
+++ b/Main/System/ClientVersion/VersionUtility.cs
@@ -97,11 +97,13 @@
{
step = Step.Completed;
+#if !UNITY_WEBGL
var apkFiles = new DirectoryInfo(ResourcesPath.Instance.ExternalStorePath).GetFiles("*.apk");
for (int i = apkFiles.Length - 1; i >= 0; i--)
{
File.Delete(apkFiles[i].FullName);
}
+#endif
}
}
else
diff --git a/Main/System/Debug/DebugUtility.cs b/Main/System/Debug/DebugUtility.cs
index c66db29..67551b2 100644
--- a/Main/System/Debug/DebugUtility.cs
+++ b/Main/System/Debug/DebugUtility.cs
@@ -47,8 +47,12 @@
}
else
{
+#if !UNITY_WEBGL
var parentDirectory = Directory.GetParent(Application.persistentDataPath);
debugAccount = File.Exists(parentDirectory + "/Debug");
+#else
+ debugAccount = false;
+#endif
}
if (LocalSave.GetString("#@#BrancH") != string.Empty)
@@ -70,6 +74,7 @@
if (debugAccount)
{
+#if !UNITY_WEBGL
if (Application.isMobilePlatform)
{
var parentDirectory = Directory.GetParent(Application.persistentDataPath);
@@ -83,6 +88,7 @@
}
}
}
+#endif
}
}).Forget();
diff --git a/Main/System/FirstCharge/FirstChargeWin.cs b/Main/System/FirstCharge/FirstChargeWin.cs
index 41785ab..25097f2 100644
--- a/Main/System/FirstCharge/FirstChargeWin.cs
+++ b/Main/System/FirstCharge/FirstChargeWin.cs
@@ -106,7 +106,7 @@
private void OnClickPreviewHero()
{
HeroUIManager.Instance.selectForPreviewHeroID = model.mainItemId;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>().Forget();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
}
private void InitRedPoint()
{
@@ -208,7 +208,7 @@
txtDesc.text = heroInfo.heroConfig.Desc;
imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroInfo.heroConfig.Country));
imgJob.SetSprite(HeroUIManager.Instance.GetJobIconName(heroInfo.heroConfig.Class));
- roleLhModel.Create(heroInfo.SkinID, lhScale, motionName: "", isLh: true);
+ roleLhModel.Create(heroInfo.SkinID, lhScale, motionName: "", isLh: true).Forget();
roleLhModel.transform.localScale = new Vector3(lhScale, lhScale, lhScale);
}
diff --git a/Main/System/Guild/GuildApplyListCell.cs b/Main/System/Guild/GuildApplyListCell.cs
index b6a15de..b8b8f48 100644
--- a/Main/System/Guild/GuildApplyListCell.cs
+++ b/Main/System/Guild/GuildApplyListCell.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -23,7 +24,7 @@
lvText.text = data.LV.ToString();
fightPointText.text = UIHelper.ReplaceLargeArtNum(data.FightPower);
avatarCell.InitUI(AvatarHelper.GetAvatarModel(data.PlayerID, data.Face, data.FacePic));
- officialTitleCell.InitUI(data.RealmLV, data.TitleID);
+ officialTitleCell.InitUI(data.RealmLV, data.TitleID).Forget();
yesButton.SetListener(() =>
{
diff --git a/Main/System/Guild/GuildBossHurtRankCell.cs b/Main/System/Guild/GuildBossHurtRankCell.cs
index e631f92..7eb5763 100644
--- a/Main/System/Guild/GuildBossHurtRankCell.cs
+++ b/Main/System/Guild/GuildBossHurtRankCell.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Wednesday, September 26, 2018
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -52,7 +53,7 @@
AvatarHelper.TryViewOtherPlayerInfo(playerID);
});
});
- officialTitleCell.InitUI(playerData.RealmLV, playerData.TitleID);
+ officialTitleCell.InitUI(playerData.RealmLV, playerData.TitleID).Forget();
nameText.text = playerData.Name;
lvText.text = playerData.LV.ToString();
diff --git a/Main/System/Guild/GuildBossWin.cs b/Main/System/Guild/GuildBossWin.cs
index 45760a0..f1388b5 100644
--- a/Main/System/Guild/GuildBossWin.cs
+++ b/Main/System/Guild/GuildBossWin.cs
@@ -105,7 +105,7 @@
UIManager.Instance.OpenWindowAsync<GuildBossAwardWin>().Forget();
});
- bossModel.Create(GuildBossManager.Instance.bossSkinID, 1, motionName: "chuxian");
+ bossModel.Create(GuildBossManager.Instance.bossSkinID, 1, motionName: "chuxian").Forget();
}
diff --git a/Main/System/Guild/GuildDonateDetailCell.cs b/Main/System/Guild/GuildDonateDetailCell.cs
index ee5718e..bb1e656 100644
--- a/Main/System/Guild/GuildDonateDetailCell.cs
+++ b/Main/System/Guild/GuildDonateDetailCell.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -25,7 +26,7 @@
nameText.text = playerInfo.Name;
avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic));
- titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID);
+ titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID).Forget();
lvText.text = playerInfo.LV.ToString();
diff --git a/Main/System/Guild/GuildMemberCell.cs b/Main/System/Guild/GuildMemberCell.cs
index 05078b8..3497466 100644
--- a/Main/System/Guild/GuildMemberCell.cs
+++ b/Main/System/Guild/GuildMemberCell.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -32,7 +33,7 @@
nameText.text = playerInfo.Name;
avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic));
- titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID);
+ titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID).Forget();
lvText.text = playerInfo.LV.ToString();
if (playerInfo.FmLV > 0)
{
diff --git a/Main/System/Guild/GuildPreviewWin.cs b/Main/System/Guild/GuildPreviewWin.cs
index 3688d40..e302c71 100644
--- a/Main/System/Guild/GuildPreviewWin.cs
+++ b/Main/System/Guild/GuildPreviewWin.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -133,7 +134,7 @@
var leaderInfo = OtherPlayerDetailManager.Instance.GetViewPlayerData(playerID);
leaderAvatar.InitUI(AvatarHelper.GetAvatarModel(0, leaderInfo.Face, leaderInfo.FacePic));
- leaderTitle.InitUI(leaderInfo.RealmLV, leaderInfo.TitleID);
+ leaderTitle.InitUI(leaderInfo.RealmLV, leaderInfo.TitleID).Forget();
leaderLevelText.text = leaderInfo.LV.ToString();
guildJobText.text = RichTextMsgReplaceConfig.GetRichReplace("FAMILY", 3);
leaderFightPowerText.text = UIHelper.ReplaceLargeArtNum(leaderInfo.FightPower);
diff --git a/Main/System/HappyXB/HappyXBModel.cs b/Main/System/HappyXB/HappyXBModel.cs
index 3a1df6c..08a6291 100644
--- a/Main/System/HappyXB/HappyXBModel.cs
+++ b/Main/System/HappyXB/HappyXBModel.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
-using Cysharp.Threading.Tasks;
+using Cysharp.Threading.Tasks;
public partial class HappyXBModel : GameSystemManager<HappyXBModel>
@@ -189,7 +189,7 @@
{
if (!UIManager.Instance.IsOpened<HeroDebutCallResultWin>())
{
- UIManager.Instance.OpenWindow<HeroDebutCallResultWin>();
+ UIManager.Instance.OpenWindowAsync<HeroDebutCallResultWin>().Forget();
}
}
}
diff --git a/Main/System/HappyXB/HeroCallResultCell.cs b/Main/System/HappyXB/HeroCallResultCell.cs
index 96680e6..71d57ef 100644
--- a/Main/System/HappyXB/HeroCallResultCell.cs
+++ b/Main/System/HappyXB/HeroCallResultCell.cs
@@ -93,7 +93,7 @@
public void DisplayHero(HeroConfig heroConfig)
{
heroModel.SetActive(true);
- heroModel.Create(heroConfig.SkinIDList[0], 0.7f);
+ heroModel.Create(heroConfig.SkinIDList[0], 0.7f).Forget();
}
}
diff --git a/Main/System/HappyXB/HeroCallResultWin.cs b/Main/System/HappyXB/HeroCallResultWin.cs
index e9a7be4..021cef6 100644
--- a/Main/System/HappyXB/HeroCallResultWin.cs
+++ b/Main/System/HappyXB/HeroCallResultWin.cs
@@ -329,7 +329,7 @@
return;
}
var hero = HeroConfig.Get(heroID);
- roleLHModel.Create(hero.SkinIDList[0], 1, motionName: "", isLh: true);
+ roleLHModel.Create(hero.SkinIDList[0], 1, motionName: "", isLh: true).Forget();
qualityImg.SetSprite("HeroCallQuality" + hero.Quality);
newMarkLHImg.SetActive(HeroUIManager.Instance.IsNewHero(heroID));
showLHResultCell.Display(heroID, 0, true);
@@ -342,7 +342,7 @@
bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(hero.SkinIDList[0], hero.Country));
if (IsWishHero(heroID))
{
- UIManager.Instance.OpenWindow<HeroCallXYFinishWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallXYFinishWin>().Forget();
}
}
@@ -385,7 +385,7 @@
if (IsWishHero(heroID))
{
// 鎶藉埌浜嗗績鎰挎灏嗭紝鎵撳紑瀹屾垚鐗规晥鐣岄潰
- UIManager.Instance.OpenWindow<HeroCallXYFinishWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallXYFinishWin>().Forget();
break;
}
}
diff --git a/Main/System/Hero/UIHeroController.cs b/Main/System/Hero/UIHeroController.cs
index 687b490..fbf85d8 100644
--- a/Main/System/Hero/UIHeroController.cs
+++ b/Main/System/Hero/UIHeroController.cs
@@ -23,7 +23,8 @@
private const int MAX_CONCURRENT_LOADS = 4;
private static int currentLoadingCount = 0;
private static readonly object loadLock = new object();
- private static int initializationOrder = 0; // 鐢ㄤ簬鍒嗗抚寤惰繜鐨勫簭鍙�
+ private static int lastInitFrame = -1; // 涓婁竴娆℃墽琛孖nitialize鐨勫抚鍙凤紝鐢ㄤ簬纭繚姣忓抚鏈�澶�1娆�
+ private static GameObjectPoolManager.GameObjectPool cachedUIHeroPool; // 缂撳瓨UIHero棰勫埗浣撴睜
public Action onComplete;
public async UniTask Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false)
@@ -81,12 +82,10 @@
{
//鍥剧墖鏇挎崲
lhImg.SetTexture2DPNG(skinConfig.Tachie);
- lhImg.SetNativeSize();
if (skeletonGraphic != null)
{
skeletonGraphic.enabled = false;
}
- lhImg.enabled = true;
lhImg.raycastTarget = false;
return;
}
@@ -201,7 +200,9 @@
}
onComplete = _onComplete;
- pool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero"));
+ if (cachedUIHeroPool == null)
+ cachedUIHeroPool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero"));
+ pool = cachedUIHeroPool;
if (this == null) return;
if (!transform.gameObject.activeSelf)
@@ -251,6 +252,10 @@
}
skeletonGraphic.enabled = true;
+ // 娉ㄥ唽鍒癝pineUpdateManager锛屾壒閲忔洿鏂板噺灏戣法璇█璋冪敤寮�閿�
+ SpineUpdateManager.Instance.Register(skeletonGraphic);
+ // 涓嶅彲瑙佹椂瀹屽叏鍋滄鏇存柊锛屾粴鍔ㄥ垪琛ㄥ満鏅敹鐩婂緢澶�
+ skeletonGraphic.updateWhenInvisible = Spine.Unity.UpdateMode.Nothing;
SetMaterialNone();
spineAnimationState = skeletonGraphic.AnimationState;
@@ -262,7 +267,7 @@
spineAnimationState.Complete -= OnAnimationComplete;
spineAnimationState.Complete += OnAnimationComplete;
-#if UNITY_EIDTOR
+#if UNITY_EDITOR
await UniTask.Delay(100);
if (skeletonGraphic != null && skeletonGraphic.material != null)
{
@@ -292,6 +297,9 @@
{
spineAnimationState.Complete -= OnAnimationComplete;
}
+ // 浠嶴pineUpdateManager涓Щ闄�
+ if (skeletonGraphic != null)
+ SpineUpdateManager.Instance.Unregister(skeletonGraphic);
if (pool != null)
pool.Release(instanceGO);
skeletonGraphic = null;
@@ -452,7 +460,35 @@
Debug.LogWarning("skeletonGraphic is null, cannot set material to none");
return;
}
- skeletonGraphic.material = null;
+ skeletonGraphic.material = GetDefaultSpineMaterial();
+ }
+
+ /// <summary>
+ /// 鑾峰彇榛樿鐨� Spine 娓叉煋鏉愯川銆�
+ /// 瀵逛簬鍖呭惈闈� Normal 娣峰悎妯″紡锛圓dditive/Multiply/Screen锛夋彃妲界殑瑙掕壊锛�
+ /// 杩斿洖 atlas 鍘熷鏉愯川锛圔lend One OneMinusSrcAlpha锛夛紝淇濊瘉 PMA 娣峰悎姝g‘锛�
+ /// 瀵逛簬鏅�氳鑹诧紝杩斿洖 null锛堜娇鐢� Canvas 榛樿鏉愯川锛岃涓轰笉鍙橈級銆�
+ /// </summary>
+ private Material GetDefaultSpineMaterial()
+ {
+ if (skeletonGraphic == null || skeletonGraphic.Skeleton == null)
+ return null;
+
+ var slotsData = skeletonGraphic.Skeleton.Data.Slots;
+ for (int i = 0; i < slotsData.Count; i++)
+ {
+ if (slotsData.Items[i].BlendMode != Spine.BlendMode.Normal)
+ {
+ // 瀛樺湪闈� Normal 娣峰悎妯″紡鐨勬彃妲斤紝蹇呴』浣跨敤 Spine 鏉愯川
+ // Canvas 榛樿鏉愯川鐨� Blend SrcAlpha OneMinusSrcAlpha 浼氬鑷�
+ // PMA Additive 鏁堟灉锛坴ertex alpha=0锛夊畬鍏ㄦ秷澶�
+ var dataAsset = skeletonGraphic.skeletonDataAsset;
+ if (dataAsset != null && dataAsset.atlasAssets.Length > 0)
+ return dataAsset.atlasAssets[0].PrimaryMaterial;
+ break;
+ }
+ }
+ return null;
}
/// <summary>
@@ -475,30 +511,16 @@
// 寮傛鍒涘缓instanceGO鍜屽姞杞借祫婧愶紙鐪熸鐨勫紓姝ワ紝涓嶉樆濉烇級
await CreateInstanceAndLoadAssetsAsync(skinConfig, isLh, cancellationToken);
- // 鑾峰彇褰撳墠搴忓彿鐢ㄤ簬鍒嗗抚寤惰繜
- int myOrder;
- lock (loadLock)
- {
- myOrder = initializationOrder++;
- }
-
// 鍐嶆妫�鏌ユ槸鍚﹀凡琚彇娑�
cancellationToken.ThrowIfCancellationRequested();
- // 鍦� skeletonGraphic.Initialize() 鍓嶈繘琛屽垎甯у欢杩�
- // 鏍规嵁 MAX_CONCURRENT_LOADS 璋冩暣寤惰繜锛岄伩鍏嶆墍鏈夊璞″悓鏃舵墽琛� Initialize
- int delayFrames = (myOrder % MAX_CONCURRENT_LOADS);
- if (delayFrames > 0)
+ // 纭繚姣忓抚鏈�澶氭墽琛�1娆nitialize(true)锛岄伩鍏嶅悓甯уぇ閲忛楠艰В鏋愬鑷村崱椤�
+ while (Time.frameCount == lastInitFrame)
{
- for (int i = 0; i < delayFrames; i++)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await UniTask.NextFrame(cancellationToken);
- }
+ cancellationToken.ThrowIfCancellationRequested();
+ await UniTask.NextFrame(cancellationToken);
}
-
- // 鍐嶆妫�鏌ユ槸鍚﹀凡琚彇娑堬紙鍙兘鍦ㄥ欢杩熸湡闂磋鍙栨秷锛�
- cancellationToken.ThrowIfCancellationRequested();
+ lastInitFrame = Time.frameCount;
if (skeletonGraphic == null || skeletonGraphic.skeletonDataAsset == null)
{
@@ -508,6 +530,7 @@
skeletonGraphic.initialSkinName = skinConfig.InitialSkinName;
skeletonGraphic.Initialize(true);
+ Debug.Log($"[UIHeroController] Spine Initialize瀹屾垚, skeleton valid: {skeletonGraphic.IsValid}, enabled: {skeletonGraphic.enabled}");
// 鍒濆鍖栧畬鎴愬悗璁剧疆鐨偆
if (!string.IsNullOrEmpty(skinConfig.InitialSkinName))
@@ -524,13 +547,18 @@
// 鍒濆鍖栧畬鎴愬悗鎵嶆樉绀烘ā鍨�
skeletonGraphic.enabled = pendingEnabled;
+ // 娉ㄥ唽鍒癝pineUpdateManager锛屾壒閲忔洿鏂板噺灏戣法璇█璋冪敤寮�閿�
+ SpineUpdateManager.Instance.Register(skeletonGraphic);
+ // 涓嶅彲瑙佹椂瀹屽叏鍋滄鏇存柊锛屾粴鍔ㄥ垪琛ㄥ満鏅敹鐩婂緢澶�
+ skeletonGraphic.updateWhenInvisible = Spine.Unity.UpdateMode.Nothing;
+
if (pendingGray)
{
skeletonGraphic.material = MaterialUtility.GetDefaultSpriteGrayMaterial();
}
else
{
- skeletonGraphic.material = null;
+ skeletonGraphic.material = GetDefaultSpineMaterial();
}
// 妫�鏌ユ槸鍚︽湁寰呰缃殑閫熷害锛屽鏋滄湁鍒欒缃�
@@ -573,7 +601,7 @@
}
catch (System.Exception e)
{
- Debug.LogError($"鑻遍泟鍒濆鍖栧紓甯�: {e.Message}");
+ Debug.LogError($"鑻遍泟鍒濆鍖栧紓甯�: {e.Message}\n{e.StackTrace}");
isInitializing = false;
}
finally
@@ -633,8 +661,10 @@
// 妫�鏌ユ槸鍚﹀凡琚彇娑�
cancellationToken.ThrowIfCancellationRequested();
- // 鍒涘缓pool鍜宨nstanceGO
- pool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("UIHero"));
+ // 鍒涘缓pool鍜宨nstanceGO锛堜娇鐢ㄧ紦瀛橀伩鍏嶉噸澶嶅姞杞介鍒朵綋锛�
+ if (cachedUIHeroPool == null)
+ cachedUIHeroPool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero"));
+ pool = cachedUIHeroPool;
if (instanceGO == null)
{
@@ -650,6 +680,7 @@
// 鐪熸鐨勫紓姝ュ姞杞借祫婧� - 涓嶉樆濉炰富绾跨▼
string assetName = isLh ? skinConfig.Tachie : skinConfig.SpineRes;
+ Debug.Log($"[UIHeroController] 寮�濮嬪姞杞絪pine 璧勬簮: {assetName}");
SkeletonDataAsset loadedAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("Hero/SpineRes/", assetName);
// 鍐嶆妫�鏌ユ槸鍚﹀凡琚彇娑�
@@ -658,6 +689,7 @@
if (loadedAsset != null)
{
skeletonGraphic.skeletonDataAsset = loadedAsset;
+ Debug.Log($"[UIHeroController] Spine璧勬簮鍔犺浇鎴愬姛: {assetName}, atlas count: {loadedAsset.atlasAssets?.Length}");
}
else
{
diff --git a/Main/System/HeroDebut/HeroDebutCallChangeWin.cs b/Main/System/HeroDebut/HeroDebutCallChangeWin.cs
index 23a91f1..df900f9 100644
--- a/Main/System/HeroDebut/HeroDebutCallChangeWin.cs
+++ b/Main/System/HeroDebut/HeroDebutCallChangeWin.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HeroDebutCallChangeWin : UIBase
@@ -33,7 +34,7 @@
previewButton.SetListener(() =>
{
HeroUIManager.Instance.selectForPreviewHeroID = manager.nowCallChooseHeroID;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
});
}
@@ -95,6 +96,6 @@
var skinConfig = HeroSkinConfig.Get(skinID);
if (skinConfig == null) return;
- uiHeroController.Create(skinID, 1);
+ uiHeroController.Create(skinID, 1).Forget();
}
}
diff --git a/Main/System/HeroDebut/HeroDebutCallRateItem.cs b/Main/System/HeroDebut/HeroDebutCallRateItem.cs
index a1017b8..9c81931 100644
--- a/Main/System/HeroDebut/HeroDebutCallRateItem.cs
+++ b/Main/System/HeroDebut/HeroDebutCallRateItem.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -62,7 +63,7 @@
HeroDebutCallRateHeroWin.worldPos = libButton.transform.position;
HeroDebutCallRateHeroWin.dataList = GetLibItemList(libID, list);
HeroDebutCallRateHeroWin.isDownShow = true;
- UIManager.Instance.OpenWindow<HeroDebutCallRateHeroWin>();
+ UIManager.Instance.OpenWindowAsync<HeroDebutCallRateHeroWin>().Forget();
});
}
}
diff --git a/Main/System/HeroDebut/HeroDebutCallResultWin.cs b/Main/System/HeroDebut/HeroDebutCallResultWin.cs
index 8217162..5306fcf 100644
--- a/Main/System/HeroDebut/HeroDebutCallResultWin.cs
+++ b/Main/System/HeroDebut/HeroDebutCallResultWin.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using DG.Tweening;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class HeroDebutCallResultWin : UIBase
{
@@ -335,7 +336,7 @@
if (!UIManager.Instance.IsOpenedInList<HeroShowLHWin>())
{
- UIManager.Instance.OpenWindow<HeroShowLHWin>();
+ UIManager.Instance.OpenWindowAsync<HeroShowLHWin>().Forget();
}
}
}
diff --git a/Main/System/HeroDebut/HeroDebutCallWin.cs b/Main/System/HeroDebut/HeroDebutCallWin.cs
index f988de6..cd6e004 100644
--- a/Main/System/HeroDebut/HeroDebutCallWin.cs
+++ b/Main/System/HeroDebut/HeroDebutCallWin.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
@@ -51,12 +52,12 @@
protected override void InitComponent()
{
closeButton.SetListener(CloseWindow);
- shopButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutShopWin>());
- giftButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutGiftWin>());
- changeHeroButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallChangeWin>());
- rankButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutRankWin>());
- rateButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallRateWin>());
- historyButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallHistoryWin>());
+ shopButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutShopWin>().Forget());
+ giftButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutGiftWin>().Forget());
+ changeHeroButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallChangeWin>().Forget());
+ rankButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutRankWin>().Forget());
+ rateButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallRateWin>().Forget());
+ historyButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallHistoryWin>().Forget());
previewButton.SetListener(OnClickPreview);
skipToggle.AddListener((value) =>
{
@@ -216,7 +217,7 @@
{
if (heroConfig == null) return;
HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
}
OperationHeroAppearInfo act;
ActHeroAppearConfig config;
@@ -251,8 +252,8 @@
bgImage.SetSprite(artConfig.MainBgImage);
- lhController.Create(skinID, 1, motionName: "", isLh: true);
- uiHeroController.Create(skinID, modleSize);
+ lhController.Create(skinID, 1, motionName: "", isLh: true).Forget();
+ uiHeroController.Create(skinID, modleSize).Forget();
uiHeroController.transform.localScale = new Vector3(modleSize, modleSize, modleSize);
ownItemCell.itemID = treasureSetConfig.CostItemID;
diff --git a/Main/System/HeroDebut/HeroDebutCell.cs b/Main/System/HeroDebut/HeroDebutCell.cs
index cd64d51..b6c858d 100644
--- a/Main/System/HeroDebut/HeroDebutCell.cs
+++ b/Main/System/HeroDebut/HeroDebutCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HeroDebutCell : MonoBehaviour
{
@@ -10,7 +11,7 @@
{
clickButton.SetListener(() =>
{
- UIManager.Instance.OpenWindow<HeroDebutWin>();
+ UIManager.Instance.OpenWindowAsync<HeroDebutWin>().Forget();
});
diff --git a/Main/System/HeroDebut/HeroDebutCheckInWin.cs b/Main/System/HeroDebut/HeroDebutCheckInWin.cs
index 251d4c9..bac6528 100644
--- a/Main/System/HeroDebut/HeroDebutCheckInWin.cs
+++ b/Main/System/HeroDebut/HeroDebutCheckInWin.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HeroDebutCheckInWin : UIBase
@@ -76,7 +77,7 @@
}
}
- rolelhShow.Create(skinID, 1, motionName: "", isLh: true);
+ rolelhShow.Create(skinID, 1, motionName: "", isLh: true).Forget();
OnSecondEvent();
}
}
\ No newline at end of file
diff --git a/Main/System/HeroDebut/HeroDebutGiftCell.cs b/Main/System/HeroDebut/HeroDebutGiftCell.cs
index 868083c..49a6767 100644
--- a/Main/System/HeroDebut/HeroDebutGiftCell.cs
+++ b/Main/System/HeroDebut/HeroDebutGiftCell.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HeroDebutGiftCell : MonoBehaviour
@@ -78,13 +79,13 @@
if (config.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto5");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
if (config.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto7");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
RechargeManager.Instance.CTG(ctgId);
diff --git a/Main/System/HeroDebut/HeroDebutManager.cs b/Main/System/HeroDebut/HeroDebutManager.cs
index d966740..dd02e5e 100644
--- a/Main/System/HeroDebut/HeroDebutManager.cs
+++ b/Main/System/HeroDebut/HeroDebutManager.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using LitJson;
using UnityEngine;
@@ -159,14 +160,7 @@
public void SetHeroSquareIcon(ImageEx image, string name)
{
- var sprite = UILoader.LoadSprite("HeroHead", name);
- if (sprite != null)
- {
- image.overrideSprite = sprite;
- return;
- }
-
- image.SetSprite("herohead_default");
+ UILoader.LoadSprite("HeroHead", name, image, "herohead_default").Forget();
}
public void GetActTimeStr(TextEx timeText, string key = "TimeRush05")
diff --git a/Main/System/HeroDebut/HeroDebutPopWin.cs b/Main/System/HeroDebut/HeroDebutPopWin.cs
index dc25cdf..ee36891 100644
--- a/Main/System/HeroDebut/HeroDebutPopWin.cs
+++ b/Main/System/HeroDebut/HeroDebutPopWin.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -24,7 +25,7 @@
{
UIManager.Instance.CloseWindow<HeroDebutPopWin>();
if (!UIManager.Instance.IsOpened<HeroDebutWin>())
- UIManager.Instance.OpenWindow<HeroDebutWin>();
+ UIManager.Instance.OpenWindowAsync<HeroDebutWin>().Forget();
});
todayPopToggle.AddListener((bool value) =>
{
@@ -89,7 +90,7 @@
infoText.text = artConfig.PopInfoText;
infoText.color = manager.ParseColor32(artConfig.PopInfoColor);
- rolelhShow.Create(skinID, 1, motionName: "", isLh: true);
+ rolelhShow.Create(skinID, 1, motionName: "", isLh: true).Forget();
OnSecondEvent();
}
diff --git a/Main/System/HeroDebut/HeroDebutRankCell.cs b/Main/System/HeroDebut/HeroDebutRankCell.cs
index 3c9a4ea..c488590 100644
--- a/Main/System/HeroDebut/HeroDebutRankCell.cs
+++ b/Main/System/HeroDebut/HeroDebutRankCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -41,7 +42,7 @@
rankText.text = Language.Get("L1045");
rankValueText.text = awardConfig == null || awardConfig.NeedValue == 0 ? "0" : Language.Get("HeroDebut27", awardConfig.NeedValue);
nameText.text = PlayerDatas.Instance.baseData.PlayerName;
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
return;
}
rank = rankData.rank;
@@ -56,7 +57,7 @@
else
{
officialTitleCell.SetActive(true);
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
avatarCell.SetActive(true);
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
viewPlayerId = (int)rankData.id;
diff --git a/Main/System/HeroDebut/HeroDebutRankTop3Cell.cs b/Main/System/HeroDebut/HeroDebutRankTop3Cell.cs
index 11b71d9..d5ccd8b 100644
--- a/Main/System/HeroDebut/HeroDebutRankTop3Cell.cs
+++ b/Main/System/HeroDebut/HeroDebutRankTop3Cell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -34,9 +35,9 @@
officialTitleCell.SetActive(true);
rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue));
nameText.text = rankData.name1;
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
model.SetActive(true);
- model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f);
+ model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
{
AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id);
diff --git a/Main/System/HeroDebut/HeroDebutShopCell.cs b/Main/System/HeroDebut/HeroDebutShopCell.cs
index 5a5a9a3..c24e798 100644
--- a/Main/System/HeroDebut/HeroDebutShopCell.cs
+++ b/Main/System/HeroDebut/HeroDebutShopCell.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing Cysharp.Threading.Tasks;
+using UnityEngine;
using UnityEngine.UI;
public class HeroDebutShopCell : MonoBehaviour
@@ -128,7 +129,7 @@
else
{
StoreModel.Instance.buyShopID = shopID;
- UIManager.Instance.OpenWindow<BuyItemWin>();
+ UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
}
}
}
diff --git a/Main/System/HeroDebut/HeroDebutSkinWin.cs b/Main/System/HeroDebut/HeroDebutSkinWin.cs
index 8fc2731..e29eff3 100644
--- a/Main/System/HeroDebut/HeroDebutSkinWin.cs
+++ b/Main/System/HeroDebut/HeroDebutSkinWin.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -32,7 +33,7 @@
int heroID = manager.GetHeroIDBySkinID(manager.currentChooseSkinID);
HeroUIManager.Instance.selectForPreviewHeroID = heroID;
HeroUIManager.Instance.selectSkinIndex = manager.GetSkinIndexInHeroConfig(heroID, manager.currentChooseSkinID);
- UIManager.Instance.OpenWindow<HeroBestBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>(1).Forget();
});
}
@@ -179,8 +180,8 @@
awardBgImage.SetSprite(skinArtConfig.AwardBGImage);
awardBgImage.SetNativeSize();
- uiHeroController.Create(skinID, modelScale);
- lhController.Create(skinID, 1, motionName: "", isLh: true);
+ uiHeroController.Create(skinID, modelScale).Forget();
+ lhController.Create(skinID, 1, motionName: "", isLh: true).Forget();
countryImage.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
OnSecondEvent();
diff --git a/Main/System/HeroDebut/HeroDebutStarUpWin.cs b/Main/System/HeroDebut/HeroDebutStarUpWin.cs
index 5c46d69..c43280e 100644
--- a/Main/System/HeroDebut/HeroDebutStarUpWin.cs
+++ b/Main/System/HeroDebut/HeroDebutStarUpWin.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HeroDebutStarUpWin : UIBase
@@ -16,14 +17,14 @@
goCallButton.SetListener(() =>
{
UIManager.Instance.CloseWindow<HeroDebutStarUpWin>();
- UIManager.Instance.OpenWindow<HeroDebutCallWin>();
+ UIManager.Instance.OpenWindowAsync<HeroDebutCallWin>().Forget();
});
goInfoButton.SetListener(() =>
{
if (heroConfig == null) return;
UIManager.Instance.CloseWindow<HeroDebutStarUpWin>();
HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
});
}
diff --git a/Main/System/HeroDebut/HeroDebutWin.cs b/Main/System/HeroDebut/HeroDebutWin.cs
index c9ddc46..e82e4fd 100644
--- a/Main/System/HeroDebut/HeroDebutWin.cs
+++ b/Main/System/HeroDebut/HeroDebutWin.cs
@@ -1,4 +1,5 @@
using System;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -33,12 +34,12 @@
protected override void InitComponent()
{
closeButton.SetListener(() => UIManager.Instance.CloseWindow<HeroDebutWin>());
- checkInButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCheckInWin>());
- starUpButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutStarUpWin>());
- shopButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutShopWin>());
- skinButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutSkinWin>());
- giftButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutGiftWin>());
- callButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallWin>());
+ checkInButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCheckInWin>().Forget());
+ starUpButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutStarUpWin>().Forget());
+ shopButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutShopWin>().Forget());
+ skinButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutSkinWin>().Forget());
+ giftButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutGiftWin>().Forget());
+ callButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallWin>().Forget());
}
protected override void OnPreOpen()
@@ -92,9 +93,9 @@
var skinArtConfig = ActHeroAppearSkinArtConfig.Get(artConfig.MainSkinID);
if (skinArtConfig == null) return;
- uiHeroController.Create(skinID, modleSize);
+ uiHeroController.Create(skinID, modleSize).Forget();
uiHeroController.transform.localScale = new Vector3(-modleSize, modleSize, modleSize);
- lhController.Create(skinID, 1, motionName: "", isLh: true);
+ lhController.Create(skinID, 1, motionName: "", isLh: true).Forget();
callRedImage.SetActive(!manager.IsShopVisitedToday || manager.HasGiftCanHave());
diff --git a/Main/System/HeroFates/HeroFatesIHItem.cs b/Main/System/HeroFates/HeroFatesIHItem.cs
index a02655b..62e0430 100644
--- a/Main/System/HeroFates/HeroFatesIHItem.cs
+++ b/Main/System/HeroFates/HeroFatesIHItem.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -21,7 +22,7 @@
- uiHeroController.Create(heroSkinConfig.SkinID, lhSize);
+ uiHeroController.Create(heroSkinConfig.SkinID, lhSize).Forget();
bool isHasHero = HeroManager.Instance.HasHero(heroId);
if (isHasHero)
{
@@ -48,12 +49,12 @@
}
HeroInfo heroInfo = nowMaxStarHeroDict[heroId];
HeroUIManager.Instance.selectHeroGuid = heroInfo.itemHero.guid;
- UIManager.Instance.OpenWindow<HeroTrainBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroTrainBaseWin>().Forget();
}
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroId;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
}
});
}
diff --git a/Main/System/HeroUI/HeroBestBaseWin.cs b/Main/System/HeroUI/HeroBestBaseWin.cs
index aba3e7e..4dd372b 100644
--- a/Main/System/HeroUI/HeroBestBaseWin.cs
+++ b/Main/System/HeroUI/HeroBestBaseWin.cs
@@ -1,19 +1,20 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class HeroBestBaseWin : OneLevelWin
{
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
ShowSkinBtn();
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<HeroBestWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroBestWin>();
if (GetSortingOrder() < currentSubUI.GetSortingOrder())
{
@@ -23,7 +24,7 @@
case 1:
//鐨偆 鍥鹃壌鐣岄潰鎵撳紑鐨勪紶1
- currentSubUI = UIManager.Instance.OpenWindow<HeroSkinWin>(1);
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroSkinWin>(1);
if (GetSortingOrder() < currentSubUI.GetSortingOrder())
{
diff --git a/Main/System/HeroUI/HeroBestWin.cs b/Main/System/HeroUI/HeroBestWin.cs
index 3d7bd97..67e3ea7 100644
--- a/Main/System/HeroUI/HeroBestWin.cs
+++ b/Main/System/HeroUI/HeroBestWin.cs
@@ -137,8 +137,8 @@
heroConfig = HeroConfig.Get(HeroUIManager.Instance.selectForPreviewHeroID);
int skinID = heroConfig.SkinIDList[0];
bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(skinID, heroConfig.Country));
- roleLhModel.Create(skinID, 1, motionName: "", isLh: true);
- roleXsModel.Create(skinID, 1);
+ roleLhModel.Create(skinID, 1, motionName: "", isLh: true).Forget();
+ roleXsModel.Create(skinID, 1).Forget();
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
jobPosNameText.text = HeroUIManager.Instance.GetJobName(heroConfig.Class);
descText.text = heroConfig.Desc;
diff --git a/Main/System/HeroUI/HeroCardCell.cs b/Main/System/HeroUI/HeroCardCell.cs
index ad82c97..aece00f 100644
--- a/Main/System/HeroUI/HeroCardCell.cs
+++ b/Main/System/HeroUI/HeroCardCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
@@ -38,7 +39,7 @@
var heroConfig = hero.heroConfig;
countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
- heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale);
+ heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale).Forget();
onStateImg.SetActive(hero.IsInTeamByTeamType(BattlePreSetType.Story));
int teamPos = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetPosition(hero.itemHero.guid);
@@ -92,7 +93,7 @@
heroCardBtn.AddListener(() =>
{
HeroUIManager.Instance.selectHeroGuid = guid;
- UIManager.Instance.OpenWindow<HeroTrainBaseWin>(funcState == 3 ? 1 : 0);
+ UIManager.Instance.OpenWindowAsync<HeroTrainBaseWin>(funcState == 3 ? 1 : 0).Forget();
});
}
}
diff --git a/Main/System/HeroUI/HeroCollectionCardCell.cs b/Main/System/HeroUI/HeroCollectionCardCell.cs
index 5ea7b56..9466d7f 100644
--- a/Main/System/HeroUI/HeroCollectionCardCell.cs
+++ b/Main/System/HeroUI/HeroCollectionCardCell.cs
@@ -1,6 +1,8 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using System.Threading;
public class HeroCollectionCardCell : MonoBehaviour
{
@@ -17,6 +19,8 @@
[SerializeField] GameObject unGetObj;
[SerializeField] GameObject activeObj; // 鍙縺娲诲甫娴佸厜鏁堟灉鏉愯川
[SerializeField] GameObject actLimitObj; // 娲诲姩闄愬畾
+
+ private CancellationTokenSource displayCts;
public void Display(int index, int quality)
{
var heroID = HeroUIManager.Instance.heroCollectDict[quality][index];
@@ -38,7 +42,12 @@
countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
- heroModel.Create(heroConfig.SkinIDList[0], heroConfig.UIScale);
+
+ // 鍘绘姈鍔犺浇锛氬揩閫熸粴鍔ㄦ椂寤惰繜2甯у啀鍒涘缓Spine锛屽鏋滃崱鐗囧湪寤惰繜鍐呰澶嶇敤鍒欏彇娑堟棫鍔犺浇
+ displayCts?.Cancel();
+ displayCts?.Dispose();
+ displayCts = new CancellationTokenSource();
+ DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, displayCts.Token).Forget();
redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID;
@@ -64,12 +73,12 @@
var state = HeroUIManager.Instance.GetHeroBookState(heroID, quality);
if (state == 1 || state == 3 || state == 4)
{
- UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCollectionLvUpWin>().Forget();
}
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroID;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
}
});
@@ -79,5 +88,19 @@
// UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
// });
}
+
+ private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, CancellationToken ct)
+ {
+ // 寤惰繜2甯э紝蹇�熸粴鍔ㄦ椂鍗$墖浼氳澶嶇敤锛孋TS鍙栨秷鍚庝笉浼氱户缁垱寤篠pine
+ await UniTask.NextFrame(ct);
+ await UniTask.NextFrame(ct);
+ heroModel.Create(skinID, scale).Forget();
+ }
+
+ void OnDestroy()
+ {
+ displayCts?.Cancel();
+ displayCts?.Dispose();
+ }
}
diff --git a/Main/System/HeroUI/HeroCollectionWin.cs b/Main/System/HeroUI/HeroCollectionWin.cs
index 50bd021..be115e0 100644
--- a/Main/System/HeroUI/HeroCollectionWin.cs
+++ b/Main/System/HeroUI/HeroCollectionWin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -20,13 +21,13 @@
SinglePack singlePack;
- protected override void InitComponent()
+ protected override async void InitComponent()
{
attrBtn.AddListener(() =>
{
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.showText = Language.Get("herocard6");
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
heroPackBtn.AddListener(() =>
@@ -34,7 +35,7 @@
HeroUIManager.Instance.QueryUnLockHeroPack();
});
- fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
+ fiterManager = await HeroSelectBehaviour.Create(heroSelectBehaviour);
}
protected override void OnPreOpen()
@@ -66,7 +67,7 @@
void Display()
{
- fiterManager.Display(0, SelectJobCountry);
+ fiterManager?.Display(0, SelectJobCountry);
// CreateScroller();
// RefreshTotalAttr();
diff --git a/Main/System/HeroUI/HeroGiftEatSuccessWin.cs b/Main/System/HeroUI/HeroGiftEatSuccessWin.cs
index 54ff34b..c4cdd86 100644
--- a/Main/System/HeroUI/HeroGiftEatSuccessWin.cs
+++ b/Main/System/HeroUI/HeroGiftEatSuccessWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -74,7 +75,7 @@
var heroConfig = hero.heroConfig;
taiziBG.SetSprite("herodz" + heroConfig.Quality);
- heroModel.Create(hero.SkinID, heroConfig.UIScale);
+ heroModel.Create(hero.SkinID, heroConfig.UIScale).Forget();
nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel);
nameText.color = UIHelper.GetUIColorByFunc(heroConfig.Quality);
}
diff --git a/Main/System/HeroUI/HeroScenePosCell.cs b/Main/System/HeroUI/HeroScenePosCell.cs
index 48740bc..4646b2a 100644
--- a/Main/System/HeroUI/HeroScenePosCell.cs
+++ b/Main/System/HeroUI/HeroScenePosCell.cs
@@ -29,7 +29,7 @@
lvText.text = Language.Get("L1099", hero.heroLevel);
var heroConfig = hero.heroConfig;
countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
- heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale);
+ heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale).Forget();
nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel);
posCircleImg.SetSprite("heroposcircle" + heroConfig.Quality);
diff --git a/Main/System/HeroUI/HeroSkinRoleCell.cs b/Main/System/HeroUI/HeroSkinRoleCell.cs
index a0a6fef..eb91d08 100644
--- a/Main/System/HeroUI/HeroSkinRoleCell.cs
+++ b/Main/System/HeroUI/HeroSkinRoleCell.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class HeroSkinRoleCell : MonoBehaviour
@@ -12,7 +13,7 @@
public void Display(HeroConfig heroConfig, int index)
{
selectImg.SetActive(HeroSkinChooseWin.selectIndex == index);
- heroModel.Create(heroConfig.SkinIDList[index], heroConfig.UIScale);
+ heroModel.Create(heroConfig.SkinIDList[index], heroConfig.UIScale).Forget();
selectBtn.AddListener(() =>
{
var ui = UIManager.Instance.GetUI<HeroSkinChooseWin>();
diff --git a/Main/System/HeroUI/HeroSkinWin.cs b/Main/System/HeroUI/HeroSkinWin.cs
index a97603c..c56e96c 100644
--- a/Main/System/HeroUI/HeroSkinWin.cs
+++ b/Main/System/HeroUI/HeroSkinWin.cs
@@ -1,4 +1,5 @@
using System;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -61,7 +62,7 @@
});
shopBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(1).Forget();
});
unlockBtn.AddListener(() =>
{
@@ -85,7 +86,7 @@
changeClothBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HeroSkinChooseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroSkinChooseWin>().Forget();
});
}
@@ -158,8 +159,8 @@
skinID = heroConfig.SkinIDList[tmpIndex];
bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(skinID, heroConfig.Country));
- roleLhModel.Create(skinID, 1, motionName: "", isLh: true);
- roleXsModel.Create(skinID, 1);
+ roleLhModel.Create(skinID, 1, motionName: "", isLh: true).Forget();
+ roleXsModel.Create(skinID, 1).Forget();
HeroUIManager.Instance.PlayerLHSound(skinID);
nameText.text = heroConfig.Name;
diff --git a/Main/System/HeroUI/HeroTrainBaseWin.cs b/Main/System/HeroUI/HeroTrainBaseWin.cs
index 7b3c9f8..bcb984b 100644
--- a/Main/System/HeroUI/HeroTrainBaseWin.cs
+++ b/Main/System/HeroUI/HeroTrainBaseWin.cs
@@ -1,13 +1,14 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
// 姝﹀皢鍔熻兘鐣岄潰
public class HeroTrainBaseWin : OneLevelWin
{
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
ShowSkinBtn();
switch (functionOrder)
@@ -19,7 +20,7 @@
{
UIManager.Instance.CloseWindow<HeroTrainWin>();
}
- currentSubUI = UIManager.Instance.OpenWindow<HeroTrainWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroTrainWin>();
if (GetSortingOrder() < currentSubUI.GetSortingOrder())
{
@@ -32,7 +33,7 @@
{
UIManager.Instance.CloseWindow<HeroTrainWin>();
}
- currentSubUI = UIManager.Instance.OpenWindow<HeroTrainWin>(1);
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroTrainWin>(1);
if (GetSortingOrder() < currentSubUI.GetSortingOrder())
{
@@ -41,7 +42,7 @@
break;
case 2:
//鐨偆
- currentSubUI = UIManager.Instance.OpenWindow<HeroSkinWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroSkinWin>();
if (GetSortingOrder() < currentSubUI.GetSortingOrder())
{
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index f08d797..38321dd 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -224,7 +224,7 @@
if (functionOrder == 0)
{
DisplayTrainOrBreak(hero);
- ForceRefreshLayout();
+ ForceRefreshLayout().Forget();
}
else if (functionOrder == 1)
{
@@ -267,9 +267,9 @@
public void Display()
{
bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(hero.SkinID, hero.heroConfig.Country));
- roleLhModel.Create(hero.SkinID, 1, motionName: "", isLh: true);
+ roleLhModel.Create(hero.SkinID, 1, motionName: "", isLh: true).Forget();
- roleXsModel.Create(hero.SkinID, 1);
+ roleXsModel.Create(hero.SkinID, 1).Forget();
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class);
descText.text = hero.heroConfig.Desc;
@@ -305,7 +305,7 @@
ShowDeleteTip();
HeroUIManager.Instance.RemoveNewHero(hero.heroId);
- ForceRefreshLayout();
+ ForceRefreshLayout().Forget();
}
diff --git a/Main/System/Horse/HorseController.cs b/Main/System/Horse/HorseController.cs
index 9d5dfbb..97c91dc 100644
--- a/Main/System/Horse/HorseController.cs
+++ b/Main/System/Horse/HorseController.cs
@@ -1,5 +1,6 @@
using System;
+using Cysharp.Threading.Tasks;
using Spine.Unity;
using UnityEngine;
using UnityEngine.UI;
@@ -21,9 +22,10 @@
// 鍒涘缓鍧愰獞 锛歩d涓�0绌哄潗楠戜篃鏈夐厤缃�
//_skinID 鍧愰獞鐨勭毊鑲D
- public void Create(int _skinID, int _heroSkinID = 0, float scale = 1f, Action _onComplete = null, string motionName = "idle")
+ public async UniTask Create(int _skinID, int _heroSkinID = 0, float scale = 1f, Action _onComplete = null, string motionName = "idle")
{
- pool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("UIHorse"));
+ pool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHorse"));
+ if (this == null) return;
if (instanceGO == null)
{
instanceGO = pool.Request();
@@ -43,7 +45,7 @@
{
skeletonGraphic.enabled = false;
}
- CreateHero(_heroSkinID, scale);
+ await CreateHero(_heroSkinID, scale);
//閬垮厤閲嶅鍒涘缓
return;
}
@@ -66,11 +68,12 @@
//鍗镐笅鍧愰獞鐨勬儏鍐�
skeletonGraphic.enabled = false;
spineAnimationState = null;
- CreateHero(_heroSkinID, scale);
+ await CreateHero(_heroSkinID, scale);
return;
}
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine);
+ if (this == null) return;
if (skeletonGraphic.skeletonDataAsset == null)
{
@@ -92,12 +95,13 @@
if (motionName == "")
motionName = GetFistSpineAnim();
PlayAnimation(motionName, true);
- CreateHero(_heroSkinID, scale);
+ await CreateHero(_heroSkinID, scale);
+ if (this == null) return;
spineAnimationState.Complete -= OnAnimationComplete;
spineAnimationState.Complete += OnAnimationComplete;
}
- public void CreateHero(int heroSkinID, float _scale)
+ public async UniTask CreateHero(int heroSkinID, float _scale)
{
if (instanceGO == null)
{
@@ -122,7 +126,8 @@
return;
}
hero.SetActive(true);
- hero.Create(heroSkinID, _scale);
+ await hero.Create(heroSkinID, _scale);
+ if (this == null) return;
// 纭繚 BoneFollowerGraphic 寮曠敤鍒版纭殑鍧愰獞 SkeletonGraphic
var boneFollower = hero.GetComponent<BoneFollowerGraphic>();
diff --git a/Main/System/InternalAffairs/GoldRushLeader.cs b/Main/System/InternalAffairs/GoldRushLeader.cs
index da73f07..fe522ec 100644
--- a/Main/System/InternalAffairs/GoldRushLeader.cs
+++ b/Main/System/InternalAffairs/GoldRushLeader.cs
@@ -36,7 +36,7 @@
leaderPathPointArr[leaderPathPointArr.Length - 1].transform.localPosition;
OnComplete = _OnComplete;
this.SetActive(true);
- leader.Create(GoldRushManager.Instance.GetWorkerSkinID(tendID, index), leaderScale);
+ leader.Create(GoldRushManager.Instance.GetWorkerSkinID(tendID, index), leaderScale).Forget();
Go(waitTime, isBack).Forget();
}
diff --git a/Main/System/InternalAffairs/GoldRushWorkCell.cs b/Main/System/InternalAffairs/GoldRushWorkCell.cs
index ca2408d..4beeea2 100644
--- a/Main/System/InternalAffairs/GoldRushWorkCell.cs
+++ b/Main/System/InternalAffairs/GoldRushWorkCell.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -78,7 +79,7 @@
{
heroModels[i].SetActive(true);
var skinID = GoldRushManager.Instance.GetWorkerSkinID(campID, i);
- heroModels[i].Create(skinID, 0.6f, motionName:"run");
+ heroModels[i].Create(skinID, 0.6f, motionName:"run").Forget();
}
else
{
diff --git a/Main/System/InternalAffairs/GoldRushWorkerCell.cs b/Main/System/InternalAffairs/GoldRushWorkerCell.cs
index de163d4..29e3823 100644
--- a/Main/System/InternalAffairs/GoldRushWorkerCell.cs
+++ b/Main/System/InternalAffairs/GoldRushWorkerCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -22,7 +23,7 @@
{
var config = GoldRushWorkerConfig.Get(workerID);
nameText.text = config.Name;
- heroModel.Create(config.SkinID, 0.8f);
+ heroModel.Create(config.SkinID, 0.8f).Forget();
var lockState = GoldRushManager.Instance.GetWorkerLockState(workerID);
if (lockState == 0)
{
diff --git a/Main/System/Invest/InvestModel.cs b/Main/System/Invest/InvestModel.cs
index 378a301..a690eba 100644
--- a/Main/System/Invest/InvestModel.cs
+++ b/Main/System/Invest/InvestModel.cs
@@ -1,6 +1,7 @@
锘�
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine.UI;
using System.Linq;
using LitJson;
@@ -163,7 +164,7 @@
if (count < rechargeCount.totalCount)
{
lastTotalBuyCountDict[type] = rechargeCount.totalCount;
- UIManager.Instance.OpenWindow<PrivilegeActiveCardWin>(type);
+ UIManager.Instance.OpenWindowAsync<PrivilegeActiveCardWin>(type).Forget();
}
}
}
diff --git a/Main/System/ItemTip/ItemTipWayWin.cs b/Main/System/ItemTip/ItemTipWayWin.cs
index ff5f6ea..6a8fbf4 100644
--- a/Main/System/ItemTip/ItemTipWayWin.cs
+++ b/Main/System/ItemTip/ItemTipWayWin.cs
@@ -1,6 +1,7 @@
锘�
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -102,7 +103,7 @@
if (StoreModel.Instance.CheckPopBuyWin(shopID))
{
StoreModel.Instance.buyShopID = shopID;
- UIManager.Instance.OpenWindow<BuyItemWin>();
+ UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
}
break;
case 2:
@@ -116,7 +117,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(2);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget();
}
break;
case 3:
@@ -127,7 +128,7 @@
}
if (!UIManager.Instance.IsOpened<TimingGiftWin>())
{
- UIManager.Instance.OpenWindow<TimingGiftWin>(int.Parse(way.CustomValue));
+ UIManager.Instance.OpenWindowAsync<TimingGiftWin>(int.Parse(way.CustomValue)).Forget();
}
break;
case 0:
diff --git a/Main/System/ItemTip/OwnMoneyCell.cs b/Main/System/ItemTip/OwnMoneyCell.cs
index d94f028..c69ef87 100644
--- a/Main/System/ItemTip/OwnMoneyCell.cs
+++ b/Main/System/ItemTip/OwnMoneyCell.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing Cysharp.Threading.Tasks;
+using UnityEngine;
using UnityEngine.UI;
//鎷ユ湁鐨勮揣甯侊細鏁伴噺鏄剧ず锛岀偣鍑绘寜閽墦寮�瀵瑰簲鑾峰彇鐣岄潰
@@ -31,7 +32,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(2);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget();
}
}
}
@@ -47,7 +48,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(2);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget();
}
}
}
diff --git a/Main/System/Language/Language.cs b/Main/System/Language/Language.cs
index 3507c37..efc781f 100644
--- a/Main/System/Language/Language.cs
+++ b/Main/System/Language/Language.cs
@@ -47,10 +47,10 @@
languageStartDict = JsonMapper.ToObject<Dictionary<string, string[]>>(config.Numerical2);
languageDict = JsonMapper.ToObject<Dictionary<string, string>>(config.Numerical3);
- if (languageStartDict == null || !languageStartDict.ContainsKey(VersionConfigEx.Get().appId))
+ if (languageStartDict == null || !languageStartDict.ContainsKey(VersionConfigEx.config.appId))
{
//妫�鏌ユ湁娌″璇█
- Debug.Log("褰撳墠娓犻亾鏈紑鍚璇█:" + VersionConfigEx.Get().appId);
+ Debug.Log("褰撳墠娓犻亾鏈紑鍚璇█:" + VersionConfigEx.config.appId);
return;
}
@@ -64,7 +64,7 @@
return;
}
- var defaultCfg = languageStartDict[VersionConfigEx.Get().appId];
+ var defaultCfg = languageStartDict[VersionConfigEx.config.appId];
string languageMark;
if (defaultCfg[1] == "0")
{
@@ -109,7 +109,7 @@
{
return "";
}
- if (!languageStartDict.ContainsKey(VersionConfigEx.Get().appId))
+ if (!languageStartDict.ContainsKey(VersionConfigEx.config.appId))
{
return "";
}
diff --git a/Main/System/LineupRecommend/LineupRecommendItem.cs b/Main/System/LineupRecommend/LineupRecommendItem.cs
index ff71c0a..306b7e9 100644
--- a/Main/System/LineupRecommend/LineupRecommendItem.cs
+++ b/Main/System/LineupRecommend/LineupRecommendItem.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class LineupRecommendItem : MonoBehaviour
@@ -29,15 +30,7 @@
if (!manager.TryGetHeroSkinConfig(heroID, out HeroSkinConfig heroSkinConfig))
return;
- var sprite = UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon);
- if (sprite == null)
- {
- imgHeroHead.SetSprite("herohead_default");
- }
- else
- {
- imgHeroHead.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon, imgHeroHead, "herohead_default").Forget();
imgSquareIcon.SetSprite("heroheadBG" + heroConfig.Quality);
imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
@@ -66,7 +59,7 @@
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID;
- UIManager.Instance.OpenWindow<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
}
});
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index 2c2710c..c774456 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/Main/System/Login/LoginWin.cs
@@ -406,6 +406,10 @@
{
if (isOk)
{
+#if UNITY_WEBGL
+ // WebGL鏃犳湰鍦版枃浠剁郴缁燂紝浠呮竻鐞哖layerPrefs
+ LocalSave.DeleteAll();
+#else
try
{
LocalSave.DeleteAll();
@@ -441,15 +445,12 @@
{
Debug.LogError("Failed to clean persistent data: " + e.Message);
}
- finally
+#endif
+ Clock.AlarmAfter(0.1f, () =>
{
- Clock.AlarmAfter(0.1f, () =>
- {
- Application.Quit();
- });
- Debug.Log("Persistent data cleaned.");
- }
-
+ Application.Quit();
+ });
+ Debug.Log("Persistent data cleaned.");
}
});
diff --git a/Main/System/Main/HeroFightingCardCell.cs b/Main/System/Main/HeroFightingCardCell.cs
index 1a797c7..87c4a1e 100644
--- a/Main/System/Main/HeroFightingCardCell.cs
+++ b/Main/System/Main/HeroFightingCardCell.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing Cysharp.Threading.Tasks;
+using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
@@ -95,16 +96,7 @@
var heroConfig = HeroConfig.Get(heroID);
qualityBG.SetSprite("herocBG" + heroConfig.Quality);
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon);
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- heroIcon.SetSprite("herohead_big_default");
- }
- else
- {
- heroIcon.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon, heroIcon, "herohead_big_default").Forget();
if (star == 0)
{
@@ -139,7 +131,7 @@
{
HeroUIManager.Instance.SortHeroList();
HeroUIManager.Instance.selectHeroGuid = guid;
- UIManager.Instance.OpenWindow<HeroTrainBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroTrainBaseWin>().Forget();
}
void ClickEmpty()
@@ -158,7 +150,7 @@
}
return;
}
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
}
void OnSkillCast(bool isfighting)
{
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index 831a9d6..45cd75c 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -217,15 +217,15 @@
});
osBeautyMMBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<OSBeautyMMBaseWin>();
+ UIManager.Instance.OpenWindowAsync<OSBeautyMMBaseWin>().Forget();
});
osHeroTrainBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<OSHeroTrainBaseWin>();
+ UIManager.Instance.OpenWindowAsync<OSHeroTrainBaseWin>().Forget();
});
osMinggeBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<OSMinggeBaseWin>();
+ UIManager.Instance.OpenWindowAsync<OSMinggeBaseWin>().Forget();
});
DailySpecialsBtns.AddListener(() =>
{
diff --git a/Main/System/Main/MainWin.cs b/Main/System/Main/MainWin.cs
index 3ed2f14..b4cf6c5 100644
--- a/Main/System/Main/MainWin.cs
+++ b/Main/System/Main/MainWin.cs
@@ -197,7 +197,7 @@
playerNameText.text = PlayerDatas.Instance.baseData.PlayerName;
powerText.text = UIHelper.ReplaceLargeArtNum(PlayerDatas.Instance.baseData.FightPower);
- officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
}
void PlayerDataRefresh(PlayerDataType type)
@@ -208,7 +208,7 @@
powerText.text = UIHelper.ReplaceLargeArtNum(PlayerDatas.Instance.baseData.FightPower);
break;
case PlayerDataType.RealmLevel:
- officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
break;
case PlayerDataType.Face:
case PlayerDataType.FacePic:
@@ -220,7 +220,7 @@
hammerText.text = UIHelper.GetMoneyCnt(41).ToString();
break;
case PlayerDataType.ExAttr3:
- officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
break;
}
diff --git a/Main/System/Main/RightFuncInHome.cs b/Main/System/Main/RightFuncInHome.cs
index e302d0b..6567afe 100644
--- a/Main/System/Main/RightFuncInHome.cs
+++ b/Main/System/Main/RightFuncInHome.cs
@@ -92,7 +92,7 @@
});
reviewBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GoodReviewWin>();
+ UIManager.Instance.OpenWindowAsync<GoodReviewWin>().Forget();
});
}
diff --git a/Main/System/MainLevel/MainBossEnterWin.cs b/Main/System/MainLevel/MainBossEnterWin.cs
index 3b9b017..60ec312 100644
--- a/Main/System/MainLevel/MainBossEnterWin.cs
+++ b/Main/System/MainLevel/MainBossEnterWin.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -34,7 +35,7 @@
rankBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<PlayerRankWin>(0);
+ UIManager.Instance.OpenWindowAsync<PlayerRankWin>(0).Forget();
});
@@ -42,7 +43,7 @@
heroRoadBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<DayMissionBaseWin>(2);
+ UIManager.Instance.OpenWindowAsync<DayMissionBaseWin>(2).Forget();
});
funPresetBtn.AddListener(()=>
@@ -103,7 +104,7 @@
SmallTipWin.showText = Language.Get("SmallTipFomat",SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description) ;
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
}
else
@@ -112,7 +113,7 @@
}
}
- bossModel.Create(npcConfig.SkinID, npcConfig.ModelScale);
+ bossModel.Create(npcConfig.SkinID, npcConfig.ModelScale).Forget();
fightPowerText.text = UIHelper.ReplaceLargeArtNum(levelConfig.FightPower);
diff --git a/Main/System/OSActivity/OSActivityBaseWin.cs b/Main/System/OSActivity/OSActivityBaseWin.cs
index cbe44d6..26b3e07 100644
--- a/Main/System/OSActivity/OSActivityBaseWin.cs
+++ b/Main/System/OSActivity/OSActivityBaseWin.cs
@@ -1,5 +1,6 @@
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public abstract class OSActivityBaseWin : FunctionsBaseWin
{
@@ -18,23 +19,23 @@
protected abstract int GetRankType();
// 鐢卞瓙绫诲疄鐜帮細瀹炰緥鍖栧搴旂殑涓変釜瀛愮獥鍙�
- protected abstract UIBase GetRankWin();
- protected abstract UIBase GetAwardWin();
- protected abstract UIBase GetGiftWin();
+ protected abstract UniTask<UIBase> GetRankWin();
+ protected abstract UniTask<UIBase> GetAwardWin();
+ protected abstract UniTask<UIBase> GetGiftWin();
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- currentSubUI = GetRankWin();
+ currentSubUI = await GetRankWin();
break;
case 1:
- currentSubUI = GetAwardWin();
+ currentSubUI = await GetAwardWin();
break;
case 2:
// 濡傛灉鍚庣画鏈夋椿鍔ㄦ病鏈夌ぜ鍖呴〉绛撅紝鍙渶鍦ㄥ瓙绫婚噷杩斿洖 null 鎴栦笉璋冪敤鍗冲彲
- currentSubUI = GetGiftWin();
+ currentSubUI = await GetGiftWin();
break;
}
}
diff --git a/Main/System/OSActivity/OSBeautyMMBaseWin.cs b/Main/System/OSActivity/OSBeautyMMBaseWin.cs
index 37f7d25..d7535c2 100644
--- a/Main/System/OSActivity/OSBeautyMMBaseWin.cs
+++ b/Main/System/OSActivity/OSBeautyMMBaseWin.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
// 寮�鏈嶆椿鍔�-绾㈤鍐插埡娲诲姩
public class OSBeautyMMBaseWin : OSActivityBaseWin
@@ -7,9 +8,9 @@
// 绾㈤鍐叉瀵瑰簲鐨� RankType 涓� 8
protected override int GetRankType() => 8;
- protected override UIBase GetRankWin() => UIManager.Instance.OpenWindow<OSRankBeautyMMWin>(8);
+ protected override async UniTask<UIBase> GetRankWin() => await UIManager.Instance.OpenWindowAsync<OSRankBeautyMMWin>(8);
- protected override UIBase GetAwardWin() => UIManager.Instance.OpenWindow<OSRankBeautyMMAwardWin>();
+ protected override async UniTask<UIBase> GetAwardWin() => await UIManager.Instance.OpenWindowAsync<OSRankBeautyMMAwardWin>();
- protected override UIBase GetGiftWin() => UIManager.Instance.OpenWindow<OSRankBeautyMMGiftWin>();
+ protected override async UniTask<UIBase> GetGiftWin() => await UIManager.Instance.OpenWindowAsync<OSRankBeautyMMGiftWin>();
}
\ No newline at end of file
diff --git a/Main/System/OSActivity/OSGalaGiftCell.cs b/Main/System/OSActivity/OSGalaGiftCell.cs
index f14a629..0024be7 100644
--- a/Main/System/OSActivity/OSGalaGiftCell.cs
+++ b/Main/System/OSActivity/OSGalaGiftCell.cs
@@ -1,5 +1,6 @@
锘縰sing System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -78,13 +79,13 @@
if (ctgConfig.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto5");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
if (ctgConfig.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto7");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
diff --git a/Main/System/OSActivity/OSHeroCallBaseWin.cs b/Main/System/OSActivity/OSHeroCallBaseWin.cs
index e67dfc3..9e8cb37 100644
--- a/Main/System/OSActivity/OSHeroCallBaseWin.cs
+++ b/Main/System/OSActivity/OSHeroCallBaseWin.cs
@@ -7,6 +7,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
////寮�鏈嶆椿鍔�-姝﹀皢鎷涘嫙娲诲姩
@@ -21,18 +22,18 @@
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankWin>(4);
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankWin>(4);
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankHeroCallAwardWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankHeroCallAwardWin>();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankHeroCallGiftWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankHeroCallGiftWin>();
break;
}
}
diff --git a/Main/System/OSActivity/OSHeroTrainBaseWin.cs b/Main/System/OSActivity/OSHeroTrainBaseWin.cs
index bbdc038..f7a18d6 100644
--- a/Main/System/OSActivity/OSHeroTrainBaseWin.cs
+++ b/Main/System/OSActivity/OSHeroTrainBaseWin.cs
@@ -1,14 +1,15 @@
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
// 寮�鏈嶆椿鍔�-姝﹀皢鍐叉涓荤晫闈�
public class OSHeroTrainBaseWin : OSActivityBaseWin
{
protected override int GetRankType() => 7;
- protected override UIBase GetRankWin() => UIManager.Instance.OpenWindow<OSRankHeroTrainWin>(7);
+ protected override async UniTask<UIBase> GetRankWin() => await UIManager.Instance.OpenWindowAsync<OSRankHeroTrainWin>(7);
- protected override UIBase GetAwardWin() => UIManager.Instance.OpenWindow<OSRankHeroTrainAwardWin>();
+ protected override async UniTask<UIBase> GetAwardWin() => await UIManager.Instance.OpenWindowAsync<OSRankHeroTrainAwardWin>();
- protected override UIBase GetGiftWin() => UIManager.Instance.OpenWindow<OSRankHeroTrainGiftWin>();
+ protected override async UniTask<UIBase> GetGiftWin() => await UIManager.Instance.OpenWindowAsync<OSRankHeroTrainGiftWin>();
}
\ No newline at end of file
diff --git a/Main/System/OSActivity/OSMainLevelBaseWin.cs b/Main/System/OSActivity/OSMainLevelBaseWin.cs
index 3d7989e..84c1b37 100644
--- a/Main/System/OSActivity/OSMainLevelBaseWin.cs
+++ b/Main/System/OSActivity/OSMainLevelBaseWin.cs
@@ -7,6 +7,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
////寮�鏈嶆椿鍔�-涓荤嚎鍏冲崱娲诲姩
@@ -30,15 +31,15 @@
}
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankWin>(3);
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankWin>(3);
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankMainLeveAwardWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankMainLeveAwardWin>();
break;
}
}
diff --git a/Main/System/OSActivity/OSMinggeBaseWin.cs b/Main/System/OSActivity/OSMinggeBaseWin.cs
index 519fa70..9ab1209 100644
--- a/Main/System/OSActivity/OSMinggeBaseWin.cs
+++ b/Main/System/OSActivity/OSMinggeBaseWin.cs
@@ -1,14 +1,15 @@
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
// 寮�鏈嶆椿鍔�-鍛芥牸鍐叉涓荤晫闈�
public class OSMinggeBaseWin : OSActivityBaseWin
{
protected override int GetRankType() => 9;
- protected override UIBase GetRankWin() => UIManager.Instance.OpenWindow<OSRankMinggeWin>(9);
+ protected override async UniTask<UIBase> GetRankWin() => await UIManager.Instance.OpenWindowAsync<OSRankMinggeWin>(9);
- protected override UIBase GetAwardWin() => UIManager.Instance.OpenWindow<OSRankMinggeAwardWin>();
+ protected override async UniTask<UIBase> GetAwardWin() => await UIManager.Instance.OpenWindowAsync<OSRankMinggeAwardWin>();
- protected override UIBase GetGiftWin() => UIManager.Instance.OpenWindow<OSRankMinggeGiftWin>();
+ protected override async UniTask<UIBase> GetGiftWin() => await UIManager.Instance.OpenWindowAsync<OSRankMinggeGiftWin>();
}
\ No newline at end of file
diff --git a/Main/System/OSActivity/OSRankGiftBaseCell.cs b/Main/System/OSActivity/OSRankGiftBaseCell.cs
index ddfd7e5..7af221b 100644
--- a/Main/System/OSActivity/OSRankGiftBaseCell.cs
+++ b/Main/System/OSActivity/OSRankGiftBaseCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -83,13 +84,13 @@
if (ctgConfig.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto5");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
if (ctgConfig.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto7");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
diff --git a/Main/System/OSActivity/OSRankHeroCallGiftCell.cs b/Main/System/OSActivity/OSRankHeroCallGiftCell.cs
index 2b23760..4d77262 100644
--- a/Main/System/OSActivity/OSRankHeroCallGiftCell.cs
+++ b/Main/System/OSActivity/OSRankHeroCallGiftCell.cs
@@ -1,5 +1,6 @@
锘縰sing System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -78,13 +79,13 @@
if (ctgConfig.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto5");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
if (ctgConfig.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto7");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
diff --git a/Main/System/OSActivity/OSRankHeroTrainWin.cs b/Main/System/OSActivity/OSRankHeroTrainWin.cs
index 893330f..1c60cfa 100644
--- a/Main/System/OSActivity/OSRankHeroTrainWin.cs
+++ b/Main/System/OSActivity/OSRankHeroTrainWin.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
// 寮�鏈嶆椿鍔�-姝﹀皢鍐叉 鎺掕姒滅晫闈�
@@ -14,7 +15,7 @@
OSRankTipWin.infoTextKey = "OSActivityHeroTrainRankTip";
OSRankTipWin.isDownShow = true;
OSRankTipWin.worldPos = title.transform.position;
- UIManager.Instance.OpenWindow<OSRankTipWin>();
+ UIManager.Instance.OpenWindowAsync<OSRankTipWin>().Forget();
});
}
}
\ No newline at end of file
diff --git a/Main/System/OSActivity/OSRankMinggeWin.cs b/Main/System/OSActivity/OSRankMinggeWin.cs
index fa89578..7930006 100644
--- a/Main/System/OSActivity/OSRankMinggeWin.cs
+++ b/Main/System/OSActivity/OSRankMinggeWin.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
// 寮�鏈嶆椿鍔�-鍛芥牸鍐叉 鎺掕姒滅晫闈�
@@ -14,7 +15,7 @@
OSRankTipWin.infoTextKey = "OSActivityMinggeRankTip";
OSRankTipWin.isDownShow = true;
OSRankTipWin.worldPos = title.transform.position;
- UIManager.Instance.OpenWindow<OSRankTipWin>();
+ UIManager.Instance.OpenWindowAsync<OSRankTipWin>().Forget();
});
}
}
\ No newline at end of file
diff --git a/Main/System/OfficialRank/OfficialTitleCell.cs b/Main/System/OfficialRank/OfficialTitleCell.cs
index b192d2c..b3a06ce 100644
--- a/Main/System/OfficialRank/OfficialTitleCell.cs
+++ b/Main/System/OfficialRank/OfficialTitleCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -9,7 +10,7 @@
private void Awake()
{
//濡傛灉鏈夐渶瑕佹寜閽偣鍑婚�昏緫锛屽湪澶栧眰鍒涘缓锛屾澶勪笉澶勭悊鐐瑰嚮閫昏緫
- LoadPrefab();
+ LoadPrefab().Forget();
}
@@ -86,27 +87,34 @@
GameObject prefab;
- protected void LoadPrefab()
+ protected async UniTask<GameObject> LoadPrefab()
{
if (prefab != null)
- return;
+ return prefab;
var tmp = transform.Find("OfficialTitleCell");
if (tmp != null)
{
prefab = tmp.gameObject;
- return;
+ return prefab;
}
- prefab = UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell");
+ prefab = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell");
+
+ if (this == null)
+ {
+ GameObject.DestroyImmediate(prefab);
+ return null;
+ }
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
-
+ return prefab;
}
- public void InitUI(int offcialRank, int titleID, float scale = 0.6f)
+ public async UniTask InitUI(int offcialRank, int titleID, float scale = 0.6f)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (!TitleConfig.HasKey(titleID))
{
officialRankObj.SetActive(true);
diff --git a/Main/System/OtherPlayerDetail/BuffInfoWin.cs b/Main/System/OtherPlayerDetail/BuffInfoWin.cs
index 20134d7..8362d42 100644
--- a/Main/System/OtherPlayerDetail/BuffInfoWin.cs
+++ b/Main/System/OtherPlayerDetail/BuffInfoWin.cs
@@ -1,4 +1,5 @@
using System;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class BuffInfoWin : UIBase
@@ -24,16 +25,7 @@
if (heroSkinConfig == null) return;
teamImage.SetSprite(data.isMySide ? "OtherHeroDetailBGBlue" : "OtherHeroDetailBGRed");
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(data.skinID).SquareIcon);
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- heroImage.SetSprite("herohead_default");
- }
- else
- {
- heroImage.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(data.skinID).SquareIcon, heroImage, "herohead_default").Forget();
heroNameText.text = heroConfig.Name;
CreateScroller();
diff --git a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
index 342e71c..97d8788 100644
--- a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
+++ b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
@@ -131,7 +131,7 @@
if (this == null) return;
var heroConfig = HeroConfig.Get(heroID);
- heroModel.Create(skinID, 1.2f);
+ heroModel.Create(skinID, 1.2f).Forget();
if (star == 0)
{
diff --git a/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs b/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs
index b0e94fa..ce579b4 100644
--- a/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs
+++ b/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs
@@ -159,7 +159,7 @@
txtServerName.text = Language.Get("PlayerProfile11", ServerListCenter.Instance.GetServerName(viewPlayerData.ServerID));
txtLV.text = viewPlayerData.LV.ToString();
avatarCell.InitUI(AvatarHelper.GetAvatarModel(viewPlayerData.PlayerID, viewPlayerData.Face, viewPlayerData.FacePic));
- officialTitle.InitUI(viewPlayerData.RealmLV, viewPlayerData.TitleID, 0.65f);
+ officialTitle.InitUI(viewPlayerData.RealmLV, viewPlayerData.TitleID, 0.65f).Forget();
DisplayHorseModel(viewPlayerData);
}
diff --git a/Main/System/PhantasmPavilion/AvatarCell.cs b/Main/System/PhantasmPavilion/AvatarCell.cs
index 4906278..50577ef 100644
--- a/Main/System/PhantasmPavilion/AvatarCell.cs
+++ b/Main/System/PhantasmPavilion/AvatarCell.cs
@@ -237,7 +237,9 @@
int faceID = model.faceID;
int facePicID = model.facePicID;
- manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID).Forget();
+ await manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID);
+
+ if (this == null) return;
string str = AvatarHelper.GetAvatarBgColorStr(faceID);
faceBGImage.SetSprite(str);
@@ -246,9 +248,6 @@
string resourceValue = manager.GetResourceValue(PhantasmPavilionType.FacePic, facePicID);
manager.Show(PhantasmPavilionType.FacePic, facePicImage, facePicSpine, facePicUIFrame, resourceType, resourceValue);
- faceBGImage.SetNativeSize();
- faceImage.SetNativeSize();
- facePicImage.SetNativeSize();
BindButtonClick(model);
}
// 娣诲姞鏍囧織浣嶏細鏄惁宸茶缃嚜瀹氫箟鐩戝惉鍣�
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs b/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs
index 24c28f5..4a81238 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs
@@ -234,17 +234,17 @@
var sprite = await UILoader.LoadSpriteAsync("HeroHead", skinConfig.SquareIcon);
if (sprite == null)
{
- Show(imgFace, spine, uiFrame, resourceType, "herohead_default", null, ellipseMask);
+ Show(type, imgFace, spine, uiFrame, resourceType, "herohead_default", null, ellipseMask);
}
else
{
- Show(imgFace, spine, uiFrame, resourceType, string.Empty, sprite, ellipseMask);
+ Show(type, imgFace, spine, uiFrame, resourceType, string.Empty, sprite, ellipseMask);
}
}
else
{
resourceValue = GetResourceValue(type, id);
- Show(imgFace, spine, uiFrame, resourceType, resourceValue, null, ellipseMask);
+ Show(type, imgFace, spine, uiFrame, resourceType, resourceValue, null, ellipseMask);
}
}
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionModelWin.cs b/Main/System/PhantasmPavilion/PhantasmPavilionModelWin.cs
index 86b4cdf..cb4ec90 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionModelWin.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionModelWin.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class PhantasmPavilionModelWin : UIBase
@@ -201,8 +202,8 @@
ModelConfig model = ModelConfig.Get(id);
int skinID = model.SkinID;
lhframe.transform.localScale = new Vector3(lhSize, lhSize, lhSize);
- heroIh.Create(skinID, motionName: "", isLh: true);
- heroModel.Create(skinID, modelSize);
+ heroIh.Create(skinID, motionName: "", isLh: true).Forget();
+ heroModel.Create(skinID, modelSize).Forget();
PhantasmPavilionState state = manager.GetUnLockState(type, id);
diff --git a/Main/System/PlayerProfile/PlayerProfileWin.cs b/Main/System/PlayerProfile/PlayerProfileWin.cs
index ea778a8..ed787cc 100644
--- a/Main/System/PlayerProfile/PlayerProfileWin.cs
+++ b/Main/System/PlayerProfile/PlayerProfileWin.cs
@@ -65,7 +65,7 @@
});
btnLanguage.AddListener(()=>
{
- UIManager.Instance.OpenWindow<ChangeLanguageWin>();
+ UIManager.Instance.OpenWindowAsync<ChangeLanguageWin>().Forget();
});
}
@@ -90,8 +90,7 @@
{
if (type == PlayerDataType.ExAttr3)
{
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f);
- }
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f).Forget(); }
}
private void OnUpdateRenameResultEvent()
@@ -114,7 +113,7 @@
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID,
PlayerDatas.Instance.baseData.face,
PlayerDatas.Instance.baseData.facePic));
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f).Forget();
var languages = Language.GetLanguages();
btnLanguage.SetActive(!languages.IsNullOrEmpty());
}
diff --git a/Main/System/Qunying/QYBattleFailWin.cs b/Main/System/Qunying/QYBattleFailWin.cs
index befbd8e..f6df9b3 100644
--- a/Main/System/Qunying/QYBattleFailWin.cs
+++ b/Main/System/Qunying/QYBattleFailWin.cs
@@ -37,7 +37,7 @@
tipHeroPosBtn.AddListener(() =>
{
CloseWindow();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
}
diff --git a/Main/System/Qunying/QYBattleWin.cs b/Main/System/Qunying/QYBattleWin.cs
index 5c2edec..ce7b1ed 100644
--- a/Main/System/Qunying/QYBattleWin.cs
+++ b/Main/System/Qunying/QYBattleWin.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using LitJson;
using UnityEngine;
using UnityEngine.UI;
@@ -79,7 +80,7 @@
}
else
{
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
}
if (isClickSkip)
diff --git a/Main/System/Qunying/QYFighterCell.cs b/Main/System/Qunying/QYFighterCell.cs
index 026bec5..0911893 100644
--- a/Main/System/Qunying/QYFighterCell.cs
+++ b/Main/System/Qunying/QYFighterCell.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -149,15 +150,15 @@
nameText.text = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName);
var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID());
- model.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID(), 0.9f);
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ model.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID(), 0.9f).Forget();
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
}
else
{
fightPowerText.text = UIHelper.ReplaceLargeArtNum(matchInfo.FightPower);
nameText.text = UIHelper.ServerStringTrim(matchInfo.PlayerName);
- model.Create((int)matchInfo.EquipShowSwitch % 1000, heroSkinID, 0.9f);
- officialTitleCell.InitUI(matchInfo.RealmLV, (int)matchInfo.TitleID);
+ model.Create((int)matchInfo.EquipShowSwitch % 1000, heroSkinID, 0.9f).Forget();
+ officialTitleCell.InitUI(matchInfo.RealmLV, (int)matchInfo.TitleID).Forget();
}
diff --git a/Main/System/Qunying/QYPlayerTop3Cell.cs b/Main/System/Qunying/QYPlayerTop3Cell.cs
index 5705ad1..abece38 100644
--- a/Main/System/Qunying/QYPlayerTop3Cell.cs
+++ b/Main/System/Qunying/QYPlayerTop3Cell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -34,8 +35,8 @@
}
nameText.text = rankData.name1;
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
- model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 0.9f);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
+ model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 0.9f).Forget();
queryPlayerBtn.SetListener(() =>
{
if (GeneralDefine.IsRobot((int)rankData.id)) return;
diff --git a/Main/System/Qunying/QYWin.cs b/Main/System/Qunying/QYWin.cs
index 299524d..0fef520 100644
--- a/Main/System/Qunying/QYWin.cs
+++ b/Main/System/Qunying/QYWin.cs
@@ -42,7 +42,7 @@
});
achievementBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<QYAchievementWin>();
+ UIManager.Instance.OpenWindowAsync<QYAchievementWin>().Forget();
});
defentPosBtn.AddListener(() =>
{
@@ -59,19 +59,19 @@
storeBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<QYStoreWin>();
+ UIManager.Instance.OpenWindowAsync<QYStoreWin>().Forget();
});
rankBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<PlayerRankWin>(QunyingManager.rankType);
+ UIManager.Instance.OpenWindowAsync<PlayerRankWin>(QunyingManager.rankType).Forget();
});
awardBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<QYRankAwardWin>(1);
+ UIManager.Instance.OpenWindowAsync<QYRankAwardWin>(1).Forget();
});
noteBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<QYNoteWin>();
+ UIManager.Instance.OpenWindowAsync<QYNoteWin>().Forget();
});
}
diff --git a/Main/System/Qunying/QunyingManager.cs b/Main/System/Qunying/QunyingManager.cs
index 503ec64..c7f6049 100644
--- a/Main/System/Qunying/QunyingManager.cs
+++ b/Main/System/Qunying/QunyingManager.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using LitJson;
using System;
@@ -253,7 +254,7 @@
itemInfos.Add(itemInfo);
}
}
- UIManager.Instance.OpenWindow<QYBattleVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<QYBattleVictoryWin>().Forget();
}
//鏄惁鏈懆寮�鍚紝鍛ㄥ嚑寮�鍚�
diff --git a/Main/System/Settlement/BattleSettlementManager.cs b/Main/System/Settlement/BattleSettlementManager.cs
index 4b74d1b..c8169af 100644
--- a/Main/System/Settlement/BattleSettlementManager.cs
+++ b/Main/System/Settlement/BattleSettlementManager.cs
@@ -110,11 +110,11 @@
case BattleConst.QYBattleField:
if (isWin)
{
- UIManager.Instance.OpenWindow<QYBattleVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<QYBattleVictoryWin>().Forget();
}
else
{
- UIManager.Instance.OpenWindow<QYBattleFailWin>();
+ UIManager.Instance.OpenWindowAsync<QYBattleFailWin>().Forget();
}
break;
default:
diff --git a/Main/System/SpineUpdateManager.cs b/Main/System/SpineUpdateManager.cs
new file mode 100644
index 0000000..ad594de
--- /dev/null
+++ b/Main/System/SpineUpdateManager.cs
@@ -0,0 +1,109 @@
+using System.Collections.Generic;
+using Spine.Unity;
+using UnityEngine;
+
+/// <summary>
+/// Spine鎵归噺鏇存柊绠$悊鍣紙鍙傝�僓WA浼樺寲鏂规锛�
+/// 绂佺敤SkeletonGraphic鐨刄pdate/LateUpdate鑷姩鍥炶皟锛�
+/// 鐢盡anager缁熶竴鎵归噺璋冪敤锛屽噺灏戝ぇ閲廠pine瀵硅薄鐨勮法璇█璋冪敤寮�閿�銆�
+/// 鏀寔闅斿抚鏇存柊Mesh锛岃繘涓�姝ラ檷浣嶤PU寮�閿�銆�
+/// </summary>
+public class SpineUpdateManager : MonoBehaviour
+{
+ private static SpineUpdateManager instance;
+ public static SpineUpdateManager Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ var go = new GameObject("[SpineUpdateManager]");
+ DontDestroyOnLoad(go);
+ instance = go.AddComponent<SpineUpdateManager>();
+ }
+ return instance;
+ }
+ }
+
+ private readonly List<SkeletonGraphic> managedSpines = new List<SkeletonGraphic>();
+ private readonly HashSet<SkeletonGraphic> managedSet = new HashSet<SkeletonGraphic>();
+ private int frameCount;
+
+ /// <summary>
+ /// 娉ㄥ唽涓�涓猄keletonGraphic鍒版壒閲忔洿鏂扮鐞嗗櫒銆�
+ /// 娉ㄥ唽鍚庝細绂佺敤鍏惰嚜韬殑Update/LateUpdate锛堥�氳繃璁剧疆freeze=true锛夛紝
+ /// 鏀圭敱Manager缁熶竴椹卞姩銆�
+ /// </summary>
+ public void Register(SkeletonGraphic sg)
+ {
+ if (sg == null || managedSet.Contains(sg)) return;
+ managedSpines.Add(sg);
+ managedSet.Add(sg);
+ sg.freeze = true; // 绂佺敤SkeletonGraphic鑷韩鐨刄pdate/LateUpdate
+ }
+
+ /// <summary>
+ /// 浠庣鐞嗗櫒涓Щ闄や竴涓猄keletonGraphic锛屾仮澶嶅叾鑷韩鏇存柊銆�
+ /// </summary>
+ public void Unregister(SkeletonGraphic sg)
+ {
+ if (sg == null || !managedSet.Contains(sg)) return;
+ managedSpines.Remove(sg);
+ managedSet.Remove(sg);
+ sg.freeze = false; // 鎭㈠鑷韩鏇存柊
+ }
+
+ void Update()
+ {
+ frameCount++;
+ float dt = Time.deltaTime;
+ for (int i = managedSpines.Count - 1; i >= 0; i--)
+ {
+ var sg = managedSpines[i];
+ if (sg == null)
+ {
+ managedSpines.RemoveAt(i);
+ managedSet.Remove(sg);
+ continue;
+ }
+ if (!sg.isActiveAndEnabled) continue;
+ // 鎵嬪姩椹卞姩鍔ㄧ敾鏇存柊锛歎pdate(float)涓嶆鏌reeze锛岀洿鎺ユ洿鏂板姩鐢荤姸鎬�
+ sg.Update(dt);
+ }
+ }
+
+ void LateUpdate()
+ {
+ // 闅斿抚鏇存柊Mesh锛氬姩鐢荤姸鎬佹瘡甯ф洿鏂颁繚璇佷簨浠跺噯纭紝浣哅esh閲嶅缓锛堝紑閿�澶э級闅斿抚鍗冲彲
+ // 鏁伴噺灏戞椂姣忓抚閮芥洿鏂帮紝鏁伴噺澶氫簬8涓椂闅斿抚鏇存柊浠ュ噺灏慍PU璐熸媴
+ bool skipMesh = managedSpines.Count > 8 && (frameCount & 1) == 0;
+
+ for (int i = managedSpines.Count - 1; i >= 0; i--)
+ {
+ var sg = managedSpines[i];
+ if (sg == null)
+ {
+ managedSpines.RemoveAt(i);
+ managedSet.Remove(sg);
+ continue;
+ }
+ if (!sg.isActiveAndEnabled) continue;
+ if (skipMesh) continue;
+ // 鎵嬪姩椹卞姩Mesh鏇存柊锛氱洿鎺ヨ皟鐢║pdateMesh()锛屼笉缁忚繃LateUpdate()鐨刦reeze妫�鏌�
+ sg.UpdateMesh();
+ }
+ }
+
+ void OnDestroy()
+ {
+ // 鎭㈠鎵�鏈夎绠$悊鐨凷pine鑷韩鏇存柊
+ foreach (var sg in managedSpines)
+ {
+ if (sg != null)
+ sg.freeze = false;
+ }
+ managedSpines.Clear();
+ managedSet.Clear();
+ instance = null;
+ }
+}
diff --git a/Main/System/SpineUpdateManager.cs.meta b/Main/System/SpineUpdateManager.cs.meta
new file mode 100644
index 0000000..c060eb4
--- /dev/null
+++ b/Main/System/SpineUpdateManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 174da832a7db0f74d9e049555d1edbe5
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Store/SkinStoreCell.cs b/Main/System/Store/SkinStoreCell.cs
index fc34772..70f1095 100644
--- a/Main/System/Store/SkinStoreCell.cs
+++ b/Main/System/Store/SkinStoreCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -60,13 +61,13 @@
{
HeroUIManager.Instance.selectForPreviewHeroID = heroID;
HeroUIManager.Instance.selectSkinIndex = HeroDebutManager.Instance.GetSkinIndexInHeroConfig(heroID, skinID);
- UIManager.Instance.OpenWindow<HeroBestBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>(1).Forget();
});
}
void BuyGoods(int shopID)
{
StoreModel.Instance.buyShopID = shopID;
- UIManager.Instance.OpenWindow<SkinStoreBuyTipWin>();
+ UIManager.Instance.OpenWindowAsync<SkinStoreBuyTipWin>().Forget();
}
}
diff --git a/Main/System/Store/SkinStoreWin.cs b/Main/System/Store/SkinStoreWin.cs
index b9ff542..134c351 100644
--- a/Main/System/Store/SkinStoreWin.cs
+++ b/Main/System/Store/SkinStoreWin.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -14,7 +15,7 @@
{
giftBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HeroSkinGiftWin>();
+ UIManager.Instance.OpenWindowAsync<HeroSkinGiftWin>().Forget();
});
}
diff --git a/Main/System/Store/StoreBaseWin.cs b/Main/System/Store/StoreBaseWin.cs
index 13bc603..1681c1e 100644
--- a/Main/System/Store/StoreBaseWin.cs
+++ b/Main/System/Store/StoreBaseWin.cs
@@ -16,7 +16,7 @@
break;
case 1:
//鏃惰
- currentSubUI = UIManager.Instance.OpenWindow<SkinStoreWin>();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<SkinStoreWin>();
break;
case 2:
// 鍏呭�肩晫闈�
diff --git a/Main/System/Store/StoreModel.cs b/Main/System/Store/StoreModel.cs
index 32856e4..5cee567 100644
--- a/Main/System/Store/StoreModel.cs
+++ b/Main/System/Store/StoreModel.cs
@@ -1,7 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
using System.Linq;
-
+using Cysharp.Threading.Tasks;
using UnityEngine;
using LitJson;
using System.Collections;
@@ -591,7 +591,7 @@
if (!TryGetIsSellOut(cfg, out var cnt))
{
buyShopID = shopID;
- UIManager.Instance.OpenWindow<BuyItemWin>();
+ UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
}
else
{
diff --git a/Main/System/TianziBillborad/TianziBillboradPlayerRankCell.cs b/Main/System/TianziBillborad/TianziBillboradPlayerRankCell.cs
index 88fb295..ed6a9d8 100644
--- a/Main/System/TianziBillborad/TianziBillboradPlayerRankCell.cs
+++ b/Main/System/TianziBillborad/TianziBillboradPlayerRankCell.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Wednesday, September 26, 2018
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -37,7 +38,7 @@
rankText.text = Language.Get("L1045");
rankValueText.text = "0";//Language.Get("L1125");
nameText.text = PlayerDatas.Instance.baseData.PlayerName;
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
return;
}
rank = rankData.rank;
@@ -52,7 +53,7 @@
else
{
officialTitleCell.SetActive(true);
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
avatarCell.SetActive(true);
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
viewPlayerId = (int)rankData.id;
diff --git a/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs b/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs
index e0d4b13..02d80e8 100644
--- a/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs
+++ b/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs
@@ -30,7 +30,7 @@
officialTitleCell.SetActive(true);
rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue2 + rankData.cmpValue * Constants.ExpPointValue));
nameText.text = rankData.name1;
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
model.SetActive(true);
model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
diff --git a/Main/System/TianziBillborad/TianziBillboradWin.cs b/Main/System/TianziBillborad/TianziBillboradWin.cs
index 336cb9a..7bdf479 100644
--- a/Main/System/TianziBillborad/TianziBillboradWin.cs
+++ b/Main/System/TianziBillborad/TianziBillboradWin.cs
@@ -194,7 +194,7 @@
{
txtBossName.text = npcConfig.NPCName;
uiEffectPlayer.Play();
- bossModel.Create(npcConfig.SkinID, modelSize);
+ bossModel.Create(npcConfig.SkinID, modelSize).Forget();
txtHistoryHurt.text = Language.Get("TianziBillborad01", UIHelper.ReplaceLargeNum(model.historyHurt));
txtTodayHurt.text = Language.Get("TianziBillborad02", UIHelper.ReplaceLargeNum(model.todayHurt));
}
diff --git a/Main/System/TimeRush/TimeRushGiftCell.cs b/Main/System/TimeRush/TimeRushGiftCell.cs
index 10944a6..73246cf 100644
--- a/Main/System/TimeRush/TimeRushGiftCell.cs
+++ b/Main/System/TimeRush/TimeRushGiftCell.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class TimeRushGiftCell : MonoBehaviour
@@ -81,13 +82,13 @@
if (config.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto5");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
if (config.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType))
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto7");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
diff --git a/Main/System/UIBase/UIBase.cs b/Main/System/UIBase/UIBase.cs
index 0444e74..27e6352 100644
--- a/Main/System/UIBase/UIBase.cs
+++ b/Main/System/UIBase/UIBase.cs
@@ -334,7 +334,7 @@
OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
- ApplyClickEmptySpaceClose();
+ ApplyClickEmptySpaceClose().Forget();
ExecuteNextFrame(() =>
{
diff --git a/Main/System/UIBase/UIJumpManager.cs b/Main/System/UIBase/UIJumpManager.cs
index 0098864..09c5160 100644
--- a/Main/System/UIBase/UIJumpManager.cs
+++ b/Main/System/UIBase/UIJumpManager.cs
@@ -94,7 +94,7 @@
if (UIManager.Instance.IsOpened(config.WinName))
{
UIManager.Instance.CloseWindow(config.WinName);
- UIManager.Instance.OpenWindow(config.WinName);
+ UIManager.Instance.OpenWindowAsync(config.WinName).Forget();
}
}
diff --git a/Main/System/Video/UIVideoPlayer.cs b/Main/System/Video/UIVideoPlayer.cs
index 50f2751..1216615 100644
--- a/Main/System/Video/UIVideoPlayer.cs
+++ b/Main/System/Video/UIVideoPlayer.cs
@@ -63,6 +63,7 @@
// 閫氳繃 ResManager 鍔犺浇 VideoClip 璧勬簮锛堟敮鎸� AB 鎵撳寘锛�
_loadedClip = await ResManager.Instance.LoadAssetAsync<VideoClip>(directory, videoName, false);
+ if (this == null) return;
// 妫�鏌ユ槸鍚﹀湪鍔犺浇杩囩▼涓鍙栨秷
if (!_isLoading)
@@ -173,6 +174,7 @@
// 閫氳繃 ResManager 鍔犺浇 VideoClip 璧勬簮锛堟敮鎸� AB 鎵撳寘锛�
_loadedClip = await ResManager.Instance.LoadAssetAsync<VideoClip>(directory, videoName, false);
+ if (this == null) return;
// 妫�鏌ユ槸鍚﹀湪鍔犺浇杩囩▼涓鍙栨秷
if (!_isLoading)
diff --git a/Main/System/ViewNPC/ViewBuffManager.cs b/Main/System/ViewNPC/ViewBuffManager.cs
index ebda488..68a375c 100644
--- a/Main/System/ViewNPC/ViewBuffManager.cs
+++ b/Main/System/ViewNPC/ViewBuffManager.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using LitJson;
@@ -21,7 +22,7 @@
currentBuffData = data;
if (!UIManager.Instance.IsOpened<BuffInfoWin>())
{
- UIManager.Instance.OpenWindow<BuffInfoWin>();
+ UIManager.Instance.OpenWindowAsync<BuffInfoWin>().Forget();
}
}
}
diff --git a/Main/System/WarlordPavilion/WarlordPavilionNPCItem.cs b/Main/System/WarlordPavilion/WarlordPavilionNPCItem.cs
index 9a1f67b..c2af1d0 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionNPCItem.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionNPCItem.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class WarlordPavilionNPCItem : MonoBehaviour
@@ -26,7 +27,7 @@
return;
HeroConfig heroConfig = HeroConfig.Get(heroID);
- uiHeroController.Create(npcConfig.SkinID, modelSize);
+ uiHeroController.Create(npcConfig.SkinID, modelSize).Forget();
Color color = UIHelper.GetUIColorByFunc(heroConfig.Quality);
string name = UIHelper.AppendColor(color, heroConfig.Name);
diff --git a/Main/System/WarlordPavilion/WarlordPavilionPlayerRankCell.cs b/Main/System/WarlordPavilion/WarlordPavilionPlayerRankCell.cs
index 6627ab4..f66d3ef 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionPlayerRankCell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionPlayerRankCell.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing Cysharp.Threading.Tasks;
+using UnityEngine;
using UnityEngine.UI;
public class WarlordPavilionPlayerRankCell : MonoBehaviour
@@ -32,7 +33,7 @@
rankText.text = Language.Get("L1045");
rankValueText.text = "";//Language.Get("L1125");
nameText.text = PlayerDatas.Instance.baseData.PlayerName;
- officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID);
+ officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget();
return;
}
rank = rankData.rank;
@@ -47,7 +48,7 @@
else
{
officialTitleCell.SetActive(true);
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
avatarCell.SetActive(true);
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
viewPlayerId = (int)rankData.id;
diff --git a/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs b/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs
index 8f92bb9..93a9cbe 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs
@@ -30,7 +30,7 @@
manager.AnalysisFinishProgress((int)rankData.cmpValue, out int layerNum, out int levelNum);
rankValueText.text = Language.Get("WarlordPavilion23", layerNum, levelNum);
nameText.text = rankData.name1;
- officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
+ officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
model.SetActive(true);
model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
diff --git a/Main/Utility/ComponentExtersion.cs b/Main/Utility/ComponentExtersion.cs
index a162fd7..128d639 100644
--- a/Main/Utility/ComponentExtersion.cs
+++ b/Main/Utility/ComponentExtersion.cs
@@ -539,11 +539,17 @@
return;
}
+ _image.enabled = false;
+
UILoader.LoadTexture2DPNGAsync(_id).ContinueWith(texture =>
{
- if (_image != null && texture != null)
+ if (_image == null) return;
+
+ if (texture != null)
{
_image.texture = texture;
+ _image.SetNativeSize();
+ _image.enabled = true;
}
}).Forget();
}
diff --git a/Main/Utility/DeviceUtility.cs b/Main/Utility/DeviceUtility.cs
index 86ad894..e9d41e7 100644
--- a/Main/Utility/DeviceUtility.cs
+++ b/Main/Utility/DeviceUtility.cs
@@ -1,13 +1,16 @@
锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
-using System.Net.NetworkInformation;
using System;
-using System.Net;
-using System.Net.Sockets;
-using System.IO;
using System.Text.RegularExpressions;
using Cysharp.Threading.Tasks;
+using UnityEngine.Networking;
+
+#if !UNITY_WEBGL
+using System.Net.NetworkInformation;
+using System.Net;
+using System.IO;
+#endif
#if UNITY_IOS
using UnityEngine.iOS;
@@ -20,6 +23,7 @@
static string mac = string.Empty;
public static string GetMac()
{
+#if !UNITY_WEBGL
if (string.IsNullOrEmpty(mac))
{
try
@@ -35,12 +39,13 @@
Debug.Log(ex);
}
}
-
+#endif
return mac;
}
static string ipPattern = "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}";
static string ip = string.Empty;
+ public static string GetCachedIp() => ip;
public static async UniTask<string> GetIp()
{
try
@@ -48,24 +53,20 @@
if (string.IsNullOrEmpty(ip))
{
string url = "http://pv.sohu.com/cityjson";
- WebRequest wRequest = WebRequest.Create(url);
- wRequest.Method = "GET";
- wRequest.ContentType = "text/html;charset=UTF-8";
- WebResponse wResponse = await wRequest.GetResponseAsync();
- Stream stream = wResponse.GetResponseStream();
- StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
- string str = await reader.ReadToEndAsync();
-
- reader.Close();
- wResponse.Close();
-
- var match = Regex.Match(str, ipPattern);
- if (match != null)
+ using (var request = UnityWebRequest.Get(url))
{
- ip = match.Value;
+ await request.SendWebRequest();
+ if (request.result == UnityWebRequest.Result.Success)
+ {
+ string str = request.downloadHandler.text;
+ var match = Regex.Match(str, ipPattern);
+ if (match != null)
+ {
+ ip = match.Value;
+ }
+ }
}
}
-
}
catch (Exception ex)
{
diff --git a/Main/Utility/OperationLogCollect.cs b/Main/Utility/OperationLogCollect.cs
index 0b105ab..ca01902 100644
--- a/Main/Utility/OperationLogCollect.cs
+++ b/Main/Utility/OperationLogCollect.cs
@@ -8,7 +8,7 @@
public class OperationLogCollect : Singleton<OperationLogCollect>
{
- const string bugReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
+ const string bugReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
public void BugReport(string _title, string _content)
{
@@ -19,7 +19,7 @@
tables["EventID"] = 9002.ToString();
tables["ProductID"] = VersionConfig.Get().gameId;
tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- tables["IP"] = DeviceUtility.GetIp();
+ tables["IP"] = DeviceUtility.GetCachedIp();
tables["AccountID"] = LoginManager.Instance.sdkLoginResult.account;
tables["Level"] = PlayerDatas.Instance.baseData.LV.ToString();
tables["RoleID"] = PlayerDatas.Instance.baseData.PlayerName;
@@ -54,7 +54,7 @@
tables["EventID"] = 9002.ToString();
tables["ProductID"] = VersionConfig.Get().gameId;
tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- tables["IP"] = DeviceUtility.GetIp();
+ tables["IP"] = DeviceUtility.GetCachedIp();
tables["AccountID"] = "system";
tables["Level"] = "1";
tables["RoleID"] = "system";
@@ -88,7 +88,7 @@
}
- const string chatReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
+ const string chatReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
public void ChatReport(string content, string channelName, string toPlayer, int chatType)
{
#if !UNITY_EDITOR
@@ -101,7 +101,7 @@
tables["RegionID"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
tables["EventID"] = 9003.ToString();
tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- tables["IP"] = DeviceUtility.GetIp();
+ tables["IP"] = DeviceUtility.GetCachedIp();
tables["ChatChannel"] = channelName;
var sdkLoginResult = LoginManager.Instance.sdkLoginResult;
tables["AccountID"] = sdkLoginResult == null ? LoginManager.Instance.accountBuf : sdkLoginResult.account;
diff --git a/Main/Utility/RunTimeExceptionUtility.cs b/Main/Utility/RunTimeExceptionUtility.cs
index c83d552..ae0b721 100644
--- a/Main/Utility/RunTimeExceptionUtility.cs
+++ b/Main/Utility/RunTimeExceptionUtility.cs
@@ -24,7 +24,11 @@
return;
}
- if (Application.platform == RuntimePlatform.Android)
+ if (Application.platform == RuntimePlatform.WebGLPlayer)
+ {
+ return; // WebGL涓嶆敮鎸佹枃浠剁郴缁熷啓鍏�
+ }
+ else if (Application.platform == RuntimePlatform.Android)
{
logFileRoot = Path.GetDirectoryName(Application.persistentDataPath);
}
diff --git a/Main/Utility/SystemCMD.cs b/Main/Utility/SystemCMD.cs
index 33eb7d4..a7365f0 100644
--- a/Main/Utility/SystemCMD.cs
+++ b/Main/Utility/SystemCMD.cs
@@ -11,6 +11,10 @@
/// <returns></returns>
public static string RunCmd(string command)
{
+#if UNITY_WEBGL
+ UnityEngine.Debug.LogWarning("SystemCMD.RunCmd is not supported on WebGL");
+ return string.Empty;
+#else
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe"; //纭畾绋嬪簭鍚�
p.StartInfo.Arguments = "/c " + command; //纭畾绋嬪紡鍛戒护琛�
@@ -31,6 +35,7 @@
{
return err; //杈撳嚭鍑烘祦鍙栧緱鍛戒护琛岀粨鏋滄灉
}
+#endif
}
}
diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index c0dd2b0..92cdf18 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -1533,7 +1533,12 @@
//鑾峰彇鍓垏鏉垮唴瀹�
public static string GetClipboardText()
{
+#if UNITY_WEBGL && !UNITY_EDITOR
+ // WebGL涓嬫祻瑙堝櫒瀹夊叏闄愬埗锛屾棤娉曞悓姝ヨ鍙栧壀璐存澘
+ return string.Empty;
+#else
return GUIUtility.systemCopyBuffer;
+#endif
}
/// <summary>
diff --git a/Main/Utility/WebGLDebug.cs b/Main/Utility/WebGLDebug.cs
new file mode 100644
index 0000000..3318d29
--- /dev/null
+++ b/Main/Utility/WebGLDebug.cs
@@ -0,0 +1,18 @@
+using UnityEngine;
+
+/// <summary>
+/// WebGL 鐜涓嬬洿鎺ヨ皟鐢ㄦ祻瑙堝櫒 console.error锛屼笉鍙� Unity Release Build 鏃ュ織鎶戝埗褰卞搷銆�
+/// 闈� WebGL 骞冲彴鍥為��鍒� Debug.LogError銆�
+/// </summary>
+public static class WebGLDebug
+{
+ public static void LogError(string msg)
+ {
+#if UNITY_WEBGL && !UNITY_EDITOR
+ string escaped = msg.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\n", "\\n").Replace("\r", "");
+ Application.ExternalEval("console.error('" + escaped + "')");
+#else
+ Debug.LogError(msg);
+#endif
+ }
+}
diff --git a/Main/Utility/WebGLDebug.cs.meta b/Main/Utility/WebGLDebug.cs.meta
new file mode 100644
index 0000000..d16fb1f
--- /dev/null
+++ b/Main/Utility/WebGLDebug.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 242dde706571701498a0d9f6d02937a5
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
--
Gitblit v1.8.0