From 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 17:46:11 +0800
Subject: [PATCH] webgl代码合并 1
---
Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs | 5
Main/Component/UI/Core/TextEx.cs | 19
Main/System/Main/AutoFightWin.cs | 1
Main/System/Video/UIVideoPlayer.cs | 3
Main/System/BeautyMM/BeautyMMCell.cs | 1
Main/System/SkillUI/SkillBaseCell.cs | 11
Main/Core/GameEngine/Launch/RequestPermissionStart.cs | 3
Main/Core/Platform/PlatformFactory.cs | 150
Main/System/BillboardRank/GuildRankCell.cs | 1
Main/System/HeroUI/HeroPosHeadCell.cs | 3
Main/System/AssetVersion/InGameDownTestUtility.cs | 47
Main/System/PlayerProfile/PlayerProfileWin.cs | 1
Main/System/ClientVersion/VersionConfig.cs | 75
Main/System/FirstCharge/FirstChargeManager.cs | 1
Main/System/Debug/DebugUtility.cs | 68
Main/System/Guild/GuildCreateWin.cs | 1
Main/System/Arena/ArenaAwardWin.cs | 4
Main/System/ChallengeTab/TianziBillboradTabHandler.cs | 5
Main/System/FuncPreset/FuncPresetChooseCell.cs | 1
Main/System/OfficialRank/OfficialRankManager.cs | 3
Main/System/Battle/UIComp/BattleBuffCell.cs | 15
Main/System/HeroUI/GiftBaseCell.cs | 21
Main/System/Battle/UIComp/MinggeBuffCell.cs | 17
Main/System/Battle/BaseBattleWin.cs | 4
Main/System/BeautyMM/BeautyMMShowWin.cs | 1
Main/Core/GameEngine/Launch/CheckAssetValidTask.cs | 48
Main/System/Mingge/MinggeManager.cs | 1
Main/SDK/SDKUtils.cs | 303 ++-
Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs | 15
Main/System/Battle/BattleField/TianziBillboradBattleField.cs | 4
Main/Core/GameEngine/Launch/AssetCopyTask.cs | 185 +-
Main/System/Gubao/GubaoBaseWin.cs | 11
Main/System/HeroUI/HeroCollectionCardCell.cs | 1
Main/System/Battle/BattleField/StoryBossBattleField.cs | 4
Main/System/Battle/BattleHUDWin.cs | 2
Main/System/Settlement/BattleFailWin.cs | 1
Main/Component/UI/Effect/EllipseMask.cs | 20
Main/System/BeautyMM/BeautyMMManager.cs | 1
Main/System/Gubao/GubaoCell.cs | 1
Main/System/HeroUI/HeroGiftWashCell.cs | 3
Main/System/ItemTip/ItemTipUtility.cs | 1
Main/ResModule/SpriteAtlasHandler.cs | 76
Main/System/Main/RightFuncInHome.cs | 1
Main/System/TimeRush/TimeRushTipWin.cs | 3
Main/System/DailySpecials/DailySpecialsBaseWin.cs | 11
Main/Core/GameEngine/Launch/LaunchInHot.cs | 53
Main/Core/NetworkPackage/Socket/ClientSocket.cs | 29
Main/System/HeroUI/HeroPosWin.cs | 21
Main/System/Store/StoreCell.cs | 1
Main/System/Battle/BattleResources/BattleCacheManager.cs | 11
Main/System/Battle/BattleField/BoneBattleField.cs | 4
Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs | 41
Main/ResModule/YooAssetService.cs | 59
Main/System/ClientVersion/VersionUtility.cs | 16
Main/System/HappyXB/HappyXBModel.cs | 1
Main/ResModule/ResManager.cs | 49
Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs | 10
Main/Core/GameEngine/Launch/AssetDeCompressTask.cs | 118
Main/Utility/DeviceUtility.cs | 9
Main/System/Main/PlayerMainDate.cs | 1
Main/System/HappyXB/HeroSmallHeadCell.cs | 5
Main/Component/UI/Effect/BattleEffectPlayer.cs | 4
Main/System/Launch/LoadingWin.cs | 6
Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs | 18
Main/System/BoneField/BoneFieldWin.cs | 2
Main/System/HeroFates/HeroFatesUpgradeHeadCell.cs | 3
Main/System/Battle/BattleResources/TeamResTracker.cs | 2
Main/System/HeroUI/HeroAwakeWin.cs | 1
Main/System/UIBase/UIBase.cs | 109 +
Main/System/OSActivity/OSHeroCallBaseWin.cs | 9
Main/System/Recharge/RechargeManager.cs | 16
Main/System/Guild/GuildHallWin.cs | 1
Main/System/Guild/GuildViewListCell.cs | 1
Main/System/HeroUI/HeroGiftWashWin.cs | 3
Main/Core/Platform/DouyinPlatform.cs | 330 ++--
Main/System/Message/MessageWin.cs | 2
Main/System/Login/LoginManager.cs | 29
Main/System/ChallengeTab/BoneFieldTabHandler.cs | 5
Main/System/Battle/Sound/BattleSoundManager.cs | 2
Main/System/HeroUI/HeroHeadBaseCell.cs | 26
Main/System/HeroUI/HeroGiftEatWin.cs | 1
Main/System/Guild/GuildHawkerWin.cs | 1
Main/System/HeroFates/HeroFatesUpgradeWin.cs | 1
Main/System/HeroUI/HeroCardCell.cs | 1
Main/System/Mail/MailWin.cs | 2
Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs | 11
Main/System/BattlePass/BattlePassBaseCell.cs | 1
Main/System/KnapSack/Logic/ItemLogicUtility.cs | 1
Main/Utility/OperationLogCollect.cs | 156 +
Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs.meta | 11
Main/System/Battle/BattleField/WarlordPavilionBattleField.cs | 4
Main/System/BeautyMM/BeautyMMActiveWin.cs | 1
Main/System/HeroUI/HeroShowBaseCell.cs | 17
Main/System/Login/GameNotice.cs | 22
Main/Utility/GMCommand.cs | 1
Main/Component/UI/Core/ImageEx.cs | 12
Main/System/Debug/DebugController.cs | 3
Main/Core/Platform/WeChatPlatform.cs | 440 ++--
Main/System/HeroUI/HeroBestWin.cs | 2
Main/System/ChallengeTab/WarlordPavilionTabHandler.cs | 5
Main/System/Settlement/BoneBattleFailWin.cs | 1
Main/System/Store/StoreBaseWin.cs | 9
Main/System/Battle/BattleResources/BattlePreloadManager.cs | 3
Main/System/AssetVersion/InGameDownLoad.cs | 11
Main/System/HeroUI/HeroUIManager.Talent.cs | 7
Main/Core/Platform/StandalonePlatform.cs | 196 +-
Main/System/Gubao/GubaoManager.cs | 1
Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs | 15
Main/System/Login/ServerListWin.cs | 7
Main/System/SkillUI/SkillWordCell.cs | 15
Main/System/Guild/GuildJoinWin.cs | 1
Main/ResModule/PlatformCacheHelper.cs | 25
Main/System/Attribute/AttributeManager.cs | 1
Main/System/OSActivity/OSGalaChangeCell.cs | 1
Main/Component/UI/Common/CyclicScroll.cs | 5
Main/Config/PartialConfigs/DirtyWordConfig.cs | 53
Main/System/KnapSack/New/CommonItemBaisc.cs | 16
Main/System/Mail/MailCell.cs | 1
Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs | 1
Main/System/HeroUI/HeroBaseWin.cs | 9
Main/System/DayMission/DayMissionBaseWin.cs | 8
Main/System/OtherPlayerDetail/OtherEquipCardItem.cs | 1
Main/Config/PartialConfigs/DirtyNameConfig.cs | 53
Main/System/NewBieGuidance/NewBieCenter.cs | 1
Main/System/Equip/EquipModel.cs | 1
Main/System/AssetVersion/AssetVersion.cs | 5
Main/System/NewBieGuidance/NewBieMask.cs | 1
Main/System/HeroFates/HeroFatesPutItem.cs | 3
Main/System/Login/LoginWin.cs | 110
Main/System/Equip/EquipExchangeCell.cs | 3
Main/System/Guild/GuildFuncCell.cs | 1
Main/System/FirstCharge/FirstChargeWin.cs | 4
Main/System/UIBase/UIJumpManager.cs | 2
Main/System/Battle/BattleEffectMgr.cs | 3
Main/System/BillboardRank/GuildTop3Cell.cs | 1
Main/System/Equip/EquipExchangeWin.cs | 5
Main/System/OSActivity/OSMainLevelBaseWin.cs | 7
Main/System/KnapSack/PackManager.cs | 45
Main/Manager/StageManager.cs | 83
Main/ResModule/BuiltInLoader.cs | 7
Main/System/InternalAffairs/GoldRushAutoWin.cs | 1
Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs | 1
Main/System/OfficialRank/OfficialTitleCell.cs | 14
Main/System/HeroUI/HeroUIManager.Reborn.cs | 1
Main/Utility/UIHelper.cs | 8
Main/System/HappyXB/HeroCallHopeAddCell.cs | 3
Main/System/PhantasmPavilion/PhantasmPavilionWin.cs | 9
Main/System/Guild/GuildDonateWin.cs | 1
Main/System/HeroUI/HeroSkinModel.cs | 4
Main/Component/UI/Common/UIPrefabLoader.cs | 15
Main/System/FuncPreset/FuncPresetChooseMoreCell.cs | 1
Main/System/Main/MainWin.cs | 19
Main/Component/UI/Common/GroupButtonExManager.cs | 6
Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs | 1
Main/Core/Platform/VivoPlatform.cs | 330 ++--
Main/System/HeroUI/HeroUIManager.cs | 1
Main/System/ChallengeTab/ArenaTabHandler.cs | 5
Main/System/HeroUI/HeroCollectionLvUpWin.cs | 3
Main/System/BeautyMM/BeautyMMBaseWin.cs | 7
Main/System/HeroUI/HeroGiftLineCell.cs | 3
Main/System/Battle/BattleField/StoryBattleField.cs | 4
Main/System/FuncPreset/FuncPresetManager.cs | 1
Main/System/KnapSack/Logic/ComposeGirdCell.cs | 1
Main/Component/UI/Common/PopupWindowsProcessor.cs | 4
Main/System/UIBase/OneLevelWin.cs | 4
Main/System/PlayerProfile/ExchangeCodeWin.cs | 6
Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs | 11
Main/System/Launch/LaunchBackGroundWin.cs | 1
Main/System/ItemTip/ItemTipWayWin.cs | 1
Main/System/HeroUI/HeroDeleteHeadCell.cs | 3
Main/System/Guild/GuildOPWin.cs | 1
Main/Manager/UIManager.cs | 59
Main/System/Battle/BattleWin.cs | 11
Main/System/TimingGift/TimingGiftCell.cs | 11
Main/System/Debug/DebugLogin.cs | 9
Main/System/Login/ServerListCenter.cs | 47
Main/System/OSActivity/OSGalaBaseWin.cs | 9
Main/System/Settlement/WarlordPavilionFailWin.cs | 1
Main/System/WarlordPavilion/TowerBaseWin.cs | 6
Main/System/CustomizedGift/CustomizedRechargeModel.cs | 1
Main/System/Login/ServerListParser.cs | 30
Main/Config/ConfigManager.cs | 80 +
Main/System/InternalAffairs/AffairFuncCell.cs | 1
Main/System/Horse/HorseManager.cs | 1
Main/Core/GameEngine/Launch/GetVersionInfoTask.cs | 23
Main/System/Battle/BattleField/BattleField.cs | 15
Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs | 3
Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0104_tagServerDisconnect.cs | 21
Main/System/Main/HomeWin.cs | 2
Main/Main.cs | 4
Main/System/ItemTip/OwnMoneyCell.cs | 1
Main/Component/UI/Effect/EffectPlayer.cs | 34
Main/System/PhantasmPavilion/AvatarCell.cs | 28
Main/System/AssetVersion/AssetVersionUtility.cs | 106
Main/System/Hero/UIHeroController.cs | 8
Main/System/Battle/BattleField/ArenaBattleField.cs | 4
Main/System/TianziBillborad/TianziBillboradRankWin.cs | 4
Main/ResModule/SpriteAtlasHandler.cs.meta | 11
Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs | 11
Main/System/Battle/RecordPlayer/RecordPlayer.cs | 51
Main/System/Equip/BlessLVWin.cs | 2
Main/System/Launch/LaunchWin.cs | 50
Main/ResModule/RemoteServicesImpl.cs | 24
Main/System/AssetVersion/InGameDownLoadProgress.cs | 1
Main/System/Battle/ArenaBattleWin.cs | 1
Main/Utility/ShaderUtility.cs | 22
206 files changed, 2,928 insertions(+), 1,799 deletions(-)
diff --git a/Main/Component/UI/Common/CyclicScroll.cs b/Main/Component/UI/Common/CyclicScroll.cs
index ed0d29f..86c5717 100644
--- a/Main/Component/UI/Common/CyclicScroll.cs
+++ b/Main/Component/UI/Common/CyclicScroll.cs
@@ -148,7 +148,7 @@
public virtual void Init<T>(List<T> _datas, bool _stepByStep = false)
{
- if (_datas == null)
+ if (_datas == null || _datas.Count == 0)
{
this.SetActive(false);
return;
@@ -623,6 +623,9 @@
private void Arrange(Align _align)
{
+ if (infiniteItems.Count == 0)
+ return;
+
var head = infiniteItems[0];
var offset1 = Vector2.zero;
diff --git a/Main/Component/UI/Common/GroupButtonExManager.cs b/Main/Component/UI/Common/GroupButtonExManager.cs
index 508bebf..87321d3 100644
--- a/Main/Component/UI/Common/GroupButtonExManager.cs
+++ b/Main/Component/UI/Common/GroupButtonExManager.cs
@@ -62,10 +62,10 @@
void OnEnable()
{
- ExecuteNextFrame();
+ ExecuteNextFrame().Forget();
}
- protected async void ExecuteNextFrame()
+ protected async UniTask ExecuteNextFrame()
{
await UniTask.DelayFrame(1);
UpdateAllButtonsState();
@@ -159,6 +159,8 @@
private void UpdateAllButtonsState()
{
// SortBtns();
+ if (this == null || m_Buttons == null)
+ return;
foreach (var btn in m_Buttons)
{
diff --git a/Main/Component/UI/Common/PopupWindowsProcessor.cs b/Main/Component/UI/Common/PopupWindowsProcessor.cs
index 0891eda..049e3a4 100644
--- a/Main/Component/UI/Common/PopupWindowsProcessor.cs
+++ b/Main/Component/UI/Common/PopupWindowsProcessor.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
@@ -154,7 +154,7 @@
currentWindow = targetPopup;
popupWindowQueue.RemoveAt(targetIndex);
- UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId).Forget();
+ UIManager.Instance.OpenWindowAsync(currentWindow.window, currentWindow.functionId).Forget();
Debug.LogFormat("鎺ㄩ�佺獥鍙� " + currentWindow.window);
lastTime = Time.realtimeSinceStartup;
diff --git a/Main/Component/UI/Common/UIPrefabLoader.cs b/Main/Component/UI/Common/UIPrefabLoader.cs
index 92c0e63..bcb9d8f 100644
--- a/Main/Component/UI/Common/UIPrefabLoader.cs
+++ b/Main/Component/UI/Common/UIPrefabLoader.cs
@@ -41,15 +41,18 @@
instance = find.gameObject;
return;
}
- instance = await UIUtility.CreateWidget(prefabName, prefabName);
- if (this == null || instance == null)
+ var inst = await UIUtility.CreateWidget(prefabName, prefabName);
+ if (this == null || inst == null)
{
- if (null != instance)
- {
- DestroyImmediate(instance);
- }
+ if (null != inst) DestroyImmediate(inst);
return;
}
+ if (instance != null)
+ {
+ DestroyImmediate(inst);
+ return;
+ }
+ instance = inst;
instance.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
}
diff --git a/Main/Component/UI/Core/ImageEx.cs b/Main/Component/UI/Core/ImageEx.cs
index f93f64d..22959ca 100644
--- a/Main/Component/UI/Core/ImageEx.cs
+++ b/Main/Component/UI/Core/ImageEx.cs
@@ -62,5 +62,17 @@
this.SetSprite(m_IconKey);
}
}
+
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+
+ #if UNITY_EDITOR
+ if (material != null)
+ {
+ material.shader = Shader.Find(material.shader.name);
+ }
+ #endif
+ }
}
diff --git a/Main/Component/UI/Core/TextEx.cs b/Main/Component/UI/Core/TextEx.cs
index 041c71a..723ffa2 100644
--- a/Main/Component/UI/Core/TextEx.cs
+++ b/Main/Component/UI/Core/TextEx.cs
@@ -42,6 +42,25 @@
}
}
+ public override string text
+ {
+ get { return base.text; }
+ set
+ {
+ if (value != base.text)
+ {
+ base.text = value;
+
+ #if UNITY_EDITOR
+ if (material != null)
+ {
+ material.shader = Shader.Find(material.shader.name);
+ }
+ #endif
+ }
+ }
+ }
+
[SerializeField]
private BackGroundColorType m_BGColorType = BackGroundColorType.Dark;
public BackGroundColorType bgColorType
diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 5f585de..441359e 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -62,7 +62,7 @@
private void OnAlphaChanged()
{
- if (spineComp != null)
+ if (spineComp != null && spineComp.Skeleton != null)
{
var skeleton = spineComp.Skeleton;
skeleton.A = Alpha;
@@ -267,7 +267,7 @@
}
}
- public virtual async void Play(bool showLog = true)
+ public virtual async UniTask Play(bool showLog = true)
{
if (!isInit)
{
diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index cda8d4c..c506f18 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -288,17 +288,22 @@
// {
// spineComp.material = null;
// }
- ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight").ContinueWith(material =>
+ var material = await ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight");
+ if (material != null)
{
- if (material != null)
- {
- spineComp.material = material;
- }
- else
- {
- Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName);
- }
- }).Forget();
+ spineComp.material = material;
+ #if UNITY_WEBGL && !UNITY_EDITOR
+ Debug.Log($"[SpineEffect][WebGL] effectId={effectConfig.id} fxName={effectConfig.fxName}" +
+ $" mat={material.name} shader={material.shader.name}" +
+ $" straightAlpha={material.IsKeywordEnabled("_STRAIGHT_ALPHA_INPUT")}" +
+ $" canvasGroup={material.IsKeywordEnabled("_CANVAS_GROUP_COMPATIBLE")}" +
+ $" pmaVert={spineComp.MeshGenerator.settings.pmaVertexColors}");
+ #endif
+ }
+ else
+ {
+ Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName);
+ }
spineAnimationState = spineComp.AnimationState;
spineAnimationState.TimeScale = speedRate;
@@ -310,6 +315,15 @@
spineComp.enabled = true;
PlayerTheSpineAnim();
SoundPlayer.Instance.PlayUIAudioDelay(effectConfig.audio).Forget();
+
+ #if UNITY_EDITOR
+ // 缂栬緫鍣ㄦā寮忎笅寮哄埗鍒锋柊鏉愯川鐞冿紝瑙e喅閮ㄥ垎鐗规晥涓嶆樉绀洪棶棰�
+ await UniTask.Delay(100);
+ if (spineComp != null && this != null && spineComp.material != null)
+ {
+ spineComp.material.shader = Shader.Find(spineComp.material.shader.name);
+ }
+ #endif
}
// 鎾斁鎸囧畾鍔ㄧ敾
diff --git a/Main/Component/UI/Effect/EllipseMask.cs b/Main/Component/UI/Effect/EllipseMask.cs
index 5c88335..8361294 100644
--- a/Main/Component/UI/Effect/EllipseMask.cs
+++ b/Main/Component/UI/Effect/EllipseMask.cs
@@ -155,6 +155,7 @@
/// </summary>
private void CreateMaskMaterial()
{
+ #if !UNITY_EDITOR
if (m_MaskMaterial == null)
{
ResManager.Instance.LoadAssetAsync<Shader>("Shader", "GUI_EllipseMask").ContinueWith(ellipseShader =>
@@ -169,6 +170,12 @@
}
}).Forget();
}
+ #else
+ if (m_MaskMaterial == null)
+ {
+ m_MaskMaterial = new Material(Shader.Find("GUI/EllipseMask"));
+ }
+ #endif
}
/// <summary>
@@ -242,6 +249,8 @@
{
if (graphic.material == null || !graphic.material.shader.name.Contains("EllipseMaskedContent"))
{
+
+#if !UNITY_EDITOR
// Shader maskedShader = Shader.Find("GUI/EllipseMaskedContent");
ResManager.Instance.LoadAssetAsync<Shader>("Shader", "GUI_EllipseMaskedContent").ContinueWith(maskedShader =>
{
@@ -253,7 +262,16 @@
graphic.material = maskedMaterial;
}
}).Forget();
-
+#else
+ Shader maskedShader = Shader.Find("GUI/EllipseMaskedContent");
+ if (maskedShader != null)
+ {
+ Material maskedMaterial = new Material(maskedShader);
+ maskedMaterial.SetInt("_Stencil", m_StencilID);
+ maskedMaterial.SetInt("_StencilComp", 3); // Equal
+ graphic.material = maskedMaterial;
+ }
+#endif
}
else
{
diff --git a/Main/Config/ConfigManager.cs b/Main/Config/ConfigManager.cs
index c70f54f..364bfb3 100644
--- a/Main/Config/ConfigManager.cs
+++ b/Main/Config/ConfigManager.cs
@@ -177,6 +177,51 @@
int iterator = 0;
int totalConfigs = configTypes.Count;
+#if UNITY_WEBGL && !UNITY_EDITOR
+ // ============================================================
+ // WebGL 浼樺寲锛氫袱闃舵鍔犺浇
+ // 闃舵1: 涓�娆℃�у苟鍙戝彂璧锋墍鏈� TextAsset 鍔犺浇锛堝悓 bundle 鍙笅杞戒竴娆★級
+ // 闃舵2: 浠庡唴瀛樹腑鍒嗘壒瑙f瀽锛屾瘡鎵� Yield 闃叉娴忚鍣ㄥ崱姝�
+ // ============================================================
+
+ // 闃舵1: 骞跺彂鍔犺浇鎵�鏈夐厤缃枃鏈埌鍐呭瓨
+ Debug.Log("[ConfigManager] WebGL 闃舵1: 鎵归噺鍔犺浇閰嶇疆鏂囦欢...");
+ var configList = configTypes.ToList();
+ var configDataMap = new Dictionary<Type, string[]>(totalConfigs);
+ var loadTasks = new List<UniTask>(totalConfigs);
+
+ foreach (var configType in configList)
+ {
+ var ct = configType; // closure capture
+ loadTasks.Add(LoadConfigTextAsync(ct).ContinueWith(texts =>
+ {
+ if (texts != null)
+ configDataMap[ct] = texts;
+ else
+ Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {ct.Name}");
+ }));
+ }
+ await UniTask.WhenAll(loadTasks);
+ loadingProgress = 0.5f; // 缃戠粶鍔犺浇瀹屾垚 50%
+ Debug.Log($"[ConfigManager] WebGL 闃舵1瀹屾垚: {configDataMap.Count}/{totalConfigs} 涓厤缃凡鍔犺浇鍒板唴瀛�");
+
+ // 闃舵2: 浠庡唴瀛樹腑鍒嗘壒瑙f瀽鍒濆鍖�
+ const int parseBatchSize = 10;
+ int parsed = 0;
+ foreach (var configType in configList)
+ {
+ if (configDataMap.TryGetValue(configType, out var texts))
+ {
+ InitConfigFromTexts(configType, texts);
+ }
+ parsed++;
+ loadingProgress = 0.5f + 0.5f * parsed / totalConfigs;
+
+ // 姣� parseBatchSize 涓鍑轰富绾跨▼
+ if (parsed % parseBatchSize == 0)
+ await UniTask.Yield();
+ }
+#else
List<UniTask> loadTasks = new List<UniTask>();
// 閫愪釜鍔犺浇閰嶇疆骞舵洿鏂拌繘搴�
@@ -199,7 +244,7 @@
sw.Stop();
#endif
- loadingProgress = (float)(iterator++ + 1) / totalConfigs;
+ loadingProgress = (float)(++iterator) / totalConfigs;
});
loadTasks.Add(uniTask);
@@ -207,6 +252,7 @@
}
await UniTask.WhenAll(loadTasks);
+#endif
// 鍔犺浇瀹屾垚鍚庤缃甶sLoadFinished涓簍rue
loadingProgress = 1f;
@@ -481,4 +527,36 @@
ClearConfigDictionary<ZhanlingConfig>();
}
+ /// <summary>
+ /// 鍙姞杞介厤缃枃鏈紝涓嶅仛瑙f瀽銆傜敤浜� WebGL 鎵归噺棰勫姞杞姐��
+ /// </summary>
+ private async UniTask<string[]> LoadConfigTextAsync(Type configType)
+ {
+ string configName = configType.Name;
+ if (configName.EndsWith("Config"))
+ configName = configName.Substring(0, configName.Length - 6);
+ return await ResManager.Instance.LoadConfigAsync(configName);
+ }
+
+ /// <summary>
+ /// 浠庡凡鍔犺浇鐨勬枃鏈垵濮嬪寲閰嶇疆锛堢函鍐呭瓨鎿嶄綔锛屾棤缃戠粶锛夈��
+ /// </summary>
+ private void InitConfigFromTexts(Type configType, string[] texts)
+ {
+ var methodInfo = configType.GetMethod("Init",
+ System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
+ if (methodInfo != null)
+ {
+ methodInfo.Invoke(null, new object[] { texts });
+ var isInitField = configType.GetField("isInit",
+ System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
+ if (isInitField != null)
+ isInitField.SetValue(null, true);
+ }
+ else
+ {
+ Debug.LogError($"閰嶇疆绫� {configType.Name} 娌℃湁闈欐�両nit鏂规硶");
+ }
+ }
+
}
diff --git a/Main/Config/PartialConfigs/DirtyNameConfig.cs b/Main/Config/PartialConfigs/DirtyNameConfig.cs
index 361927f..97cc4b9 100644
--- a/Main/Config/PartialConfigs/DirtyNameConfig.cs
+++ b/Main/Config/PartialConfigs/DirtyNameConfig.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
using UnityEngine;
-using System.Threading;
public partial class DirtyNameConfig : ConfigBase<int, DirtyNameConfig>
{
@@ -144,31 +144,38 @@
}
dirtyNameInited = true;
+ DirtyNameInitAsync().Forget();
+ }
- ThreadPool.QueueUserWorkItem((object aaa) =>
+ private static async UniTaskVoid DirtyNameInitAsync()
+ {
+ memoryList.Sort((string x, string y) =>
{
- memoryList.Sort((string x, string y) =>
- {
- return x.CompareTo(y);
- });
- for (int i = memoryList.Count - 1; i > 0; i--)
- {
- if (memoryList[i].ToString() == memoryList[i - 1].ToString())
- {
- memoryList.RemoveAt(i);
- }
- }
- foreach (string word in memoryList)
- {
- WordGroup group = DIRTYWORLD[(int)word[0]];
- if (group == null)
- {
- group = new WordGroup();
- DIRTYWORLD[(int)word[0]] = group;
- }
- group.Add(word.Substring(1));
- }
+ return x.CompareTo(y);
});
+ await UniTask.Yield();
+ for (int i = memoryList.Count - 1; i > 0; i--)
+ {
+ if (memoryList[i].ToString() == memoryList[i - 1].ToString())
+ {
+ memoryList.RemoveAt(i);
+ }
+ }
+ await UniTask.Yield();
+ int count = 0;
+ foreach (string word in memoryList)
+ {
+ WordGroup group = DIRTYWORLD[(int)word[0]];
+ if (group == null)
+ {
+ group = new WordGroup();
+ DIRTYWORLD[(int)word[0]] = group;
+ }
+ group.Add(word.Substring(1));
+ count++;
+ if (count % 100 == 0)
+ await UniTask.Yield();
+ }
}
public static bool IsCHS(char character)
diff --git a/Main/Config/PartialConfigs/DirtyWordConfig.cs b/Main/Config/PartialConfigs/DirtyWordConfig.cs
index d8e0908..51c6225 100644
--- a/Main/Config/PartialConfigs/DirtyWordConfig.cs
+++ b/Main/Config/PartialConfigs/DirtyWordConfig.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
+ using Cysharp.Threading.Tasks;
using UnityEngine;
- using System.Threading;
public partial class DirtyWordConfig : ConfigBase<int, DirtyWordConfig>
{
@@ -194,31 +194,38 @@
}
dirtyWordInited = true;
+ DirtyWordInitAsync().Forget();
+ }
- ThreadPool.QueueUserWorkItem((object aaa) =>
+ private static async UniTaskVoid DirtyWordInitAsync()
+ {
+ memoryList.Sort((string x, string y) =>
{
- memoryList.Sort((string x, string y) =>
- {
- return x.CompareTo(y);
- });
- for (int i = memoryList.Count - 1; i > 0; i--)
- {
- if (memoryList[i].ToString() == memoryList[i - 1].ToString())
- {
- memoryList.RemoveAt(i);
- }
- }
- foreach (string word in memoryList)
- {
- WordGroup group = DIRTYWORLD[(int)word[0]];
- if (group == null)
- {
- group = new WordGroup();
- DIRTYWORLD[(int)word[0]] = group;
- }
- group.Add(word.Substring(1));
- }
+ return x.CompareTo(y);
});
+ await UniTask.Yield();
+ for (int i = memoryList.Count - 1; i > 0; i--)
+ {
+ if (memoryList[i].ToString() == memoryList[i - 1].ToString())
+ {
+ memoryList.RemoveAt(i);
+ }
+ }
+ await UniTask.Yield();
+ int count = 0;
+ foreach (string word in memoryList)
+ {
+ WordGroup group = DIRTYWORLD[(int)word[0]];
+ if (group == null)
+ {
+ group = new WordGroup();
+ DIRTYWORLD[(int)word[0]] = group;
+ }
+ group.Add(word.Substring(1));
+ count++;
+ if (count % 100 == 0)
+ await UniTask.Yield();
+ }
}
public static bool IsCHS(char character)
diff --git a/Main/Core/GameEngine/Launch/AssetCopyTask.cs b/Main/Core/GameEngine/Launch/AssetCopyTask.cs
index 61ba736..6bbe36a 100644
--- a/Main/Core/GameEngine/Launch/AssetCopyTask.cs
+++ b/Main/Core/GameEngine/Launch/AssetCopyTask.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using Cysharp.Threading.Tasks;
using UnityEngine;
@@ -91,39 +92,95 @@
private void AndroidCopyAsset()
{
- switch (VersionConfig.Get().assetAccess)
+ VersionConfig.GetAsync().ContinueWith(config =>
{
- case InstalledAsset.FullAsset:
- case InstalledAsset.HalfAsset:
- case InstalledAsset.IngoreDownLoad:
- if (!SDKUtils.Instance.AssetCopyFinished)
- {
- SDKUtils.Instance.CopyAsset();
- done = false;
- progress = 0f;
- }
- else
- {
- done = true;
- }
- break;
- case InstalledAsset.NullAsset:
- done = true;
- break;
- }
- }
-
- private void IOSCopyAsset()
- {
- if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
- {
- switch (VersionConfig.Get().assetAccess)
+ switch (config.assetAccess)
{
case InstalledAsset.FullAsset:
case InstalledAsset.HalfAsset:
case InstalledAsset.IngoreDownLoad:
if (!SDKUtils.Instance.AssetCopyFinished)
{
+ SDKUtils.Instance.CopyAsset();
+ done = false;
+ progress = 0f;
+ }
+ else
+ {
+ done = true;
+ }
+ break;
+ case InstalledAsset.NullAsset:
+ done = true;
+ break;
+ }
+ }).Forget();
+ }
+
+ private void IOSCopyAsset()
+ {
+ if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
+ {
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ switch (config.assetAccess)
+ {
+ case InstalledAsset.FullAsset:
+ case InstalledAsset.HalfAsset:
+ case InstalledAsset.IngoreDownLoad:
+ if (!SDKUtils.Instance.AssetCopyFinished)
+ {
+ copyTasks = new List<FileInfo>();
+ FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, copyTasks);
+
+ for (var i = copyTasks.Count - 1; i >= 0; i--)
+ {
+ var fileInfo = copyTasks[i];
+ var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
+ if (File.Exists(destPath))
+ {
+ copyTasks.RemoveAt(i);
+ }
+ }
+
+ completedCount = 0;
+ totalCount = copyTasks.Count;
+ }
+
+ if (totalCount > 0)
+ {
+ done = false;
+ progress = 0f;
+ }
+ else
+ {
+ done = true;
+ }
+ break;
+ case InstalledAsset.NullAsset:
+ done = true;
+ break;
+ }
+ }).Forget();
+
+ }
+ else
+ {
+ done = true;
+ }
+ }
+
+ private void StandaloneCopyAsset()
+ {
+ if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
+ {
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ switch (config.assetAccess)
+ {
+ case InstalledAsset.FullAsset:
+ case InstalledAsset.HalfAsset:
+ case InstalledAsset.IngoreDownLoad:
copyTasks = new List<FileInfo>();
FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, copyTasks);
@@ -139,68 +196,23 @@
completedCount = 0;
totalCount = copyTasks.Count;
- }
- if (totalCount > 0)
- {
- done = false;
- progress = 0f;
- }
- else
- {
- done = true;
- }
- break;
- case InstalledAsset.NullAsset:
- done = true;
- break;
- }
- }
- else
- {
- done = true;
- }
- }
-
- private void StandaloneCopyAsset()
- {
- if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
- {
- switch (VersionConfig.Get().assetAccess)
- {
- case InstalledAsset.FullAsset:
- case InstalledAsset.HalfAsset:
- case InstalledAsset.IngoreDownLoad:
- copyTasks = new List<FileInfo>();
- FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, copyTasks);
-
- for (var i = copyTasks.Count - 1; i >= 0; i--)
- {
- var fileInfo = copyTasks[i];
- var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
- if (File.Exists(destPath))
+ if (totalCount > 0)
{
- copyTasks.RemoveAt(i);
+ done = false;
+ progress = 0f;
}
- }
-
- completedCount = 0;
- totalCount = copyTasks.Count;
-
- if (totalCount > 0)
- {
- done = false;
- progress = 0f;
- }
- else
- {
+ else
+ {
+ done = true;
+ }
+ break;
+ case InstalledAsset.NullAsset:
done = true;
- }
- break;
- case InstalledAsset.NullAsset:
- done = true;
- break;
- }
+ break;
+ }
+ }).Forget();
+
}
else
{
@@ -260,7 +272,10 @@
private void IOSProcessCopyComplete()
{
- LocalSave.SetString("AssetCopyCompleted_IOSorStandalone", VersionConfig.Get().version);
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ LocalSave.SetString("AssetCopyCompleted_IOSorStandalone", config.version);
+ }).Forget();
}
}
\ No newline at end of file
diff --git a/Main/Core/GameEngine/Launch/AssetDeCompressTask.cs b/Main/Core/GameEngine/Launch/AssetDeCompressTask.cs
index 317ca3a..256e04b 100644
--- a/Main/Core/GameEngine/Launch/AssetDeCompressTask.cs
+++ b/Main/Core/GameEngine/Launch/AssetDeCompressTask.cs
@@ -20,20 +20,20 @@
}
}
- public static bool assetDeCompressCompleted
- {
- get
- {
- if (string.IsNullOrEmpty(assetDeCompressVersion))
- {
- return false;
- }
- else
- {
- return assetDeCompressVersion == VersionConfig.Get().version;
- }
- }
- }
+ // public static bool assetDeCompressCompleted
+ // {
+ // get
+ // {
+ // if (string.IsNullOrEmpty(assetDeCompressVersion))
+ // {
+ // return false;
+ // }
+ // else
+ // {
+ // return assetDeCompressVersion == VersionConfig.Get().version;
+ // }
+ // }
+ // }
@@ -124,55 +124,55 @@
-public class AssetDecompressTask : LaunchTask
-{
- public override float expectTime
- {
- get { return LocalSave.GetFloat("AssetDecompressTask_ExpectTime", 5f); }
- protected set { LocalSave.SetFloat("AssetDecompressTask_ExpectTime", value); }
- }
+// public class AssetDecompressTask : LaunchTask
+// {
+// public override float expectTime
+// {
+// get { return LocalSave.GetFloat("AssetDecompressTask_ExpectTime", 5f); }
+// protected set { LocalSave.SetFloat("AssetDecompressTask_ExpectTime", value); }
+// }
- AssetDeCompressTask.DecompressProgress deCompressProgress = null;
- float waitTimer = 0f;
+// AssetDeCompressTask.DecompressProgress deCompressProgress = null;
+// float waitTimer = 0f;
- public override void Begin()
- {
- LaunchInHot.m_CurrentStage = LaunchStage.AssetDecompress;
- duration = Mathf.Max(0.5f, expectTime);
+// public override void Begin()
+// {
+// LaunchInHot.m_CurrentStage = LaunchStage.AssetDecompress;
+// duration = Mathf.Max(0.5f, expectTime);
- if (!AssetDeCompressTask.assetDeCompressCompleted)
- {
- deCompressProgress = AssetDeCompressTask.DecompressAync(ResourcesPath.Instance.ExternalStorePath);
- done = false;
- }
- else
- {
- done = true;
- }
- }
+// if (!AssetDeCompressTask.assetDeCompressCompleted)
+// {
+// deCompressProgress = AssetDeCompressTask.DecompressAync(ResourcesPath.Instance.ExternalStorePath);
+// done = false;
+// }
+// else
+// {
+// done = true;
+// }
+// }
- public override void End()
- {
- AssetDeCompressTask.assetDeCompressVersion = VersionConfig.Get().version;
- }
+// public override void End()
+// {
+// AssetDeCompressTask.assetDeCompressVersion = VersionConfig.Get().version;
+// }
- public override void Update()
- {
- if (done)
- {
- return;
- }
+// public override void Update()
+// {
+// if (done)
+// {
+// return;
+// }
- timer += Time.deltaTime;
- progress = timer / duration;
- if (deCompressProgress == null || deCompressProgress.done)
- {
- waitTimer += Time.deltaTime;
- if (waitTimer > 2f)
- {
- done = true;
- }
- }
- }
+// timer += Time.deltaTime;
+// progress = timer / duration;
+// if (deCompressProgress == null || deCompressProgress.done)
+// {
+// waitTimer += Time.deltaTime;
+// if (waitTimer > 2f)
+// {
+// done = true;
+// }
+// }
+// }
-}
\ No newline at end of file
+// }
\ No newline at end of file
diff --git a/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs b/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
index 2dc7886..c45a2ef 100644
--- a/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
+++ b/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
@@ -58,14 +58,14 @@
// done = true;
//}
- public override void End()
+ public override async void End()
{
if (AssetSource.isUseAssetBundle)
{
// YooAsset 宸插湪 Launch 闃舵鍒濆鍖栧唴缃祫婧愶紝涓嶅啀闇�瑕� AssetBundleUtility.InitBuiltInAsset()
// YooAssetInitializer.Instance.DefaultPackage 宸插寘鍚唴缃祫婧�
- LaunchInHot.Instance.InitSystemMgr();
+ await LaunchInHot.Instance.InitSystemMgr();
// 杩欓噷杩樻病寮�濮嬪姞杞介厤缃� 浣嗘槸鎻愬墠鍔犺浇浜嗕緵LaunchWin浣跨敤
@@ -86,7 +86,7 @@
return;
}
- if (!PriorLanguageConfig.isInit || !InitialFunctionConfig.isInit)
+ if (!(PriorLanguageConfig.isInit && InitialFunctionConfig.isInit))
{
return;
}
@@ -151,9 +151,9 @@
}
}
- private void IosCopyAsset()
+ private async void IosCopyAsset()
{
- if (!VersionUtility.Instance.InIosAuditTime())
+ if (!await VersionUtility.Instance.InIosAuditTime())
{
if (!SDKUtils.builtinAssetCopyFinished)
{
@@ -198,7 +198,10 @@
File.Copy(fromPath, toPath, true);
}
- LocalSave.SetString("BuiltInAssetCopyCompleted_IOSorStandalone", VersionConfig.Get().version);
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ LocalSave.SetString("BuiltInAssetCopyCompleted_IOSorStandalone", config.version);
+ }).Forget();
}
}
}
diff --git a/Main/Core/GameEngine/Launch/CheckAssetValidTask.cs b/Main/Core/GameEngine/Launch/CheckAssetValidTask.cs
index a9bf147..0ad6355 100644
--- a/Main/Core/GameEngine/Launch/CheckAssetValidTask.cs
+++ b/Main/Core/GameEngine/Launch/CheckAssetValidTask.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class CheckAssetValidTask : LaunchTask
@@ -16,34 +17,41 @@
LaunchInHot.m_CurrentStage = LaunchStage.CheckAsset;
duration = Mathf.Max(0.5f, expectTime);
- ServerListCenter.Instance.RequestJumpUrl();
+ ServerListCenter.Instance.RequestJumpUrl().Forget();
// TODO YYL
// OperationLogCollect.Instance.RecordLauchEvent(2);
// OperationLogCollect.Instance.RecordEvent(2);
- if (VersionUtility.Instance.NeedDownAsset())
+ VersionConfig.GetAsync().ContinueWith(config =>
{
- var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/config/PriorBundle.txt");
- var localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, "config/PriorBundle.txt");
- var downloadTask = new DownloadHotTask(remoteURL, localURL);
- downloadTask.BeginDownload(AssetVersionUtility.OnDownLoadPriorBundle);
+ if (VersionUtility.Instance.NeedDownAsset())
+ {
+ var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, "/config/PriorBundle.txt");
+ var localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, "config/PriorBundle.txt");
+ var downloadTask = new DownloadHotTask(remoteURL, localURL);
+ downloadTask.BeginDownload(AssetVersionUtility.OnDownLoadPriorBundle);
- remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, $"/config/{VersionConfig.Get().appId}OPConfig.txt");
- localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, "config/OPConfig.txt");
- var downloadTask2 = new DownloadHotTask(remoteURL, localURL);
- downloadTask2.BeginDownload(AssetVersionUtility.OnDownLoadOPConfig);
- //AssetVersionUtility.GetAssetVersionFile();
- done = false;
- progress = 0f;
- }
- else
- {
- //if (Application.isEditor)
- // PatchLoader.InitLocalPatchAsset();
- done = true;
- }
+ remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, $"/config/{config.appId}OPConfig.txt");
+ localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, "config/OPConfig.txt");
+ var downloadTask2 = new DownloadHotTask(remoteURL, localURL);
+ downloadTask2.BeginDownload(AssetVersionUtility.OnDownLoadOPConfig);
+ //AssetVersionUtility.GetAssetVersionFile();
+ done = false;
+ progress = 0f;
+ }
+ else
+ {
+ //if (Application.isEditor)
+ // PatchLoader.InitLocalPatchAsset();
+ done = true;
+ }
+
+
+ }).Forget();
+
+
}
public override void End()
diff --git a/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs b/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs
index 77cee0b..f282146 100644
--- a/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs
+++ b/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using Cysharp.Threading.Tasks;
public class GetVersionInfoTask : LaunchTask
{
@@ -34,16 +35,20 @@
}
else
{
- if (!VersionUtility.Instance.InIosAuditTime())
+ VersionUtility.Instance.InIosAuditTime().ContinueWith(isInAuditTime =>
{
- VersionUtility.Instance.RequestVersionCheck();
- done = false;
- progress = 0f;
- }
- else
- {
- done = true;
- }
+ if (!isInAuditTime)
+ {
+ VersionUtility.Instance.RequestVersionCheck();
+ done = false;
+ progress = 0f;
+ }
+ else
+ {
+ done = true;
+ }
+ }).Forget();
+
}
}
diff --git a/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs b/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
index 3ce7dce..99d4d08 100644
--- a/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
+++ b/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class LaunchFadeOutTask : LaunchTask
{
public override float expectTime
@@ -15,7 +16,11 @@
LaunchInHot.m_CurrentStage = LaunchStage.Complete;
duration = 0.5f;
- ShaderUtility.WarmUpAll();
+ ShaderUtility.WarmUpAllAsync().ContinueWith(() =>
+ {
+ Debug.LogError("warm up shader complete");
+ done = true;
+ }).Forget();
//SpeechTranslate.Instance.RequestGetToken();
@@ -60,11 +65,11 @@
if (timer >= 0.5f)//&& ILLauncherProxy.Instance.started)
{
- done = true;
+ // done = true;
}
else
{
- done = false;
+ // done = false;
progress = Mathf.Clamp01(timer / expectTime);
}
diff --git a/Main/Core/GameEngine/Launch/LaunchInHot.cs b/Main/Core/GameEngine/Launch/LaunchInHot.cs
index 2003d76..bb29ec1 100644
--- a/Main/Core/GameEngine/Launch/LaunchInHot.cs
+++ b/Main/Core/GameEngine/Launch/LaunchInHot.cs
@@ -1,8 +1,9 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
using System.IO;
+using Cysharp.Threading.Tasks;
public class LaunchInHot : SingletonMonobehaviour<LaunchInHot>
{
@@ -17,19 +18,38 @@
float surplusProgress = 0f;
float surplusTime = 0f;
+ bool launchStartFinish = false;
+
public Action OnApplicationOut = null;
- void Start()
+ async void Start()
+ {
+ launchStartFinish = false;
+ try
+ {
+ await StartAsync();
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError($"[LaunchInHot] Start 鍒濆鍖栧紓甯革紝娓告垙鏃犳硶缁х画: {ex}");
+ return; // launchStartFinish 淇濇寔 false锛孶pdate 浼氫竴鐩寸瓑寰咃紙涓嶄細杩涘叆 Main.Init锛�
+ }
+ launchStartFinish = true;
+ }
+
+ async UniTask StartAsync()
{
System.Net.ServicePointManager.DefaultConnectionLimit = 100;//璁剧疆http鏈�澶ц繛鎺ユ暟
Application.backgroundLoadingPriority = ThreadPriority.High;
Screen.sleepTimeout = SleepTimeout.NeverSleep;
+ await VersionConfig.GetAsync(); // 纭繚 VersionConfig.config 鍦� SDKUtils.Init() 鍓嶅凡鍔犺浇
+
SDKUtils.Instance.Init(); //鍘焥dk鎺ュ彛
if (!AssetSource.isUseAssetBundle)
{
- InitSystemMgr();
+ await InitSystemMgr();
UIManager.Instance.OpenWindowAsync<LaunchWin>().Forget();
@@ -39,7 +59,12 @@
var yooAssetInitTask = new YooAssetInitTask();
tasks.Enqueue(yooAssetInitTask);
// AssetBundleInitTask removed 鈥� YooAssetInitTask handles all resource system initialization
-#if !UNITY_WEBGL
+#if UNITY_WEBGL
+ // WebGL 涓嶄娇鐢� BuiltInAssetCopyTask锛堟棤闇�鎷疯礉鍐呯疆璧勬簮锛夛紝
+ // 浣嗕粛闇�鍦� YooAsset 鍒濆鍖栧悗璋冪敤 InitSystemMgr 鍒濆鍖� UIManager 绛夈��
+ var webGLSystemInitTask = new WebGLSystemInitTask();
+ tasks.Enqueue(webGLSystemInitTask);
+#else
var builtInAssetCopyTask = new BuiltInAssetCopyTask();
tasks.Enqueue(builtInAssetCopyTask);
#endif
@@ -83,6 +108,9 @@
//tasks.Enqueue(assetCopyTask);
tasks.Enqueue(getVersionInfoTask);
break;
+ case RuntimePlatform.WebGLPlayer:
+ tasks.Enqueue(getVersionInfoTask);
+ break;
}
tasks.Enqueue(checkAssetValidTask);
@@ -93,19 +121,24 @@
tasks.Enqueue(launchFadeOutTask);
CalculateExpectTotalTime();
-
}
- public void InitSystemMgr()
+ public async UniTask InitSystemMgr()
{
+ SpriteAtlasHandler.Register();
ResManager.Instance.Init();
- UIManager.Instance.Init();
- StageManager.Instance.Init();
- LoginManager.Instance.Init();
+ await UIManager.Instance.Init();
+ await StageManager.Instance.Init();
+ await LoginManager.Instance.Init();
}
void Update()
{
+ if (!launchStartFinish)
+ {
+ return;
+ }
+
if (!launchComplete)
{
if (currentTask == null)
@@ -113,10 +146,12 @@
if (tasks.Count > 0)
{
currentTask = tasks.Dequeue();
+ Debug.LogError("start currentTask is " + currentTask.GetType().Name);
currentTask.Begin();
}
else
{
+ Debug.LogError("launchComplete = true");
launchComplete = true;
}
}
diff --git a/Main/Core/GameEngine/Launch/RequestPermissionStart.cs b/Main/Core/GameEngine/Launch/RequestPermissionStart.cs
index 6ee458a..dc5c223 100644
--- a/Main/Core/GameEngine/Launch/RequestPermissionStart.cs
+++ b/Main/Core/GameEngine/Launch/RequestPermissionStart.cs
@@ -1,4 +1,5 @@
-锘�
+锘縰sing Cysharp.Threading.Tasks;
+
//鍚屾剰闅愮鏉冮檺鍚庢墠鍙互鐢宠鏉冮檺
public class RequestPermissionStart : LaunchTask
{
diff --git a/Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs b/Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs
new file mode 100644
index 0000000..6078ac6
--- /dev/null
+++ b/Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs
@@ -0,0 +1,41 @@
+using Cysharp.Threading.Tasks;
+using UnityEngine;
+
+/// <summary>
+/// WebGL 骞冲彴涓撶敤绯荤粺鍒濆鍖栦换鍔°��
+/// 鍥犱负 BuiltInAssetCopyTask 琚� #if !UNITY_WEBGL 鎺掗櫎锛�
+/// 鎵�浠� WebGL 闇�瑕佷竴涓嫭绔嬩换鍔″湪 YooAsset 鍒濆鍖栧畬鎴愬悗
+/// 璋冪敤 InitSystemMgr() 鍒濆鍖� UIManager銆丼tageManager 绛夛紝骞舵樉绀� LaunchWin銆�
+/// </summary>
+public class WebGLSystemInitTask : LaunchTask
+{
+ public override float expectTime
+ {
+ get { return LocalSave.GetFloat("WebGLSystemInitTask_ExpectTime", 0.5f); }
+ protected set { LocalSave.SetFloat("WebGLSystemInitTask_ExpectTime", value); }
+ }
+
+ public override void Begin()
+ {
+ duration = 0.5f;
+ done = true;
+ }
+
+ public override async void End()
+ {
+ expectTime = timer;
+ Debug.LogFormat("{0}鎵ц鏃堕暱锛歿1}锛�", GetType().Name, timer);
+
+ await LaunchInHot.Instance.InitSystemMgr();
+
+ UIManager.Instance.OpenWindowAsync<LaunchWin>().Forget();
+
+ UIManager.Instance.CloseWindow<DownLoadWin>();
+ UIManager.Instance.CloseWindow<VersionUpdateWin>();
+ }
+
+ public override void Update()
+ {
+ if (done) return;
+ }
+}
diff --git a/Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs.meta b/Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs.meta
new file mode 100644
index 0000000..77f0286
--- /dev/null
+++ b/Main/Core/GameEngine/Launch/WebGLSystemInitTask.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 19bb1b490eaec714882b825f8dfe89ef
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0104_tagServerDisconnect.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0104_tagServerDisconnect.cs
index 7b39cfd..6b6d58d 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0104_tagServerDisconnect.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0104_tagServerDisconnect.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using System.Collections;
using System;
+using Cysharp.Threading.Tasks;
//01 04 鏂嚎#tagServerDisconnect
@@ -15,19 +16,23 @@
ServerForceExitHintWin.reason = vNetData.Reason;
LoginManager.Instance.busy = false;
- if (VersionConfig.Get().versionAuthority == VersionAuthority.Release)
+ VersionConfig.GetAsync().ContinueWith(config =>
{
- if (vNetData.Reason == 1 || vNetData.Reason == 110)
+ if (config.versionAuthority == VersionAuthority.Release)
{
- SDKUtils.Instance.FreePlatformLoginout();
- LoginManager.Instance.sdkLogined = false;
+ if (vNetData.Reason == 1 || vNetData.Reason == 110)
+ {
+ SDKUtils.Instance.FreePlatformLoginout();
+ LoginManager.Instance.sdkLogined = false;
+ }
+ else
+ GameNetSystem.Instance.LoginOut();
}
else
GameNetSystem.Instance.LoginOut();
- }
- else
- GameNetSystem.Instance.LoginOut();
- NetLinkWin.Hide();
+ NetLinkWin.Hide();
+ }).Forget();
+
}
catch (Exception ex)
diff --git a/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs b/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
index 91690fb..c968dad 100644
--- a/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
+++ b/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
public class ConnectedState : NetState
{
diff --git a/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs b/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs
index d5bde02..77d8fca 100644
--- a/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs
+++ b/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class RoleLoginState : NetState
{
diff --git a/Main/Core/NetworkPackage/Socket/ClientSocket.cs b/Main/Core/NetworkPackage/Socket/ClientSocket.cs
index 8c64874..12a16c2 100644
--- a/Main/Core/NetworkPackage/Socket/ClientSocket.cs
+++ b/Main/Core/NetworkPackage/Socket/ClientSocket.cs
@@ -60,6 +60,10 @@
Action<bool> onConnected = null;
Queue<byte[]> sendQueue = new Queue<byte[]>();
static byte[] vCmdBytes = new byte[2];
+#if UNITY_WEBGL
+ string webSocketUrl;
+ bool webSocketOpened;
+#endif
public ClientSocket(ServerType type)
{
@@ -437,13 +441,15 @@
ip = _ip;
port = _port;
onConnected = _onConnected;
-
- string url = $"ws://{_ip}:{_port}";
- Debug.Log($"[ClientSocket-WebSocket] 寮�濮嬭繛鎺�: {url}");
+
+ var scheme = Application.absoluteURL.StartsWith("https://", StringComparison.OrdinalIgnoreCase) ? "wss" : "ws";
+ webSocketUrl = $"{scheme}://{_ip}:{_port}";
+ webSocketOpened = false;
+ Debug.Log($"[ClientSocket-WebSocket] 寮�濮嬭繛鎺�: {webSocketUrl}, pageUrl={Application.absoluteURL}");
try
{
- webSocket = new WebSocket(url);
+ webSocket = new WebSocket(webSocketUrl);
// 娉ㄥ唽WebSocket鍥炶皟
webSocket.OnOpen += OnWebSocketOpen;
@@ -466,7 +472,8 @@
private void OnWebSocketOpen()
{
- Debug.Log("[ClientSocket-WebSocket] 杩炴帴鎴愬姛");
+ webSocketOpened = true;
+ Debug.Log($"[ClientSocket-WebSocket] 杩炴帴鎴愬姛: {webSocketUrl}");
m_LastPackageTime = DateTime.Now;
if (onConnected != null)
@@ -545,11 +552,21 @@
private void OnWebSocketError(string error)
{
Debug.LogError($"[ClientSocket-WebSocket] 閿欒: {error}");
+ if (!webSocketOpened && onConnected != null)
+ {
+ onConnected(false);
+ onConnected = null;
+ }
}
private void OnWebSocketClose(WebSocketCloseCode code)
{
- Debug.Log($"[ClientSocket-WebSocket] 杩炴帴鍏抽棴: {code}");
+ Debug.LogError($"[ClientSocket-WebSocket] 杩炴帴鍏抽棴: code={code}, url={webSocketUrl}, opened={webSocketOpened}");
+ if (!webSocketOpened && onConnected != null)
+ {
+ onConnected(false);
+ onConnected = null;
+ }
OnDisconnected?.Invoke();
}
diff --git a/Main/Core/Platform/DouyinPlatform.cs b/Main/Core/Platform/DouyinPlatform.cs
index 04adc3d..fb32988 100644
--- a/Main/Core/Platform/DouyinPlatform.cs
+++ b/Main/Core/Platform/DouyinPlatform.cs
@@ -1,193 +1,193 @@
-using System;
-using System.Runtime.InteropServices;
-using Cysharp.Threading.Tasks;
-using UnityEngine;
+// using System;
+// using System.Runtime.InteropServices;
+// using Cysharp.Threading.Tasks;
+// using UnityEngine;
-/// <summary>
-/// 鎶栭煶灏忔父鎴忓钩鍙板疄鐜�
-/// </summary>
-public class DouyinPlatform : IPlatformService
-{
- #if UNITY_WEBGL && !UNITY_EDITOR
- // JavaScript 鎻掍欢鏂规硶澹版槑
- [DllImport("__Internal")]
- private static extern bool TT_Init();
+// /// <summary>
+// /// 鎶栭煶灏忔父鎴忓钩鍙板疄鐜�
+// /// </summary>
+// public class DouyinPlatform : IPlatformService
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // JavaScript 鎻掍欢鏂规硶澹版槑
+// [DllImport("__Internal")]
+// private static extern bool TT_Init();
- [DllImport("__Internal")]
- private static extern void TT_Login(string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void TT_Login(string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern string TT_GetSystemInfo();
+// [DllImport("__Internal")]
+// private static extern string TT_GetSystemInfo();
- [DllImport("__Internal")]
- private static extern void TT_ShareAppMessage(string title, string imageUrl);
+// [DllImport("__Internal")]
+// private static extern void TT_ShareAppMessage(string title, string imageUrl);
- [DllImport("__Internal")]
- private static extern void TT_CreateRewardedVideoAd(string adUnitId, string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void TT_CreateRewardedVideoAd(string adUnitId, string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern void TT_SetStorageSync(string key, string value);
+// [DllImport("__Internal")]
+// private static extern void TT_SetStorageSync(string key, string value);
- [DllImport("__Internal")]
- private static extern string TT_GetStorageSync(string key);
+// [DllImport("__Internal")]
+// private static extern string TT_GetStorageSync(string key);
- [DllImport("__Internal")]
- private static extern void TT_VibrateShort();
+// [DllImport("__Internal")]
+// private static extern void TT_VibrateShort();
- [DllImport("__Internal")]
- private static extern void TT_VibrateLong();
- #endif
+// [DllImport("__Internal")]
+// private static extern void TT_VibrateLong();
+// #endif
- private SystemInfo _cachedSystemInfo;
- private bool _isInitialized = false;
+// private SystemInfo _cachedSystemInfo;
+// private bool _isInitialized = false;
- public async UniTask<bool> InitAsync()
- {
- Debug.Log("[DouyinPlatform] 鍒濆鍖栨姈闊冲皬娓告垙骞冲彴");
+// public async UniTask<bool> InitAsync()
+// {
+// Debug.Log("[DouyinPlatform] 鍒濆鍖栨姈闊冲皬娓告垙骞冲彴");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- _isInitialized = TT_Init();
- if (_isInitialized)
- {
- _cachedSystemInfo = GetSystemInfo();
- Debug.Log("[DouyinPlatform] 鍒濆鍖栨垚鍔�");
- }
- return _isInitialized;
- }
- catch (Exception e)
- {
- Debug.LogError($"[DouyinPlatform] 鍒濆鍖栧け璐�: {e.Message}");
- return false;
- }
- #else
- await UniTask.Delay(100);
- _isInitialized = true;
- _cachedSystemInfo = CreateMockSystemInfo();
- return true;
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// _isInitialized = TT_Init();
+// if (_isInitialized)
+// {
+// _cachedSystemInfo = GetSystemInfo();
+// Debug.Log("[DouyinPlatform] 鍒濆鍖栨垚鍔�");
+// }
+// return _isInitialized;
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[DouyinPlatform] 鍒濆鍖栧け璐�: {e.Message}");
+// return false;
+// }
+// #else
+// await UniTask.Delay(100);
+// _isInitialized = true;
+// _cachedSystemInfo = CreateMockSystemInfo();
+// return true;
+// #endif
+// }
- public PlatformType GetPlatformType()
- {
- return PlatformType.Douyin;
- }
+// public PlatformType GetPlatformType()
+// {
+// return PlatformType.Douyin;
+// }
- public async UniTask<LoginResult> LoginAsync()
- {
- Debug.Log("[DouyinPlatform] 寮�濮嬬櫥褰�");
+// public async UniTask<LoginResult> LoginAsync()
+// {
+// Debug.Log("[DouyinPlatform] 寮�濮嬬櫥褰�");
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 瀹炵幇鎶栭煶鐧诲綍閫昏緫
- await UniTask.Delay(500);
- return new LoginResult { Success = true, UserId = "douyin_user" };
- #else
- await UniTask.Delay(500);
- return new LoginResult { Success = true, UserId = "douyin_test_user" };
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 瀹炵幇鎶栭煶鐧诲綍閫昏緫
+// await UniTask.Delay(500);
+// return new LoginResult { Success = true, UserId = "douyin_user" };
+// #else
+// await UniTask.Delay(500);
+// return new LoginResult { Success = true, UserId = "douyin_test_user" };
+// #endif
+// }
- public async UniTask<bool> ShareAsync(ShareData shareData)
- {
- Debug.Log($"[DouyinPlatform] 鍒嗕韩: {shareData.Title}");
+// public async UniTask<bool> ShareAsync(ShareData shareData)
+// {
+// Debug.Log($"[DouyinPlatform] 鍒嗕韩: {shareData.Title}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- TT_ShareAppMessage(shareData.Title, shareData.ImageUrl);
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// TT_ShareAppMessage(shareData.Title, shareData.ImageUrl);
+// #endif
- await UniTask.Delay(300);
- return true;
- }
+// await UniTask.Delay(300);
+// return true;
+// }
- public async UniTask<AdResult> ShowAdAsync(AdType adType)
- {
- Debug.Log($"[DouyinPlatform] 鏄剧ず骞垮憡: {adType}");
+// public async UniTask<AdResult> ShowAdAsync(AdType adType)
+// {
+// Debug.Log($"[DouyinPlatform] 鏄剧ず骞垮憡: {adType}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 瀹炵幇鎶栭煶骞垮憡閫昏緫
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 瀹炵幇鎶栭煶骞垮憡閫昏緫
+// #endif
- await UniTask.Delay(1000);
- return new AdResult { Success = true, Completed = true };
- }
+// await UniTask.Delay(1000);
+// return new AdResult { Success = true, Completed = true };
+// }
- public async UniTask<bool> SaveDataAsync(string key, string value)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- TT_SetStorageSync(key, value);
- #endif
- await UniTask.Yield();
- return true;
- }
+// public async UniTask<bool> SaveDataAsync(string key, string value)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// TT_SetStorageSync(key, value);
+// #endif
+// await UniTask.Yield();
+// return true;
+// }
- public async UniTask<string> LoadDataAsync(string key)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- string value = TT_GetStorageSync(key);
- await UniTask.Yield();
- return value;
- #else
- await UniTask.Yield();
- return null;
- #endif
- }
+// public async UniTask<string> LoadDataAsync(string key)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// string value = TT_GetStorageSync(key);
+// await UniTask.Yield();
+// return value;
+// #else
+// await UniTask.Yield();
+// return null;
+// #endif
+// }
- public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
- {
- Debug.Log($"[DouyinPlatform] 涓嬭浇鏂囦欢: {url}");
- await UniTask.Delay(500);
- return localPath;
- }
+// public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
+// {
+// Debug.Log($"[DouyinPlatform] 涓嬭浇鏂囦欢: {url}");
+// await UniTask.Delay(500);
+// return localPath;
+// }
- public SystemInfo GetSystemInfo()
- {
- if (_cachedSystemInfo != null)
- return _cachedSystemInfo;
+// public SystemInfo GetSystemInfo()
+// {
+// if (_cachedSystemInfo != null)
+// return _cachedSystemInfo;
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- string jsonInfo = TT_GetSystemInfo();
- _cachedSystemInfo = JsonUtility.FromJson<SystemInfo>(jsonInfo);
- return _cachedSystemInfo;
- }
- catch (Exception e)
- {
- Debug.LogError($"[DouyinPlatform] 鑾峰彇绯荤粺淇℃伅澶辫触: {e.Message}");
- return CreateMockSystemInfo();
- }
- #else
- return CreateMockSystemInfo();
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// string jsonInfo = TT_GetSystemInfo();
+// _cachedSystemInfo = JsonUtility.FromJson<SystemInfo>(jsonInfo);
+// return _cachedSystemInfo;
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[DouyinPlatform] 鑾峰彇绯荤粺淇℃伅澶辫触: {e.Message}");
+// return CreateMockSystemInfo();
+// }
+// #else
+// return CreateMockSystemInfo();
+// #endif
+// }
- public void Vibrate(VibrationType vibrationType)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- switch (vibrationType)
- {
- case VibrationType.Light:
- case VibrationType.Medium:
- TT_VibrateShort();
- break;
- case VibrationType.Heavy:
- TT_VibrateLong();
- break;
- }
- #endif
- }
+// public void Vibrate(VibrationType vibrationType)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// switch (vibrationType)
+// {
+// case VibrationType.Light:
+// case VibrationType.Medium:
+// TT_VibrateShort();
+// break;
+// case VibrationType.Heavy:
+// TT_VibrateLong();
+// break;
+// }
+// #endif
+// }
- private SystemInfo CreateMockSystemInfo()
- {
- return new SystemInfo
- {
- DeviceModel = UnityEngine.SystemInfo.deviceModel,
- PlatformVersion = "Douyin 1.0.0",
- ScreenWidth = Screen.width,
- ScreenHeight = Screen.height,
- SafeArea = SafeAreaData.FromRect(Screen.safeArea),
- PixelRatio = Screen.dpi / 160f
- };
- }
-}
+// private SystemInfo CreateMockSystemInfo()
+// {
+// return new SystemInfo
+// {
+// DeviceModel = UnityEngine.SystemInfo.deviceModel,
+// PlatformVersion = "Douyin 1.0.0",
+// ScreenWidth = Screen.width,
+// ScreenHeight = Screen.height,
+// SafeArea = SafeAreaData.FromRect(Screen.safeArea),
+// PixelRatio = Screen.dpi / 160f
+// };
+// }
+// }
diff --git a/Main/Core/Platform/PlatformFactory.cs b/Main/Core/Platform/PlatformFactory.cs
index 3882365..db91460 100644
--- a/Main/Core/Platform/PlatformFactory.cs
+++ b/Main/Core/Platform/PlatformFactory.cs
@@ -1,85 +1,85 @@
-using UnityEngine;
+// using UnityEngine;
-/// <summary>
-/// 骞冲彴宸ュ巶绫伙紝鐢ㄤ簬鍒涘缓瀵瑰簲骞冲彴鐨勫疄鐜�
-/// </summary>
-public static class PlatformFactory
-{
- private static IPlatformService _currentPlatform;
- private static PlatformType? _forcedPlatformType;
+// /// <summary>
+// /// 骞冲彴宸ュ巶绫伙紝鐢ㄤ簬鍒涘缓瀵瑰簲骞冲彴鐨勫疄鐜�
+// /// </summary>
+// public static class PlatformFactory
+// {
+// private static IPlatformService _currentPlatform;
+// private static PlatformType? _forcedPlatformType;
- /// <summary>
- /// 鑾峰彇褰撳墠骞冲彴瀹炰緥
- /// </summary>
- public static IPlatformService GetCurrent()
- {
- if (_currentPlatform == null)
- {
- _currentPlatform = CreatePlatform();
- }
- return _currentPlatform;
- }
+// /// <summary>
+// /// 鑾峰彇褰撳墠骞冲彴瀹炰緥
+// /// </summary>
+// public static IPlatformService GetCurrent()
+// {
+// if (_currentPlatform == null)
+// {
+// _currentPlatform = CreatePlatform();
+// }
+// return _currentPlatform;
+// }
- /// <summary>
- /// 寮哄埗鎸囧畾骞冲彴绫诲瀷锛堢敤浜庢祴璇曪級
- /// </summary>
- public static void ForcePlatform(PlatformType platformType)
- {
- _forcedPlatformType = platformType;
- _currentPlatform = null; // 閲嶇疆褰撳墠骞冲彴
- }
+// /// <summary>
+// /// 寮哄埗鎸囧畾骞冲彴绫诲瀷锛堢敤浜庢祴璇曪級
+// /// </summary>
+// public static void ForcePlatform(PlatformType platformType)
+// {
+// _forcedPlatformType = platformType;
+// _currentPlatform = null; // 閲嶇疆褰撳墠骞冲彴
+// }
- /// <summary>
- /// 鍒涘缓骞冲彴瀹炰緥
- /// </summary>
- private static IPlatformService CreatePlatform()
- {
- PlatformType platformType = DetectPlatformType();
+// /// <summary>
+// /// 鍒涘缓骞冲彴瀹炰緥
+// /// </summary>
+// private static IPlatformService CreatePlatform()
+// {
+// PlatformType platformType = DetectPlatformType();
- switch (platformType)
- {
- case PlatformType.WeChat:
- Debug.Log("[PlatformFactory] 鍒涘缓寰俊灏忔父鎴忓钩鍙板疄渚�");
- return new WeChatPlatform();
+// switch (platformType)
+// {
+// case PlatformType.WeChat:
+// Debug.Log("[PlatformFactory] 鍒涘缓寰俊灏忔父鎴忓钩鍙板疄渚�");
+// return new WeChatPlatform();
- case PlatformType.Douyin:
- Debug.Log("[PlatformFactory] 鍒涘缓鎶栭煶灏忔父鎴忓钩鍙板疄渚�");
- return new DouyinPlatform();
+// case PlatformType.Douyin:
+// Debug.Log("[PlatformFactory] 鍒涘缓鎶栭煶灏忔父鎴忓钩鍙板疄渚�");
+// return new DouyinPlatform();
- case PlatformType.Vivo:
- Debug.Log("[PlatformFactory] 鍒涘缓vivo灏忔父鎴忓钩鍙板疄渚�");
- return new VivoPlatform();
+// case PlatformType.Vivo:
+// Debug.Log("[PlatformFactory] 鍒涘缓vivo灏忔父鎴忓钩鍙板疄渚�");
+// return new VivoPlatform();
- case PlatformType.Standalone:
- default:
- Debug.Log("[PlatformFactory] 鍒涘缓缂栬緫鍣ㄦ祴璇曞钩鍙板疄渚�");
- return new StandalonePlatform();
- }
- }
+// case PlatformType.Standalone:
+// default:
+// Debug.Log("[PlatformFactory] 鍒涘缓缂栬緫鍣ㄦ祴璇曞钩鍙板疄渚�");
+// return new StandalonePlatform();
+// }
+// }
- /// <summary>
- /// 妫�娴嬪綋鍓嶅钩鍙扮被鍨�
- /// </summary>
- private static PlatformType DetectPlatformType()
- {
- // 濡傛灉寮哄埗鎸囧畾浜嗗钩鍙扮被鍨嬶紝浣跨敤寮哄埗绫诲瀷
- if (_forcedPlatformType.HasValue)
- {
- Debug.Log($"[PlatformFactory] 浣跨敤寮哄埗鎸囧畾鐨勫钩鍙扮被鍨�: {_forcedPlatformType.Value}");
- return _forcedPlatformType.Value;
- }
+// /// <summary>
+// /// 妫�娴嬪綋鍓嶅钩鍙扮被鍨�
+// /// </summary>
+// private static PlatformType DetectPlatformType()
+// {
+// // 濡傛灉寮哄埗鎸囧畾浜嗗钩鍙扮被鍨嬶紝浣跨敤寮哄埗绫诲瀷
+// if (_forcedPlatformType.HasValue)
+// {
+// Debug.Log($"[PlatformFactory] 浣跨敤寮哄埗鎸囧畾鐨勫钩鍙扮被鍨�: {_forcedPlatformType.Value}");
+// return _forcedPlatformType.Value;
+// }
- #if UNITY_EDITOR
- // Unity 缂栬緫鍣ㄧ幆澧�
- return PlatformType.Standalone;
- #elif UNITY_WEBGL
- // WebGL 骞冲彴锛岄渶瑕侀�氳繃 JavaScript 妫�娴嬪叿浣撳钩鍙�
- // TODO: 閫氳繃 Application.ExternalEval 妫�娴嬪井淇°�佹姈闊崇瓑骞冲彴
- // 鏆傛椂榛樿杩斿洖寰俊
- return PlatformType.WeChat;
- #else
- // 鍏朵粬骞冲彴榛樿涓� Standalone
- return PlatformType.Standalone;
- #endif
- }
- }
+// #if UNITY_EDITOR
+// // Unity 缂栬緫鍣ㄧ幆澧�
+// return PlatformType.Standalone;
+// #elif UNITY_WEBGL
+// // WebGL 骞冲彴锛岄渶瑕侀�氳繃 JavaScript 妫�娴嬪叿浣撳钩鍙�
+// // TODO: 閫氳繃 Application.ExternalEval 妫�娴嬪井淇°�佹姈闊崇瓑骞冲彴
+// // 鏆傛椂榛樿杩斿洖寰俊
+// return PlatformType.WeChat;
+// #else
+// // 鍏朵粬骞冲彴榛樿涓� Standalone
+// return PlatformType.Standalone;
+// #endif
+// }
+// }
diff --git a/Main/Core/Platform/StandalonePlatform.cs b/Main/Core/Platform/StandalonePlatform.cs
index f8ba565..52b75e4 100644
--- a/Main/Core/Platform/StandalonePlatform.cs
+++ b/Main/Core/Platform/StandalonePlatform.cs
@@ -1,114 +1,114 @@
-using System;
-using Cysharp.Threading.Tasks;
-using UnityEngine;
+// using System;
+// using Cysharp.Threading.Tasks;
+// using UnityEngine;
-/// <summary>
-/// 缂栬緫鍣ㄦ祴璇曞钩鍙板疄鐜帮紙妯℃嫙骞冲彴琛屼负锛�
-/// </summary>
-public class StandalonePlatform : IPlatformService
-{
- private SystemInfo _cachedSystemInfo;
+// /// <summary>
+// /// 缂栬緫鍣ㄦ祴璇曞钩鍙板疄鐜帮紙妯℃嫙骞冲彴琛屼负锛�
+// /// </summary>
+// public class StandalonePlatform : IPlatformService
+// {
+// private SystemInfo _cachedSystemInfo;
- public async UniTask<bool> InitAsync()
- {
- Debug.Log("[StandalonePlatform] 鍒濆鍖栫紪杈戝櫒娴嬭瘯骞冲彴");
- await UniTask.Delay(100); // 妯℃嫙鍒濆鍖栧欢杩�
- _cachedSystemInfo = CreateMockSystemInfo();
- return true;
- }
+// public async UniTask<bool> InitAsync()
+// {
+// Debug.Log("[StandalonePlatform] 鍒濆鍖栫紪杈戝櫒娴嬭瘯骞冲彴");
+// await UniTask.Delay(100); // 妯℃嫙鍒濆鍖栧欢杩�
+// _cachedSystemInfo = CreateMockSystemInfo();
+// return true;
+// }
- public PlatformType GetPlatformType()
- {
- return PlatformType.Standalone;
- }
+// public PlatformType GetPlatformType()
+// {
+// return PlatformType.Standalone;
+// }
- public async UniTask<LoginResult> LoginAsync()
- {
- Debug.Log("[StandalonePlatform] 妯℃嫙鐧诲綍鎴愬姛");
- await UniTask.Delay(500); // 妯℃嫙缃戠粶寤惰繜
+// public async UniTask<LoginResult> LoginAsync()
+// {
+// Debug.Log("[StandalonePlatform] 妯℃嫙鐧诲綍鎴愬姛");
+// await UniTask.Delay(500); // 妯℃嫙缃戠粶寤惰繜
- return new LoginResult
- {
- Success = true,
- UserId = "test_user_12345",
- Nickname = "娴嬭瘯鐢ㄦ埛",
- AvatarUrl = "https://example.com/avatar.jpg",
- ErrorMessage = null
- };
- }
+// return new LoginResult
+// {
+// Success = true,
+// UserId = "test_user_12345",
+// Nickname = "娴嬭瘯鐢ㄦ埛",
+// AvatarUrl = "https://example.com/avatar.jpg",
+// ErrorMessage = null
+// };
+// }
- public async UniTask<bool> ShareAsync(ShareData shareData)
- {
- Debug.Log($"[StandalonePlatform] 妯℃嫙鍒嗕韩: {shareData.Title}");
- await UniTask.Delay(300);
- return true;
- }
+// public async UniTask<bool> ShareAsync(ShareData shareData)
+// {
+// Debug.Log($"[StandalonePlatform] 妯℃嫙鍒嗕韩: {shareData.Title}");
+// await UniTask.Delay(300);
+// return true;
+// }
- public async UniTask<AdResult> ShowAdAsync(AdType adType)
- {
- Debug.Log($"[StandalonePlatform] 妯℃嫙鏄剧ず骞垮憡: {adType}");
- await UniTask.Delay(2000); // 妯℃嫙骞垮憡鎾斁鏃堕棿
+// public async UniTask<AdResult> ShowAdAsync(AdType adType)
+// {
+// Debug.Log($"[StandalonePlatform] 妯℃嫙鏄剧ず骞垮憡: {adType}");
+// await UniTask.Delay(2000); // 妯℃嫙骞垮憡鎾斁鏃堕棿
- return new AdResult
- {
- Success = true,
- Completed = true, // 妯℃嫙鐢ㄦ埛鐪嬪畬骞垮憡
- ErrorMessage = null
- };
- }
+// return new AdResult
+// {
+// Success = true,
+// Completed = true, // 妯℃嫙鐢ㄦ埛鐪嬪畬骞垮憡
+// ErrorMessage = null
+// };
+// }
- public async UniTask<bool> SaveDataAsync(string key, string value)
- {
- Debug.Log($"[StandalonePlatform] 淇濆瓨鏁版嵁: {key} = {value}");
- await UniTask.Delay(50);
- PlayerPrefs.SetString(key, value);
- PlayerPrefs.Save();
- return true;
- }
+// public async UniTask<bool> SaveDataAsync(string key, string value)
+// {
+// Debug.Log($"[StandalonePlatform] 淇濆瓨鏁版嵁: {key} = {value}");
+// await UniTask.Delay(50);
+// PlayerPrefs.SetString(key, value);
+// PlayerPrefs.Save();
+// return true;
+// }
- public async UniTask<string> LoadDataAsync(string key)
- {
- Debug.Log($"[StandalonePlatform] 鍔犺浇鏁版嵁: {key}");
- await UniTask.Delay(50);
- return PlayerPrefs.GetString(key, null);
- }
+// public async UniTask<string> LoadDataAsync(string key)
+// {
+// Debug.Log($"[StandalonePlatform] 鍔犺浇鏁版嵁: {key}");
+// await UniTask.Delay(50);
+// return PlayerPrefs.GetString(key, null);
+// }
- public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
- {
- Debug.Log($"[StandalonePlatform] 妯℃嫙涓嬭浇鏂囦欢: {url} -> {localPath}");
+// public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
+// {
+// Debug.Log($"[StandalonePlatform] 妯℃嫙涓嬭浇鏂囦欢: {url} -> {localPath}");
- // 妯℃嫙涓嬭浇杩涘害
- for (int i = 0; i <= 10; i++)
- {
- await UniTask.Delay(100);
- onProgress?.Invoke(i / 10f);
- }
+// // 妯℃嫙涓嬭浇杩涘害
+// for (int i = 0; i <= 10; i++)
+// {
+// await UniTask.Delay(100);
+// onProgress?.Invoke(i / 10f);
+// }
- return localPath;
- }
+// return localPath;
+// }
- public SystemInfo GetSystemInfo()
- {
- return _cachedSystemInfo ?? (_cachedSystemInfo = CreateMockSystemInfo());
- }
+// public SystemInfo GetSystemInfo()
+// {
+// return _cachedSystemInfo ?? (_cachedSystemInfo = CreateMockSystemInfo());
+// }
- public void Vibrate(VibrationType vibrationType)
- {
- Debug.Log($"[StandalonePlatform] 妯℃嫙闇囧姩: {vibrationType}");
- // 缂栬緫鍣ㄤ腑鏃犳硶瀹為檯闇囧姩
- }
+// public void Vibrate(VibrationType vibrationType)
+// {
+// Debug.Log($"[StandalonePlatform] 妯℃嫙闇囧姩: {vibrationType}");
+// // 缂栬緫鍣ㄤ腑鏃犳硶瀹為檯闇囧姩
+// }
- private SystemInfo CreateMockSystemInfo()
- {
- return new SystemInfo
- {
- DeviceModel = UnityEngine.SystemInfo.deviceModel,
- SystemVersion = UnityEngine.SystemInfo.operatingSystem,
- PlatformVersion = "Standalone 1.0.0",
- ScreenWidth = Screen.width,
- ScreenHeight = Screen.height,
- SafeArea = SafeAreaData.FromRect(Screen.safeArea),
- PixelRatio = Screen.dpi / 160f
- };
- }
- }
+// private SystemInfo CreateMockSystemInfo()
+// {
+// return new SystemInfo
+// {
+// DeviceModel = UnityEngine.SystemInfo.deviceModel,
+// SystemVersion = UnityEngine.SystemInfo.operatingSystem,
+// PlatformVersion = "Standalone 1.0.0",
+// ScreenWidth = Screen.width,
+// ScreenHeight = Screen.height,
+// SafeArea = SafeAreaData.FromRect(Screen.safeArea),
+// PixelRatio = Screen.dpi / 160f
+// };
+// }
+// }
diff --git a/Main/Core/Platform/VivoPlatform.cs b/Main/Core/Platform/VivoPlatform.cs
index d44640b..d928184 100644
--- a/Main/Core/Platform/VivoPlatform.cs
+++ b/Main/Core/Platform/VivoPlatform.cs
@@ -1,193 +1,193 @@
-using System;
-using System.Runtime.InteropServices;
-using Cysharp.Threading.Tasks;
-using UnityEngine;
+// using System;
+// using System.Runtime.InteropServices;
+// using Cysharp.Threading.Tasks;
+// using UnityEngine;
-/// <summary>
-/// vivo灏忔父鎴忓钩鍙板疄鐜�
-/// </summary>
-public class VivoPlatform : IPlatformService
-{
- #if UNITY_WEBGL && !UNITY_EDITOR
- // JavaScript 鎻掍欢鏂规硶澹版槑
- [DllImport("__Internal")]
- private static extern bool QG_Init();
+// /// <summary>
+// /// vivo灏忔父鎴忓钩鍙板疄鐜�
+// /// </summary>
+// public class VivoPlatform : IPlatformService
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // JavaScript 鎻掍欢鏂规硶澹版槑
+// [DllImport("__Internal")]
+// private static extern bool QG_Init();
- [DllImport("__Internal")]
- private static extern void QG_Login(string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void QG_Login(string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern string QG_GetSystemInfo();
+// [DllImport("__Internal")]
+// private static extern string QG_GetSystemInfo();
- [DllImport("__Internal")]
- private static extern void QG_Share(string title, string imageUrl);
+// [DllImport("__Internal")]
+// private static extern void QG_Share(string title, string imageUrl);
- [DllImport("__Internal")]
- private static extern void QG_CreateRewardedVideoAd(string adUnitId, string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void QG_CreateRewardedVideoAd(string adUnitId, string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern void QG_SetStorageSync(string key, string value);
+// [DllImport("__Internal")]
+// private static extern void QG_SetStorageSync(string key, string value);
- [DllImport("__Internal")]
- private static extern string QG_GetStorageSync(string key);
+// [DllImport("__Internal")]
+// private static extern string QG_GetStorageSync(string key);
- [DllImport("__Internal")]
- private static extern void QG_VibrateShort();
+// [DllImport("__Internal")]
+// private static extern void QG_VibrateShort();
- [DllImport("__Internal")]
- private static extern void QG_VibrateLong();
- #endif
+// [DllImport("__Internal")]
+// private static extern void QG_VibrateLong();
+// #endif
- private SystemInfo _cachedSystemInfo;
- private bool _isInitialized = false;
+// private SystemInfo _cachedSystemInfo;
+// private bool _isInitialized = false;
- public async UniTask<bool> InitAsync()
- {
- Debug.Log("[VivoPlatform] 鍒濆鍖杤ivo灏忔父鎴忓钩鍙�");
+// public async UniTask<bool> InitAsync()
+// {
+// Debug.Log("[VivoPlatform] 鍒濆鍖杤ivo灏忔父鎴忓钩鍙�");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- _isInitialized = QG_Init();
- if (_isInitialized)
- {
- _cachedSystemInfo = GetSystemInfo();
- Debug.Log("[VivoPlatform] 鍒濆鍖栨垚鍔�");
- }
- return _isInitialized;
- }
- catch (Exception e)
- {
- Debug.LogError($"[VivoPlatform] 鍒濆鍖栧け璐�: {e.Message}");
- return false;
- }
- #else
- await UniTask.Delay(100);
- _isInitialized = true;
- _cachedSystemInfo = CreateMockSystemInfo();
- return true;
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// _isInitialized = QG_Init();
+// if (_isInitialized)
+// {
+// _cachedSystemInfo = GetSystemInfo();
+// Debug.Log("[VivoPlatform] 鍒濆鍖栨垚鍔�");
+// }
+// return _isInitialized;
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[VivoPlatform] 鍒濆鍖栧け璐�: {e.Message}");
+// return false;
+// }
+// #else
+// await UniTask.Delay(100);
+// _isInitialized = true;
+// _cachedSystemInfo = CreateMockSystemInfo();
+// return true;
+// #endif
+// }
- public PlatformType GetPlatformType()
- {
- return PlatformType.Vivo;
- }
+// public PlatformType GetPlatformType()
+// {
+// return PlatformType.Vivo;
+// }
- public async UniTask<LoginResult> LoginAsync()
- {
- Debug.Log("[VivoPlatform] 寮�濮嬬櫥褰�");
+// public async UniTask<LoginResult> LoginAsync()
+// {
+// Debug.Log("[VivoPlatform] 寮�濮嬬櫥褰�");
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 瀹炵幇vivo鐧诲綍閫昏緫
- await UniTask.Delay(500);
- return new LoginResult { Success = true, UserId = "vivo_user" };
- #else
- await UniTask.Delay(500);
- return new LoginResult { Success = true, UserId = "vivo_test_user" };
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 瀹炵幇vivo鐧诲綍閫昏緫
+// await UniTask.Delay(500);
+// return new LoginResult { Success = true, UserId = "vivo_user" };
+// #else
+// await UniTask.Delay(500);
+// return new LoginResult { Success = true, UserId = "vivo_test_user" };
+// #endif
+// }
- public async UniTask<bool> ShareAsync(ShareData shareData)
- {
- Debug.Log($"[VivoPlatform] 鍒嗕韩: {shareData.Title}");
+// public async UniTask<bool> ShareAsync(ShareData shareData)
+// {
+// Debug.Log($"[VivoPlatform] 鍒嗕韩: {shareData.Title}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- QG_Share(shareData.Title, shareData.ImageUrl);
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// QG_Share(shareData.Title, shareData.ImageUrl);
+// #endif
- await UniTask.Delay(300);
- return true;
- }
+// await UniTask.Delay(300);
+// return true;
+// }
- public async UniTask<AdResult> ShowAdAsync(AdType adType)
- {
- Debug.Log($"[VivoPlatform] 鏄剧ず骞垮憡: {adType}");
+// public async UniTask<AdResult> ShowAdAsync(AdType adType)
+// {
+// Debug.Log($"[VivoPlatform] 鏄剧ず骞垮憡: {adType}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 瀹炵幇vivo骞垮憡閫昏緫
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 瀹炵幇vivo骞垮憡閫昏緫
+// #endif
- await UniTask.Delay(1000);
- return new AdResult { Success = true, Completed = true };
- }
+// await UniTask.Delay(1000);
+// return new AdResult { Success = true, Completed = true };
+// }
- public async UniTask<bool> SaveDataAsync(string key, string value)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- QG_SetStorageSync(key, value);
- #endif
- await UniTask.Yield();
- return true;
- }
+// public async UniTask<bool> SaveDataAsync(string key, string value)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// QG_SetStorageSync(key, value);
+// #endif
+// await UniTask.Yield();
+// return true;
+// }
- public async UniTask<string> LoadDataAsync(string key)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- string value = QG_GetStorageSync(key);
- await UniTask.Yield();
- return value;
- #else
- await UniTask.Yield();
- return null;
- #endif
- }
+// public async UniTask<string> LoadDataAsync(string key)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// string value = QG_GetStorageSync(key);
+// await UniTask.Yield();
+// return value;
+// #else
+// await UniTask.Yield();
+// return null;
+// #endif
+// }
- public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
- {
- Debug.Log($"[VivoPlatform] 涓嬭浇鏂囦欢: {url}");
- await UniTask.Delay(500);
- return localPath;
- }
+// public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
+// {
+// Debug.Log($"[VivoPlatform] 涓嬭浇鏂囦欢: {url}");
+// await UniTask.Delay(500);
+// return localPath;
+// }
- public SystemInfo GetSystemInfo()
- {
- if (_cachedSystemInfo != null)
- return _cachedSystemInfo;
+// public SystemInfo GetSystemInfo()
+// {
+// if (_cachedSystemInfo != null)
+// return _cachedSystemInfo;
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- string jsonInfo = QG_GetSystemInfo();
- _cachedSystemInfo = JsonUtility.FromJson<SystemInfo>(jsonInfo);
- return _cachedSystemInfo;
- }
- catch (Exception e)
- {
- Debug.LogError($"[VivoPlatform] 鑾峰彇绯荤粺淇℃伅澶辫触: {e.Message}");
- return CreateMockSystemInfo();
- }
- #else
- return CreateMockSystemInfo();
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// string jsonInfo = QG_GetSystemInfo();
+// _cachedSystemInfo = JsonUtility.FromJson<SystemInfo>(jsonInfo);
+// return _cachedSystemInfo;
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[VivoPlatform] 鑾峰彇绯荤粺淇℃伅澶辫触: {e.Message}");
+// return CreateMockSystemInfo();
+// }
+// #else
+// return CreateMockSystemInfo();
+// #endif
+// }
- public void Vibrate(VibrationType vibrationType)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- switch (vibrationType)
- {
- case VibrationType.Light:
- case VibrationType.Medium:
- QG_VibrateShort();
- break;
- case VibrationType.Heavy:
- QG_VibrateLong();
- break;
- }
- #endif
- }
+// public void Vibrate(VibrationType vibrationType)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// switch (vibrationType)
+// {
+// case VibrationType.Light:
+// case VibrationType.Medium:
+// QG_VibrateShort();
+// break;
+// case VibrationType.Heavy:
+// QG_VibrateLong();
+// break;
+// }
+// #endif
+// }
- private SystemInfo CreateMockSystemInfo()
- {
- return new SystemInfo
- {
- DeviceModel = UnityEngine.SystemInfo.deviceModel,
- PlatformVersion = "Vivo 1.0.0",
- ScreenWidth = Screen.width,
- ScreenHeight = Screen.height,
- SafeArea = SafeAreaData.FromRect(Screen.safeArea),
- PixelRatio = Screen.dpi / 160f
- };
- }
-}
+// private SystemInfo CreateMockSystemInfo()
+// {
+// return new SystemInfo
+// {
+// DeviceModel = UnityEngine.SystemInfo.deviceModel,
+// PlatformVersion = "Vivo 1.0.0",
+// ScreenWidth = Screen.width,
+// ScreenHeight = Screen.height,
+// SafeArea = SafeAreaData.FromRect(Screen.safeArea),
+// PixelRatio = Screen.dpi / 160f
+// };
+// }
+// }
diff --git a/Main/Core/Platform/WeChatPlatform.cs b/Main/Core/Platform/WeChatPlatform.cs
index 92d2e5b..8a0d8fe 100644
--- a/Main/Core/Platform/WeChatPlatform.cs
+++ b/Main/Core/Platform/WeChatPlatform.cs
@@ -1,256 +1,256 @@
-using System;
-using System.Runtime.InteropServices;
-using Cysharp.Threading.Tasks;
-using UnityEngine;
+// using System;
+// using System.Runtime.InteropServices;
+// using Cysharp.Threading.Tasks;
+// using UnityEngine;
-/// <summary>
-/// 寰俊灏忔父鎴忓钩鍙板疄鐜�
-/// </summary>
-public class WeChatPlatform : IPlatformService
-{
- #if UNITY_WEBGL && !UNITY_EDITOR
- // JavaScript 鎻掍欢鏂规硶澹版槑
- [DllImport("__Internal")]
- private static extern void WX_Init();
+// /// <summary>
+// /// 寰俊灏忔父鎴忓钩鍙板疄鐜�
+// /// </summary>
+// public class WeChatPlatform : IPlatformService
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // JavaScript 鎻掍欢鏂规硶澹版槑
+// [DllImport("__Internal")]
+// private static extern void WX_Init();
- [DllImport("__Internal")]
- private static extern void WX_Login(string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void WX_Login(string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern void WX_GetSystemInfo(string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void WX_GetSystemInfo(string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern void WX_ShareAppMessage(string title, string imageUrl);
+// [DllImport("__Internal")]
+// private static extern void WX_ShareAppMessage(string title, string imageUrl);
- [DllImport("__Internal")]
- private static extern void WX_CreateRewardedVideoAd(string adUnitId, string callbackObjectName, string callbackMethodName);
+// [DllImport("__Internal")]
+// private static extern void WX_CreateRewardedVideoAd(string adUnitId, string callbackObjectName, string callbackMethodName);
- [DllImport("__Internal")]
- private static extern void WX_SetStorageSync(string key, string value);
+// [DllImport("__Internal")]
+// private static extern void WX_SetStorageSync(string key, string value);
- [DllImport("__Internal")]
- private static extern string WX_GetStorageSync(string key);
+// [DllImport("__Internal")]
+// private static extern string WX_GetStorageSync(string key);
- [DllImport("__Internal")]
- private static extern void WX_VibrateShort();
+// [DllImport("__Internal")]
+// private static extern void WX_VibrateShort();
- [DllImport("__Internal")]
- private static extern void WX_VibrateLong();
- #endif
+// [DllImport("__Internal")]
+// private static extern void WX_VibrateLong();
+// #endif
- private SystemInfo _cachedSystemInfo;
- private bool _isInitialized = false;
+// private SystemInfo _cachedSystemInfo;
+// private bool _isInitialized = false;
- public async UniTask<bool> InitAsync()
- {
- Debug.Log("[WeChatPlatform] 鍒濆鍖栧井淇″皬娓告垙骞冲彴");
+// public async UniTask<bool> InitAsync()
+// {
+// Debug.Log("[WeChatPlatform] 鍒濆鍖栧井淇″皬娓告垙骞冲彴");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- WX_Init();
- _isInitialized = true;
- Debug.Log("[WeChatPlatform] 寰俊SDK鍒濆鍖栨垚鍔�");
- }
- catch (Exception e)
- {
- Debug.LogError($"[WeChatPlatform] 寰俊SDK鍒濆鍖栧け璐�: {e.Message}");
- return false;
- }
- #else
- Debug.LogWarning("[WeChatPlatform] 闈濿ebGL骞冲彴锛屼娇鐢ㄦā鎷熸ā寮�");
- _isInitialized = true;
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// WX_Init();
+// _isInitialized = true;
+// Debug.Log("[WeChatPlatform] 寰俊SDK鍒濆鍖栨垚鍔�");
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[WeChatPlatform] 寰俊SDK鍒濆鍖栧け璐�: {e.Message}");
+// return false;
+// }
+// #else
+// Debug.LogWarning("[WeChatPlatform] 闈濿ebGL骞冲彴锛屼娇鐢ㄦā鎷熸ā寮�");
+// _isInitialized = true;
+// #endif
- await UniTask.Delay(100);
- return true;
- }
+// await UniTask.Delay(100);
+// return true;
+// }
- public PlatformType GetPlatformType()
- {
- return PlatformType.WeChat;
- }
+// public PlatformType GetPlatformType()
+// {
+// return PlatformType.WeChat;
+// }
- public async UniTask<LoginResult> LoginAsync()
- {
- Debug.Log("[WeChatPlatform] 寰俊鐧诲綍");
+// public async UniTask<LoginResult> LoginAsync()
+// {
+// Debug.Log("[WeChatPlatform] 寰俊鐧诲綍");
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 瀹炵幇鍥炶皟鏈哄埗
- // WX_Login("WeChatPlatform", "OnLoginCallback");
- await UniTask.Delay(1000); // 绛夊緟鍥炶皟
- #else
- await UniTask.Delay(500);
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 瀹炵幇鍥炶皟鏈哄埗
+// // WX_Login("WeChatPlatform", "OnLoginCallback");
+// await UniTask.Delay(1000); // 绛夊緟鍥炶皟
+// #else
+// await UniTask.Delay(500);
+// #endif
- // 妯℃嫙鐧诲綍鎴愬姛锛堝疄闄呴渶瑕侀�氳繃鍥炶皟鑾峰彇锛�
- return new LoginResult
- {
- Success = true,
- UserId = "wx_user_mock",
- Nickname = "寰俊鐢ㄦ埛",
- AvatarUrl = "https://example.com/avatar.jpg",
- ErrorMessage = null
- };
- }
+// // 妯℃嫙鐧诲綍鎴愬姛锛堝疄闄呴渶瑕侀�氳繃鍥炶皟鑾峰彇锛�
+// return new LoginResult
+// {
+// Success = true,
+// UserId = "wx_user_mock",
+// Nickname = "寰俊鐢ㄦ埛",
+// AvatarUrl = "https://example.com/avatar.jpg",
+// ErrorMessage = null
+// };
+// }
- public async UniTask<bool> ShareAsync(ShareData shareData)
- {
- Debug.Log($"[WeChatPlatform] 鍒嗕韩鍒板井淇�: {shareData.Title}");
+// public async UniTask<bool> ShareAsync(ShareData shareData)
+// {
+// Debug.Log($"[WeChatPlatform] 鍒嗕韩鍒板井淇�: {shareData.Title}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- WX_ShareAppMessage(shareData.Title, shareData.ImageUrl);
- await UniTask.Delay(300);
- return true;
- }
- catch (Exception e)
- {
- Debug.LogError($"[WeChatPlatform] 鍒嗕韩澶辫触: {e.Message}");
- return false;
- }
- #else
- await UniTask.Delay(300);
- return true;
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// WX_ShareAppMessage(shareData.Title, shareData.ImageUrl);
+// await UniTask.Delay(300);
+// return true;
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[WeChatPlatform] 鍒嗕韩澶辫触: {e.Message}");
+// return false;
+// }
+// #else
+// await UniTask.Delay(300);
+// return true;
+// #endif
+// }
- public async UniTask<AdResult> ShowAdAsync(AdType adType)
- {
- Debug.Log($"[WeChatPlatform] 鏄剧ず寰俊骞垮憡: {adType}");
+// public async UniTask<AdResult> ShowAdAsync(AdType adType)
+// {
+// Debug.Log($"[WeChatPlatform] 鏄剧ず寰俊骞垮憡: {adType}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 瀹炵幇骞垮憡鍥炶皟
- string adUnitId = GetAdUnitId(adType);
- // WX_CreateRewardedVideoAd(adUnitId, "WeChatPlatform", "OnAdCallback");
- await UniTask.Delay(3000);
- #else
- await UniTask.Delay(2000);
- #endif
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 瀹炵幇骞垮憡鍥炶皟
+// string adUnitId = GetAdUnitId(adType);
+// // WX_CreateRewardedVideoAd(adUnitId, "WeChatPlatform", "OnAdCallback");
+// await UniTask.Delay(3000);
+// #else
+// await UniTask.Delay(2000);
+// #endif
- return new AdResult
- {
- Success = true,
- Completed = true,
- ErrorMessage = null
- };
- }
+// return new AdResult
+// {
+// Success = true,
+// Completed = true,
+// ErrorMessage = null
+// };
+// }
- public async UniTask<bool> SaveDataAsync(string key, string value)
- {
- Debug.Log($"[WeChatPlatform] 淇濆瓨鏁版嵁鍒板井淇″瓨鍌�: {key}");
+// public async UniTask<bool> SaveDataAsync(string key, string value)
+// {
+// Debug.Log($"[WeChatPlatform] 淇濆瓨鏁版嵁鍒板井淇″瓨鍌�: {key}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- WX_SetStorageSync(key, value);
- await UniTask.Delay(50);
- return true;
- }
- catch (Exception e)
- {
- Debug.LogError($"[WeChatPlatform] 淇濆瓨鏁版嵁澶辫触: {e.Message}");
- return false;
- }
- #else
- await UniTask.Delay(50);
- PlayerPrefs.SetString(key, value);
- PlayerPrefs.Save();
- return true;
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// WX_SetStorageSync(key, value);
+// await UniTask.Delay(50);
+// return true;
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[WeChatPlatform] 淇濆瓨鏁版嵁澶辫触: {e.Message}");
+// return false;
+// }
+// #else
+// await UniTask.Delay(50);
+// PlayerPrefs.SetString(key, value);
+// PlayerPrefs.Save();
+// return true;
+// #endif
+// }
- public async UniTask<string> LoadDataAsync(string key)
- {
- Debug.Log($"[WeChatPlatform] 浠庡井淇″瓨鍌ㄥ姞杞芥暟鎹�: {key}");
+// public async UniTask<string> LoadDataAsync(string key)
+// {
+// Debug.Log($"[WeChatPlatform] 浠庡井淇″瓨鍌ㄥ姞杞芥暟鎹�: {key}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- await UniTask.Delay(50);
- return WX_GetStorageSync(key);
- }
- catch (Exception e)
- {
- Debug.LogError($"[WeChatPlatform] 鍔犺浇鏁版嵁澶辫触: {e.Message}");
- return null;
- }
- #else
- await UniTask.Delay(50);
- return PlayerPrefs.GetString(key, null);
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// await UniTask.Delay(50);
+// return WX_GetStorageSync(key);
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[WeChatPlatform] 鍔犺浇鏁版嵁澶辫触: {e.Message}");
+// return null;
+// }
+// #else
+// await UniTask.Delay(50);
+// return PlayerPrefs.GetString(key, null);
+// #endif
+// }
- public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
- {
- Debug.Log($"[WeChatPlatform] 涓嬭浇鏂囦欢: {url}");
+// public async UniTask<string> DownloadFileAsync(string url, string localPath, Action<float> onProgress = null)
+// {
+// Debug.Log($"[WeChatPlatform] 涓嬭浇鏂囦欢: {url}");
- // TODO: 瀹炵幇寰俊鏂囦欢涓嬭浇API
- // wx.downloadFile({ url, success, fail })
+// // TODO: 瀹炵幇寰俊鏂囦欢涓嬭浇API
+// // wx.downloadFile({ url, success, fail })
- // 妯℃嫙涓嬭浇
- for (int i = 0; i <= 10; i++)
- {
- await UniTask.Delay(100);
- onProgress?.Invoke(i / 10f);
- }
+// // 妯℃嫙涓嬭浇
+// for (int i = 0; i <= 10; i++)
+// {
+// await UniTask.Delay(100);
+// onProgress?.Invoke(i / 10f);
+// }
- return localPath;
- }
+// return localPath;
+// }
- public SystemInfo GetSystemInfo()
- {
- if (_cachedSystemInfo == null)
- {
- #if UNITY_WEBGL && !UNITY_EDITOR
- // TODO: 浠庡井淇PI鑾峰彇绯荤粺淇℃伅
- // WX_GetSystemInfo("WeChatPlatform", "OnSystemInfoCallback");
- #endif
+// public SystemInfo GetSystemInfo()
+// {
+// if (_cachedSystemInfo == null)
+// {
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// // TODO: 浠庡井淇PI鑾峰彇绯荤粺淇℃伅
+// // WX_GetSystemInfo("WeChatPlatform", "OnSystemInfoCallback");
+// #endif
- _cachedSystemInfo = new SystemInfo
- {
- DeviceModel = UnityEngine.SystemInfo.deviceModel,
- SystemVersion = UnityEngine.SystemInfo.operatingSystem,
- PlatformVersion = "WeChat 8.0.0",
- ScreenWidth = Screen.width,
- ScreenHeight = Screen.height,
- SafeArea = SafeAreaData.FromRect(Screen.safeArea),
- PixelRatio = Screen.dpi / 160f
- };
- }
+// _cachedSystemInfo = new SystemInfo
+// {
+// DeviceModel = UnityEngine.SystemInfo.deviceModel,
+// SystemVersion = UnityEngine.SystemInfo.operatingSystem,
+// PlatformVersion = "WeChat 8.0.0",
+// ScreenWidth = Screen.width,
+// ScreenHeight = Screen.height,
+// SafeArea = SafeAreaData.FromRect(Screen.safeArea),
+// PixelRatio = Screen.dpi / 160f
+// };
+// }
- return _cachedSystemInfo;
- }
+// return _cachedSystemInfo;
+// }
- public void Vibrate(VibrationType vibrationType)
- {
- Debug.Log($"[WeChatPlatform] 闇囧姩: {vibrationType}");
+// public void Vibrate(VibrationType vibrationType)
+// {
+// Debug.Log($"[WeChatPlatform] 闇囧姩: {vibrationType}");
- #if UNITY_WEBGL && !UNITY_EDITOR
- try
- {
- if (vibrationType == VibrationType.Heavy)
- WX_VibrateLong();
- else
- WX_VibrateShort();
- }
- catch (Exception e)
- {
- Debug.LogError($"[WeChatPlatform] 闇囧姩澶辫触: {e.Message}");
- }
- #endif
- }
+// #if UNITY_WEBGL && !UNITY_EDITOR
+// try
+// {
+// if (vibrationType == VibrationType.Heavy)
+// WX_VibrateLong();
+// else
+// WX_VibrateShort();
+// }
+// catch (Exception e)
+// {
+// Debug.LogError($"[WeChatPlatform] 闇囧姩澶辫触: {e.Message}");
+// }
+// #endif
+// }
- private string GetAdUnitId(AdType adType)
- {
- // TODO: 浠庨厤缃枃浠惰鍙栧箍鍛婁綅ID
- return adType switch
- {
- AdType.Video => "adunit-xxxxxx",
- AdType.Banner => "adunit-yyyyyy",
- AdType.Interstitial => "adunit-zzzzzz",
- _ => ""
- };
- }
- }
+// private string GetAdUnitId(AdType adType)
+// {
+// // TODO: 浠庨厤缃枃浠惰鍙栧箍鍛婁綅ID
+// return adType switch
+// {
+// AdType.Video => "adunit-xxxxxx",
+// AdType.Banner => "adunit-yyyyyy",
+// AdType.Interstitial => "adunit-zzzzzz",
+// _ => ""
+// };
+// }
+// }
diff --git a/Main/Main.cs b/Main/Main.cs
index c43a202..4cbd6dc 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -34,10 +34,10 @@
{
launchWin.FadeOut();
}
- SwitchToLoginScene();
+ SwitchToLoginScene().Forget();
}
- private static async void SwitchToLoginScene()
+ private static async UniTask SwitchToLoginScene()
{
// Debug.Log("鎵撳紑鐧诲綍鐣岄潰");
// UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
diff --git a/Main/Manager/StageManager.cs b/Main/Manager/StageManager.cs
index 861d9f1..43ecc22 100644
--- a/Main/Manager/StageManager.cs
+++ b/Main/Manager/StageManager.cs
@@ -42,15 +42,7 @@
LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
InitLoadingWinData(loadingWin);
- // Phase 1 (0% ~ 30%): YooAsset resource preload
- if (AssetSource.isUseAssetBundle)
- {
- loadingWin.SetProgress(0.05f);
- await YooAssetService.Instance.LoadAllAssetsAsync<UnityEngine.Object>("Assets/ResourcesOut/Scenes/Login");
- loadingWin.SetProgress(0.3f);
- }
-
- // Phase 2 (30% ~ 60%): Scene loading
+ // Phase 1 (0% ~ 60%): Scene loading
AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Login");
asyncOperation.allowSceneActivation = false;
@@ -60,12 +52,12 @@
{
asyncOperation.allowSceneActivation = true;
}
- loadingWin.SetProgress(0.3f + asyncOperation.progress * 0.3f);
+ loadingWin.SetProgress(asyncOperation.progress * 0.5f);
await UniTask.Yield();
}
- // Phase 3 (60% ~ 100%): Manager initialization
- await WaitForManagerProgress(loadingWin, 0.6f, 1.0f,
+ // Phase 2 (50% ~ 100%): Manager initialization
+ await WaitForManagerProgress(loadingWin, 0.5f, 1.0f,
ConfigManager.Instance.GetLoadingProgress, Main.InitManagers);
loadingWin.SetProgress(1f, true);
@@ -76,36 +68,51 @@
currentStage = StageName.Login;
- UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().Forget();
- UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
+ UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().ContinueWith(s => {
+ UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
+ DumpLoginSceneDiagnostics("ToLoginScene open triggered").ContinueWith(() => {
+ if (VersionUtility.Instance.NeedDownAsset() && !AssetVersionUtility.hasDownLoadFullAsset)
+ {
+ DownloadHotMgr.Instance.ClearDownloadCache();
+ InGameDownLoad.Instance.inGameDownLoadAllow = true;
+ InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.None);
+ }
+ }).Forget();
+ }).Forget();
- if (VersionUtility.Instance.NeedDownAsset() && !AssetVersionUtility.hasDownLoadFullAsset)
- {
- DownloadHotMgr.Instance.ClearDownloadCache();
- InGameDownLoad.Instance.inGameDownLoadAllow = true;
- InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.None);
- }
+
}
// 杩斿洖鐧诲綍鐣岄潰 濡傛柇绾�
- public void ReturnToLoginScene()
+ public async UniTaskVoid ReturnToLoginScene()
{
UIManager.Instance.DestroyAllUI();
- SceneManager.LoadSceneAsync("Login");
+ await SceneManager.LoadSceneAsync("Login");
Main.OnSwitchToLoginScene();
currentStage = StageName.Login;
- UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().Forget();
- UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
- if (ServerForceExitHintWin.reason != 0)
- {
- UIManager.Instance.OpenWindowAsync<ServerForceExitHintWin>().Forget();
- }
- // SoundPlayer.Instance.StopBackGroundMusic();
- SoundPlayer.Instance.PlayLoginMusic();
+ UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().ContinueWith(s => {
+ UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
+ DumpLoginSceneDiagnostics("ToLoginScene open triggered").ContinueWith(() => {
+ if (ServerForceExitHintWin.reason != 0)
+ {
+ UIManager.Instance.OpenWindowAsync<ServerForceExitHintWin>().Forget();
+ }
+ // SoundPlayer.Instance.StopBackGroundMusic();
+ SoundPlayer.Instance.PlayLoginMusic();
+ }).Forget();
+ }).Forget();
+ }
+
+ private async UniTask DumpLoginSceneDiagnostics(string context)
+ {
+ await UniTask.DelayFrame(2);
+ UIManager.Instance.DumpUIDiagnostics(context + " after 2 frames");
+ await UniTask.DelayFrame(30);
+ UIManager.Instance.DumpUIDiagnostics(context + " after 32 frames");
}
protected float GetManagerRequestDataProgress()
@@ -140,17 +147,9 @@
LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
InitLoadingWinData(loadingWin);
- // Phase 1 (0% ~ 30%): YooAsset resource preload
- if (AssetSource.isUseAssetBundle)
- {
- loadingWin.SetProgress(0.05f);
- await YooAssetService.Instance.LoadAllAssetsAsync<UnityEngine.Object>("Assets/ResourcesOut/Scenes/Game");
- loadingWin.SetProgress(0.3f);
- }
-
SoundPlayer.Instance.StopBackGroundMusic();
- // Phase 2 (30% ~ 60%): Scene loading
+ // Phase 1 (0% ~ 60%): Scene loading
AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Game");
asyncOperation.allowSceneActivation = false;
@@ -160,12 +159,12 @@
{
asyncOperation.allowSceneActivation = true;
}
- loadingWin.SetProgress(0.3f + asyncOperation.progress * 0.3f);
+ loadingWin.SetProgress(asyncOperation.progress * 0.5f);
await UniTask.Yield();
}
- // Phase 3 (60% ~ 100%): Manager data ready
- await WaitForManagerProgress(loadingWin, 0.6f, 1.0f,
+ // Phase 2 (50% ~ 100%): Manager data ready
+ await WaitForManagerProgress(loadingWin, 0.5f, 1.0f,
() => (DTC0403_tagPlayerLoginLoadOK.finishedLogin ? .5f : 0f) + GetManagerRequestDataProgress() * .5f);
loadingWin.SetProgress(1f, true);
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index 35baaf0..94da3ac 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -5,6 +5,7 @@
using System.Linq;
using DG.Tweening;
using Cysharp.Threading.Tasks;
+using UnityEngine.EventSystems;
/// <summary>
/// UI绠$悊鍣� - 璐熻矗绠$悊鎵�鏈塙I鐣岄潰鐨勬樉绀恒�侀殣钘忓拰灞傜骇
@@ -105,8 +106,10 @@
Debug.LogError("鏃犳硶鎵惧埌UI鏍硅妭鐐�");
return;
}
- GameObject.DontDestroyOnLoad(root);
}
+
+ // 鏃犺鏄粠鍦烘櫙鎵惧埌杩樻槸鏂板疄渚嬪寲鐨勶紝閮界‘淇濊法鍦烘櫙涓嶈閿�姣�
+ GameObject.DontDestroyOnLoad(root);
uiRoot = root.transform;
uiRoot.position = Vector3.zero;
@@ -123,6 +126,8 @@
layerTransformCache.Add(UILayer.Mid, midTrans);
layerTransformCache.Add(UILayer.System, systemTrans);
layerTransformCache.Add(UILayer.Loading, loadingTrans);
+
+ LogUIRootEventSystemState("InitUIRoot");
}
public Transform GetUIRoot()
@@ -632,8 +637,10 @@
Debug.LogError("鏃犳硶鍔犺浇UI鏍硅妭鐐�");
return;
}
- GameObject.DontDestroyOnLoad(root);
}
+
+ // 鏃犺鏄粠鍦烘櫙鎵惧埌杩樻槸鏂板疄渚嬪寲鐨勶紝閮界‘淇濊法鍦烘櫙涓嶈閿�姣�
+ GameObject.DontDestroyOnLoad(root);
}
/// <summary>
@@ -806,6 +813,48 @@
}
}
+ public void DumpUIDiagnostics(string context)
+ {
+ var eventSystem = EventSystem.current;
+ Debug.Log($"[UIManager][Diag] {context} EventSystem={(eventSystem != null ? eventSystem.name : "<null>")} selected={(eventSystem != null && eventSystem.currentSelectedGameObject != null ? eventSystem.currentSelectedGameObject.name : "<null>")} loadingIndicatorActive={(_loadingIndicatorGO != null && _loadingIndicatorGO.activeSelf)} loadingRefCount={_loadingRefCount} uiStackCount={uiStack.Count}");
+ LogUIRootEventSystemState(context);
+
+ var uiArray = new UIBase[uiStack.Count];
+ uiStack.CopyTo(uiArray, 0);
+ foreach (var ui in uiArray)
+ {
+ if (ui == null)
+ {
+ continue;
+ }
+
+ var uiCanvas = ui.GetComponent<Canvas>();
+ var uiCanvasGroup = ui.GetComponent<CanvasGroup>();
+ Debug.Log($"[UIManager][Diag] {context} ui={ui.GetType().Name} active={ui.gameObject.activeInHierarchy} layer={ui.uiLayer} sortingOrder={(uiCanvas != null ? uiCanvas.sortingOrder : -1)} siblingIndex={ui.transform.GetSiblingIndex()} canvasGroup.blocksRaycasts={(uiCanvasGroup != null ? uiCanvasGroup.blocksRaycasts : false)} canvasGroup.interactable={(uiCanvasGroup != null ? uiCanvasGroup.interactable : false)}");
+ }
+ }
+
+ private void LogUIRootEventSystemState(string context)
+ {
+ if (uiRoot == null)
+ {
+ Debug.Log($"[UIManager][Diag] {context} uiRoot=<null>");
+ return;
+ }
+
+ var eventSystemTransform = uiRoot.Find("EventSystem");
+ if (eventSystemTransform == null)
+ {
+ Debug.Log($"[UIManager][Diag] {context} uiRoot.EventSystem child=<null>");
+ return;
+ }
+
+ var eventSystemComponent = eventSystemTransform.GetComponent<EventSystem>();
+ var standaloneInputModule = eventSystemTransform.GetComponent<StandaloneInputModule>();
+ var baseInputModule = eventSystemTransform.GetComponent<BaseInputModule>();
+ Debug.Log($"[UIManager][Diag] {context} uiRoot.EventSystem childExists=true activeSelf={eventSystemTransform.gameObject.activeSelf} activeInHierarchy={eventSystemTransform.gameObject.activeInHierarchy} eventSystemComponent={(eventSystemComponent != null)} standaloneInputModule={(standaloneInputModule != null)} baseInputModuleType={(baseInputModule != null ? baseInputModule.GetType().Name : "<null>")} currentMatchesChild={(EventSystem.current == eventSystemComponent)}");
+ }
+
private void EnsureLoadingIndicator()
{
if (_loadingIndicatorGO != null) return;
@@ -865,6 +914,10 @@
// 閬嶅巻UI鏍堬紝璁剧疆鎺掑簭椤哄簭
UIBase[] uiArray = new UIBase[uiStack.Count];
uiStack.CopyTo(uiArray, 0);
+
+ // WebGL/IL2CPP 涓嬭 Destroy 鐨勫璞¤闂换浣曞睘鎬ч兘浼� NullReferenceException锛�
+ // 蹇呴』鍦ㄤ娇鐢ㄥ墠杩囨护鎺夛紙Unity 浼� null锛欳# 寮曠敤闈� null 浣� == null 涓� true锛�
+ uiArray = System.Array.FindAll(uiArray, ui => ui != null);
// 鍏堟寜鐓ILayer杩涜鎺掑簭锛岀劧鍚庡啀鎸夌収鏍堥『搴忔帓搴�
Dictionary<UIBase, int> uiOrderDict = new Dictionary<UIBase, int>();
@@ -875,6 +928,7 @@
Array.Sort(uiArray, (a, b) =>
{
+ if (a == null || b == null) return 0;
int layerCompare = a.uiLayer.CompareTo(b.uiLayer);
if (layerCompare != 0)
return layerCompare;
@@ -885,6 +939,7 @@
// 閬嶅巻鎺掑簭鍚庣殑UI鏁扮粍锛岃缃帓搴忛『搴�
foreach (var ui in uiArray)
{
+ if (ui == null) continue;
// 鑾峰彇鍩虹鎺掑簭椤哄簭
int baseSortingOrder = GetBaseSortingOrderForLayer(ui.uiLayer);
// 璁$畻褰撳墠UI鐨勬帓搴忛『搴�
diff --git a/Main/ResModule/BuiltInLoader.cs b/Main/ResModule/BuiltInLoader.cs
index 8c00524..98aee23 100644
--- a/Main/ResModule/BuiltInLoader.cs
+++ b/Main/ResModule/BuiltInLoader.cs
@@ -19,7 +19,12 @@
public static async UniTask<Sprite> LoadSpriteAsync(string name, CancellationToken ct = default)
{
var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Sprites/", name, SPRITE_EXTENSION);
- return await YooAssetService.Instance.LoadAssetAsync<Sprite>(path, ct: ct);
+ var sprite = await YooAssetService.Instance.LoadAssetAsync<Sprite>(path, ct: ct);
+#if UNITY_WEBGL
+ if (sprite == null)
+ Debug.LogWarning($"[BuiltInLoader][WebGL-Diag] Sprite load returned NULL: path={path}");
+#endif
+ return sprite;
}
public static async UniTask<GameObject> LoadPrefabAsync(string name, CancellationToken ct = default)
diff --git a/Main/ResModule/PlatformCacheHelper.cs b/Main/ResModule/PlatformCacheHelper.cs
index 137d48e..d156b87 100644
--- a/Main/ResModule/PlatformCacheHelper.cs
+++ b/Main/ResModule/PlatformCacheHelper.cs
@@ -57,18 +57,19 @@
/// </summary>
public static int GetCacheSizeLimitMB()
{
- var platform = PlatformFactory.GetCurrent();
- switch (platform.GetPlatformType())
- {
- case PlatformType.WeChat:
- return 200; // 寰俊灏忔父鎴忕敤鎴锋暟鎹笂闄愮害 200MB
- case PlatformType.Douyin:
- return 200; // 鎶栭煶灏忔父鎴忕被浼奸檺鍒�
- case PlatformType.Vivo:
- return 100; // Vivo 闄愬埗杈冨皬
- default:
- return 1024; // Standalone 鏃犱弗鏍奸檺鍒�
- }
+ return 1024;
+ // var platform = PlatformFactory.GetCurrent();
+ // switch (platform.GetPlatformType())
+ // {
+ // case PlatformType.WeChat:
+ // return 200; // 寰俊灏忔父鎴忕敤鎴锋暟鎹笂闄愮害 200MB
+ // case PlatformType.Douyin:
+ // return 200; // 鎶栭煶灏忔父鎴忕被浼奸檺鍒�
+ // case PlatformType.Vivo:
+ // return 100; // Vivo 闄愬埗杈冨皬
+ // default:
+ // return 1024; // Standalone 鏃犱弗鏍奸檺鍒�
+ // }
}
/// <summary>
diff --git a/Main/ResModule/RemoteServicesImpl.cs b/Main/ResModule/RemoteServicesImpl.cs
index 69c9aee..44a52cb 100644
--- a/Main/ResModule/RemoteServicesImpl.cs
+++ b/Main/ResModule/RemoteServicesImpl.cs
@@ -50,22 +50,22 @@
/// <param name="baseCdnUrl">鍩虹 CDN 鍦板潃锛堝 https://cdn.example.com锛�</param>
/// <param name="fallbackCdnUrl">澶囩敤 CDN 鍦板潃锛堝彲閫夛紝榛樿鍚� baseCdnUrl锛�</param>
/// <returns>骞冲彴瀵瑰簲鐨� RemoteServicesImpl 瀹炰緥</returns>
- public static RemoteServicesImpl CreateForCurrentPlatform(string baseCdnUrl, string fallbackCdnUrl = null)
- {
- fallbackCdnUrl = fallbackCdnUrl ?? baseCdnUrl;
+ // public static RemoteServicesImpl CreateForCurrentPlatform(string baseCdnUrl, string fallbackCdnUrl = null)
+ // {
+ // fallbackCdnUrl = fallbackCdnUrl ?? baseCdnUrl;
- var platform = PlatformFactory.GetCurrent();
- var platformType = platform.GetPlatformType();
+ // var platform = PlatformFactory.GetCurrent();
+ // var platformType = platform.GetPlatformType();
- // 鎸夊钩鍙扮被鍨嬭矾鐢卞瓙璺緞
- string platformPath = GetPlatformCdnPath(platformType);
+ // // 鎸夊钩鍙扮被鍨嬭矾鐢卞瓙璺緞
+ // string platformPath = GetPlatformCdnPath(platformType);
- string mainUrl = $"{baseCdnUrl}/{platformPath}";
- string fallbackUrl = $"{fallbackCdnUrl}/{platformPath}";
+ // string mainUrl = $"{baseCdnUrl}/{platformPath}";
+ // string fallbackUrl = $"{fallbackCdnUrl}/{platformPath}";
- UnityEngine.Debug.Log($"[RemoteServicesImpl] Platform={platformType}, CDN={mainUrl}");
- return new RemoteServicesImpl(mainUrl, fallbackUrl);
- }
+ // UnityEngine.Debug.Log($"[RemoteServicesImpl] Platform={platformType}, CDN={mainUrl}");
+ // return new RemoteServicesImpl(mainUrl, fallbackUrl);
+ // }
/// <summary>
/// 鑾峰彇骞冲彴瀵瑰簲鐨� CDN 瀛愯矾寰勩��
diff --git a/Main/ResModule/ResManager.cs b/Main/ResModule/ResManager.cs
index 8ec4613..47471ba 100644
--- a/Main/ResModule/ResManager.cs
+++ b/Main/ResModule/ResManager.cs
@@ -189,10 +189,7 @@
public async UniTask<T> LoadAssetAsync<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
{
- // 鏂扮増鐩存帴璧� YooAsset/寮傛鍔犺浇
- // 杩欓噷鍋囪鏈� YooAssetService.Instance.LoadAssetAsync<T>(...) 鍙敤
- string path = directory.EndsWith("/") ? directory + name : directory + "/" + name;
- return await YooAssetService.Instance.LoadAssetAsync<T>(path);
+ return await LoadAssetAsync<T>(directory, name, needExt, CancellationToken.None);
}
private void LoadSpriteAsync<T>(string atlasName, string spriteName, Action<bool, UnityEngine.Object> callBack) where T : UnityEngine.Object
@@ -246,7 +243,9 @@
public void UnloadAsset(string directory, string assetName)
{
- string path = directory.EndsWith("/") ? directory + assetName : directory + "/" + assetName;
+ directory = directory.Replace("\\", "/").TrimEnd('/');
+ assetName = assetName.Replace("\\", "/");
+ string path = ($"Assets/ResourcesOut/{directory}/{assetName}").Replace("//", "/");
YooAssetService.Instance.UnloadAsset(path);
}
@@ -289,7 +288,13 @@
var path = ($"Assets/ResourcesOut/{directory}/{name}" + (needExt ? GetExtension(typeof(T)) : ""))
.Replace("//", "/").Trim().Replace("\\", "/");
-
+ // 闊抽鏂囦欢鎵╁睍鍚嶇粺涓�杞皬鍐欙紝閬垮厤 .WAV/.MP3 澶у皬鍐欎笉鍖归厤
+ if (typeof(T) == typeof(AudioClip))
+ {
+ var pathExt = System.IO.Path.GetExtension(path);
+ if (!string.IsNullOrEmpty(pathExt) && pathExt != pathExt.ToLower())
+ path = path.Substring(0, path.Length - pathExt.Length) + pathExt.ToLower();
+ }
if (!AssetSource.isUseAssetBundle)
{
#if UNITY_EDITOR
@@ -312,7 +317,13 @@
var path = ($"Assets/ResourcesOut/{directory}/{name}" + (needExt ? GetExtension(typeof(T)) : ""))
.Replace("//", "/").Trim().Replace("\\", "/");
-
+ // 闊抽鏂囦欢鎵╁睍鍚嶇粺涓�杞皬鍐欙紝閬垮厤 .WAV/.MP3 澶у皬鍐欎笉鍖归厤
+ if (typeof(T) == typeof(AudioClip))
+ {
+ var pathExt2 = System.IO.Path.GetExtension(path);
+ if (!string.IsNullOrEmpty(pathExt2) && pathExt2 != pathExt2.ToLower())
+ path = path.Substring(0, path.Length - pathExt2.Length) + pathExt2.ToLower();
+ }
if (!AssetSource.isUseAssetBundle)
{
#if UNITY_EDITOR
@@ -336,7 +347,12 @@
{
var path = $"Assets/ResourcesOut/{atlasName}/{spriteName}.png"
.Replace("//", "/").Trim().Replace("\\", "/");
- return await YooAssetService.Instance.LoadAssetAsync<Sprite>(path, ct: ct);
+ var sprite = await YooAssetService.Instance.LoadAssetAsync<Sprite>(path, ct: ct);
+#if UNITY_WEBGL
+ if (sprite == null)
+ Debug.LogWarning($"[ResManager][WebGL-Diag] Sprite load returned NULL: path={path}");
+#endif
+ return sprite;
}
}
@@ -344,12 +360,17 @@
/// 寮傛鍔犺浇閰嶇疆鏂囦欢锛圲niTask 鐗堟湰锛夈��
/// AB 妯″紡浣跨敤 YooAsset RawFile 寮傛鍔犺浇锛岄潪 AB 妯″紡鐩存帴璇绘枃浠躲��
/// </summary>
- public async UniTask<string[]> LoadConfigAsync(string name, CancellationToken ct = default)
+ public async UniTask<string[]> LoadConfigAsync(string name, bool needExt = true, CancellationToken ct = default)
{
// AB 妯″紡锛堝惈 WebGL锛�: 浣跨敤 YooAsset 鍔犺浇閰嶇疆鏂囦欢
if (AssetSource.isUseAssetBundle)
{
- var location = $"Assets/ResourcesOut/Config/{name}.txt";
+ // 鍒ゆ柇涓�涓嬫槸鍚﹀師鏉ュ凡缁忓寘鍚�.txt 閰嶅悎 needExt 鍋氬吋瀹癸紝閬垮厤璋冪敤鏂逛紶鍏ラ噸澶嶅悗缂�瀵艰嚧璺緞閿欒
+ if (name.EndsWith(".txt") && needExt)
+ {
+ name = name.Substring(0, name.Length - 4);
+ }
+ var location = $"Assets/ResourcesOut/Config/{name}" + (needExt ? ".txt" : "");
try
{
#if UNITY_WEBGL
@@ -360,9 +381,9 @@
if (asset != null && !string.IsNullOrEmpty(asset.text))
return asset.text.Split(new[] { "\r\n", "\n" }, System.StringSplitOptions.None);
#else
- var text = await ProjSG.Resource.YooAssetService.Instance.LoadRawFileTextAsync(location, ct);
- if (!string.IsNullOrEmpty(text))
- return text.Split(new[] { "\r\n", "\n" }, System.StringSplitOptions.None);
+ var textAsset = await ProjSG.Resource.YooAssetService.Instance.LoadAssetAsync<TextAsset>(location, 0, ct);
+ if (textAsset != null && !string.IsNullOrEmpty(textAsset.text))
+ return textAsset.text.Split(new[] { "\r\n", "\n" }, System.StringSplitOptions.None);
#endif
}
catch (System.Exception ex)
@@ -374,7 +395,7 @@
// 闈� AB 妯″紡: 鐩存帴璇绘枃浠讹紙Editor 寮�鍙戞ā寮忥級
#if UNITY_EDITOR
- string path = ResourcesPath.CONFIG_FODLER + "/" + name + ".txt";
+ string path = ResourcesPath.CONFIG_FODLER + "/" + name + (needExt ? ".txt" : "");
return await UniTask.RunOnThreadPool(() => File.ReadAllLines(path));
#else
return System.Array.Empty<string>();
diff --git a/Main/ResModule/SpriteAtlasHandler.cs b/Main/ResModule/SpriteAtlasHandler.cs
new file mode 100644
index 0000000..250fffe
--- /dev/null
+++ b/Main/ResModule/SpriteAtlasHandler.cs
@@ -0,0 +1,76 @@
+using Cysharp.Threading.Tasks;
+using UnityEngine;
+using UnityEngine.U2D;
+using ProjSG.Resource;
+
+/// <summary>
+/// 娉ㄥ唽 SpriteAtlasManager.atlasRequested 鍥炶皟锛�
+/// 褰� Unity 杩愯鏃堕渶瑕� SpriteAtlas (V2) 鏃堕�氳繃 YooAsset 寮傛鍔犺浇鍥鹃泦銆�
+///
+/// 鏍规湰鍘熷洜锛氶」鐩娇鐢� 63+ 涓� SpriteAtlas V2 (.spriteatlasv2) 鏂囦欢锛�
+/// Prefab 涓潤鎬佸紩鐢ㄧ殑 Sprite 鍦� AssetBundle 杩愯鏃堕渶瑕侀�氳繃姝ゅ洖璋�
+/// 鍔犺浇瀵瑰簲鐨� SpriteAtlas 鎵嶈兘姝g‘鏄剧ず銆�
+/// 缂栬緫鍣ㄤ笅 Unity 鑷姩澶勭悊锛屼絾鏋勫缓鍚庯紙灏ゅ叾 WebGL锛夊繀椤绘墜鍔ㄥ鐞嗐��
+/// </summary>
+public static class SpriteAtlasHandler
+{
+ private static bool _registered;
+
+ /// <summary>
+ /// 娉ㄥ唽 atlasRequested 鍥炶皟銆傚簲鍦� YooAsset 鍒濆鍖栧畬鎴愬悗銆乁I 鍔犺浇鍓嶈皟鐢ㄣ��
+ /// </summary>
+ public static void Register()
+ {
+ if (_registered) return;
+ _registered = true;
+
+ SpriteAtlasManager.atlasRequested += OnAtlasRequested;
+ Debug.Log("[SpriteAtlasHandler] atlasRequested callback registered.");
+ }
+
+ private static void OnAtlasRequested(string tag, System.Action<SpriteAtlas> callback)
+ {
+ Debug.Log($"[SpriteAtlasHandler] Atlas requested: tag='{tag}'");
+ LoadAtlasAsync(tag, callback).Forget();
+ }
+
+ private static async UniTaskVoid LoadAtlasAsync(string tag, System.Action<SpriteAtlas> callback)
+ {
+ // 涓荤洰褰�: Assets/ResourcesOut/Sprite/{tag}.spriteatlasv2 (UI 鍖�)
+ string location = $"Assets/ResourcesOut/Sprite/{tag}.spriteatlasv2";
+ try
+ {
+ var atlas = await YooAssetService.Instance.LoadAssetAsync<SpriteAtlas>(location);
+ if (atlas != null)
+ {
+ Debug.Log($"[SpriteAtlasHandler] Loaded atlas '{tag}' from '{location}'");
+ callback(atlas);
+ return;
+ }
+ }
+ catch (System.Exception ex)
+ {
+ Debug.LogWarning($"[SpriteAtlasHandler] Failed to load atlas from '{location}': {ex.Message}");
+ }
+
+ // 鍥為��: Assets/ResourcesOut/BuiltIn/Sprites/{tag}.spriteatlasv2 (Builtin 鍖�)
+ string builtinLocation = $"Assets/ResourcesOut/BuiltIn/Sprites/{tag}.spriteatlasv2";
+ try
+ {
+ var atlas = await YooAssetService.Instance.LoadAssetAsync<SpriteAtlas>(builtinLocation);
+ if (atlas != null)
+ {
+ Debug.Log($"[SpriteAtlasHandler] Loaded atlas '{tag}' from '{builtinLocation}'");
+ callback(atlas);
+ return;
+ }
+ }
+ catch (System.Exception ex)
+ {
+ Debug.LogWarning($"[SpriteAtlasHandler] Failed to load atlas from '{builtinLocation}': {ex.Message}");
+ }
+
+ Debug.LogError($"[SpriteAtlasHandler] Could not load SpriteAtlas for tag '{tag}'. " +
+ $"Searched: '{location}', '{builtinLocation}'");
+ }
+}
diff --git a/Main/ResModule/SpriteAtlasHandler.cs.meta b/Main/ResModule/SpriteAtlasHandler.cs.meta
new file mode 100644
index 0000000..a112859
--- /dev/null
+++ b/Main/ResModule/SpriteAtlasHandler.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4cf80bc251fa65d4f89c015496c56db8
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/ResModule/YooAssetService.cs b/Main/ResModule/YooAssetService.cs
index db8d5af..81bcaca 100644
--- a/Main/ResModule/YooAssetService.cs
+++ b/Main/ResModule/YooAssetService.cs
@@ -1,4 +1,4 @@
-// ============================================================================
+锘�// ============================================================================
// YooAssetService.cs 鈥� YooAsset 灏佽鏈嶅姟
// 瀹炵幇 IYooAssetService 鍜� IYooAssetBridge锛屾浛浠� AssetBundleUtility
// ============================================================================
@@ -171,6 +171,11 @@
}
Debug.Log($"[YooAssetService] Initialized {_packages.Count}/{allPkgs.Length} packages with PlayMode={playMode}. " +
$"Active: [{string.Join(", ", _packages.Keys)}]");
+
+#if UNITY_WEBGL
+ // WebGL 璇婃柇锛氳緭鍑烘瘡涓寘鐨� Manifest 鍜� Bundle 璇︽儏
+ DiagDumpPackageStatus();
+#endif
}
/// <summary>
@@ -450,7 +455,7 @@
var package = FindPackageForAsset(location);
- Debug.LogError($"[YooAssetService] LoadAssetAsync: Loading asset '{location}' of package '{package.PackageName}'.");
+ // Debug.LogError($"[YooAssetService] LoadAssetAsync: Loading asset '{location}' of package '{package.PackageName}'.");
return await ExecuteWithRetryAsync(async () =>
{
@@ -533,7 +538,17 @@
throw new InvalidOperationException($"LoadRawFileTextAsync failed for '{location}': {handle.LastError}");
}
+#if UNITY_ANDROID && !UNITY_EDITOR
+ // 鐪熸満锛歋treamingAssets鍦╝pk鍐咃紝闇�鐢║nityWebRequest璇诲彇
+ string filePath = handle.GetRawFilePath();
+ using var uwr = UnityEngine.Networking.UnityWebRequest.Get(filePath);
+ await uwr.SendWebRequest().ToUniTask(cancellationToken: ct);
+ if (uwr.result != UnityEngine.Networking.UnityWebRequest.Result.Success)
+ throw new InvalidOperationException($"LoadRawFileTextAsync UWR failed for '{location}': {uwr.error}");
+ return uwr.downloadHandler.text;
+#else
return handle.GetRawFileText();
+#endif
}, $"LoadRawFileTextAsync('{location}')", ct);
}
@@ -553,7 +568,17 @@
throw new InvalidOperationException($"LoadRawFileBytesAsync failed for '{location}': {handle.LastError}");
}
+#if UNITY_ANDROID && !UNITY_EDITOR
+ // 鐪熸満锛歋treamingAssets鍦╝pk鍐咃紝闇�鐢║nityWebRequest璇诲彇
+ string filePath = handle.GetRawFilePath();
+ using var uwr = UnityEngine.Networking.UnityWebRequest.Get(filePath);
+ await uwr.SendWebRequest().ToUniTask(cancellationToken: ct);
+ if (uwr.result != UnityEngine.Networking.UnityWebRequest.Result.Success)
+ throw new InvalidOperationException($"LoadRawFileBytesAsync UWR failed for '{location}': {uwr.error}");
+ return uwr.downloadHandler.data;
+#else
return handle.GetRawFileData();
+#endif
}, $"LoadRawFileBytesAsync('{location}')", ct);
}
@@ -788,5 +813,35 @@
var package = FindPackageForAsset(location);
return package.LoadAllAssetsSync<T>(location);
}
+
+#if UNITY_WEBGL
+ /// <summary>
+ /// WebGL 璇婃柇锛氳緭鍑烘瘡涓� YooAsset 鍖呯殑鍒濆鍖栫姸鎬佸拰璧勬簮鏁伴噺銆�
+ /// </summary>
+ private void DiagDumpPackageStatus()
+ {
+ var sb = new System.Text.StringBuilder();
+ sb.AppendLine("[YooAssetService][WebGL-Diag] Package status dump:");
+ foreach (var kv in _packages)
+ {
+ var pkg = kv.Value;
+ var status = pkg.InitializeStatus;
+ // 灏濊瘯鑾峰彇娓呭崟涓殑璧勬簮淇℃伅鏁伴噺
+ int assetCount = 0;
+ try
+ {
+ // GetAssetInfos 杩斿洖璇ュ寘鎵�鏈夎祫婧愪俊鎭�
+ var infos = pkg.GetAssetInfos(string.Empty);
+ assetCount = infos != null ? infos.Length : -1;
+ }
+ catch
+ {
+ assetCount = -1;
+ }
+ sb.AppendLine($" [{kv.Key}] status={status}, assetInfoCount={assetCount}");
+ }
+ Debug.Log(sb.ToString());
+ }
+#endif
}
}
diff --git a/Main/SDK/SDKUtils.cs b/Main/SDK/SDKUtils.cs
index 8ba419a..533ee09 100644
--- a/Main/SDK/SDKUtils.cs
+++ b/Main/SDK/SDKUtils.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System;
+using Cysharp.Threading.Tasks;
public class SDKUtils : SingletonMonobehaviour<SDKUtils>
@@ -165,7 +166,7 @@
}
else
{
- builtinAssetCopyFinished = VersionConfig.Get().version == builtinAssetsCopyFinishVersion;
+ builtinAssetCopyFinished = VersionConfig.config.version == builtinAssetsCopyFinishVersion;
}
#endif
#if UNITY_IOS || UNITY_STANDALONE
@@ -176,7 +177,7 @@
}
else
{
- builtinAssetCopyFinished = VersionConfig.Get().version == builtinAssetsCopyFinishVersion;
+ builtinAssetCopyFinished = VersionConfig.config.version == builtinAssetsCopyFinishVersion;
}
var assetsCopyFinishVersion = LocalSave.GetString("AssetCopyCompleted_IOSorStandalone");
@@ -186,19 +187,27 @@
}
else
{
- AssetCopyFinished = VersionConfig.Get().version == assetsCopyFinishVersion;
+ AssetCopyFinished = VersionConfig.config.version == assetsCopyFinishVersion;
}
#elif UNITY_ANDROID
SyncClientPackageID();
#endif
- InitFinished = false;
- m_Json.Clear();
- m_Json["code"] = CodeU2A.Init;
- m_Json["appID"] = VersionConfig.Get().appId;
- m_Json["gameID"] = VersionConfig.Get().gameId;
- SendMessageToSDK(m_Json);
+ if (Application.platform == RuntimePlatform.WebGLPlayer)
+ {
+ // WebGL 鏃犲師鐢� SDK 鍥炶皟锛岀洿鎺ユ爣璁板畬鎴�
+ InitFinished = true;
+ }
+ else
+ {
+ InitFinished = false;
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.Init;
+ m_Json["appID"] = VersionConfig.config.appId;
+ m_Json["gameID"] = VersionConfig.config.gameId;
+ SendMessageToSDK(m_Json);
+ }
#endif
StartCoroutine("ProcessNetworkStatus");
}
@@ -320,10 +329,13 @@
public void SyncClientPackageID()
{
#if UNITY_ANDROID
- m_Json.Clear();
- m_Json["code"] = CodeU2A.ClientPackage;
- m_Json["clientPkgID"] = VersionConfig.Get().clientPackageFlag;
- SendMessageToSDK(m_Json);
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.ClientPackage;
+ m_Json["clientPkgID"] = config.clientPackageFlag;
+ SendMessageToSDK(m_Json);
+ }).Forget();
#endif
}
@@ -968,38 +980,44 @@
}
+
if (!isBuyGameCash && gameCash >= money * 100)
{
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ UIManager.Instance.CloseWindow<GotoChargeWin>();
- UIManager.Instance.CloseWindow<GotoChargeWin>();
- if (DayRemind.Instance.GetDayRemind(DayRemind.DJQTip))
- {
- var pack = new CA125_tagCMCoinBuyOrderInfo();
- pack.AppID = VersionConfig.Get().appId;
- pack.AppIDLen = (byte)pack.AppID.Length;
- pack.OrderInfo = cpInfo;
- pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
- GameNetSystem.Instance.SendInfo(pack);
- }
- else
- {
- ConfirmCancel.ShowPopConfirm(
- Language.Get("Mail101"),
- Language.Get("GameCashRule1", money, title),
- (bool isOk) =>
- {
- if (isOk)
+
+ if (DayRemind.Instance.GetDayRemind(DayRemind.DJQTip))
+ {
+ var pack = new CA125_tagCMCoinBuyOrderInfo();
+ pack.AppID = config.appId;
+ pack.AppIDLen = (byte)pack.AppID.Length;
+ pack.OrderInfo = cpInfo;
+ pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
+ GameNetSystem.Instance.SendInfo(pack);
+ }
+ else
+ {
+ ConfirmCancel.ShowPopConfirm(
+ Language.Get("Mail101"),
+ Language.Get("GameCashRule1", money, title),
+ (bool isOk) =>
{
- var pack = new CA125_tagCMCoinBuyOrderInfo();
- pack.AppID = VersionConfig.Get().appId;
- pack.AppIDLen = (byte)pack.AppID.Length;
- pack.OrderInfo = cpInfo;
- pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
- GameNetSystem.Instance.SendInfo(pack);
- }
+ if (isOk)
+ {
+ var pack = new CA125_tagCMCoinBuyOrderInfo();
+ pack.AppID = config.appId;
+ pack.AppIDLen = (byte)pack.AppID.Length;
+ pack.OrderInfo = cpInfo;
+ pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
+ GameNetSystem.Instance.SendInfo(pack);
+ }
- });
- }
+ });
+ }
+ }).Forget();
+
}
else
{
@@ -1033,36 +1051,41 @@
// string storeOrderInfo = orderInfo.StoreOrderInfo2;
//#endif
-#if UNITY_EDITOR
- Debug.LogFormat("鍏呭��: {0}-{1}-{2}", title, money, cpInfo);
- return;
-#endif
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ #if UNITY_EDITOR
+ Debug.LogFormat("鍏呭��: {0}-{1}-{2}", title, money, cpInfo);
+ return;
+ #endif
- m_Json.Clear();
- m_Json["code"] = CodeU2A.FreePlatformPay;
- m_Json["orderId"] = DateTime.Now.ToString("yyyyMMddHHmmss") + UnityEngine.Random.Range(100000, 999999).ToString();
- m_Json["mount"] = money.ToString();
- m_Json["cpInfo"] = cpInfo;
- //m_Json["storeOrderInfo"] = storeOrderInfo;
- m_Json["title"] = title;
- m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID;
- m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
- m_Json["level"] = PlayerDatas.Instance.baseData.LV.ToString();
- m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
- m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
- m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
- m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
- m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
- m_Json["gameName"] = VersionConfig.Get().productName;
- m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
- m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
- m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
- m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.FreePlatformPay;
+ m_Json["orderId"] = DateTime.Now.ToString("yyyyMMddHHmmss") + UnityEngine.Random.Range(100000, 999999).ToString();
+ m_Json["mount"] = money.ToString();
+ m_Json["cpInfo"] = cpInfo;
+ //m_Json["storeOrderInfo"] = storeOrderInfo;
+ m_Json["title"] = title;
+ m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID;
+ m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
+ m_Json["level"] = PlayerDatas.Instance.baseData.LV.ToString();
+ m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
+ m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
+ m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
+ m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
+ m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
+ m_Json["gameName"] = config.productName;
+ m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+ m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
+ m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
+ m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
-#if UNITY_IOS
- m_Json["identifier"] = VersionConfig.Get().bundleIdentifier;
-#endif
- SendMessageToSDK(m_Json);
+ #if UNITY_IOS
+ m_Json["identifier"] = config.bundleIdentifier;
+ #endif
+ SendMessageToSDK(m_Json);
+ }).Forget();
+
+
}
@@ -1240,23 +1263,26 @@
public void CreateRoleOk(string roleID, string roleName, string time)
{
- m_Json.Clear();
- m_Json["code"] = CodeU2A.CreateRole;
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.CreateRole;
- m_Json["roleID"] = roleID;
- m_Json["roleName"] = roleName;
- m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
- m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
- m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
- m_Json["level"] = "1";
- m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
- m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
- m_Json["gameName"] = VersionConfig.Get().productName;
- m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
- m_Json["createTime"] = time;
- m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
- m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
- SendMessageToSDK(m_Json);
+ m_Json["roleID"] = roleID;
+ m_Json["roleName"] = roleName;
+ m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
+ m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
+ m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
+ m_Json["level"] = "1";
+ m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
+ m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
+ m_Json["gameName"] = config.productName;
+ m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+ m_Json["createTime"] = time;
+ m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
+ m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
+ SendMessageToSDK(m_Json);
+ }).Forget();
}
public void DownloadStart()
@@ -1277,45 +1303,51 @@
public void RoleLogin()
{
- m_Json.Clear();
- m_Json["code"] = CodeU2A.RoleLogin;
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.RoleLogin;
- m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID.ToString();
- m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
- m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
- m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
- m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
- m_Json["level"] = PlayerDatas.Instance.baseData.LV;
- m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
- m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
- m_Json["gameName"] = VersionConfig.Get().productName;
- m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
- m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
- m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
- m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
- SendMessageToSDK(m_Json);
+ m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID.ToString();
+ m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
+ m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
+ m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
+ m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
+ m_Json["level"] = PlayerDatas.Instance.baseData.LV;
+ m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
+ m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
+ m_Json["gameName"] = config.productName;
+ m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+ m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
+ m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
+ m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
+ SendMessageToSDK(m_Json);
+ }).Forget();
}
public void RoleLevelUp()
{
- m_Json.Clear();
- m_Json["code"] = CodeU2A.RoleLevelUp;
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.RoleLevelUp;
- m_Json["roleID"] = PlayerDatas.Instance.PlayerId.ToString();
- m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
- m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
- m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
- m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
- m_Json["level"] = PlayerDatas.Instance.baseData.LV;
- m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
- m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
- m_Json["gameName"] = VersionConfig.Get().productName;
- m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
- m_Json["levelUpTime"] = TimeUtility.AllSeconds.ToString();
- m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
- m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
- m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
- SendMessageToSDK(m_Json);
+ m_Json["roleID"] = PlayerDatas.Instance.PlayerId.ToString();
+ m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
+ m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
+ m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
+ m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
+ m_Json["level"] = PlayerDatas.Instance.baseData.LV;
+ m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
+ m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
+ m_Json["gameName"] = config.productName;
+ m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+ m_Json["levelUpTime"] = TimeUtility.AllSeconds.ToString();
+ m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
+ m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
+ m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
+ SendMessageToSDK(m_Json);
+ }).Forget();
}
@@ -1327,24 +1359,27 @@
if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin)
return;
- m_Json.Clear();
- m_Json["code"] = CodeU2A.RoleLoginOut;
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ m_Json.Clear();
+ m_Json["code"] = CodeU2A.RoleLoginOut;
- m_Json["roleID"] = PlayerDatas.Instance.PlayerId.ToString();
- m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
- m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
- m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
- m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
- m_Json["level"] = PlayerDatas.Instance.baseData.LV;
- m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
- m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
- m_Json["gameName"] = VersionConfig.Get().productName;
- m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
- m_Json["levelUpTime"] = TimeUtility.AllSeconds.ToString();
- m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
- m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
- m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
- SendMessageToSDK(m_Json);
+ m_Json["roleID"] = PlayerDatas.Instance.PlayerId.ToString();
+ m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
+ m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
+ m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
+ m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
+ m_Json["level"] = PlayerDatas.Instance.baseData.LV;
+ m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
+ m_Json["money"] = PlayerDatas.Instance.baseData.diamond.ToString();
+ m_Json["gameName"] = config.productName;
+ m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+ m_Json["levelUpTime"] = TimeUtility.AllSeconds.ToString();
+ m_Json["createTime"] = TimeUtility.CreateSeconds.ToString();
+ m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString();
+ m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString();
+ SendMessageToSDK(m_Json);
+ }).Forget();
}
public void GotoFansHouse()
diff --git a/Main/System/Arena/ArenaAwardWin.cs b/Main/System/Arena/ArenaAwardWin.cs
index 890ce45..d0180fb 100644
--- a/Main/System/Arena/ArenaAwardWin.cs
+++ b/Main/System/Arena/ArenaAwardWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -68,7 +68,7 @@
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
ArenaManager.Instance.nowAwardTabIndex = functionOrder;
Display();
diff --git a/Main/System/AssetVersion/AssetVersion.cs b/Main/System/AssetVersion/AssetVersion.cs
index 2d98fd1..0a34c54 100644
--- a/Main/System/AssetVersion/AssetVersion.cs
+++ b/Main/System/AssetVersion/AssetVersion.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System.IO;
+using Cysharp.Threading.Tasks;
public class AssetVersion
@@ -173,9 +174,9 @@
}
- public bool IsPriorAsset()
+ public async UniTask<bool> IsPriorAsset()
{
- if (VersionConfig.Get().partAssetPackage)
+ if ((await VersionConfig.GetAsync()).partAssetPackage)
{
//濡傛灉杩欏彴鏈哄櫒鏇剧粡瀹屾暣鐨勪笅杞借繃鎵�鏈夎祫婧愶紝閭d箞灏变笉鍐嶄娇鐢ㄥ垎鍖呬笅杞界瓥鐣ワ紝鍦ㄨ祫婧愮儹鏇存柊鐨勬椂鍊欒繖绉嶆儏鍐典細瑙﹀彂銆�
if (AssetVersionUtility.hasDownLoadFullAsset)
diff --git a/Main/System/AssetVersion/AssetVersionUtility.cs b/Main/System/AssetVersion/AssetVersionUtility.cs
index 96dbc31..d46bce3 100644
--- a/Main/System/AssetVersion/AssetVersionUtility.cs
+++ b/Main/System/AssetVersion/AssetVersionUtility.cs
@@ -101,21 +101,25 @@
}
public static void GetAssetVersionFile()
{
- checkAssetCompleted = false;
- Debug.LogFormat("寮�濮嬭幏鍙栬祫婧愮増鏈枃浠讹細鏃堕棿 {0}", DateTime.Now);
- var assetVersionUrl = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/AssetsVersion.txt");
- assetVerUrl = assetVersionUrl;
- Debug.Log("http鍦板潃:assetVersionUrl " + assetVersionUrl);
- HttpRequest.Instance.UnityWebRequestGet(assetVersionUrl, 5, OnGetAssetVersionFile);
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ checkAssetCompleted = false;
+ Debug.LogFormat("寮�濮嬭幏鍙栬祫婧愮増鏈枃浠讹細鏃堕棿 {0}", DateTime.Now);
+ var assetVersionUrl = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, "/AssetsVersion.txt");
+ assetVerUrl = assetVersionUrl;
+ Debug.Log("http鍦板潃:assetVersionUrl " + assetVersionUrl);
+ HttpRequest.Instance.UnityWebRequestGet(assetVersionUrl, 5, OnGetAssetVersionFile);
+ }).Forget();
+
}
- private static void OnGetAssetVersionFile(bool _ok, string _result)
+ private static async void OnGetAssetVersionFile(bool _ok, string _result)
{
Debug.LogFormat("鑾峰彇璧勬簮鐗堟湰鏂囦欢缁撴灉锛氭椂闂� {0}锛岀粨鏋� {1}, 鏂囦欢澶у皬 {2}", DateTime.Now, _ok, _result.Length);
if (_ok)
{
assetVersionsLocalMd5 = FileExtersion.GetStringMD5Hash(_result);
- var assetVersions = UpdateAssetVersions(_result);
+ var assetVersions = await UpdateAssetVersions(_result);
BeginCheckAssets();
}
else
@@ -132,48 +136,48 @@
if (InGameDownTestUtility.enable && !InGameDownTestUtility.isReadStreamingAssets)
checkStream = false;
#endif
+ BeginCheckAssetsAsync(checkStream).Forget();
+ }
- ThreadPool.QueueUserWorkItem(
- (object aaa) =>
+ private static async UniTaskVoid BeginCheckAssetsAsync(bool checkStream)
+ {
+ int count = 0;
+ foreach (var assetVersion in assetVersions.Values)
+ {
+ bool checkReuslt;
+ if (checkStream)
{
- foreach (var assetVersion in assetVersions.Values)
- {
- bool checkReuslt;
- if (checkStream)
- {
- AssetVersion localAssetVersion = null;
- localAssetVersions.TryGetValue(assetVersion.relativePath, out localAssetVersion);
- checkReuslt = assetVersion.CheckLocalFileValid(localAssetVersion);
- }
- else
- {
- checkReuslt = assetVersion.CheckLocalFileValid(false);
- }
- if (!checkReuslt)
- {
- if (assetVersion.IsPriorAsset())
- {
- priorDownLoadAssetVersions.Add(assetVersion);
- }
- else
- {
- unpriorDownLoadAssetVersions.Add(assetVersion);
- }
-
- assetVersion.localValid = false;
- }
- else
- {
- assetVersion.localValid = true;
- }
- }
-
- m_PriorAssetDownLoadDone = priorDownLoadAssetVersions.Count <= 0;
- m_UnPriorAssetDownLoadDone = unpriorDownLoadAssetVersions.Count <= 0;
-
- checkAssetCompleted = true;
+ AssetVersion localAssetVersion = null;
+ localAssetVersions.TryGetValue(assetVersion.relativePath, out localAssetVersion);
+ checkReuslt = assetVersion.CheckLocalFileValid(localAssetVersion);
}
- );
+ else
+ {
+ checkReuslt = assetVersion.CheckLocalFileValid(false);
+ }
+
+ if (!checkReuslt)
+ {
+ if (await assetVersion.IsPriorAsset())
+ priorDownLoadAssetVersions.Add(assetVersion);
+ else
+ unpriorDownLoadAssetVersions.Add(assetVersion);
+
+ assetVersion.localValid = false;
+ }
+ else
+ {
+ assetVersion.localValid = true;
+ }
+
+ count++;
+ if (count % 50 == 0)
+ await UniTask.Yield(); // 姣�50涓鍑轰竴甯э紝閬垮厤涓荤嚎绋嬪崱椤�
+ }
+
+ m_PriorAssetDownLoadDone = priorDownLoadAssetVersions.Count <= 0;
+ m_UnPriorAssetDownLoadDone = unpriorDownLoadAssetVersions.Count <= 0;
+ checkAssetCompleted = true;
}
public static void BeginDownLoadTask(bool _prior)
@@ -194,9 +198,9 @@
}
}
- public static Dictionary<string, AssetVersion> UpdateAssetVersions(string _assetVersionFile)
+ public async static UniTask<Dictionary<string, AssetVersion>> UpdateAssetVersions(string _assetVersionFile)
{
- InitPackageVersionInfo();
+ await InitPackageVersionInfo();
var lines = _assetVersionFile.Split(new string[] { FileExtersion.lineSplit }, StringSplitOptions.RemoveEmptyEntries);
assetVersions.Clear();
for (int i = 0; i < lines.Length; i++)
@@ -207,9 +211,9 @@
return assetVersions;
}
- static void InitPackageVersionInfo()
+ static async UniTask InitPackageVersionInfo()
{
- var text = Resources.Load<TextAsset>("AssetsVersionCmp");
+ var text = await Resources.LoadAsync<TextAsset>("AssetsVersionCmp") as TextAsset;
if (text != null)
{
var lines = text.text.Split(new string[] { FileExtersion.lineSplit }, StringSplitOptions.RemoveEmptyEntries);
diff --git a/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs b/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
index 2ec532b..8d0be2a 100644
--- a/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
+++ b/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
@@ -92,13 +92,16 @@
protected async UniTask Co_StartDownLoad()
{
+ var config = await VersionConfig.GetAsync();
+
while (tasks.Count > 0)
{
DownloadHotMgr.Instance.Prepare();
+
for (int i = 0; i < tasks.Count; i++)
{
var assetVersion = tasks[i];
- var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath);
+ var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, "/", assetVersion.relativePath);
var localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath);
DownloadHotMgr.Instance.AddTask(new DownloadHotTask(remoteURL, localURL));
}
diff --git a/Main/System/AssetVersion/InGameDownLoad.cs b/Main/System/AssetVersion/InGameDownLoad.cs
index 2581672..6fbdfeb 100644
--- a/Main/System/AssetVersion/InGameDownLoad.cs
+++ b/Main/System/AssetVersion/InGameDownLoad.cs
@@ -4,6 +4,7 @@
using System;
using System.Text.RegularExpressions;
using LitJson;
+using Cysharp.Threading.Tasks;
public class InGameDownLoad : SingletonMonobehaviour<InGameDownLoad>
@@ -147,13 +148,21 @@
DownloadHotMgr.Instance.Prepare();
+ var versionConfig = VersionConfig.config;
+
+ if (null == versionConfig)
+ {
+ // 濡傛灉鍓嶉潰閮芥病鑾峰彇鍒伴偅涓�瀹氭槸鍝噷鍑洪棶棰樹簡 浠庤繖閲屾墦鏂�
+ throw new Exception("VersionConfig is null when AssignTasks, game will pause here");
+ }
+
for (int i = 0; i < this.assets.Count; i++)
{
var assetVersion = this.assets[i];
totalSize += assetVersion.size;//缁熻璧勬簮鎬诲ぇ灏�
//娣诲姞涓嬭浇浠诲姟
- var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath);
+ var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(versionConfig.branch), Language.fixPath, "/", assetVersion.relativePath);
var localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath);
DownloadHotMgr.Instance.AddTask(new DownloadHotTask(remoteURL, localURL, assetVersion));
}
diff --git a/Main/System/AssetVersion/InGameDownLoadProgress.cs b/Main/System/AssetVersion/InGameDownLoadProgress.cs
index dc6d038..5f27db7 100644
--- a/Main/System/AssetVersion/InGameDownLoadProgress.cs
+++ b/Main/System/AssetVersion/InGameDownLoadProgress.cs
@@ -5,6 +5,7 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class InGameDownLoadProgress : MonoBehaviour
diff --git a/Main/System/AssetVersion/InGameDownTestUtility.cs b/Main/System/AssetVersion/InGameDownTestUtility.cs
index e9166c4..caa503a 100644
--- a/Main/System/AssetVersion/InGameDownTestUtility.cs
+++ b/Main/System/AssetVersion/InGameDownTestUtility.cs
@@ -3,6 +3,8 @@
using UnityEngine;
using System.IO;
using System;
+using Cysharp.Threading.Tasks;
+
#if UNITY_EDITOR
using UnityEditor;
#endif
@@ -51,33 +53,40 @@
[RuntimeInitializeOnLoadMethod]
public static void Init()
{
- if (InGameDownTestUtility.enable)
- {
- VersionConfig.Get().assetAccess = InstalledAsset.NullAsset;
- }
- else
- {
- VersionConfig.Get().assetAccess = InstalledAsset.IngoreDownLoad;
- }
+ VersionConfig.GetAsync().ContinueWith(config => {
+ if (InGameDownTestUtility.enable)
+ {
+ config.assetAccess = InstalledAsset.NullAsset;
+ }
+ else
+ {
+ config.assetAccess = InstalledAsset.IngoreDownLoad;
+ }
- VersionConfig.Get().partAssetPackage = InGameDownTestUtility.isPartPackage;
+ config.partAssetPackage = InGameDownTestUtility.isPartPackage;
+ }).Forget();
+
}
#endif
public static bool GetReadVerionEx()
{
#if UNITY_EDITOR
- //鐢熸垚VersionConfigEx.txt 鎻愪緵缁橝OT鍚姩鏃朵娇鐢�
- var json = JsonUtility.ToJson(VersionConfig.Get());
- string versionConfigExFile = Application.dataPath + "/Resources/VersionConfigEx.txt";
- if (File.Exists(versionConfigExFile))
+ VersionConfig.GetAsync().ContinueWith(config =>
{
- File.Delete(versionConfigExFile);
- }
- File.WriteAllText(versionConfigExFile, json);
- AssetDatabase.SaveAssets();
- AssetDatabase.Refresh();
- Debug.Log("鍚屾VersionConfigEx.txt鎴愬姛");
+ //鐢熸垚VersionConfigEx.txt 鎻愪緵缁橝OT鍚姩鏃朵娇鐢�
+ var json = JsonUtility.ToJson(config);
+ string versionConfigExFile = Application.dataPath + "/Resources/VersionConfigEx.txt";
+ if (File.Exists(versionConfigExFile))
+ {
+ File.Delete(versionConfigExFile);
+ }
+ File.WriteAllText(versionConfigExFile, json);
+ AssetDatabase.SaveAssets();
+ AssetDatabase.Refresh();
+ Debug.Log("鍚屾VersionConfigEx.txt鎴愬姛");
+ }).Forget();
+
#endif
return enable && isReadVesionEx;
}
diff --git a/Main/System/Attribute/AttributeManager.cs b/Main/System/Attribute/AttributeManager.cs
index fb87b23..3b3d2e1 100644
--- a/Main/System/Attribute/AttributeManager.cs
+++ b/Main/System/Attribute/AttributeManager.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class AttributeManager : GameSystemManager<AttributeManager>
{
diff --git a/Main/System/Battle/ArenaBattleWin.cs b/Main/System/Battle/ArenaBattleWin.cs
index 0a25800..a1ad183 100644
--- a/Main/System/Battle/ArenaBattleWin.cs
+++ b/Main/System/Battle/ArenaBattleWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using LitJson;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class ArenaBattleWin : BaseBattleWin
{
diff --git a/Main/System/Battle/BaseBattleWin.cs b/Main/System/Battle/BaseBattleWin.cs
index b39f7d3..064383d 100644
--- a/Main/System/Battle/BaseBattleWin.cs
+++ b/Main/System/Battle/BaseBattleWin.cs
@@ -310,7 +310,7 @@
/// <summary>
/// 璁剧疆鎴樻枟瀛楁
/// </summary>
- public virtual void SetBattleField(BattleField _battleField)
+ public virtual async void SetBattleField(BattleField _battleField)
{
// 1. 娓呯悊鏃х殑鎴樺満
if (battleField != null)
@@ -341,7 +341,7 @@
BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
if (null == ui)
{
- ui = UIManager.Instance.OpenWindowAsync<BattleHUDWin>().Forget();
+ ui = await UIManager.Instance.OpenWindowAsync<BattleHUDWin>();
}
ui.SetBattleField(battleField);
diff --git a/Main/System/Battle/BattleEffectMgr.cs b/Main/System/Battle/BattleEffectMgr.cs
index eb29191..a015f53 100644
--- a/Main/System/Battle/BattleEffectMgr.cs
+++ b/Main/System/Battle/BattleEffectMgr.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class BattleEffectMgr
@@ -108,7 +109,7 @@
}
effectPlayer.SetSpeedRatio(battleField.speedRatio);
- effectPlayer.Play(true);
+ effectPlayer.Play(true).Forget();
effectPlayer.SetScaleX(isRedCamp ? 1 : -1);
diff --git a/Main/System/Battle/BattleField/ArenaBattleField.cs b/Main/System/Battle/BattleField/ArenaBattleField.cs
index f0286e2..7ad4307 100644
--- a/Main/System/Battle/BattleField/ArenaBattleField.cs
+++ b/Main/System/Battle/BattleField/ArenaBattleField.cs
@@ -104,12 +104,12 @@
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
ArenaBattleWin fsBattleWin = UIManager.Instance.GetUI<ArenaBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindowAsync<ArenaBattleWin>().Forget();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<ArenaBattleWin>();
}
fsBattleWin.SetBattleField(this);
if (UIManager.Instance.IsOpened<ArenaWin>())
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index 04293c2..fe6bee2 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -60,6 +60,12 @@
}
}
+ public bool IsInit
+ {
+ get;
+ protected set;
+ } = false;
+
protected bool isFocus = false;
public BattleRootNode battleRootNode;
@@ -92,7 +98,6 @@
battleEffectMgr = new BattleEffectMgr();
battleTweenMgr = new BattleTweenMgr();
recordPlayer = new RecordPlayer();
- soundManager = new BattleSoundManager(this);
processingDeathObjIds = new HashSet<uint>();
}
@@ -106,6 +111,9 @@
GameObject battleRootNodeGO = GameObject.Instantiate(go);
battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>();
battleRootNodeGO.name = GetType().Name;
+
+ soundManager = new BattleSoundManager(this);
+
}
public void AddCastingSkill(long objID, SkillBase skill)
{
@@ -146,6 +154,7 @@
public async virtual UniTask Init(int _MapID, int _FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte _turnMax)
{
+ IsInit = false;
SetData(_MapID, _FuncLineID, _extendData, _redTeamList, _blueTeamList, _turnMax);
battleEffectMgr.Init(this);
battleTweenMgr.Init(this);
@@ -169,6 +178,8 @@
PreloadResources(redTeamList, blueTeamList);
EventBroadcast.Instance.Broadcast<string>(EventName.BATTLE_START, guid);
+
+ IsInit = true;
#if UNITY_EDITOR
if (Launch.Instance.isOpenSkillLogFile)
@@ -214,6 +225,7 @@
public async virtual UniTask Reload(int _MapID, int _FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte _turnMax)
{
+ IsInit = false;
SetData(_MapID, _FuncLineID, _extendData, _redTeamList, _blueTeamList, _turnMax);
battleEffectMgr.Reload(this);
battleTweenMgr.Reload(this);
@@ -239,6 +251,7 @@
PreloadResources(redTeamList, blueTeamList);
+ IsInit = true;
}
public virtual void SetData(int _MapID, int _FuncLineID, JsonData _extendData,
diff --git a/Main/System/Battle/BattleField/BoneBattleField.cs b/Main/System/Battle/BattleField/BoneBattleField.cs
index 1ed3adb..f831a27 100644
--- a/Main/System/Battle/BattleField/BoneBattleField.cs
+++ b/Main/System/Battle/BattleField/BoneBattleField.cs
@@ -90,12 +90,12 @@
BattleManager.Instance.DistributeNextReportPackage(guid);
}
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
BoneFieldBattleWin fsBattleWin = UIManager.Instance.GetUI<BoneFieldBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindowAsync<BoneFieldBattleWin>().Forget();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<BoneFieldBattleWin>();
}
fsBattleWin.SetBattleField(this);
diff --git a/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs b/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs
index e01ae0b..28b2f17 100644
--- a/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs
@@ -1,5 +1,6 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class BattleStartAction : RecordAction
{
diff --git a/Main/System/Battle/BattleField/StoryBattleField.cs b/Main/System/Battle/BattleField/StoryBattleField.cs
index e7b2852..e61e9ed 100644
--- a/Main/System/Battle/BattleField/StoryBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBattleField.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using LitJson;
using UnityEngine;
using System.Collections.Generic;
@@ -323,7 +323,7 @@
return false;
}
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
BattleWin battleWin = UIManager.Instance.GetUI<BattleWin>();
if (null != battleWin)
diff --git a/Main/System/Battle/BattleField/StoryBossBattleField.cs b/Main/System/Battle/BattleField/StoryBossBattleField.cs
index 5d3ec7d..d7797b7 100644
--- a/Main/System/Battle/BattleField/StoryBossBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBossBattleField.cs
@@ -125,12 +125,12 @@
BattleManager.Instance.DistributeNextReportPackage(guid);
}
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
StoryBossBattleWin fsBattleWin = UIManager.Instance.GetUI<StoryBossBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindowAsync<StoryBossBattleWin>().Forget();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<StoryBossBattleWin>();
}
fsBattleWin.SetBattleField(this);
}
diff --git a/Main/System/Battle/BattleField/TianziBillboradBattleField.cs b/Main/System/Battle/BattleField/TianziBillboradBattleField.cs
index 52688eb..7c639b3 100644
--- a/Main/System/Battle/BattleField/TianziBillboradBattleField.cs
+++ b/Main/System/Battle/BattleField/TianziBillboradBattleField.cs
@@ -92,12 +92,12 @@
BattleManager.Instance.DistributeNextReportPackage(guid);
}
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
TianziBillboradBattleWin fsBattleWin = UIManager.Instance.GetUI<TianziBillboradBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindowAsync<TianziBillboradBattleWin>().Forget();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<TianziBillboradBattleWin>();
}
fsBattleWin.SetBattleField(this);
diff --git a/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs b/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs
index 1724d87..9806bec 100644
--- a/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs
+++ b/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs
@@ -85,12 +85,12 @@
BattleManager.Instance.DistributeNextReportPackage(guid);
}
- public override void ShowWindow(HB424_tagSCTurnFightInit vNetData)
+ public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData)
{
WarlordPavilionBattleWin fsBattleWin = UIManager.Instance.GetUI<WarlordPavilionBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindowAsync<WarlordPavilionBattleWin>().Forget();
+ fsBattleWin = await UIManager.Instance.OpenWindowAsync<WarlordPavilionBattleWin>();
}
fsBattleWin.SetBattleField(this);
diff --git a/Main/System/Battle/BattleHUDWin.cs b/Main/System/Battle/BattleHUDWin.cs
index 9caf522..fbb0cc0 100644
--- a/Main/System/Battle/BattleHUDWin.cs
+++ b/Main/System/Battle/BattleHUDWin.cs
@@ -84,7 +84,7 @@
}
- public void SetBattleField(BattleField _battleField)
+ public async void SetBattleField(BattleField _battleField)
{
CleanupBattleField();
ClearContent(string.Empty, true);
diff --git a/Main/System/Battle/BattleResources/BattleCacheManager.cs b/Main/System/Battle/BattleResources/BattleCacheManager.cs
index f9716f3..89af7a8 100644
--- a/Main/System/Battle/BattleResources/BattleCacheManager.cs
+++ b/Main/System/Battle/BattleResources/BattleCacheManager.cs
@@ -138,9 +138,12 @@
var res = globalSpineCache[key];
if (res.CachedResource.Asset != null)
{
+ // spine AssetName 鏃犳墿灞曞悕锛孶nloadAsset 闇�涓� LoadAssetAsync(needExt=true) 涓�鑷村姞 .asset
+ string spineAssetName = res.CachedResource.Identifier.AssetName;
+ if (!spineAssetName.EndsWith(".asset")) spineAssetName += ".asset";
ResManager.Instance.UnloadAsset(
- res.CachedResource.Identifier.Directory,
- res.CachedResource.Identifier.AssetName
+ res.CachedResource.Identifier.Directory,
+ spineAssetName
);
}
globalSpineCache.Remove(key);
@@ -369,9 +372,11 @@
var res = globalSpineCache[key];
if (res.CachedResource.Asset != null)
{
+ string spineAssetName2 = res.CachedResource.Identifier.AssetName;
+ if (!spineAssetName2.EndsWith(".asset")) spineAssetName2 += ".asset";
ResManager.Instance.UnloadAsset(
res.CachedResource.Identifier.Directory,
- res.CachedResource.Identifier.AssetName
+ spineAssetName2
);
}
globalSpineCache.Remove(key);
diff --git a/Main/System/Battle/BattleResources/BattlePreloadManager.cs b/Main/System/Battle/BattleResources/BattlePreloadManager.cs
index 3c331cb..f0fe5fe 100644
--- a/Main/System/Battle/BattleResources/BattlePreloadManager.cs
+++ b/Main/System/Battle/BattleResources/BattlePreloadManager.cs
@@ -212,7 +212,8 @@
ResManager.Instance.LoadAssetAsync<AudioClip>(
identifier.Directory,
- identifier.AssetName).ContinueWith(
+ identifier.AssetName,
+ false).ContinueWith(
(asset) =>
{
if (asset != null)
diff --git a/Main/System/Battle/BattleResources/TeamResTracker.cs b/Main/System/Battle/BattleResources/TeamResTracker.cs
index ef06205..6219ba1 100644
--- a/Main/System/Battle/BattleResources/TeamResTracker.cs
+++ b/Main/System/Battle/BattleResources/TeamResTracker.cs
@@ -146,7 +146,7 @@
{
var identifier = new BattleResCache.ResourceIdentifier
{
- Directory = "UIEffect/" + effectConfig.packageName,
+ Directory = "UIEffect/" + effectConfig.packageName.Replace("\\", "/"),
AssetName = effectConfig.fxName,
Type = BattleResCache.ResourceType.Spine,
IsPersistent = isPersistent,
diff --git a/Main/System/Battle/BattleWin.cs b/Main/System/Battle/BattleWin.cs
index 221b3c2..59a0e12 100644
--- a/Main/System/Battle/BattleWin.cs
+++ b/Main/System/Battle/BattleWin.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BattleWin : UIBase
{
@@ -129,7 +130,7 @@
- public void SetBattleField(BattleField _battleField)
+ public async void SetBattleField(BattleField _battleField)
{
battleField = _battleField;
if (battleRootNode != null)
@@ -148,11 +149,9 @@
if (null == ui)
{
- UIManager.Instance.OpenWindowAsync<BattleHUDWin>().ContinueWith(w =>
- {
- w.SetBattleField(battleField);
- battleField.UpdateCanvas(canvas);
- }).Forget();
+ ui = await UIManager.Instance.OpenWindowAsync<BattleHUDWin>();
+ ui.SetBattleField(battleField);
+ battleField.UpdateCanvas(canvas);
return;
}
diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index 83300c5..35a6f77 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -4,6 +4,17 @@
public class RecordPlayer
{
+
+
+ // 鍒濆鍖栦箣鍓嶅厑璁哥殑record action绫诲瀷
+ private readonly static List<Type> allowedActionTypes = new List<Type>()
+ {
+ typeof(BattleStartAction),
+ typeof(PreloadResAction),
+ };
+
+ private List<RecordAction> tempPreinitRecordActionList = new List<RecordAction>();
+
protected BattleField battleField;
private Queue<RecordAction> recordActionQueue = new Queue<RecordAction>();
@@ -48,6 +59,7 @@
public void PlayRecord(RecordAction recordAction)
{
if (recordAction == null) return;
+ if (!CheckRecordType(recordAction)) return;
recordAction.actionOwner = this;
// Debug.LogError("Enqueue record action " + recordAction.GetType() + " to queue");
if (isForceFinish || stepForcefinish)
@@ -62,6 +74,7 @@
public void PlayRecord(RecordAction recordAction, RecordAction waitingAnimeAction)
{
if (recordAction == null) return;
+ if (!CheckRecordType(recordAction)) return;
recordAction.actionOwner = this;
// Debug.LogError("Enqueue record action " + recordAction.GetType() + " to queue");
if (isForceFinish || stepForcefinish)
@@ -85,6 +98,7 @@
public void InsertRecord(RecordAction recordAction, int position = 0)
{
if (recordAction == null) return;
+ if (!CheckRecordType(recordAction)) return;
recordAction.actionOwner = this;
if (isForceFinish || stepForcefinish)
{
@@ -270,8 +284,45 @@
}
}
+ private bool CheckRecordType(RecordAction recordAction)
+ {
+ if (battleField.IsInit)
+ {
+ return true;
+ }
+ else
+ {
+ if (!allowedActionTypes.Contains(recordAction.GetType()))
+ {
+ tempPreinitRecordActionList.Add(recordAction);
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+
public virtual void Run()
{
+
+ if (battleField != null)
+ {
+ if (!battleField.IsInit)
+ {
+ return;
+ }
+ if (tempPreinitRecordActionList.Count > 0)
+ {
+ foreach (var action in tempPreinitRecordActionList)
+ {
+ PlayRecord(action);
+ }
+ tempPreinitRecordActionList.Clear();
+ }
+ }
+
ImmediatelyPlayRun();
// 绛夊緟涓嬩竴涓猘ction
diff --git a/Main/System/Battle/Sound/BattleSoundManager.cs b/Main/System/Battle/Sound/BattleSoundManager.cs
index ee5f0aa..597ffa2 100644
--- a/Main/System/Battle/Sound/BattleSoundManager.cs
+++ b/Main/System/Battle/Sound/BattleSoundManager.cs
@@ -167,7 +167,7 @@
// 璁剧疆闊抽噺锛堜娇鐢ㄩ煶鏁堥煶閲忚缃級
source.volume = SystemSetting.Instance.GetSoundEffect();
-
+ source.mute = SystemSetting.Instance.GetMuteSoundEffect();
// 璁剧疆鎾斁閫熷害锛屼娇鐢╬itch鏉ユ帶鍒�
// pitch鑼冨洿寤鸿鍦�0.5-2.0涔嬮棿浠ラ伩鍏嶅け鐪�
if (pitchControl)
diff --git a/Main/System/Battle/UIComp/BattleBuffCell.cs b/Main/System/Battle/UIComp/BattleBuffCell.cs
index 90e2946..2b1e5dd 100644
--- a/Main/System/Battle/UIComp/BattleBuffCell.cs
+++ b/Main/System/Battle/UIComp/BattleBuffCell.cs
@@ -66,15 +66,19 @@
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("BattleBuffCell", "Container_BuffCell");
+ var inst = await UIUtility.CreateWidget("BattleBuffCell", "Container_BuffCell");
if (this == null)
{
- if (null != cellContainer)
- {
- DestroyImmediate(cellContainer);
- }
+ if (null != inst) DestroyImmediate(inst);
return;
}
+
+ if (cellContainer != null)
+ {
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
if (cellContainer != null)
{
@@ -109,6 +113,7 @@
return;
}
await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
var config = SkillConfig.Get((int)buffData.SkillID);
if (config == null)
{
diff --git a/Main/System/Battle/UIComp/MinggeBuffCell.cs b/Main/System/Battle/UIComp/MinggeBuffCell.cs
index 56454ca..7bd6dd4 100644
--- a/Main/System/Battle/UIComp/MinggeBuffCell.cs
+++ b/Main/System/Battle/UIComp/MinggeBuffCell.cs
@@ -47,7 +47,7 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
GameObject cellContainer;
@@ -66,15 +66,20 @@
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("MinggeBuffCell", "Container_BuffCell");
+ var inst = await UIUtility.CreateWidget("MinggeBuffCell", "Container_BuffCell");
if (this == null)
{
- if (null != cellContainer)
- {
- DestroyImmediate(cellContainer);
- }
+ if (null != inst) DestroyImmediate(inst);
return;
}
+
+ if (cellContainer != null)
+ {
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
if (cellContainer != null)
{
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
diff --git a/Main/System/BattlePass/BattlePassBaseCell.cs b/Main/System/BattlePass/BattlePassBaseCell.cs
index c7b9090..7aa52df 100644
--- a/Main/System/BattlePass/BattlePassBaseCell.cs
+++ b/Main/System/BattlePass/BattlePassBaseCell.cs
@@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BattlePassBaseCell : CellView
diff --git a/Main/System/BeautyMM/BeautyMMActiveWin.cs b/Main/System/BeautyMM/BeautyMMActiveWin.cs
index 753dd61..ae54d32 100644
--- a/Main/System/BeautyMM/BeautyMMActiveWin.cs
+++ b/Main/System/BeautyMM/BeautyMMActiveWin.cs
@@ -3,6 +3,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BeautyMMActiveWin : UIBase
{
diff --git a/Main/System/BeautyMM/BeautyMMBaseWin.cs b/Main/System/BeautyMM/BeautyMMBaseWin.cs
index e6af6da..9f9fe3f 100644
--- a/Main/System/BeautyMM/BeautyMMBaseWin.cs
+++ b/Main/System/BeautyMM/BeautyMMBaseWin.cs
@@ -1,22 +1,23 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BeautyMMBaseWin : OneLevelWin
{
[SerializeField] Image ylBG;
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindowAsync<BeautyMMListWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<BeautyMMListWin>();
ylBG.SetActive(false);
break;
case 1:
// 鍏呭�肩晫闈�
- currentSubUI = UIManager.Instance.OpenWindowAsync<BeautyMMTravelWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<BeautyMMTravelWin>();
ylBG.SetActive(true);
break;
default:
diff --git a/Main/System/BeautyMM/BeautyMMCell.cs b/Main/System/BeautyMM/BeautyMMCell.cs
index 55124ca..012a6af 100644
--- a/Main/System/BeautyMM/BeautyMMCell.cs
+++ b/Main/System/BeautyMM/BeautyMMCell.cs
@@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BeautyMMCell : MonoBehaviour
diff --git a/Main/System/BeautyMM/BeautyMMManager.cs b/Main/System/BeautyMM/BeautyMMManager.cs
index 73668e5..067c44c 100644
--- a/Main/System/BeautyMM/BeautyMMManager.cs
+++ b/Main/System/BeautyMM/BeautyMMManager.cs
@@ -4,6 +4,7 @@
using System;
using System.Linq;
using LitJson;
+using Cysharp.Threading.Tasks;
public partial class BeautyMMManager : GameSystemManager<BeautyMMManager>
diff --git a/Main/System/BeautyMM/BeautyMMShowWin.cs b/Main/System/BeautyMM/BeautyMMShowWin.cs
index 803c858..5b8dca8 100644
--- a/Main/System/BeautyMM/BeautyMMShowWin.cs
+++ b/Main/System/BeautyMM/BeautyMMShowWin.cs
@@ -3,6 +3,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BeautyMMShowWin : UIBase
{
diff --git a/Main/System/BillboardRank/GuildRankCell.cs b/Main/System/BillboardRank/GuildRankCell.cs
index 09d9d32..4e5df98 100644
--- a/Main/System/BillboardRank/GuildRankCell.cs
+++ b/Main/System/BillboardRank/GuildRankCell.cs
@@ -4,6 +4,7 @@
//--------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鐜╁閫氱敤鎺掑悕
public class GuildRankCell : MonoBehaviour
diff --git a/Main/System/BillboardRank/GuildTop3Cell.cs b/Main/System/BillboardRank/GuildTop3Cell.cs
index 8c35d1a..08f13c6 100644
--- a/Main/System/BillboardRank/GuildTop3Cell.cs
+++ b/Main/System/BillboardRank/GuildTop3Cell.cs
@@ -4,6 +4,7 @@
//--------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鐜╁閫氱敤鐨勫墠3鎺掑悕
public class GuildTop3Cell : MonoBehaviour
diff --git a/Main/System/BoneField/BoneFieldWin.cs b/Main/System/BoneField/BoneFieldWin.cs
index 1cce980..a791f61 100644
--- a/Main/System/BoneField/BoneFieldWin.cs
+++ b/Main/System/BoneField/BoneFieldWin.cs
@@ -192,7 +192,7 @@
txtBossName.text = nPCConfig.NPCName;
txtDifficulty.text = nowPassLineID.ToString();
txtFightPower.text = UIHelper.ReplaceLargeArtNum(dungeonConfig.FightPower);
- bossModel.Create(nPCConfig.SkinID, modelSize);
+ bossModel.Create(nPCConfig.SkinID, modelSize).Forget();
}
public void DisplayChallengeButton(DungeonConfig dungeonConfig, FBInfo fBInfo)
diff --git a/Main/System/ChallengeTab/ArenaTabHandler.cs b/Main/System/ChallengeTab/ArenaTabHandler.cs
index 256eb12..e040f0d 100644
--- a/Main/System/ChallengeTab/ArenaTabHandler.cs
+++ b/Main/System/ChallengeTab/ArenaTabHandler.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class ArenaTabHandler : BaseChallengeTabHandler
{
@@ -19,7 +20,7 @@
return HandleArenaNavigation;
}
- private void HandleArenaNavigation()
+ private async void HandleArenaNavigation()
{
if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true))
return;
@@ -31,7 +32,7 @@
ArenaBattleWin battleWin;
if (!UIManager.Instance.IsOpened<ArenaBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindowAsync<ArenaBattleWin>().Forget();
+ battleWin = await UIManager.Instance.OpenWindowAsync<ArenaBattleWin>();
}
else
{
diff --git a/Main/System/ChallengeTab/BoneFieldTabHandler.cs b/Main/System/ChallengeTab/BoneFieldTabHandler.cs
index 47f01cc..f61c614 100644
--- a/Main/System/ChallengeTab/BoneFieldTabHandler.cs
+++ b/Main/System/ChallengeTab/BoneFieldTabHandler.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class BoneFieldTabHandler : BaseChallengeTabHandler
{
@@ -22,7 +23,7 @@
return HandleBoneFieldNavigation;
}
- private void HandleBoneFieldNavigation()
+ private async void HandleBoneFieldNavigation()
{
if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true))
return;
@@ -33,7 +34,7 @@
BoneFieldBattleWin battleWin;
if (!UIManager.Instance.IsOpened<BoneFieldBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindowAsync<BoneFieldBattleWin>().Forget();
+ battleWin = await UIManager.Instance.OpenWindowAsync<BoneFieldBattleWin>();
}
else
{
diff --git a/Main/System/ChallengeTab/TianziBillboradTabHandler.cs b/Main/System/ChallengeTab/TianziBillboradTabHandler.cs
index 67e0d1c..e092c37 100644
--- a/Main/System/ChallengeTab/TianziBillboradTabHandler.cs
+++ b/Main/System/ChallengeTab/TianziBillboradTabHandler.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TianziBillboradTabHandler : BaseChallengeTabHandler
{
@@ -19,7 +20,7 @@
return HandleBoneFieldNavigation;
}
- private void HandleBoneFieldNavigation()
+ private async void HandleBoneFieldNavigation()
{
if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true))
return;
@@ -31,7 +32,7 @@
TianziBillboradBattleWin battleWin;
if (!UIManager.Instance.IsOpened<TianziBillboradBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindowAsync<TianziBillboradBattleWin>().Forget();
+ battleWin = await UIManager.Instance.OpenWindowAsync<TianziBillboradBattleWin>();
}
else
{
diff --git a/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs b/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs
index 5ad70eb..95841f3 100644
--- a/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs
+++ b/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionTabHandler : BaseChallengeTabHandler
{
@@ -19,7 +20,7 @@
return HandleBoneFieldNavigation;
}
- private void HandleBoneFieldNavigation()
+ private async void HandleBoneFieldNavigation()
{
if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true))
return;
@@ -31,7 +32,7 @@
WarlordPavilionBattleWin battleWin;
if (!UIManager.Instance.IsOpened<WarlordPavilionBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindowAsync<WarlordPavilionBattleWin>().Forget();
+ battleWin = await UIManager.Instance.OpenWindowAsync<WarlordPavilionBattleWin>();
}
else
{
diff --git a/Main/System/ClientVersion/VersionConfig.cs b/Main/System/ClientVersion/VersionConfig.cs
index 5a0251f..c9f8c69 100644
--- a/Main/System/ClientVersion/VersionConfig.cs
+++ b/Main/System/ClientVersion/VersionConfig.cs
@@ -3,6 +3,8 @@
using UnityEngine;
using System.IO;
using LitJson;
+using Cysharp.Threading.Tasks;
+
#if UNITY_EDITOR
using UnityEditor;
@@ -12,6 +14,7 @@
public class VersionConfig : ScriptableObject
{
+
public const string VERSION_ALTERNATIVE = "1.0.0";
[SerializeField] public string m_AppId = string.Empty;
@@ -73,15 +76,7 @@
{
if (string.IsNullOrEmpty(m_GameId))
{
- var gameText = Resources.Load<TextAsset>("Game");
- if (gameText != null)
- {
- m_GameId = gameText.text;
- }
- else
- {
- m_GameId = "xssg";
- }
+ Debug.LogError("VersionConfig gameId is empty, do getasync first");
}
return m_GameId;
@@ -200,14 +195,13 @@
}
}
- static VersionConfig config = null;
- public static VersionConfig Get()
+ public static async UniTask<VersionConfig> GetAsync()
{
if (config == null)
{
if (Application.isEditor)
{
- config = Resources.Load<VersionConfig>("VersionConfig");
+ config = await Resources.LoadAsync<VersionConfig>("VersionConfig") as VersionConfig;
//debug鐧诲綍鍚庣浜屾鍚姩榛樿鎭㈠test
if (LocalSave.GetBool("RestoreTest"))
{
@@ -215,23 +209,72 @@
LocalSave.SetBool("RestoreTest", false);
Debug.Log("appid 鎭㈠test");
}
-
}
else
{
- var text = Resources.Load<TextAsset>("VersionConfigEx");
- if (text != null)
+ var textAsset = await Resources.LoadAsync<TextAsset>("VersionConfigEx") as TextAsset;
+ if (textAsset != null)
{
config = ScriptableObject.CreateInstance<VersionConfig>();
- var json = JsonMapper.ToObject(text.text);
+ var json = JsonMapper.ToObject(textAsset.text);
ReadJson(json); //閫愪竴瑙f瀽锛屼笉鐢╒ersionConfig绫荤粨鏋勮鍙栵紝鍥犱负鍙橀噺瀹氫箟鏄寜asset鐨勭粨鏋勫畾涔夌殑
}
+ else
+ {
+ Debug.LogError("[VersionConfig] VersionConfigEx not found, falling back to VersionConfig asset");
+ config = await Resources.LoadAsync<VersionConfig>("VersionConfig") as VersionConfig;
+ }
+ }
+ }
+
+ if (string.IsNullOrEmpty(config.m_GameId))
+ {
+ var gameText = await Resources.LoadAsync<TextAsset>("Game") as TextAsset;
+ if (gameText != null)
+ {
+ config.m_GameId = gameText.text;
+ }
+ else
+ {
+ config.m_GameId = "xssg";
}
}
return config;
}
+ 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 void ReadJson(JsonData _data)
{
try
diff --git a/Main/System/ClientVersion/VersionUtility.cs b/Main/System/ClientVersion/VersionUtility.cs
index 1ad3e53..664d822 100644
--- a/Main/System/ClientVersion/VersionUtility.cs
+++ b/Main/System/ClientVersion/VersionUtility.cs
@@ -10,13 +10,14 @@
using LitJson;
using System.IO;
using System.Text;
+using Cysharp.Threading.Tasks;
public class VersionUtility : Singleton<VersionUtility>
{
// public static readonly string[] VERSION_URL = new string[] {
- // "http://xssgcenter.secondworld.net.cn:11000/center/appversion_new.php/?"};
+ // "http://gamecenter.secondworld.net.cn:11000/center/appversion_new.php/?"};
public string androidRoot { get { return string.Empty;/*StringUtility.Concat(SDKUtils.Instance.DeviceRootPath, "/", VersionConfig.Get().bundleIdentifier);*/ } }
@@ -228,13 +229,13 @@
/// 鏄惁涓篿os瀹℃牳鏃堕棿鍐�
/// </summary>
/// <returns></returns>
- public bool InIosAuditTime()
+ public async UniTask<bool> InIosAuditTime()
{
DateTime dateTime;
try
{
- var textAsset = Resources.Load<UnityEngine.TextAsset>("Config/AuditTime");
+ var textAsset = await Resources.LoadAsync<UnityEngine.TextAsset>("Config/AuditTime") as UnityEngine.TextAsset;
var content = string.Empty;
if (textAsset != null)
{
@@ -261,7 +262,14 @@
public bool NeedDownAsset()
{
- if (versionInfo != null && versionInfo.downAsset == 1 && VersionConfig.Get().assetAccess != InstalledAsset.IngoreDownLoad)
+ if (VersionConfig.config == null)
+ {
+ VersionConfig.GetAsync().Forget();
+ Debug.LogError("VersionConfig is null when check NeedDownAsset, check VersionConfig.GetAsync for more details");
+ return false;
+ }
+
+ if (versionInfo != null && versionInfo.downAsset == 1 && VersionConfig.config.assetAccess != InstalledAsset.IngoreDownLoad)
{
return true;
}
diff --git a/Main/System/CustomizedGift/CustomizedRechargeModel.cs b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
index e960f89..fc33518 100644
--- a/Main/System/CustomizedGift/CustomizedRechargeModel.cs
+++ b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
//鍏呭�艰嚜閫夊姛鑳�
diff --git a/Main/System/DailySpecials/DailySpecialsBaseWin.cs b/Main/System/DailySpecials/DailySpecialsBaseWin.cs
index 476f98f..2af1778 100644
--- a/Main/System/DailySpecials/DailySpecialsBaseWin.cs
+++ b/Main/System/DailySpecials/DailySpecialsBaseWin.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class DailySpecialsBaseWin : FunctionsBaseWin
{
@@ -154,7 +155,7 @@
}
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
DisplayBG(functionOrder);
DisplayFan(functionOrder);
@@ -168,20 +169,20 @@
{
case 0:
// 姣忔棩鐗规儬
- currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<DailySpecialsWin>();
break;
case 1:
// 鐗规儬鍟嗗煄
StoreModel.Instance.selectStoreFuncType = StoreFunc.SpecialStore;
- currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsShopWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<DailySpecialsShopWin>();
break;
case 2:
// 姣忔棩绀煎寘
- currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsDayGiftWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<DailySpecialsDayGiftWin>();
break;
case 3:
// 姣忓懆绀煎寘
- currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsWeekGiftWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<DailySpecialsWeekGiftWin>();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/DayMission/DayMissionBaseWin.cs b/Main/System/DayMission/DayMissionBaseWin.cs
index c2699f0..d18f754 100644
--- a/Main/System/DayMission/DayMissionBaseWin.cs
+++ b/Main/System/DayMission/DayMissionBaseWin.cs
@@ -11,23 +11,23 @@
[SerializeField] Text titleText;
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
//鏃ュ父浠诲姟
- UIManager.Instance.OpenWindowAsync<DayMissionWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<DayMissionWin>();
titleText.text = Language.Get("DayMission2");
break;
case 1:
//鍛ㄥ鍔�
- UIManager.Instance.OpenWindowAsync<WeekBattlePassWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<WeekBattlePassWin>();
titleText.text = Language.Get("DayMission3");
break;
case 2:
//涓荤嚎浠诲姟锛堣嫳闆勪箣璺級
- UIManager.Instance.OpenWindowAsync<MissionHeroRoadWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<MissionHeroRoadWin>();
titleText.text = Language.Get("DayMission4");
break;
default:
diff --git a/Main/System/Debug/DebugController.cs b/Main/System/Debug/DebugController.cs
index 0f232db..c87c3e4 100644
--- a/Main/System/Debug/DebugController.cs
+++ b/Main/System/Debug/DebugController.cs
@@ -5,6 +5,7 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class DebugController : MonoBehaviour
@@ -20,7 +21,7 @@
m_Version.text = string.Empty;
#else
m_Version.text = string.Format("{0}_{1} 鍒嗘敮: {2}",
- VersionConfig.Get().version, VersionConfig.Get().buildIndex, VersionConfig.Get().branch);
+ VersionConfig.config.version, VersionConfig.config.buildIndex, VersionConfig.config.branch);
#endif
}
diff --git a/Main/System/Debug/DebugLogin.cs b/Main/System/Debug/DebugLogin.cs
index 6e2981c..3dc2939 100644
--- a/Main/System/Debug/DebugLogin.cs
+++ b/Main/System/Debug/DebugLogin.cs
@@ -61,6 +61,11 @@
public void Login()
{
+ if (null == VersionConfig.config)
+ {
+ throw new System.Exception("VersionConfig is null when Login, game will pause here");
+ }
+
appidRecorder = appid.text;
serverIdRecorder = serverId.text;
accountRecorder = account.text;
@@ -72,8 +77,8 @@
if (!string.IsNullOrEmpty(appid.text))
{
- bool needRestore = VersionConfig.Get().m_AppId != appid.text;
- VersionConfig.Get().m_AppId = appid.text;
+ bool needRestore = VersionConfig.config.m_AppId != appid.text;
+ VersionConfig.config.m_AppId = appid.text;
#if UNITY_EDITOR
//debug鐧诲綍鍚庣浜屾鍚姩榛樿鎭㈠test
if (needRestore)
diff --git a/Main/System/Debug/DebugUtility.cs b/Main/System/Debug/DebugUtility.cs
index 6fc4385..c66db29 100644
--- a/Main/System/Debug/DebugUtility.cs
+++ b/Main/System/Debug/DebugUtility.cs
@@ -39,49 +39,53 @@
public void Init()
{
isWhiteListAccount = false;
- if (VersionConfig.Get().debugVersion)
+ VersionConfig.GetAsync().ContinueWith(config =>
{
- debugAccount = true;
- }
- else
- {
- var parentDirectory = Directory.GetParent(Application.persistentDataPath);
- debugAccount = File.Exists(parentDirectory + "/Debug");
- }
-
- if (LocalSave.GetString("#@#BrancH") != string.Empty)
- {
- var branch = LocalSave.GetString("#@#BrancH");
- int tmpbranch;
- int.TryParse(LocalSave.GetString("#@#BrancH").Substring(1), out tmpbranch);
- if (branch.StartsWith("d") && tmpbranch != 0)
+ if (config != null && config.debugVersion)
{
- debugBranch = tmpbranch;
debugAccount = true;
}
- else if (branch.StartsWith("r") && tmpbranch != 0)
- {
- debugBranch = tmpbranch;
- debugAccount = false;
- }
- }
-
- if (debugAccount)
- {
- if (Application.isMobilePlatform)
+ else
{
var parentDirectory = Directory.GetParent(Application.persistentDataPath);
- if (File.Exists(parentDirectory + "/Debug"))
+ debugAccount = File.Exists(parentDirectory + "/Debug");
+ }
+
+ if (LocalSave.GetString("#@#BrancH") != string.Empty)
+ {
+ var branch = LocalSave.GetString("#@#BrancH");
+ int tmpbranch;
+ int.TryParse(LocalSave.GetString("#@#BrancH").Substring(1), out tmpbranch);
+ if (branch.StartsWith("d") && tmpbranch != 0)
{
- var content = File.ReadAllText(parentDirectory + "/Debug");
- if (!string.IsNullOrEmpty(content))
+ debugBranch = tmpbranch;
+ debugAccount = true;
+ }
+ else if (branch.StartsWith("r") && tmpbranch != 0)
+ {
+ debugBranch = tmpbranch;
+ debugAccount = false;
+ }
+ }
+
+ if (debugAccount)
+ {
+ if (Application.isMobilePlatform)
+ {
+ var parentDirectory = Directory.GetParent(Application.persistentDataPath);
+ if (File.Exists(parentDirectory + "/Debug"))
{
- var json = JsonMapper.ToObject<DebugBranch>(File.ReadAllText(parentDirectory + "/Debug"));
- debugBranch = json.branch;
+ var content = File.ReadAllText(parentDirectory + "/Debug");
+ if (!string.IsNullOrEmpty(content))
+ {
+ var json = JsonMapper.ToObject<DebugBranch>(File.ReadAllText(parentDirectory + "/Debug"));
+ debugBranch = json.branch;
+ }
}
}
}
- }
+ }).Forget();
+
}
diff --git a/Main/System/Equip/BlessLVWin.cs b/Main/System/Equip/BlessLVWin.cs
index b0d7f3a..2445c93 100644
--- a/Main/System/Equip/BlessLVWin.cs
+++ b/Main/System/Equip/BlessLVWin.cs
@@ -1,6 +1,6 @@
锘�
using System;
-
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
diff --git a/Main/System/Equip/EquipExchangeCell.cs b/Main/System/Equip/EquipExchangeCell.cs
index 9c7d65e..5e784c2 100644
--- a/Main/System/Equip/EquipExchangeCell.cs
+++ b/Main/System/Equip/EquipExchangeCell.cs
@@ -268,7 +268,8 @@
if (isNewEquip)
{
//鎵惧姣旇澶�
- oldEquip = PackManager.Instance.GetItemByIndex(PackType.Equip, EquipModel.Instance.selectFloorEquip.config.EquipPlace - 1);
+ if (EquipModel.Instance.selectFloorEquip != null && EquipModel.Instance.selectFloorEquip.config != null)
+ oldEquip = PackManager.Instance.GetItemByIndex(PackType.Equip, EquipModel.Instance.selectFloorEquip.config.EquipPlace - 1);
}
if (oldEquip == null)
diff --git a/Main/System/Equip/EquipExchangeWin.cs b/Main/System/Equip/EquipExchangeWin.cs
index eb71d49..fd9a091 100644
--- a/Main/System/Equip/EquipExchangeWin.cs
+++ b/Main/System/Equip/EquipExchangeWin.cs
@@ -32,6 +32,11 @@
void Display()
{
+ if (EquipModel.Instance.selectFloorEquip == null || EquipModel.Instance.selectFloorEquip.config == null)
+ {
+ CloseWindow();
+ return;
+ }
EquipModel.Instance.lastShowEquipIndex = EquipModel.Instance.selectFloorEquip.config.EquipPlace - 1;
var oldEquip = PackManager.Instance.GetItemByIndex(PackType.Equip, EquipModel.Instance.lastShowEquipIndex);
if (oldEquip == null)
diff --git a/Main/System/Equip/EquipModel.cs b/Main/System/Equip/EquipModel.cs
index abd3c3e..8380c80 100644
--- a/Main/System/Equip/EquipModel.cs
+++ b/Main/System/Equip/EquipModel.cs
@@ -4,6 +4,7 @@
using System;
using LitJson;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class EquipModel : GameSystemManager<EquipModel>
diff --git a/Main/System/FirstCharge/FirstChargeManager.cs b/Main/System/FirstCharge/FirstChargeManager.cs
index 78cb92a..81e49f6 100644
--- a/Main/System/FirstCharge/FirstChargeManager.cs
+++ b/Main/System/FirstCharge/FirstChargeManager.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class FirstChargeManager : GameSystemManager<FirstChargeManager>
{
diff --git a/Main/System/FirstCharge/FirstChargeWin.cs b/Main/System/FirstCharge/FirstChargeWin.cs
index afcc7c9..d9ee4b2 100644
--- a/Main/System/FirstCharge/FirstChargeWin.cs
+++ b/Main/System/FirstCharge/FirstChargeWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using Cysharp.Threading.Tasks;
@@ -79,7 +79,7 @@
DisplayButton(firstId);
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
int firstId = model.GetFirstIDByTabIndex(functionOrder);
model.SetClickTabState(firstId);
diff --git a/Main/System/FuncPreset/FuncPresetChooseCell.cs b/Main/System/FuncPreset/FuncPresetChooseCell.cs
index 9893811..72df8fc 100644
--- a/Main/System/FuncPreset/FuncPresetChooseCell.cs
+++ b/Main/System/FuncPreset/FuncPresetChooseCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鏂规棰勮 鏂规閫夋嫨缁勪欢
public class FuncPresetChooseCell : MonoBehaviour
diff --git a/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs b/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs
index 7da5c76..25f9054 100644
--- a/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs
+++ b/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鏂规棰勮 鏂规閫夋嫨缁勪欢, 闅愯棌鐨勬柟妗�
public class FuncPresetChooseMoreCell : MonoBehaviour
diff --git a/Main/System/FuncPreset/FuncPresetManager.cs b/Main/System/FuncPreset/FuncPresetManager.cs
index 32d4e33..44f8f82 100644
--- a/Main/System/FuncPreset/FuncPresetManager.cs
+++ b/Main/System/FuncPreset/FuncPresetManager.cs
@@ -2,6 +2,7 @@
using UnityEngine;
using LitJson;
using System;
+using Cysharp.Threading.Tasks;
//鏂规棰勮锛氭祦娲捐瀹�
// 杩欓噷瀛樺偍鐨勬槸娴佹淳id璁惧畾; 鍔熻兘棰勮鍦ㄥ悇涓姛鑳介噷濡傚懡鏍肩殑鏄瓨鍦ㄥ懡鏍艰儗鍖呭搴旓紝姝﹀皢鏄彟澶栭�氱煡浣跨敤鐨勬牸瀛愮储寮�
diff --git a/Main/System/Gubao/GubaoBaseWin.cs b/Main/System/Gubao/GubaoBaseWin.cs
index 9989103..fb73f98 100644
--- a/Main/System/Gubao/GubaoBaseWin.cs
+++ b/Main/System/Gubao/GubaoBaseWin.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+锘縰sing UnityEngine;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍙ゅ疂鍩虹鐣岄潰
@@ -7,22 +8,22 @@
{
[SerializeField] Transform bg;
[SerializeField] Transform jbbg;
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- UIManager.Instance.OpenWindowAsync<GubaoListWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<GubaoListWin>();
jbbg.SetActive(false);
bg.SetActive(true);
break;
case 1:
- UIManager.Instance.OpenWindowAsync<GubaoCallWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<GubaoCallWin>();
jbbg.SetActive(true);
bg.SetActive(false);
break;
case 2:
- UIManager.Instance.OpenWindowAsync<GubaoSuiteListWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<GubaoSuiteListWin>();
jbbg.SetActive(false);
bg.SetActive(true);
break;
diff --git a/Main/System/Gubao/GubaoCell.cs b/Main/System/Gubao/GubaoCell.cs
index 64fb177..d7abf80 100644
--- a/Main/System/Gubao/GubaoCell.cs
+++ b/Main/System/Gubao/GubaoCell.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class GubaoCell : MonoBehaviour
{
diff --git a/Main/System/Gubao/GubaoManager.cs b/Main/System/Gubao/GubaoManager.cs
index b8be16f..96323ad 100644
--- a/Main/System/Gubao/GubaoManager.cs
+++ b/Main/System/Gubao/GubaoManager.cs
@@ -4,6 +4,7 @@
using System;
using System.Linq;
using LitJson;
+using Cysharp.Threading.Tasks;
public partial class GubaoManager : GameSystemManager<GubaoManager>
diff --git a/Main/System/Guild/GuildCreateWin.cs b/Main/System/Guild/GuildCreateWin.cs
index 5d1c3d8..120dab9 100644
--- a/Main/System/Guild/GuildCreateWin.cs
+++ b/Main/System/Guild/GuildCreateWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍒涘缓鍏細鐣岄潰
diff --git a/Main/System/Guild/GuildDonateWin.cs b/Main/System/Guild/GuildDonateWin.cs
index 9c78150..3ddb38d 100644
--- a/Main/System/Guild/GuildDonateWin.cs
+++ b/Main/System/Guild/GuildDonateWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍏細鎹愯禒鐣岄潰
diff --git a/Main/System/Guild/GuildFuncCell.cs b/Main/System/Guild/GuildFuncCell.cs
index 01e2686..4602465 100644
--- a/Main/System/Guild/GuildFuncCell.cs
+++ b/Main/System/Guild/GuildFuncCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class GuildFuncCell : MonoBehaviour
{
diff --git a/Main/System/Guild/GuildHallWin.cs b/Main/System/Guild/GuildHallWin.cs
index 7a36f1e..afc40ff 100644
--- a/Main/System/Guild/GuildHallWin.cs
+++ b/Main/System/Guild/GuildHallWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍏細澶у巺
diff --git a/Main/System/Guild/GuildHawkerWin.cs b/Main/System/Guild/GuildHawkerWin.cs
index 1e44da6..468dd8a 100644
--- a/Main/System/Guild/GuildHawkerWin.cs
+++ b/Main/System/Guild/GuildHawkerWin.cs
@@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class GuildHawkerWin : UIBase
{
diff --git a/Main/System/Guild/GuildJoinWin.cs b/Main/System/Guild/GuildJoinWin.cs
index d685dbd..5e0b9f4 100644
--- a/Main/System/Guild/GuildJoinWin.cs
+++ b/Main/System/Guild/GuildJoinWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍔犲叆鍏細鐣岄潰 锛氬叕浼氭煡鎵惧垪琛紝涔熸槸鎺掕姒�
diff --git a/Main/System/Guild/GuildOPWin.cs b/Main/System/Guild/GuildOPWin.cs
index 6cba609..d04f708 100644
--- a/Main/System/Guild/GuildOPWin.cs
+++ b/Main/System/Guild/GuildOPWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍏細绠$悊鐣岄潰
diff --git a/Main/System/Guild/GuildViewListCell.cs b/Main/System/Guild/GuildViewListCell.cs
index 4e42aed..e27ac88 100644
--- a/Main/System/Guild/GuildViewListCell.cs
+++ b/Main/System/Guild/GuildViewListCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鍏細鏌ユ壘鍒楄〃锛屼篃鏄帓琛屾
diff --git a/Main/System/HappyXB/HappyXBModel.cs b/Main/System/HappyXB/HappyXBModel.cs
index 1286a66..6e9ac4e 100644
--- a/Main/System/HappyXB/HappyXBModel.cs
+++ b/Main/System/HappyXB/HappyXBModel.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public partial class HappyXBModel : GameSystemManager<HappyXBModel>
diff --git a/Main/System/HappyXB/HeroCallHopeAddCell.cs b/Main/System/HappyXB/HeroCallHopeAddCell.cs
index e77e43c..4d1cec9 100644
--- a/Main/System/HappyXB/HeroCallHopeAddCell.cs
+++ b/Main/System/HappyXB/HeroCallHopeAddCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class HeroCallHopeAddCell : MonoBehaviour
@@ -118,7 +119,7 @@
{
head.SetActive(true);
addImg.SetActive(false);
- head.Init(heroID, headGray, ()=> { heroAction.Invoke(quality); });
+ head.Init(heroID, headGray, ()=> { heroAction.Invoke(quality); }).Forget();
}
else
{
diff --git a/Main/System/HappyXB/HeroSmallHeadCell.cs b/Main/System/HappyXB/HeroSmallHeadCell.cs
index 5f8f5df..c8da1d5 100644
--- a/Main/System/HappyXB/HeroSmallHeadCell.cs
+++ b/Main/System/HappyXB/HeroSmallHeadCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -11,14 +12,14 @@
public void Display(int heroID)
{
var hero = HeroConfig.Get(heroID);
- heroHeadBaseCell.Init(hero.HeroID, hero.SkinIDList[0]);
+ heroHeadBaseCell.Init(hero.HeroID, hero.SkinIDList[0]).Forget();
nameText.text = hero.Name;
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.Class));
}
public void Display(HeroInfo hero)
{
- heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel);
+ heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel).Forget();
nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
}
diff --git a/Main/System/Hero/UIHeroController.cs b/Main/System/Hero/UIHeroController.cs
index d274488..3c89fe5 100644
--- a/Main/System/Hero/UIHeroController.cs
+++ b/Main/System/Hero/UIHeroController.cs
@@ -286,6 +286,14 @@
PlayAnimation(motionName, true);
spineAnimationState.Complete -= OnAnimationComplete;
spineAnimationState.Complete += OnAnimationComplete;
+
+#if UNITY_EIDTOR
+ await UniTask.Delay(100);
+ if (skeletonGraphic != null && skeletonGraphic.material != null)
+ {
+ skeletonGraphic.material.shader = Shader.Find(skeletonGraphic.material.shader.name);
+ }
+#endif
}
diff --git a/Main/System/HeroFates/HeroFatesPutItem.cs b/Main/System/HeroFates/HeroFatesPutItem.cs
index f8fda96..06778f9 100644
--- a/Main/System/HeroFates/HeroFatesPutItem.cs
+++ b/Main/System/HeroFates/HeroFatesPutItem.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -12,7 +13,7 @@
public void Display(HeroInfo hero)
{
this.hero = hero;
- heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel, OnClick);
+ heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel, OnClick).Forget();
nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
bool isChoose = manager.chooseCostHeroInfos.Contains(hero);
diff --git a/Main/System/HeroFates/HeroFatesUpgradeHeadCell.cs b/Main/System/HeroFates/HeroFatesUpgradeHeadCell.cs
index 0168781..3a08b96 100644
--- a/Main/System/HeroFates/HeroFatesUpgradeHeadCell.cs
+++ b/Main/System/HeroFates/HeroFatesUpgradeHeadCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -10,7 +11,7 @@
public void Display(HeroInfo hero)
{
- heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel);
+ heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel).Forget();
nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
}
diff --git a/Main/System/HeroFates/HeroFatesUpgradeWin.cs b/Main/System/HeroFates/HeroFatesUpgradeWin.cs
index 97b7332..dd61f2b 100644
--- a/Main/System/HeroFates/HeroFatesUpgradeWin.cs
+++ b/Main/System/HeroFates/HeroFatesUpgradeWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class HeroFatesUpgradeWin : UIBase
{
diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index 31b83cf..4113405 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -115,14 +115,15 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
//showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
//giftID 0 :浠h〃鐏拌壊闇�鍗囨槦婵�娲� -1锛氫唬琛ㄦ鑹查渶瑙夐啋婵�娲伙紝鍏朵粬鏍规嵁閰嶈〃锛屾病鏈夊ぉ璧嬬殑澶栧眰鎺у埗鏄鹃殣
- public void Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0)
+ public async UniTask Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (HeroTalentConfig.HasKey(giftID))
{
var config = HeroTalentConfig.Get(giftID);
@@ -256,19 +257,23 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+ var inst = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
if (this == null)
{
- if (null != cellContainer)
- {
- GameObject.DestroyImmediate(cellContainer);
- }
+ if (null != inst) GameObject.DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ GameObject.DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/HeroUI/HeroAwakeWin.cs b/Main/System/HeroUI/HeroAwakeWin.cs
index 89c4813..4305bdd 100644
--- a/Main/System/HeroUI/HeroAwakeWin.cs
+++ b/Main/System/HeroUI/HeroAwakeWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
diff --git a/Main/System/HeroUI/HeroBaseWin.cs b/Main/System/HeroUI/HeroBaseWin.cs
index c9571aa..b8a29ff 100644
--- a/Main/System/HeroUI/HeroBaseWin.cs
+++ b/Main/System/HeroUI/HeroBaseWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 姝﹀皢鍩虹鐣岄潰
@@ -44,7 +45,7 @@
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
Debug.Log("鎵撳紑瀛愮晫闈� : " + functionOrder);
// 涓诲煄 鍐呮斂 姝﹀皢 鎸戞垬 鍏細
@@ -52,13 +53,13 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindowAsync<HeroListWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroListWin>();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindowAsync<HeroCollectionWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroCollectionWin>();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindowAsync<HeroFatesWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroFatesWin>();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/HeroUI/HeroBestWin.cs b/Main/System/HeroUI/HeroBestWin.cs
index 1bca2d2..2bb3e8f 100644
--- a/Main/System/HeroUI/HeroBestWin.cs
+++ b/Main/System/HeroUI/HeroBestWin.cs
@@ -436,7 +436,7 @@
if (i < heroConfig.TalentList.Length)
{
giftBaseCells[i].SetActive(true);
- giftBaseCells[i].Init(heroConfig.TalentList[i], HeroUIManager.Instance.maxGiftLevel);
+ giftBaseCells[i].Init(heroConfig.TalentList[i], HeroUIManager.Instance.maxGiftLevel).Forget();
}
else
{
diff --git a/Main/System/HeroUI/HeroCardCell.cs b/Main/System/HeroUI/HeroCardCell.cs
index f9f4fcc..0b78714 100644
--- a/Main/System/HeroUI/HeroCardCell.cs
+++ b/Main/System/HeroUI/HeroCardCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class HeroCardCell : MonoBehaviour
{
diff --git a/Main/System/HeroUI/HeroCollectionCardCell.cs b/Main/System/HeroUI/HeroCollectionCardCell.cs
index c764852..e2e041c 100644
--- a/Main/System/HeroUI/HeroCollectionCardCell.cs
+++ b/Main/System/HeroUI/HeroCollectionCardCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class HeroCollectionCardCell : MonoBehaviour
{
diff --git a/Main/System/HeroUI/HeroCollectionLvUpWin.cs b/Main/System/HeroUI/HeroCollectionLvUpWin.cs
index cf71fb2..bdeb670 100644
--- a/Main/System/HeroUI/HeroCollectionLvUpWin.cs
+++ b/Main/System/HeroUI/HeroCollectionLvUpWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -95,7 +96,7 @@
{
// fullPanel.SetActive(true);
lvupPanel.SetActive(state == 1);
- fullHeadCell.Init(HeroUIManager.Instance.selectCollectHeroID, config.SkinIDList[0], colData.BookStarLV);
+ fullHeadCell.Init(HeroUIManager.Instance.selectCollectHeroID, config.SkinIDList[0], colData.BookStarLV).Forget();
name3.text = colData.BookBreakLV == 0 ? config.Name : Language.Get("herocardbreaklv", config.Name, colData.BookBreakLV);
diff --git a/Main/System/HeroUI/HeroDeleteHeadCell.cs b/Main/System/HeroUI/HeroDeleteHeadCell.cs
index 5c0424c..1a7d097 100644
--- a/Main/System/HeroUI/HeroDeleteHeadCell.cs
+++ b/Main/System/HeroUI/HeroDeleteHeadCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -31,7 +32,7 @@
heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel, () =>
{
Click(hero, index);
- });
+ }).Forget();
nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
diff --git a/Main/System/HeroUI/HeroGiftEatWin.cs b/Main/System/HeroUI/HeroGiftEatWin.cs
index bf0d3d8..9a51f8c 100644
--- a/Main/System/HeroUI/HeroGiftEatWin.cs
+++ b/Main/System/HeroUI/HeroGiftEatWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
diff --git a/Main/System/HeroUI/HeroGiftLineCell.cs b/Main/System/HeroUI/HeroGiftLineCell.cs
index c86faa0..749d84b 100644
--- a/Main/System/HeroUI/HeroGiftLineCell.cs
+++ b/Main/System/HeroUI/HeroGiftLineCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HeroGiftLineCell : CellView
@@ -14,7 +15,7 @@
var giftID = configList[index + i];
var giftLV = HeroUIManager.Instance.maxGiftLevel;
cardList[i].SetActive(true);
- cardList[i].Init(giftID, giftLV);
+ cardList[i].Init(giftID, giftLV).Forget();
}
else
{
diff --git a/Main/System/HeroUI/HeroGiftWashCell.cs b/Main/System/HeroUI/HeroGiftWashCell.cs
index 3842aae..16acd3b 100644
--- a/Main/System/HeroUI/HeroGiftWashCell.cs
+++ b/Main/System/HeroUI/HeroGiftWashCell.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -20,7 +21,7 @@
int giftID = hero.talentIDList[index];
int giftLV = hero.talentLvList[index];
- giftCell.Init(giftID, giftLV, 0, hero.heroId, index, hero.awakeLevel);
+ giftCell.Init(giftID, giftLV, 0, hero.heroId, index, hero.awakeLevel).Forget();
if (hero.talentLockList.IndexOf(index) != -1)
{
diff --git a/Main/System/HeroUI/HeroGiftWashWin.cs b/Main/System/HeroUI/HeroGiftWashWin.cs
index 697ede3..038d3d3 100644
--- a/Main/System/HeroUI/HeroGiftWashWin.cs
+++ b/Main/System/HeroUI/HeroGiftWashWin.cs
@@ -68,7 +68,6 @@
public void Display()
{
heroShow.Init(hero.heroId, hero.SkinID, hero.breakLevel, hero.heroStar, hero.awakeLevel, hero.heroLevel);
-
if (hero.talentRandomIDList.Count == 0)
{
currentGo.SetActive(true);
@@ -179,7 +178,7 @@
afterGiftCells[i].SetActive(true);
- afterGiftCells[i].Init(hero.talentRandomIDList[i], hero.talentLvList[i], 0, hero.heroId, i, hero.awakeLevel);
+ afterGiftCells[i].Init(hero.talentRandomIDList[i], hero.talentLvList[i], 0, hero.heroId, i, hero.awakeLevel).Forget();
//瀵规瘮鍙樺寲鐨勫ぉ璧嬫樉绀虹壒鏁�
if (hero.talentRandomIDList[i] != hero.talentIDList[i])
diff --git a/Main/System/HeroUI/HeroHeadBaseCell.cs b/Main/System/HeroUI/HeroHeadBaseCell.cs
index 4422cf0..5dcc15a 100644
--- a/Main/System/HeroUI/HeroHeadBaseCell.cs
+++ b/Main/System/HeroUI/HeroHeadBaseCell.cs
@@ -134,13 +134,14 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
// 姝﹀皢灏忓ご鍍忥紝锛堣亴涓氬拰鍚嶇О涓嶅啀姝ょ鐞嗭紝鍚勪釜鐣岄潰鎺掔増涓嶅悓锛�
- public void Init(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null)
+ public async UniTask Init(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (onclick != null)
{
clickBtn.AddListener(onclick);
@@ -192,7 +193,8 @@
// 姝﹀皢灏忓ご鍍� Async鐗堟湰
public async UniTask InitAsync(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (onclick != null)
{
clickBtn.AddListener(onclick);
@@ -265,19 +267,23 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell");
+ var inst = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell");
if (this == null)
{
- if (cellContainer != null)
- {
- DestroyImmediate(cellContainer);
- return;
- }
+ if (inst != null) DestroyImmediate(inst);
+ return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs b/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
index 446b672..c7de2f4 100644
--- a/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
+++ b/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
@@ -96,7 +96,9 @@
public async UniTask Init(int heroID, bool _gray = false, UnityAction onclick = null)
{
await LoadPrefab();
- clickBtn.AddListener(onclick);
+ if (this == null) return;
+ if (onclick != null)
+ clickBtn.AddListener(onclick);
var heroConfig = HeroConfig.Get(heroID);
qualityBG.SetSprite("heroheadBG" + heroConfig.Quality);
@@ -129,19 +131,23 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell");
+ var inst = await UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell");
if (this == null)
{
- if (cellContainer != null)
- {
- DestroyImmediate(cellContainer);
- }
+ if (inst != null) DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/HeroUI/HeroPosHeadCell.cs b/Main/System/HeroUI/HeroPosHeadCell.cs
index d70783f..7aec7cc 100644
--- a/Main/System/HeroUI/HeroPosHeadCell.cs
+++ b/Main/System/HeroUI/HeroPosHeadCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -20,7 +21,7 @@
heroHeadBaseCell.Init(hero.heroId, hero.SkinID, hero.heroStar, hero.awakeLevel, hero.heroLevel, () =>
{
Click(hero, index);
- });
+ }).Forget();
nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
diff --git a/Main/System/HeroUI/HeroPosWin.cs b/Main/System/HeroUI/HeroPosWin.cs
index 7bb4492..88ba5aa 100644
--- a/Main/System/HeroUI/HeroPosWin.cs
+++ b/Main/System/HeroUI/HeroPosWin.cs
@@ -43,6 +43,8 @@
[SerializeField] Transform caseesObj;
FuncPresetChooseCells presetChooseCells;
+ Action presetChooseCellssetOnLoaded;
+
[SerializeField] Button funPresetBtn;
@@ -107,6 +109,8 @@
presetObj.transform.SetParentEx(caseesObj, Vector3.zero, Quaternion.identity, Vector3.one);
presetChooseCells = presetObj.GetComponent<FuncPresetChooseCells>();
presetChooseCells.ChangeAlignment(TextAnchor.MiddleCenter);
+ presetChooseCellssetOnLoaded?.Invoke();
+ presetChooseCellssetOnLoaded = null;
}).Forget();
@@ -199,7 +203,20 @@
}
fightPowerText.text = UIHelper.ReplaceLargeArtNum(FightPowerManager.Instance.GetTeamFightPower(HeroUIManager.Instance.selectTeamType, true));
- presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Team);
+ if (null == presetChooseCells)
+ {
+ presetChooseCellssetOnLoaded = () =>
+ {
+ if (this == null)
+ return;
+ presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Team);
+ };
+ }
+ else
+ {
+ presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Team);
+ }
+
funPresetBtn.SetActive(FuncPresetManager.Instance.IsPreShow());
}
@@ -382,7 +399,7 @@
flyAlphaTween.alpha = 1;
- flyHead.Init(flyHero.heroId, flyHero.SkinID);
+ flyHead.Init(flyHero.heroId, flyHero.SkinID).Forget();
flyHead.transform.position = startPos;
var targetPos = scenePosImgs[posList[0]].transform.position;
flyHead.transform.localScale = Vector3.one;
diff --git a/Main/System/HeroUI/HeroShowBaseCell.cs b/Main/System/HeroUI/HeroShowBaseCell.cs
index 84b1c13..a11e383 100644
--- a/Main/System/HeroUI/HeroShowBaseCell.cs
+++ b/Main/System/HeroUI/HeroShowBaseCell.cs
@@ -141,6 +141,7 @@
public async void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
{
await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
var heroConfig = HeroConfig.Get(heroID);
qualityBG.SetSprite("herodz" + heroConfig.Quality);
// int skinID = 0;
@@ -221,19 +222,23 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow");
+ var inst = await UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow");
if (this == null)
{
- if (cellContainer != null)
- {
- DestroyImmediate(cellContainer);
- return;
- }
+ if (inst != null) DestroyImmediate(inst);
+ return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/HeroUI/HeroSkinModel.cs b/Main/System/HeroUI/HeroSkinModel.cs
index 9d24b54..2a72b4a 100644
--- a/Main/System/HeroUI/HeroSkinModel.cs
+++ b/Main/System/HeroUI/HeroSkinModel.cs
@@ -12,9 +12,9 @@
public bool enable = true;
- public void Start()
+ public async void Start()
{
- heroModel.Create(heroSkinID, scale);
+ await heroModel.Create(heroSkinID, scale);
heroModel.PlayAnimation(actionName, true);
heroModel.SetEnabled(enable);
}
diff --git a/Main/System/HeroUI/HeroUIManager.Reborn.cs b/Main/System/HeroUI/HeroUIManager.Reborn.cs
index 9870322..596dce0 100644
--- a/Main/System/HeroUI/HeroUIManager.Reborn.cs
+++ b/Main/System/HeroUI/HeroUIManager.Reborn.cs
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
diff --git a/Main/System/HeroUI/HeroUIManager.Talent.cs b/Main/System/HeroUI/HeroUIManager.Talent.cs
index 6b02438..b8b5b9f 100644
--- a/Main/System/HeroUI/HeroUIManager.Talent.cs
+++ b/Main/System/HeroUI/HeroUIManager.Talent.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using LitJson;
using UnityEngine;
@@ -140,7 +141,7 @@
}
}
- giftBaseCells[i].Init(giftID, giftLV, state, hero.heroId, i, hero.awakeLevel);
+ giftBaseCells[i].Init(giftID, giftLV, state, hero.heroId, i, hero.awakeLevel).Forget();
}
else
{
@@ -154,11 +155,11 @@
//闈炲姣旂殑鏄剧ず
if (i < normalGiftMaxCnt)
{
- giftBaseCells[i].Init(0, 0);
+ giftBaseCells[i].Init(0, 0).Forget();
}
else
{
- giftBaseCells[i].Init(-1, 0, 0, hero.heroId, i);
+ giftBaseCells[i].Init(-1, 0, 0, hero.heroId, i).Forget();
}
}
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index c97b74f..af0421a 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using LitJson;
+using Cysharp.Threading.Tasks;
using UnityEngine;
diff --git a/Main/System/Horse/HorseManager.cs b/Main/System/Horse/HorseManager.cs
index 0687bec..76c3fea 100644
--- a/Main/System/Horse/HorseManager.cs
+++ b/Main/System/Horse/HorseManager.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using LitJson;
+using Cysharp.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
diff --git a/Main/System/InternalAffairs/AffairFuncCell.cs b/Main/System/InternalAffairs/AffairFuncCell.cs
index baf4724..f63b8ff 100644
--- a/Main/System/InternalAffairs/AffairFuncCell.cs
+++ b/Main/System/InternalAffairs/AffairFuncCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class AffairFuncCell : MonoBehaviour
{
diff --git a/Main/System/InternalAffairs/GoldRushAutoWin.cs b/Main/System/InternalAffairs/GoldRushAutoWin.cs
index 0b09cc7..467b3df 100644
--- a/Main/System/InternalAffairs/GoldRushAutoWin.cs
+++ b/Main/System/InternalAffairs/GoldRushAutoWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
diff --git a/Main/System/ItemTip/ItemTipUtility.cs b/Main/System/ItemTip/ItemTipUtility.cs
index 626aa8f..6afea1d 100644
--- a/Main/System/ItemTip/ItemTipUtility.cs
+++ b/Main/System/ItemTip/ItemTipUtility.cs
@@ -8,6 +8,7 @@
using System.Collections.Generic;
using System.Linq;
using LitJson;
+using Cysharp.Threading.Tasks;
public class ItemTipUtility
{
diff --git a/Main/System/ItemTip/ItemTipWayWin.cs b/Main/System/ItemTip/ItemTipWayWin.cs
index 1ef06c6..90d1726 100644
--- a/Main/System/ItemTip/ItemTipWayWin.cs
+++ b/Main/System/ItemTip/ItemTipWayWin.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class ItemTipWayWin : UIBase
{
diff --git a/Main/System/ItemTip/OwnMoneyCell.cs b/Main/System/ItemTip/OwnMoneyCell.cs
index ed0f456..50ee91f 100644
--- a/Main/System/ItemTip/OwnMoneyCell.cs
+++ b/Main/System/ItemTip/OwnMoneyCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鎷ユ湁鐨勮揣甯侊細鏁伴噺鏄剧ず锛岀偣鍑绘寜閽墦寮�瀵瑰簲鑾峰彇鐣岄潰
public class OwnMoneyCell : MonoBehaviour
diff --git a/Main/System/KnapSack/Logic/ComposeGirdCell.cs b/Main/System/KnapSack/Logic/ComposeGirdCell.cs
index 22615bf..76547f6 100644
--- a/Main/System/KnapSack/Logic/ComposeGirdCell.cs
+++ b/Main/System/KnapSack/Logic/ComposeGirdCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍚堟垚鏍煎瓙
diff --git a/Main/System/KnapSack/Logic/ItemLogicUtility.cs b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
index 56a327d..dc726dd 100644
--- a/Main/System/KnapSack/Logic/ItemLogicUtility.cs
+++ b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -3,6 +3,7 @@
using System.Linq;
using LitJson;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class ItemLogicUtility : Singleton<ItemLogicUtility>
diff --git a/Main/System/KnapSack/New/CommonItemBaisc.cs b/Main/System/KnapSack/New/CommonItemBaisc.cs
index 605f887..f91fa7c 100644
--- a/Main/System/KnapSack/New/CommonItemBaisc.cs
+++ b/Main/System/KnapSack/New/CommonItemBaisc.cs
@@ -170,7 +170,20 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell");
+ var inst = await UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell");
+
+ if (this == null)
+ {
+ if (inst != null) DestroyImmediate(inst);
+ return;
+ }
+
+ if (cellContainer != null)
+ {
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
if (cellContainer != null)
{
@@ -254,6 +267,7 @@
if (config == null) return;
await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
itemIcon.SetActive(true);
bgIcon.SetActive(true);
diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs
index 3d7279b..e35cb16 100644
--- a/Main/System/KnapSack/PackManager.cs
+++ b/Main/System/KnapSack/PackManager.cs
@@ -5,6 +5,7 @@
using LitJson;
using System.Collections;
using System.IO;
+using Cysharp.Threading.Tasks;
public class PackManager : GameSystemManager<PackManager>
{
@@ -54,11 +55,11 @@
public int[] noRedpointComposeItemIDs;
- public override void Init()
+ public async override void Init()
{
DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
- ParseConfig();
+ await ParseConfig();
//SysNotifyMgr.Instance.sysNotifyEvent += RefreshSysInfo;
@@ -497,10 +498,10 @@
#region 鐜╁瑁呭鐗规畩閫昏緫
- void ParseConfig()
+ async UniTask ParseConfig()
{
- ParsePackConfigIni();
+ await ParsePackConfigIni();
autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("AutoUseItem").Numerical1);
var config= FuncConfigConfig.Get("InitBagCellCount");
initBagGridCount = int.Parse(config.Numerical1);
@@ -520,9 +521,9 @@
noRedpointComposeItemIDs = JsonMapper.ToObject<int[]>(config.Numerical1);
}
- void ParsePackConfigIni()
+ async UniTask ParsePackConfigIni()
{
- string[] lines = LoadConfigIni("MapServerConfig");
+ string[] lines = await LoadConfigIni("MapServerConfig.ini");
foreach (string line in lines)
{
if (line.StartsWith("PackCnt") && line.Contains("="))
@@ -540,22 +541,24 @@
}
}
- public string[] LoadConfigIni(string name)
+ public async UniTask<string[]> LoadConfigIni(string name)
{
- string path = string.Empty;
-#if UNITY_EDITOR
- if (!AssetSource.isUseAssetBundle)
- {
- path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini";
- }
- else
-#endif
- {
- //浠庢湇鍔$鎷疯礉鏄痠ni锛屾墦鍖呯敤txt缁熶竴澶勭悊
- path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.txt");
- }
+// string path = string.Empty;
+// #if UNITY_EDITOR
+// if (!AssetSource.isUseAssetBundle)
+// {
+// path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini";
+// }
+// else
+// #endif
+// {
+// //浠庢湇鍔$鎷疯礉鏄痠ni锛屾墦鍖呯敤txt缁熶竴澶勭悊
+// path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.txt");
+// }
- return File.ReadAllLines(path);
+ return await ResManager.Instance.LoadConfigAsync(name, false);
+
+ // return File.ReadAllLines(path);
}
public int GetCanBuyPackGirdCount(PackType type)
@@ -669,7 +672,7 @@
{
return null;
}
-
+
ItemModel itemModel = null;
itemGUIDDict.TryGetValue(guid, out itemModel);
return itemModel;
diff --git a/Main/System/Launch/LaunchBackGroundWin.cs b/Main/System/Launch/LaunchBackGroundWin.cs
index 991b74e..a9bd703 100644
--- a/Main/System/Launch/LaunchBackGroundWin.cs
+++ b/Main/System/Launch/LaunchBackGroundWin.cs
@@ -60,4 +60,5 @@
{
info.text = LoginManager.Instance.loginErrorInfo;
}
+
}
diff --git a/Main/System/Launch/LaunchWin.cs b/Main/System/Launch/LaunchWin.cs
index a8984ef..ca717de 100644
--- a/Main/System/Launch/LaunchWin.cs
+++ b/Main/System/Launch/LaunchWin.cs
@@ -8,6 +8,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
@@ -53,39 +54,62 @@
m_TotalProgressSlider.value = 0f;
}
+ if (null == VersionConfig.config)
+ {
+ throw new Exception("VersionConfig is null when LaunchWin open, check VersionConfig.GetAsync for more details");
+ }
+
// m_AlphaTween.SetStartState();
- m_BuildTime.text = VersionConfig.Get().debugVersion ? VersionConfig.Get().buildTime : "";
+ m_BuildTime.text = VersionConfig.config.debugVersion ? VersionConfig.config.buildTime : "";
if (m_NetworkContainer != null)
{
m_NetworkContainer.SetActive(false);
}
- var AppleCheck = InitialFunctionConfig.Get("CheckTime").Numerical1;
- var AndroidCheck = InitialFunctionConfig.Get("CheckTime").Numerical2;
- var CheckAll = InitialFunctionConfig.Get("NetworkCheck").Numerical1;
+ var checkTimeCfg = LaunchCommon.InitialFunctionConfig.Get("CheckTime");
+ var networkCheckCfg = LaunchCommon.InitialFunctionConfig.Get("NetworkCheck");
+ Debug.LogErrorFormat("checktimecfg is null {0}, networkCheckCfg is null {1}", checkTimeCfg == null, networkCheckCfg == null);
+ var AppleCheck = checkTimeCfg?.Numerical1 ?? "0";
+ var AndroidCheck = checkTimeCfg?.Numerical2 ?? "0";
+ var CheckAll = networkCheckCfg?.Numerical1 ?? "3";
AllTimes = int.Parse(CheckAll);
- var CheckTime = InitialFunctionConfig.Get("NetworkCheck").Numerical2;
+ var CheckTime = networkCheckCfg?.Numerical2 ?? "5";
WaitSeconds = int.Parse(CheckTime);
ShowCircleView = false;
if (Application.platform == RuntimePlatform.IPhonePlayer && AppleCheck == "1")
ShowCircleView = true;
if (Application.platform == RuntimePlatform.Android && AndroidCheck == "1")
ShowCircleView = true;
-
- if (ShowCircleView)
+
+ if (Application.platform == RuntimePlatform.WebGLPlayer)
{
m_AndroidProgressContainer.SetActive(false);
- m_IosProgressContainer.SetActive(true);
- m_Version.text = string.Empty;
+ m_IosProgressContainer.SetActive(false);
+ LoginManager.Instance.GetVersionStr().ContinueWith(versionStr =>
+ {
+ m_Version.text = versionStr;
+ }).Forget();
}
else
{
- m_AndroidProgressContainer.SetActive(true);
- m_IosProgressContainer.SetActive(false);
- //鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
- m_Version.text = LoginManager.Instance.GetVersionStr();
+ if (ShowCircleView)
+ {
+ m_AndroidProgressContainer.SetActive(false);
+ m_IosProgressContainer.SetActive(true);
+ m_Version.text = string.Empty;
+ }
+ else
+ {
+ m_AndroidProgressContainer.SetActive(true);
+ m_IosProgressContainer.SetActive(false);
+ //鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
+ LoginManager.Instance.GetVersionStr().ContinueWith(versionStr =>
+ {
+ m_Version.text = versionStr;
+ }).Forget();
+ }
}
if (m_StageDescription != null)
diff --git a/Main/System/Launch/LoadingWin.cs b/Main/System/Launch/LoadingWin.cs
index 6bf68b7..eadf587 100644
--- a/Main/System/Launch/LoadingWin.cs
+++ b/Main/System/Launch/LoadingWin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -58,7 +59,10 @@
currentProgress = targetProgress = 0;
Refresh();
//鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
- m_Version.text = LoginManager.Instance.GetVersionStr();
+ LoginManager.Instance.GetVersionStr().ContinueWith(versionStr =>
+ {
+ m_Version.text = versionStr;
+ }).Forget();
}
protected override void OnPreClose()
diff --git a/Main/System/Login/GameNotice.cs b/Main/System/Login/GameNotice.cs
index 1701cf9..fcab7a8 100644
--- a/Main/System/Login/GameNotice.cs
+++ b/Main/System/Login/GameNotice.cs
@@ -12,7 +12,13 @@
{
if (VersionUtility.Instance.versionInfo == null || noticeShowed)
return;
- var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.Get().branch);
+
+ if (null == VersionConfig.config)
+ {
+ throw new System.Exception("VersionConfig is null when OpenGameNotice, game will pause here");
+ }
+
+ var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.config.branch);
if (!string.IsNullOrEmpty(url))
{
SDKUtils.Instance.OpenUrl(url);
@@ -31,7 +37,13 @@
{
if (VersionUtility.Instance.versionInfo == null)
return false;
- var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.Get().branch);
+
+ if (null == VersionConfig.config)
+ {
+ throw new System.Exception("VersionConfig is null when HasNotice, check VersionConfig.GetAsync for more details");
+ }
+
+ var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.config.branch);
Debug.LogFormat("鍏憡鍦板潃锛歿0}", url);
return !string.IsNullOrEmpty(url);
}
@@ -47,7 +59,11 @@
{
if (VersionUtility.Instance.versionInfo == null)
return;
- var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.Get().branch);
+ if (null == VersionConfig.config)
+ {
+ throw new System.Exception("VersionConfig is null when OpenGameNoticeForce, check VersionConfig.GetAsync for more details");
+ }
+ var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.config.branch);
if (!string.IsNullOrEmpty(url))
{
SDKUtils.Instance.OpenUrl(url);
diff --git a/Main/System/Login/LoginManager.cs b/Main/System/Login/LoginManager.cs
index 0c6f8d2..37da50d 100644
--- a/Main/System/Login/LoginManager.cs
+++ b/Main/System/Login/LoginManager.cs
@@ -73,6 +73,11 @@
// #if UNITY_EDITOR
// GlobalTimeEvent.Instance.MSEvent += OnMSEvent;
// #endif
+
+ if (null == VersionConfig.config)
+ {
+ await VersionConfig.GetAsync();
+ }
}
public override void Release()
@@ -381,7 +386,7 @@
{
GameNetSystem.Instance.SetIsWaitLogin(false);
var send = new C0101_tagCPlayerLogin();
- switch (VersionConfig.Get().versionAuthority)
+ switch (VersionConfig.config.versionAuthority)
{
case VersionAuthority.InterTest:
send.IDType = 1;
@@ -393,7 +398,7 @@
send.MAC = DeviceUtility.GetMac();
send.Version = _serverInfo.Version;
send.LineNO = 255;
- send.AppID = VersionConfig.Get().appId;
+ send.AppID = VersionConfig.config.appId;
send.AccountID = 1000;// 鍐呴儴鐧婚檰鐨勬椂鍊欑殑id
send.TokenExpire = "1519750743000";// 鍐呴儴鐧婚檰鐨勬椂闀�,鏃犳墍璋撶殑
send.Phone = 0;
@@ -406,11 +411,11 @@
{
var deviceInfo = DeviceUtility.GetDeviceModel();
deviceInfo.Replace(" ", "").Replace("=", "").Replace("%", "").Replace("-", "").Replace("|", "");
- var versionStr = StringUtility.Concat(VersionConfig.Get().version, "_",
- VersionConfig.Get().buildIndex.ToString(), "_",
+ var versionStr = StringUtility.Concat(VersionConfig.config.version, "_",
+ VersionConfig.config.buildIndex.ToString(), "_",
hotVersion, "-", deviceInfo);
- send.Extra = StringUtility.Concat(VersionConfig.Get().SpID, "|",
+ send.Extra = StringUtility.Concat(VersionConfig.config.SpID, "|",
SDKUtils.Instance.Device.uniqueID, "|",
sdkLoginResult.token, "|",
sdkLoginResult.qkUserName, "|",
@@ -426,7 +431,7 @@
send.MAC = DeviceUtility.GetMac();
send.Version = _serverInfo.Version;
send.LineNO = 255;
- send.AppID = VersionConfig.Get().appId;
+ send.AppID = VersionConfig.config.appId;
send.AccountID = (uint)sdkLoginResult.accountID;
send.TokenExpire = sdkLoginResult.tokenExpire;
send.Phone = (byte)sdkLoginResult.phone;
@@ -450,8 +455,16 @@
return send;
}
- public string GetVersionStr()
+ public async UniTask<string> GetVersionStr()
{
- return StringUtility.Concat(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex.ToString(), "_", InitialFunctionConfig.Get("version").Numerical1);
+ await VersionConfig.GetAsync();
+ await InitialFunctionConfig.LazyInitAsync();
+ var versionConfig = VersionConfig.config;
+ var funcVersionNumerical = InitialFunctionConfig.Get("version")?.Numerical1 ?? string.Empty;
+ if (versionConfig == null)
+ {
+ return funcVersionNumerical;
+ }
+ return StringUtility.Concat(versionConfig.version, "_", versionConfig.buildIndex.ToString(), "_", funcVersionNumerical);
}
}
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index 01cc657..a49c133 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/Main/System/Login/LoginWin.cs
@@ -2,6 +2,7 @@
using UnityEngine.UI;
using System.IO;
using Cysharp.Threading.Tasks;
+using UnityEngine.EventSystems;
public class LoginWin : UIBase, ICanvasRaycastFilter
{
@@ -91,6 +92,11 @@
base.OnPreOpen();
Debug.Log("鎵撳紑鐧诲綍绐楀彛");
LoginManager.Instance.RefreshHotVersion();
+ LaunchBackGroundWin launchBackGroundWin = UIManager.Instance.GetUI<LaunchBackGroundWin>();
+ if (null != launchBackGroundWin)
+ {
+ launchBackGroundWin.transform.SetAsFirstSibling();
+ }
ServerListCenter.Instance.serverSelectEvent += OnServerChange;
ServerListCenter.Instance.onServerListRefreshEvent += OnServerListRefresh;
@@ -141,15 +147,22 @@
{
base.Refresh();
Debug.Log("鍒锋柊鐧诲綍绐楀彛");
+ LogLoginInteractionDiagnostics("Refresh begin");
//鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
- verInfo.text = LoginManager.Instance.GetVersionStr();
+ LoginManager.Instance.GetVersionStr().ContinueWith(versionStr =>
+ {
+ verInfo.text = versionStr;
+ }).Forget();
BuiltInLoader.LoadSpriteAsync("TB_DL_Logo").ContinueWith(sprite =>
{
m_Logo.overrideSprite = sprite;
m_Logo.SetNativeSize();
- m_Logo.rectTransform.anchoredPosition = VersionConfig.Get().logoPosition;
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ m_Logo.rectTransform.anchoredPosition = config.logoPosition;
+ }).Forget();
m_Notice.SetActive(GameNotice.HasNotice());
}).Forget();
@@ -159,18 +172,26 @@
// 璐﹀彿鍒囨崲
m_SwitchAccount.SetActive(false);
// 鐢ㄦ埛甯姪
+ bool isGetServerList = ServerListCenter.Instance.serverListGot;
+
+ m_ContainerAccount.SetActive(false);
+
// TODO YYL
- var appId = VersionConfig.Get().appId;
- var branch = VersionConfig.Get().branch;
+ VersionConfig.GetAsync().ContinueWith(config =>
+ {
+ var appId = VersionConfig.config.appId;
+ var branch = VersionConfig.config.branch;
+ m_ContainerAccount.SetActive(isGetServerList
+ && (VersionConfig.config.versionAuthority == VersionAuthority.InterTest || VersionConfig.config.isBanShu));
+ }).Forget();
+
// m_UserHelp.SetActive(ContactConfig.GetConfig(appId, branch) != null);
// 鏄惁宸茬粡鑾峰彇鍒版湇鍔″櫒鍒楄〃
- bool isGetServerList = ServerListCenter.Instance.serverListGot;
m_WaitServerList.SetActive(!isGetServerList);
m_ContainerEnterGame.SetActive(isGetServerList);
- m_ContainerAccount.SetActive(isGetServerList
- && (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest || VersionConfig.Get().isBanShu));
+
m_EnterGame.SetActive(isGetServerList);
if (isGetServerList)
@@ -187,57 +208,9 @@
// 鐢ㄦ埛鍗忚 todo
checkRead.isOn = LocalSave.GetBool("secretToggleStart5");
- }
- public async UniTask RefreshAsync()
- {
- base.Refresh();
- Debug.Log("鍒锋柊鐧诲綍绐楀彛");
-
- //鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
- verInfo.text = LoginManager.Instance.GetVersionStr();
-
- var sprite = await BuiltInLoader.LoadSpriteAsync("TB_DL_Logo");
- if (this == null) return;
- m_Logo.overrideSprite = sprite;
- m_Logo.SetNativeSize();
- m_Logo.rectTransform.anchoredPosition = VersionConfig.Get().logoPosition;
- m_Notice.SetActive(GameNotice.HasNotice());
-
-
- bool hasNotice = GameNotice.HasNotice();
-
- // 璐﹀彿鍒囨崲
- m_SwitchAccount.SetActive(false);
- // 鐢ㄦ埛甯姪
- // TODO YYL
- var appId = VersionConfig.Get().appId;
- var branch = VersionConfig.Get().branch;
- // m_UserHelp.SetActive(ContactConfig.GetConfig(appId, branch) != null);
-
- // 鏄惁宸茬粡鑾峰彇鍒版湇鍔″櫒鍒楄〃
- bool isGetServerList = ServerListCenter.Instance.serverListGot;
- m_WaitServerList.SetActive(!isGetServerList);
-
- m_ContainerEnterGame.SetActive(isGetServerList);
- m_ContainerAccount.SetActive(isGetServerList
- && (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest || VersionConfig.Get().isBanShu));
- m_EnterGame.SetActive(isGetServerList);
-
- if (isGetServerList)
- {
- ChangeServerInfo(ServerListCenter.Instance.currentServer);
- }
-
-
- ChangeUserInfo(LoginManager.Instance.localSaveAccountName);
-
- m_EnterGame.SetActive(true);
- //m_QQLogin.SetActive(false);
- //m_WXLogin.SetActive(false);
-
- // 鐢ㄦ埛鍗忚 todo
- checkRead.isOn = LocalSave.GetBool("secretToggleStart5");
+ LogLoginInteractionDiagnostics("Refresh end");
+ DelayLogLoginInteractionDiagnostics().Forget();
}
private void OnLoginOk(SDKUtils.FP_LoginOk arg0)
@@ -294,10 +267,14 @@
private void OnServerListRefresh()
{
+ if (null == VersionConfig.config)
+ {
+ throw new System.Exception("VersionConfig is null when OnServerListRefresh, check VersionConfig.GetAsync for more details");
+ }
m_WaitServerList.SetActive(!ServerListCenter.Instance.serverListGot);
m_ContainerEnterGame.SetActive(ServerListCenter.Instance.serverListGot);
m_ContainerAccount.SetActive(ServerListCenter.Instance.serverListGot
- && (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest || VersionConfig.Get().isBanShu));
+ && (VersionConfig.config.versionAuthority == VersionAuthority.InterTest || VersionConfig.config.isBanShu));
}
protected virtual void EnterGame()
@@ -319,6 +296,21 @@
{
raycastTarget = true;
LoginManager.Instance.RequestServerListLoop();
+ }
+
+ private void LogLoginInteractionDiagnostics(string context)
+ {
+ var eventSystem = EventSystem.current;
+ Debug.Log($"[LoginWin][Diag] {context} sortingOrder={GetSortingOrder()} siblingIndex={transform.GetSiblingIndex()} raycastTarget={raycastTarget} canvasGroup.blocksRaycasts={(canvasGroup != null ? canvasGroup.blocksRaycasts : false)} canvasGroup.interactable={(canvasGroup != null ? canvasGroup.interactable : false)} EventSystem={(eventSystem != null ? eventSystem.name : "<null>")} account.enabled={(m_Account != null && m_Account.enabled)} account.interactable={(m_Account != null && m_Account.interactable)} enter.active={(m_EnterGame != null && m_EnterGame.gameObject.activeInHierarchy)} enter.interactable={(m_EnterGame != null && m_EnterGame.interactable)} serverSelect.interactable={(m_ServerSelect != null && m_ServerSelect.interactable)} waitServerListActive={(m_WaitServerList != null && m_WaitServerList.gameObject.activeInHierarchy)} enterContainerActive={(m_ContainerEnterGame != null && m_ContainerEnterGame.gameObject.activeInHierarchy)}");
+ UIManager.Instance.DumpUIDiagnostics("LoginWin/" + context);
+ }
+
+ private async UniTaskVoid DelayLogLoginInteractionDiagnostics()
+ {
+ await UniTask.DelayFrame(2);
+ LogLoginInteractionDiagnostics("Refresh +2f");
+ await UniTask.DelayFrame(30);
+ LogLoginInteractionDiagnostics("Refresh +32f");
}
@@ -382,7 +374,7 @@
if (GameNetSystem.Instance.netState == GameNetSystem.NetState.NerverConnect ||
GameNetSystem.Instance.netState == GameNetSystem.NetState.DisConnected)
{
- switch (VersionConfig.Get().versionAuthority)
+ switch (VersionConfig.config.versionAuthority)
{
case VersionAuthority.InterTest:
if (string.IsNullOrEmpty(m_Account.text))
diff --git a/Main/System/Login/ServerListCenter.cs b/Main/System/Login/ServerListCenter.cs
index e5b7eb0..57fff87 100644
--- a/Main/System/Login/ServerListCenter.cs
+++ b/Main/System/Login/ServerListCenter.cs
@@ -3,12 +3,13 @@
using UnityEngine;
using LitJson;
using System;
+using Cysharp.Threading.Tasks;
public class ServerListCenter : Singleton<ServerListCenter>
{
public static readonly string[] JUMP_URL = new string[]
{
- "http://xssgcenter.secondworld.net.cn:11000/center/server_list.php/?",
+ "http://gamecenter.secondworld.net.cn:11000/center/server_list.php/?",
"http://106.55.151.92:11000/center/server_list_new.php/?"
};
@@ -195,16 +196,23 @@
}
- public void RequestJumpUrl()
+ public async UniTask RequestJumpUrl()
{
- if (VersionUtility.Instance.InIosAuditTime())
+ if (await VersionUtility.Instance.InIosAuditTime())
{
return;
}
- var url = StringUtility.Concat(JUMP_URL[jumpUrlIndex % JUMP_URL.Length], "game=xssg&flag=", VersionConfig.Get().appId, "_", VersionConfig.Get().branch.ToString(), "_", VersionConfig.Get().version);
+ if (VersionConfig.config == null)
+ {
+ throw new System.Exception("VersionConfig is null when RequestJumpUrl, check VersionConfig.GetAsync for more details");
+ }
+
+ var url = StringUtility.Concat(JUMP_URL[jumpUrlIndex % JUMP_URL.Length], "game=xssg&flag=", VersionConfig.config.appId, "_", VersionConfig.config.branch.ToString(), "_", VersionConfig.config.version);
jumpUrlIndex++;
serverUrl = url;
+ // 鍔犳椂闂存埑闃叉娴忚鍣�/CDN缂撳瓨
+ url = StringUtility.Concat(url, "&_t=", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString());
Debug.Log("http鍦板潃:serverlist " + url);
HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnRequestJumpUrl);
}
@@ -213,17 +221,21 @@
{
if (_ok)
{
+ // 鍘婚櫎鍝嶅簲寮�澶村彲鑳藉瓨鍦ㄧ殑 UTF-8 BOM锛圽uFEFF锛夛紝鍚﹀垯 WebGL 涓嬩細鎷兼垚 localhost:8080/%EF%BB%BF... 瀵艰嚧 404
+ _result = _result.TrimStart('\uFEFF');
+
var serverUrls = _result.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
SERVERLIST_URL_COMMON = serverUrls[0];
SERVERLIST_URL_PLAYER = serverUrls[1];
-
+ Debug.LogError("SERVERLIST_URL_COMMON is " + SERVERLIST_URL_COMMON);
+ Debug.LogError("SERVERLIST_URL_PLAYER is " + SERVERLIST_URL_PLAYER);
RequestServerList();
}
else
{
Debug.Log("http 鏁版嵁閫氳: ServerlistCenter:" + serverUrl + " result:" + _result);
//BuglyAgent.ReportException(new System.Exception(), "http 鏁版嵁閫氳: ServerlistCenter:" + serverUrl + " result:" + _result);
- Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestJumpUrl);
+ Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), () => RequestJumpUrl().Forget());
}
}
@@ -233,7 +245,12 @@
serverListPlayerPartGot = false;
RequestServerCommonList();
- if (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest)
+ if (VersionConfig.config == null)
+ {
+ throw new System.Exception("VersionConfig is null when RequestServerList, check VersionConfig.GetAsync for more details");
+ }
+
+ if (VersionConfig.config.versionAuthority == VersionAuthority.InterTest)
{
var localSaveAccountName = LocalSave.GetString(LoginManager.USER_ACCOUNT);
RequestServerListPlayer(localSaveAccountName);
@@ -242,18 +259,25 @@
public void RequestServerCommonList()
{
- HttpRequest.Instance.RequestHttpGet(SERVERLIST_URL_COMMON, HttpRequest.defaultHttpContentType, 1, OnGetServerList);
+ // 鍔犳椂闂存埑闃叉娴忚鍣�/CDN缂撳瓨
+ var url = SERVERLIST_URL_COMMON;
+ var separator = url.Contains("?") ? "&" : "?";
+ url = StringUtility.Concat(url, separator, "_t=", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString());
+ HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnGetServerList);
}
private void OnGetServerList(bool _ok, string _result)
{
if (_ok)
{
+ _result = _result.TrimStart('\uFEFF');
+ Debug.LogError("get server list string is " + _result);
ServerListParser.Instance.PushCommonServerListRawData(_result);
NetLinkWin.Hide();
}
else
{
+ Debug.LogError("failure to get server list " + _result);
Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestServerCommonList);
}
}
@@ -295,9 +319,9 @@
}
}
- public void RequestServerListPlayer(string _accountName)
+ public async void RequestServerListPlayer(string _accountName)
{
- if (VersionUtility.Instance.InIosAuditTime())
+ if (await VersionUtility.Instance.InIosAuditTime())
{
return;
}
@@ -318,6 +342,8 @@
url = StringUtility.Concat(SERVERLIST_URL_PLAYER, "&", HttpRequest.HashtablaToString(tables));
}
+ // 鍔犳椂闂存埑闃叉娴忚鍣�/CDN缂撳瓨
+ url = StringUtility.Concat(url, "&_t=", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString());
HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnGetServerListPlayer);
}
@@ -326,6 +352,7 @@
if (_ok)
{
serverListPlayerPartGot = true;
+ _result = _result.TrimStart('\uFEFF');
ServerListParser.Instance.PushPlayerServerListRawData(_result);
}
else
diff --git a/Main/System/Login/ServerListParser.cs b/Main/System/Login/ServerListParser.cs
index bbfd2e0..e1daf9e 100644
--- a/Main/System/Login/ServerListParser.cs
+++ b/Main/System/Login/ServerListParser.cs
@@ -1,7 +1,7 @@
锘縰sing System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
-using System.Threading;
using LitJson;
public class ServerListParser : SingletonMonobehaviour<ServerListParser>
@@ -15,11 +15,14 @@
public void PushCommonServerListRawData(string content)
{
hasCommonResult = false;
- ThreadPool.QueueUserWorkItem((object aaa) =>
- {
- serverInfoCommon = JsonMapper.ToObject<ServerInfoCommon>(content);
- hasCommonResult = true;
- });
+ ParseCommonServerListAsync(content).Forget();
+ }
+
+ private async UniTaskVoid ParseCommonServerListAsync(string content)
+ {
+ await UniTask.Yield();
+ serverInfoCommon = JsonMapper.ToObject<ServerInfoCommon>(content);
+ hasCommonResult = true;
}
public void PushPlayerServerListRawData(string content)
@@ -32,12 +35,15 @@
if (RankArr["player"]["group_list"].Count == 0)
return;
- ThreadPool.QueueUserWorkItem((object aaa) =>
- {
- serverInfoPlayer = JsonMapper.ToObject<ServerInfoPlayer>(content);
- hasPlayerResult = true;
- SetIsInWhiteList();
- });
+ ParsePlayerServerListAsync(content).Forget();
+ }
+
+ private async UniTaskVoid ParsePlayerServerListAsync(string content)
+ {
+ await UniTask.Yield();
+ serverInfoPlayer = JsonMapper.ToObject<ServerInfoPlayer>(content);
+ hasPlayerResult = true;
+ SetIsInWhiteList();
}
public void ReportCommonResult()
diff --git a/Main/System/Login/ServerListWin.cs b/Main/System/Login/ServerListWin.cs
index dd38056..a34ef82 100644
--- a/Main/System/Login/ServerListWin.cs
+++ b/Main/System/Login/ServerListWin.cs
@@ -62,9 +62,14 @@
var groupDatas = new List<ServerDataCouple>();
var serverDataList = new List<ServerData>(serverGroup.group_list);
+ if (null == VersionConfig.config)
+ {
+ throw new System.Exception("VersionConfig is null when RefreshServerList, check VersionConfig.GetAsync for more details");
+ }
+
for (int i = serverDataList.Count - 1; i >= 0; i--)
{
- if (VersionConfig.Get().isBanShu)
+ if (VersionConfig.config.isBanShu)
{
if (serverDataList[i].region_flag != 8000)
{
diff --git a/Main/System/Mail/MailCell.cs b/Main/System/Mail/MailCell.cs
index 725a067..60fa97e 100644
--- a/Main/System/Mail/MailCell.cs
+++ b/Main/System/Mail/MailCell.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class MailCell : CellView
{
diff --git a/Main/System/Mail/MailWin.cs b/Main/System/Mail/MailWin.cs
index 7f86d4a..85605ef 100644
--- a/Main/System/Mail/MailWin.cs
+++ b/Main/System/Mail/MailWin.cs
@@ -52,7 +52,7 @@
txtCurrentMailCount.text = StringUtility.Concat(personalMailCount.ToString(), "/", MailManager.Instance.personalMailMaxLimitCount.ToString());
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
diff --git a/Main/System/Main/AutoFightWin.cs b/Main/System/Main/AutoFightWin.cs
index 8ea6a57..50f8dd3 100644
--- a/Main/System/Main/AutoFightWin.cs
+++ b/Main/System/Main/AutoFightWin.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class AutoFightWin : UIBase
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index f514112..0cbe97f 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -503,7 +503,7 @@
// if (null != battleField)
// {
- // StoryBossBattleWin fsBattleWin = UIManager.Instance.OpenWindowAsync<StoryBossBattleWin>().Forget();
+ // StoryBossBattleWin fsBattleWin = await UIManager.Instance.OpenWindowAsync<StoryBossBattleWin>();
// fsBattleWin.SetBattleField(battleField);
// return;
// }
diff --git a/Main/System/Main/MainWin.cs b/Main/System/Main/MainWin.cs
index 5177284..3ed2f14 100644
--- a/Main/System/Main/MainWin.cs
+++ b/Main/System/Main/MainWin.cs
@@ -1,8 +1,9 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 娓告垙涓荤晫闈㈠簳閮ㄥ姛鑳芥寜閽�
@@ -295,7 +296,7 @@
/// <summary>
/// 鏍规嵁鏍囩绱㈠紩鎵撳紑瀵瑰簲鐨勫瓙鐣岄潰
/// </summary>
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
Debug.Log("鎵撳紑瀛愮晫闈� : " + functionOrder);
@@ -307,18 +308,18 @@
// 鎵撳紑涓婚〉鐣岄潰
if (!UIManager.Instance.IsOpened<BattleWin>())
{
- UIManager.Instance.OpenWindowAsync<BattleWin>().ContinueWith(battleWin =>
- battleWin.SetBattleField(BattleManager.Instance.storyBattleField)).Forget();
+ BattleWin battleWin = await UIManager.Instance.OpenWindowAsync<BattleWin>();
+ battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
}
else
{
BattleWin battleWin = UIManager.Instance.GetUI<BattleWin>();
battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
}
- UIManager.Instance.OpenWindowAsync<HomeWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HomeWin>();
break;
case 1:
- UIManager.Instance.OpenWindowAsync<AffairBaseWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<AffairBaseWin>();
break;
case 2:
if (gameTip.gameObject.activeSelf)
@@ -328,14 +329,14 @@
HappyXBModel.Instance.startTenCallGuide = true;
}
}
- UIManager.Instance.OpenWindowAsync<HeroBaseWin>(0).ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroBaseWin>(0);
break;
// case 3:
// 鎸戞垬鐣岄潰涓嶈烦杞�
// Debug.Log("鎵撳紑鎸戞垬鐣岄潰");
// break;
case 4:
- UIManager.Instance.OpenWindowAsync<GuildBaseWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<GuildBaseWin>();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
@@ -471,7 +472,7 @@
{
if (nextCantAttackMask.localScale == Vector3.one)
{
- if (BattleManager.Instance.storyBattleField.IsCanRequestFight())
+ if (BattleManager.Instance.storyBattleField != null && BattleManager.Instance.storyBattleField.IsCanRequestFight())
{
nextCantAttackMask.localScale = Vector3.zero;
}
diff --git a/Main/System/Main/PlayerMainDate.cs b/Main/System/Main/PlayerMainDate.cs
index 14589d2..da15d22 100644
--- a/Main/System/Main/PlayerMainDate.cs
+++ b/Main/System/Main/PlayerMainDate.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using System.Collections;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
using System.Collections.Generic;
using System;
diff --git a/Main/System/Main/RightFuncInHome.cs b/Main/System/Main/RightFuncInHome.cs
index daff21e..7b28b8c 100644
--- a/Main/System/Main/RightFuncInHome.cs
+++ b/Main/System/Main/RightFuncInHome.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
+using Cysharp.Threading.Tasks;
//涓荤晫闈㈢殑鍙宠竟鏍忕缉杩涘姛鑳�
public class RightFuncInHome : MonoBehaviour
diff --git a/Main/System/Message/MessageWin.cs b/Main/System/Message/MessageWin.cs
index 2c0c278..1b7fcfd 100644
--- a/Main/System/Message/MessageWin.cs
+++ b/Main/System/Message/MessageWin.cs
@@ -56,7 +56,7 @@
m_ServerTipPrepared = true;
#if UNITY_EDITOR
- m_ContainerGM.SetActive(VersionConfig.Get().debugVersion);
+ m_ContainerGM.SetActive(VersionConfig.config.debugVersion);
#else
m_ContainerGM.SetActive(false);
#endif
diff --git a/Main/System/Mingge/MinggeManager.cs b/Main/System/Mingge/MinggeManager.cs
index 9ef3020..4c07e6b 100644
--- a/Main/System/Mingge/MinggeManager.cs
+++ b/Main/System/Mingge/MinggeManager.cs
@@ -3,6 +3,7 @@
using LitJson;
using System;
using System.Linq;
+using Cysharp.Threading.Tasks;
public class MinggeManager : GameSystemManager<MinggeManager>
diff --git a/Main/System/NewBieGuidance/NewBieCenter.cs b/Main/System/NewBieGuidance/NewBieCenter.cs
index f289d78..6b4c30d 100644
--- a/Main/System/NewBieGuidance/NewBieCenter.cs
+++ b/Main/System/NewBieGuidance/NewBieCenter.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System;
using LitJson;
+using Cysharp.Threading.Tasks;
diff --git a/Main/System/NewBieGuidance/NewBieMask.cs b/Main/System/NewBieGuidance/NewBieMask.cs
index dfee74a..96fe8db 100644
--- a/Main/System/NewBieGuidance/NewBieMask.cs
+++ b/Main/System/NewBieGuidance/NewBieMask.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using System.Collections;
+using Cysharp.Threading.Tasks;
using UnityEngine.UI;
using UnityEngine.Events;
diff --git a/Main/System/OSActivity/OSGalaBaseWin.cs b/Main/System/OSActivity/OSGalaBaseWin.cs
index 2797a0a..e6f5da9 100644
--- a/Main/System/OSActivity/OSGalaBaseWin.cs
+++ b/Main/System/OSActivity/OSGalaBaseWin.cs
@@ -8,6 +8,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
////寮�鏈嶇洓鍏�
@@ -38,18 +39,18 @@
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSGalaMissionWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSGalaMissionWin>();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSGalaChangeWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSGalaChangeWin>();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSGalaGiftWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSGalaGiftWin>();
break;
}
}
diff --git a/Main/System/OSActivity/OSGalaChangeCell.cs b/Main/System/OSActivity/OSGalaChangeCell.cs
index 72bb402..dab877e 100644
--- a/Main/System/OSActivity/OSGalaChangeCell.cs
+++ b/Main/System/OSActivity/OSGalaChangeCell.cs
@@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class OSGalaChangeCell : CellView
{
diff --git a/Main/System/OSActivity/OSHeroCallBaseWin.cs b/Main/System/OSActivity/OSHeroCallBaseWin.cs
index 9f5eaa9..576006f 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,20 +22,20 @@
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
RankModel.Instance.ResetQueryParam();
RankModel.Instance.QueryRankByPage(4, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankWin>(4).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankWin>(4);
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankHeroCallAwardWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankHeroCallAwardWin>();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankHeroCallGiftWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankHeroCallGiftWin>();
break;
}
}
diff --git a/Main/System/OSActivity/OSMainLevelBaseWin.cs b/Main/System/OSActivity/OSMainLevelBaseWin.cs
index 3d17abc..4d216c4 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,17 +31,17 @@
}
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
RankModel.Instance.ResetQueryParam();
RankModel.Instance.QueryRankByPage(3, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankWin>(3).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankWin>(3);
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankMainLeveAwardWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankMainLeveAwardWin>();
break;
}
}
diff --git a/Main/System/OfficialRank/OfficialRankManager.cs b/Main/System/OfficialRank/OfficialRankManager.cs
index 8774f7e..5458b73 100644
--- a/Main/System/OfficialRank/OfficialRankManager.cs
+++ b/Main/System/OfficialRank/OfficialRankManager.cs
@@ -1,9 +1,10 @@
-
+锘�
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class OfficialRankManager : GameSystemManager<OfficialRankManager>
{
diff --git a/Main/System/OfficialRank/OfficialTitleCell.cs b/Main/System/OfficialRank/OfficialTitleCell.cs
index 7a2656b..916988a 100644
--- a/Main/System/OfficialRank/OfficialTitleCell.cs
+++ b/Main/System/OfficialRank/OfficialTitleCell.cs
@@ -98,17 +98,20 @@
prefab = tmp.gameObject;
return;
}
- prefab = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell");
+ var inst = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell");
if (this == null)
{
- if (prefab != null)
- {
- GameObject.DestroyImmediate(prefab);
- }
+ if (inst != null) GameObject.DestroyImmediate(inst);
return;
}
+ if (prefab != null)
+ {
+ GameObject.DestroyImmediate(inst);
+ return;
+ }
+ prefab = inst;
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
@@ -118,6 +121,7 @@
public async UniTask InitUI(int offcialRank, int titleID)
{
await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (!TitleConfig.HasKey(titleID))
{
officialRankObj.SetActive(true);
diff --git a/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs b/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs
index 1515352..3781386 100644
--- a/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs
+++ b/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class OtherEquipCardItem : MonoBehaviour
{
diff --git a/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs b/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs
index 45b29c1..50e85da 100644
--- a/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs
+++ b/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs
@@ -525,11 +525,11 @@
//闈炲姣旂殑鏄剧ず
if (i < HeroUIManager.Instance.normalGiftMaxCnt)
{
- giftBaseCells[i].Init(0, 0);
+ giftBaseCells[i].Init(0, 0).Forget();
}
else
{
- giftBaseCells[i].Init(-1, 0, 0, heroID, i);
+ giftBaseCells[i].Init(-1, 0, 0, heroID, i).Forget();
}
}
return;
@@ -550,18 +550,18 @@
int giftID = talentIDList[i];
int giftLV = talentLvList[i];
int state = 0; //0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
- giftBaseCells[i].Init(giftID, giftLV, state, heroID, i, awakeLevel);
+ giftBaseCells[i].Init(giftID, giftLV, state, heroID, i, awakeLevel).Forget();
}
else
{
//闈炲姣旂殑鏄剧ず
if (i < HeroUIManager.Instance.normalGiftMaxCnt)
{
- giftBaseCells[i].Init(0, 0);
+ giftBaseCells[i].Init(0, 0).Forget();
}
else
{
- giftBaseCells[i].Init(-1, 0, 0, heroID, i);
+ giftBaseCells[i].Init(-1, 0, 0, heroID, i).Forget();
}
}
diff --git a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
index a2f86dc..342e71c 100644
--- a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
+++ b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
@@ -128,6 +128,7 @@
public async UniTask Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
{
await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
var heroConfig = HeroConfig.Get(heroID);
heroModel.Create(skinID, 1.2f);
@@ -197,19 +198,23 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("OtherNpcHeroCell", "Container_HeroShow");
+ var inst = await UIUtility.CreateWidget("OtherNpcHeroCell", "Container_HeroShow");
if (this == null)
{
- if (null != cellContainer)
- {
- DestroyImmediate(cellContainer);
- }
+ if (null != inst) DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs b/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs
index 323cf14..a939a0e 100644
--- a/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs
+++ b/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs
@@ -3,6 +3,7 @@
using UnityEngine;
using LitJson;
using System.Linq;
+using Cysharp.Threading.Tasks;
//鏌ョ湅鍏朵粬鐜╁鐨勭畝鐭俊鎭�, 璇ユā鍧楀鐞嗘暟鎹紝鍏朵粬鐢卞悇鑷姛鑳芥ā鍧楀鐞� 閫氳繃OnRevPackage
diff --git a/Main/System/PhantasmPavilion/AvatarCell.cs b/Main/System/PhantasmPavilion/AvatarCell.cs
index 19b8f5f..b30e46a 100644
--- a/Main/System/PhantasmPavilion/AvatarCell.cs
+++ b/Main/System/PhantasmPavilion/AvatarCell.cs
@@ -13,7 +13,6 @@
{
if (m_button == null)
{
- LoadPrefab();
m_button = this.GetComponent<ButtonEx>("AvatarCell/Img_FaceBG");
}
return m_button;
@@ -27,7 +26,6 @@
{
if (m_FaceBGImage == null)
{
- LoadPrefab();
m_FaceBGImage = this.GetComponent<ImageEx>("AvatarCell/Img_FaceBG");
}
return m_FaceBGImage;
@@ -41,7 +39,6 @@
{
if (m_FaceMask == null)
{
- LoadPrefab();
m_FaceMask = this.GetComponent<EllipseMask>("AvatarCell/Img_FaceBG/Mask_Face");
}
return m_FaceMask;
@@ -55,7 +52,6 @@
{
if (m_FaceUIFrame == null)
{
- LoadPrefab();
m_FaceUIFrame = this.GetComponent<UIFrame>("AvatarCell/Img_FaceBG/Mask_Face/Img_Face");
}
return m_FaceUIFrame;
@@ -69,7 +65,6 @@
{
if (m_FaceImage == null)
{
- LoadPrefab();
m_FaceImage = this.GetComponent<ImageEx>("AvatarCell/Img_FaceBG/Mask_Face/Img_Face");
}
return m_FaceImage;
@@ -83,7 +78,6 @@
{
if (m_faceSpine == null)
{
- LoadPrefab();
m_faceSpine = this.GetComponent<UIEffectPlayer>("AvatarCell/Img_FaceBG/Mask_Face/Img_Face/Spine_Face");
}
return m_faceSpine;
@@ -98,7 +92,6 @@
{
if (m_FacePicImage == null)
{
- LoadPrefab();
m_FacePicImage = this.GetComponent<ImageEx>("AvatarCell/Img_FaceBG/Img_FacePic");
}
return m_FacePicImage;
@@ -112,7 +105,6 @@
{
if (m_FacePicUIFrame == null)
{
- LoadPrefab();
m_FacePicUIFrame = this.GetComponent<UIFrame>("AvatarCell/Img_FaceBG/Img_FacePic");
}
return m_FacePicUIFrame;
@@ -126,7 +118,6 @@
{
if (m_facePicSpine == null)
{
- LoadPrefab();
m_facePicSpine = this.GetComponent<UIEffectPlayer>("AvatarCell/Img_FaceBG/Img_FacePic/Spine_FacePic");
}
return m_facePicSpine;
@@ -140,7 +131,6 @@
{
if (m_redpoint == null)
{
- LoadPrefab();
m_redpoint = this.GetComponent<RedpointBehaviour>("AvatarCell/Img_FaceBG/RedPoint");
}
return m_redpoint;
@@ -154,7 +144,7 @@
private void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
public void SetOnLoaded(Action _onloaded)
@@ -202,17 +192,21 @@
prefab = tmp.gameObject;
return;
}
- prefab = await UIUtility.CreateWidget("AvatarCell", "AvatarCell");
+ var inst = await UIUtility.CreateWidget("AvatarCell", "AvatarCell");
if (this == null)
{
- if (prefab != null)
- {
- GameObject.DestroyImmediate(prefab);
- return;
- }
+ if (inst != null) GameObject.DestroyImmediate(inst);
+ return;
}
+ if (prefab != null)
+ {
+ GameObject.DestroyImmediate(inst);
+ return;
+ }
+ prefab = inst;
+
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs b/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs
index 6f279d5..9a98265 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs
@@ -1,4 +1,5 @@
锘縰sing UnityEngine;
+using Cysharp.Threading.Tasks;
public class PhantasmPavilionWin : FunctionsBaseWin
{
@@ -19,24 +20,24 @@
tabButtons[2].redpoint.redpointId = manager.GetRedpointId(PhantasmPavilionRepointType.Title);
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
imgModelBG.SetActive(functionOrder == 0);
switch (functionOrder)
{
case 0:
//褰㈣薄
- currentSubUI = UIManager.Instance.OpenWindowAsync<PhantasmPavilionModelWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<PhantasmPavilionModelWin>();
manager.nowType = PhantasmPavilionType.Model;
break;
case 1:
//澶村儚
- currentSubUI = UIManager.Instance.OpenWindowAsync<PhantasmPavilionFaceWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<PhantasmPavilionFaceWin>();
manager.nowType = PhantasmPavilionType.Face;
break;
case 2:
//绉板彿
- currentSubUI = UIManager.Instance.OpenWindowAsync<PhantasmPavilionTitleWin>().Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<PhantasmPavilionTitleWin>();
manager.nowType = PhantasmPavilionType.Title;
break;
default:
diff --git a/Main/System/PlayerProfile/ExchangeCodeWin.cs b/Main/System/PlayerProfile/ExchangeCodeWin.cs
index 3fe08b3..17e1f1f 100644
--- a/Main/System/PlayerProfile/ExchangeCodeWin.cs
+++ b/Main/System/PlayerProfile/ExchangeCodeWin.cs
@@ -6,7 +6,7 @@
{
[SerializeField] InputField input;
[SerializeField] Button receiveBtn;
- const string exchangeUrl = "http://xssgcenter.secondworld.net.cn:53003/Coupon/CouponCode.php?";
+ const string exchangeUrl = "http://gamecenter.secondworld.net.cn:53003/Coupon/CouponCode.php?";
bool isCool = false;
float time = 0;
@@ -61,7 +61,7 @@
{
isCool = true;
var tables = new Dictionary<string, string>();
- tables["channel"] = VersionConfig.Get().appId;
+ tables["channel"] = VersionConfig.config.appId;
tables["code"] = passward;
#if UNITY_EDITOR
tables["accid"] = LoginManager.Instance.accountBuf;
@@ -71,7 +71,7 @@
#endif
tables["sid"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
tables["pushurl"] = ServerListCenter.Instance.currentServer.region_domain;
- tables["spid"] = VersionConfig.Get().SpID;
+ tables["spid"] = VersionConfig.config.SpID;
tables["roleid"] = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName);
tables["level"] = PlayerDatas.Instance.baseData.LV.ToString();
tables["viplevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
diff --git a/Main/System/PlayerProfile/PlayerProfileWin.cs b/Main/System/PlayerProfile/PlayerProfileWin.cs
index abb29ed..0cad221 100644
--- a/Main/System/PlayerProfile/PlayerProfileWin.cs
+++ b/Main/System/PlayerProfile/PlayerProfileWin.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class PlayerProfileWin : UIBase
{
diff --git a/Main/System/Recharge/RechargeManager.cs b/Main/System/Recharge/RechargeManager.cs
index 477765d..ff8e625 100644
--- a/Main/System/Recharge/RechargeManager.cs
+++ b/Main/System/Recharge/RechargeManager.cs
@@ -170,7 +170,7 @@
#if UNITY_EDITOR
orderInfoToCTGID[configs[i].OrderInfo] = configs[i].CTGID;
#else
- if (configs[i].AppId == VersionConfig.Get().appId)
+ if (configs[i].AppId == VersionConfig.config.appId)
{
orderInfoToCTGID[configs[i].OrderInfo] = configs[i].CTGID;
}
@@ -319,7 +319,7 @@
return false;
}
List<OrderInfoConfig> list;
- if (m_OrderInfoDict.TryGetValue(VersionConfig.Get().appId, out list))
+ if (m_OrderInfoDict.TryGetValue(VersionConfig.config.appId, out list))
{
for (int i = 0; i < list.Count; i++)
{
@@ -344,7 +344,7 @@
return result;
}
List<OrderInfoConfig> list;
- if (m_OrderInfoDict.TryGetValue(VersionConfig.Get().appId, out list))
+ if (m_OrderInfoDict.TryGetValue(VersionConfig.config.appId, out list))
{
for (int i = 0; i < list.Count; i++)
{
@@ -362,7 +362,7 @@
{
config = null;
List<OrderInfoConfig> list;
- if (m_OrderInfoDict.TryGetValue(VersionConfig.Get().appId, out list))
+ if (m_OrderInfoDict.TryGetValue(VersionConfig.config.appId, out list))
{
for (int i = 0; i < list.Count; i++)
{
@@ -379,7 +379,7 @@
public float GetOnSalePayRmb(int _id)
{
- var appid = VersionConfig.Get().appId;
+ var appid = VersionConfig.config.appId;
appid = m_CTGConfigDict.ContainsKey(appid) ? appid : m_CTGConfigDict.Keys.Last();
var configs = OrderInfoConfig.GetValues();
for (int i = 0; i < configs.Count; i++)
@@ -395,7 +395,7 @@
public float GetOrgPayRmb(int _id)
{
- var appid = VersionConfig.Get().appId;
+ var appid = VersionConfig.config.appId;
appid = m_CTGConfigDict.ContainsKey(appid) ? appid : m_CTGConfigDict.Keys.Last();
var configs = OrderInfoConfig.GetValues();
for (int i = 0; i < configs.Count; i++)
@@ -426,7 +426,7 @@
return;
}
var rechargeConfig = CTGConfig.Get(config.CTGID);
- if (!VersionConfig.Get().appId.Equals(config.AppId))
+ if (!VersionConfig.config.appId.Equals(config.AppId))
{
return;
}
@@ -708,7 +708,7 @@
// {
// return;
// }
- // var list = GetCTGConfigs(VersionConfig.Get().appId);
+ // var list = GetCTGConfigs(VersionConfig.config.appId);
// var config = CTGConfig.Get(list[0]);
// if (m_RechargeCountDict.ContainsKey(config.RecordID))
// {
diff --git a/Main/System/Settlement/BattleFailWin.cs b/Main/System/Settlement/BattleFailWin.cs
index dea9780..a1bb7aa 100644
--- a/Main/System/Settlement/BattleFailWin.cs
+++ b/Main/System/Settlement/BattleFailWin.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鎴樺満缁撶畻鐣岄潰锛屽瓨鍦ㄥ涓殑鎯呭喌
public class BattleFailWin : UIBase
diff --git a/Main/System/Settlement/BoneBattleFailWin.cs b/Main/System/Settlement/BoneBattleFailWin.cs
index 2dd83fc..65889ff 100644
--- a/Main/System/Settlement/BoneBattleFailWin.cs
+++ b/Main/System/Settlement/BoneBattleFailWin.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鎴樺満缁撶畻鐣岄潰锛屽瓨鍦ㄥ涓殑鎯呭喌
public class BoneBattleFailWin : UIBase
diff --git a/Main/System/Settlement/WarlordPavilionFailWin.cs b/Main/System/Settlement/WarlordPavilionFailWin.cs
index a991dbe..3997762 100644
--- a/Main/System/Settlement/WarlordPavilionFailWin.cs
+++ b/Main/System/Settlement/WarlordPavilionFailWin.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
//鎴樺満缁撶畻鐣岄潰锛屽瓨鍦ㄥ涓殑鎯呭喌
public class WarlordPavilionFailWin : UIBase
diff --git a/Main/System/SkillUI/SkillBaseCell.cs b/Main/System/SkillUI/SkillBaseCell.cs
index 1540573..4a73513 100644
--- a/Main/System/SkillUI/SkillBaseCell.cs
+++ b/Main/System/SkillUI/SkillBaseCell.cs
@@ -114,16 +114,23 @@
return;
}
- cellContainer = await UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
+ var inst = await UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
if (this == null)
{
- if (null != cellContainer) DestroyImmediate(cellContainer);
+ if (null != inst) DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/SkillUI/SkillWordCell.cs b/Main/System/SkillUI/SkillWordCell.cs
index fa00e2e..6ffe0f3 100644
--- a/Main/System/SkillUI/SkillWordCell.cs
+++ b/Main/System/SkillUI/SkillWordCell.cs
@@ -54,6 +54,7 @@
public async UniTask Init(int skillID, UnityAction onclick = null, bool showType = false)
{
await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
var config = SkillConfig.Get(skillID);
if (config == null)
{
@@ -91,19 +92,23 @@
}
if (cellContainer == null)
{
- cellContainer = await UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell");
+ var inst = await UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell");
if (this == null)
{
- if (null != cellContainer)
- {
- DestroyImmediate(cellContainer);
- }
+ if (null != inst) DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/Store/StoreBaseWin.cs b/Main/System/Store/StoreBaseWin.cs
index 940df2d..520359e 100644
--- a/Main/System/Store/StoreBaseWin.cs
+++ b/Main/System/Store/StoreBaseWin.cs
@@ -1,21 +1,22 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class StoreBaseWin : OneLevelWin
{
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
switch (functionOrder)
{
case 0:
- UIManager.Instance.OpenWindowAsync<StoreWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<StoreWin>();
break;
case 1:
// 鍏呭�肩晫闈�
- UIManager.Instance.OpenWindowAsync<RechargeWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<RechargeWin>();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/Store/StoreCell.cs b/Main/System/Store/StoreCell.cs
index fd123a3..851e1e6 100644
--- a/Main/System/Store/StoreCell.cs
+++ b/Main/System/Store/StoreCell.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class StoreCell : MonoBehaviour
diff --git a/Main/System/TianziBillborad/TianziBillboradRankWin.cs b/Main/System/TianziBillborad/TianziBillboradRankWin.cs
index fee8a50..8e577ad 100644
--- a/Main/System/TianziBillborad/TianziBillboradRankWin.cs
+++ b/Main/System/TianziBillborad/TianziBillboradRankWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -78,7 +78,7 @@
Refresh();
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
transRank.SetActive(functionOrder == 0);
transAward.SetActive(functionOrder == 1);
diff --git a/Main/System/TimeRush/TimeRushTipWin.cs b/Main/System/TimeRush/TimeRushTipWin.cs
index 483ac7c..a6eec58 100644
--- a/Main/System/TimeRush/TimeRushTipWin.cs
+++ b/Main/System/TimeRush/TimeRushTipWin.cs
@@ -1,5 +1,6 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TimeRushTipWin : UIBase
{
diff --git a/Main/System/TimingGift/TimingGiftCell.cs b/Main/System/TimingGift/TimingGiftCell.cs
index 44df006..01dd48f 100644
--- a/Main/System/TimingGift/TimingGiftCell.cs
+++ b/Main/System/TimingGift/TimingGiftCell.cs
@@ -129,14 +129,21 @@
return;
}
- prefab = await UIUtility.CreateWidget("TimingGiftCell", "TimingGiftCell");
+ var inst = await UIUtility.CreateWidget("TimingGiftCell", "TimingGiftCell");
if (this == null)
{
- if (null != prefab) DestroyImmediate(prefab);
+ if (null != inst) DestroyImmediate(inst);
return;
}
+ if (prefab != null)
+ {
+ DestroyImmediate(inst);
+ return;
+ }
+ prefab = inst;
+
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
}
diff --git a/Main/System/UIBase/OneLevelWin.cs b/Main/System/UIBase/OneLevelWin.cs
index 02feaa8..72007b9 100644
--- a/Main/System/UIBase/OneLevelWin.cs
+++ b/Main/System/UIBase/OneLevelWin.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
using System;
using Cysharp.Threading.Tasks;
@@ -69,7 +69,7 @@
isComponentReady = true;
}
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
}
diff --git a/Main/System/UIBase/UIBase.cs b/Main/System/UIBase/UIBase.cs
index 6514d5e..b4e444f 100644
--- a/Main/System/UIBase/UIBase.cs
+++ b/Main/System/UIBase/UIBase.cs
@@ -127,7 +127,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨処nitComponentInternal鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨処nitComponentInternal鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
try
@@ -136,7 +136,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨処nitComponent鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨処nitComponent鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
// 淇濆瓨鍘熷鍊肩敤浜庡姩鐢�
@@ -144,9 +144,8 @@
{
if (Screen.height / Screen.width > 1.8)//瀹藉睆闇�瑕侀�傞厤
{
- //涓婁笅鍚勯棿闅擲afeWidth
- _rectTransform.offsetMax = new Vector2(0, -SafeHeightUp); //涓�
- _rectTransform.offsetMin = new Vector2(0, SafeHeightDown); //涓�
+ _rectTransform.offsetMax = new Vector2(0, -SafeHeightUp); //涓�
+ _rectTransform.offsetMin = new Vector2(0, SafeHeightDown); //涓�
}
originalPosition = _rectTransform.anchoredPosition;
}
@@ -204,7 +203,6 @@
btnClickEmptyClose.enabled = false;
}
-
protected async void ExecuteNextFrame(Action _action)
{
@@ -274,7 +272,10 @@
// 璁剧疆UI灞傜骇
public void SetSortingOrder(int order)
{
- canvas.sortingOrder = order;
+ if (canvas == null)
+ canvas = GetComponent<Canvas>();
+ if (canvas != null)
+ canvas.sortingOrder = order;
}
protected virtual void OnPreOpen()
@@ -308,7 +309,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nPreOpen鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nPreOpen鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
StopCurrentAnimation();
@@ -329,10 +330,15 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nOpen鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nOpen鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
- ApplyClickEmptySpaceClose();
+ ApplyClickEmptySpaceClose().Forget();
+
+#if UNITY_WEBGL
+ // WebGL 璇婃柇锛氭娴� Image 缁勪欢鐨� sprite 鏄惁涓� null
+ DiagCheckImageSprites();
+#endif
ExecuteNextFrame(() =>
{
@@ -346,7 +352,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凬extFrameAfterOpen鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凬extFrameAfterOpen鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
});
}
@@ -355,6 +361,75 @@
{
}
+
+#if UNITY_WEBGL
+ /// <summary>
+ /// WebGL 璇婃柇锛氭娴嬫墍鏈� Image 瀛愮粍浠剁殑 sprite 鐘舵�併��
+ /// 鐢ㄤ簬鎺掓煡 WebGL 鏋勫缓涓� Image 璧勬簮涓㈠け鐨勯棶棰樸��
+ /// </summary>
+ private void DiagCheckImageSprites()
+ {
+ var images = GetComponentsInChildren<Image>(true);
+ int nullCount = 0;
+ int totalCount = images.Length;
+ var sb = new System.Text.StringBuilder();
+
+ foreach (var img in images)
+ {
+ if (img.sprite == null && img.overrideSprite == null)
+ {
+ // 璺宠繃 Color-only 鎴� mask 鐢ㄩ�旂殑 Image锛堟棤闇� sprite锛�
+ if (img.type == Image.Type.Simple && img.color.a < 0.01f)
+ continue;
+
+ nullCount++;
+ string path = GetTransformPath(img.transform);
+ sb.AppendLine($" [NULL sprite] {path} (type={img.type}, raycast={img.raycastTarget})");
+ }
+ }
+
+ var rawImages = GetComponentsInChildren<RawImage>(true);
+ int rawNullCount = 0;
+ foreach (var ri in rawImages)
+ {
+ if (ri.texture == null)
+ {
+ rawNullCount++;
+ string path = GetTransformPath(ri.transform);
+ sb.AppendLine($" [NULL texture] RawImage: {path}");
+ }
+ }
+
+ if (nullCount > 0 || rawNullCount > 0)
+ {
+ Debug.LogWarning($"[UIBase][SpriteDiag] {uiName}: {nullCount}/{totalCount} Image sprites NULL, {rawNullCount} RawImage textures NULL\n{sb}");
+ }
+ else
+ {
+ Debug.Log($"[UIBase][SpriteDiag] {uiName}: All {totalCount} Image sprites OK");
+ }
+
+ // 妫�鏌� Canvas 鐘舵��
+ if (canvas != null)
+ {
+ Debug.Log($"[UIBase][SpriteDiag] {uiName} Canvas: renderMode={canvas.renderMode}, worldCamera={(canvas.worldCamera != null ? canvas.worldCamera.name : "NULL")}, sortingOrder={canvas.sortingOrder}");
+ }
+ }
+
+ private string GetTransformPath(Transform t)
+ {
+ string path = t.name;
+ Transform parent = t.parent;
+ int depth = 0;
+ while (parent != null && parent != transform && depth < 10)
+ {
+ path = parent.name + "/" + path;
+ parent = parent.parent;
+ depth++;
+ }
+ return path;
+ }
+#endif
// 鍏抽棴UI - 淇敼鍚庣殑鏂规硶
public void HandleClose()
@@ -371,7 +446,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nPreClose鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nPreClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
StopCurrentAnimation();
@@ -392,7 +467,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nClose鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
if (closeAnimationType == UIAnimationType.None)
@@ -403,7 +478,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
}
// 鍚﹀垯鍦ㄥ姩鐢诲畬鎴愬悗绂佺敤娓告垙瀵硅薄锛堝湪PlayCloseAnimation涓鐞嗭級
@@ -672,7 +747,7 @@
}
catch (System.Exception e)
{
- Debug.LogError($"鎾斁鎵撳紑鍔ㄧ敾鏃跺嚭閿�: {e.StackTrace}");
+ Debug.LogError($"鎾斁鎵撳紑鍔ㄧ敾鏃跺嚭閿�: message: {e.Message} \nStackTrace: {e.StackTrace}");
// 鍑洪敊鏃剁‘淇漊I鍙骞跺彲浜や簰
if (canvasGroup != null)
@@ -795,7 +870,7 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
}
}
});
@@ -804,7 +879,7 @@
}
catch (System.Exception e)
{
- Debug.LogError($"鎾斁鍏抽棴鍔ㄧ敾鏃跺嚭閿�: {e.StackTrace}");
+ Debug.LogError($"鎾斁鍏抽棴鍔ㄧ敾鏃跺嚭閿�: message: {e.Message} \nStackTrace: {e.StackTrace}");
// 鍑洪敊鏃剁洿鎺ュ畬鎴愬叧闂�
isAnimating = false;
diff --git a/Main/System/UIBase/UIJumpManager.cs b/Main/System/UIBase/UIJumpManager.cs
index 74810c0..d5ac708 100644
--- a/Main/System/UIBase/UIJumpManager.cs
+++ b/Main/System/UIBase/UIJumpManager.cs
@@ -55,7 +55,7 @@
if (!UIManager.Instance.IsOpened(config.WinName))
{
- UIManager.Instance.OpenWindow(config.WinName, config.TabIndex).Forget();
+ UIManager.Instance.OpenWindowAsync(config.WinName, config.TabIndex).Forget();
}
else
{
diff --git a/Main/System/Video/UIVideoPlayer.cs b/Main/System/Video/UIVideoPlayer.cs
index 1b005b2..50f2751 100644
--- a/Main/System/Video/UIVideoPlayer.cs
+++ b/Main/System/Video/UIVideoPlayer.cs
@@ -1,7 +1,8 @@
-using System;
+锘縰sing System;
using UnityEngine;
using UnityEngine.Video;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// UI瑙嗛鎾斁鍣ㄧ粍浠� - 鏀寔WebM鏍煎紡閫忔槑瑙嗛鎾斁
diff --git a/Main/System/WarlordPavilion/TowerBaseWin.cs b/Main/System/WarlordPavilion/TowerBaseWin.cs
index 0616054..0fdf855 100644
--- a/Main/System/WarlordPavilion/TowerBaseWin.cs
+++ b/Main/System/WarlordPavilion/TowerBaseWin.cs
@@ -1,16 +1,16 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using Cysharp.Threading.Tasks;
public class TowerBaseWin : OneLevelWin
{
[SerializeField] Transform WarlordPavilionWinTop;
- protected override void OpenSubUIByTabIndex()
+ protected override async void OpenSubUIByTabIndex()
{
WarlordPavilionWinTop.SetActive(functionOrder == 0);
switch (functionOrder)
{
case 0:
- UIManager.Instance.OpenWindowAsync<WarlordPavilionWin>().ContinueWith(w => currentSubUI = w).Forget();
+ currentSubUI = await UIManager.Instance.OpenWindowAsync<WarlordPavilionWin>();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs b/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs
index f273e9e..6863d79 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs
@@ -228,16 +228,23 @@
return;
}
- cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+ var inst = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
if (this == null)
{
- if (null != cellContainer) DestroyImmediate(cellContainer);
+ if (null != inst) DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs b/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs
index f155f19..0d0b71a 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs
@@ -260,16 +260,23 @@
return;
}
- cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+ var inst = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
if (this == null)
{
- if (null != cellContainer) DestroyImmediate(cellContainer);
+ if (null != inst) DestroyImmediate(inst);
return;
}
if (cellContainer != null)
{
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
cellContainer.transform.SetAsFirstSibling();
}
diff --git a/Main/Utility/DeviceUtility.cs b/Main/Utility/DeviceUtility.cs
index 3d50384..b44fb1f 100644
--- a/Main/Utility/DeviceUtility.cs
+++ b/Main/Utility/DeviceUtility.cs
@@ -7,6 +7,7 @@
using System.Net.Sockets;
using System.IO;
using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
#if UNITY_IOS
using UnityEngine.iOS;
@@ -40,7 +41,7 @@
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 GetIp()
+ public static async UniTask<string> GetIp()
{
try
{
@@ -50,10 +51,10 @@
WebRequest wRequest = WebRequest.Create(url);
wRequest.Method = "GET";
wRequest.ContentType = "text/html;charset=UTF-8";
- WebResponse wResponse = wRequest.GetResponse();
+ WebResponse wResponse = await wRequest.GetResponseAsync();
Stream stream = wResponse.GetResponseStream();
StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
- string str = reader.ReadToEnd();
+ string str = await reader.ReadToEndAsync();
reader.Close();
wResponse.Close();
@@ -64,12 +65,12 @@
ip = match.Value;
}
}
+
}
catch (Exception ex)
{
Debug.Log(ex);
}
-
return ip;
}
diff --git a/Main/Utility/GMCommand.cs b/Main/Utility/GMCommand.cs
index adb7b6a..fb040fb 100644
--- a/Main/Utility/GMCommand.cs
+++ b/Main/Utility/GMCommand.cs
@@ -1,4 +1,5 @@
锘縰sing UnityEngine;
+using Cysharp.Threading.Tasks;
public class GMCommand : SingletonMonobehaviour<GMCommand>
{
diff --git a/Main/Utility/OperationLogCollect.cs b/Main/Utility/OperationLogCollect.cs
index f80ac79..d260794 100644
--- a/Main/Utility/OperationLogCollect.cs
+++ b/Main/Utility/OperationLogCollect.cs
@@ -3,6 +3,7 @@
using UnityEngine;
using System;
using LitJson;
+using Cysharp.Threading.Tasks;
public class OperationLogCollect : Singleton<OperationLogCollect>
@@ -14,13 +15,13 @@
// {
// return;
// #if !UNITY_EDITOR
-// if (VersionConfig.Get().versionAuthority == VersionAuthority.Release)
+// if (config.versionAuthority == VersionAuthority.Release)
// {
// var tables = new Dictionary<string, string>();
-// tables["OperatorID"] = VersionConfig.Get().appId;
+// tables["OperatorID"] = config.appId;
// tables["RegionName"] = "data";
// tables["EventID"] = 9001.ToString();
-// tables["ProductID"] = VersionConfig.Get().gameId;
+// tables["ProductID"] = config.gameId;
// tables["Device"] = SystemInfo.deviceName;
// tables["DeviceFlag"] = ynmbxxjUtil.Instance.Device.uniqueID;
// tables["IP"] = DeviceUtility.GetIp();
@@ -38,18 +39,18 @@
// {
// return;
// #if !UNITY_EDITOR
-// if (VersionConfig.Get().versionAuthority == VersionAuthority.Release)
+// if (config.versionAuthority == VersionAuthority.Release)
// {
// var tables = new Dictionary<string, string>();
-// tables["OperatorID"] = VersionConfig.Get().appId;
+// tables["OperatorID"] = config.appId;
// tables["RegionName"] = "data";
// tables["AccountID"] = ynmbxxjUtil.Instance.FreePlatformInfo == null ? "" : ynmbxxjUtil.Instance.FreePlatformInfo.account;
// tables["EventID"] = 9001.ToString();
-// tables["ProductID"] = VersionConfig.Get().gameId;
+// tables["ProductID"] = config.gameId;
// tables["Device"] = SystemInfo.deviceName;
// tables["IP"] = DeviceUtility.GetIp();
// tables["DeviceFlag"] = ynmbxxjUtil.Instance.Device.uniqueID;
-// tables["Flag"] = VersionConfig.Get().clientPackageFlag;
+// tables["Flag"] = config.clientPackageFlag;
// tables["Time"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// tables["Step"] = _step.ToString();
@@ -69,7 +70,7 @@
// {
// return;
// #if !UNITY_EDITOR
-// if (VersionConfig.Get().versionAuthority != VersionAuthority.Release)
+// if (config.versionAuthority != VersionAuthority.Release)
// {
// return;
// }
@@ -77,10 +78,10 @@
// if (!recordedDeviceDetail)
// {
// var tables = new Dictionary<string, string>();
-// tables["OperatorID"] = VersionConfig.Get().appId;
+// tables["OperatorID"] = config.appId;
// tables["RegionName"] = StringUtility.Concat("s" + ServerListCenter.Instance.currentServer.region_flag);
// tables["EventID"] = 1102.ToString();
-// tables["ProductID"] = VersionConfig.Get().gameId;
+// tables["ProductID"] = config.gameId;
// tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// tables["IP"] = DeviceUtility.GetIp();
// tables["AccountID"] = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account;
@@ -99,7 +100,7 @@
// var runtime = new Dictionary<string, string>();
// runtime["os_version"] = DeviceUtility.GetDeviceOSLevel();
// tables["Runtime"] = JsonMapper.ToJson(runtime);
-// tables["Version"] = StringUtility.Concat(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex);
+// tables["Version"] = StringUtility.Concat(config.version, "_", config.buildIndex);
// HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(url, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
// }
@@ -109,36 +110,45 @@
// }
- 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)
{
- var tables = new Dictionary<string, string>();
- tables["OperatorID"] = VersionConfig.Get().appId;
- tables["RegionName"] = "data";
- tables["RegionID"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
- 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["AccountID"] = LoginManager.Instance.sdkLoginResult.account;
- tables["Level"] = PlayerDatas.Instance.baseData.LV.ToString();
- tables["RoleID"] = PlayerDatas.Instance.baseData.PlayerName;
- tables["VIPLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
- tables["DeviceFlag"] = SDKUtils.Instance.Device.uniqueID;
- var contentPrefix = StringUtility.Concat("IMEI:", DeviceUtility.GetDeviceUniquenessIdentify(), ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "Version:", StringUtility.Concat(VersionConfig.Get().version, "_",
- VersionConfig.Get().buildIndex.ToString(), "-", LoginManager.Instance.hotVersion), Language.Id, ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "Brand:", DeviceUtility.GetDeviceName(), ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "MI5:", DeviceUtility.GetDeviceModel(), ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "os_version:", DeviceUtility.GetDeviceOSLevel(), ";");
+ var config = VersionConfig.config;
+ DeviceUtility.GetIp().ContinueWith(ip =>
+ {
+ var gameId = config.gameId;
- tables["Title"] = _title;
- tables["Content"] = _content;
- tables["ClientInfo"] = contentPrefix;
+ var tables = new Dictionary<string, string>();
+ tables["OperatorID"] = config.appId;
+ tables["RegionName"] = "data";
+ tables["RegionID"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
+ tables["EventID"] = 9002.ToString();
+ tables["ProductID"] = config.gameId;
+ tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ tables["IP"] = ip;
+ tables["AccountID"] = LoginManager.Instance.sdkLoginResult.account;
+ tables["Level"] = PlayerDatas.Instance.baseData.LV.ToString();
+ tables["RoleID"] = PlayerDatas.Instance.baseData.PlayerName;
+ tables["VIPLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+ tables["DeviceFlag"] = SDKUtils.Instance.Device.uniqueID;
- HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(bugReportUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
+ var contentPrefix = StringUtility.Concat("IMEI:", DeviceUtility.GetDeviceUniquenessIdentify(), ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "Version:", StringUtility.Concat(config.version, "_",
+ config.buildIndex.ToString(), "-", LoginManager.Instance.hotVersion), Language.Id, ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "Brand:", DeviceUtility.GetDeviceName(), ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "MI5:", DeviceUtility.GetDeviceModel(), ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "os_version:", DeviceUtility.GetDeviceOSLevel(), ";");
+
+ tables["Title"] = _title;
+ tables["Content"] = _content;
+ tables["ClientInfo"] = contentPrefix;
+
+ HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(bugReportUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
+
+ }).Forget();
+
}
@@ -147,38 +157,43 @@
#if !UNITY_EDITOR
try
{
- var tables = new Dictionary<string, string>();
- tables["OperatorID"] = VersionConfig.Get().appId;
- tables["RegionName"] = "data";
- tables["RegionID"] = "10000";
- 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["AccountID"] = "system";
- tables["Level"] = "1";
- tables["RoleID"] = "system";
- tables["VIPLevel"] = "1";
- tables["DeviceFlag"] = SDKUtils.Instance.Device.uniqueID;
-
- var contentPrefix = StringUtility.Concat("IMEI:", DeviceUtility.GetDeviceUniquenessIdentify(), ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "Version:", StringUtility.Concat(VersionConfig.Get().version, "_",
- VersionConfig.Get().buildIndex.ToString(), "-", LoginManager.Instance.hotVersion), Language.Id, ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "Brand:", DeviceUtility.GetDeviceName(), ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "MI5:", DeviceUtility.GetDeviceModel(), ";");
- contentPrefix = StringUtility.Concat(contentPrefix, "os_version:", DeviceUtility.GetDeviceOSLevel(), ";");
-
- tables["Title"] = "system";
- _content = _content.Replace("0000", "");
- if (ConfigManager.Instance.isLoadFinished && DTC0102_tagCDBPlayer.playerIdBuf != 0 && LoginManager.Instance.sdkLoginResult != null && !string.IsNullOrEmpty(LoginManager.Instance.sdkLoginResult.account))
+ DeviceUtility.GetIp().ContinueWith(ip =>
{
- _content = StringUtility.Concat(LoginManager.Instance.sdkLoginResult.account, "@", ServerListCenter.Instance.currentServer.region_flag.ToString(), " ", _content);
- }
-
- tables["Content"] = _content.Substring(0, Math.Min(800, _content.Length));
- tables["ClientInfo"] = contentPrefix;
+ var config = VersionConfig.config;
+ var tables = new Dictionary<string, string>();
+ tables["OperatorID"] = config.appId;
+ tables["RegionName"] = "data";
+ tables["RegionID"] = "10000";
+ tables["EventID"] = 9002.ToString();
+ tables["ProductID"] = config.gameId;
+ tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ tables["IP"] = ip;
+ tables["AccountID"] = "system";
+ tables["Level"] = "1";
+ tables["RoleID"] = "system";
+ tables["VIPLevel"] = "1";
+ tables["DeviceFlag"] = SDKUtils.Instance.Device.uniqueID;
- HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(bugReportUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
+ var contentPrefix = StringUtility.Concat("IMEI:", DeviceUtility.GetDeviceUniquenessIdentify(), ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "Version:", StringUtility.Concat(config.version, "_",
+ config.buildIndex.ToString(), "-", LoginManager.Instance.hotVersion), Language.Id, ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "Brand:", DeviceUtility.GetDeviceName(), ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "MI5:", DeviceUtility.GetDeviceModel(), ";");
+ contentPrefix = StringUtility.Concat(contentPrefix, "os_version:", DeviceUtility.GetDeviceOSLevel(), ";");
+
+ tables["Title"] = "system";
+ _content = _content.Replace("0000", "");
+ if (ConfigManager.Instance.isLoadFinished && DTC0102_tagCDBPlayer.playerIdBuf != 0 && LoginManager.Instance.sdkLoginResult != null && !string.IsNullOrEmpty(LoginManager.Instance.sdkLoginResult.account))
+ {
+ _content = StringUtility.Concat(LoginManager.Instance.sdkLoginResult.account, "@", ServerListCenter.Instance.currentServer.region_flag.ToString(), " ", _content);
+ }
+
+ tables["Content"] = _content.Substring(0, Math.Min(800, _content.Length));
+ tables["ClientInfo"] = contentPrefix;
+
+ HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(bugReportUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
+ }).Forget();
+
}
catch (System.Exception ex)
{
@@ -188,20 +203,21 @@
}
- const string chatReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
- public void ChatReport(string content, string channelName, string toPlayer, int chatType)
+ const string chatReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
+ public async void ChatReport(string content, string channelName, string toPlayer, int chatType)
{
#if !UNITY_EDITOR
bool isFairy = chatType == 3;
var tables = new Dictionary<string, string>();
- tables["ProductID"] = VersionConfig.Get().gameId;
- tables["OperatorID"] = VersionConfig.Get().appId;
+ var config = VersionConfig.config;
+ tables["ProductID"] = config.gameId;
+ tables["OperatorID"] = config.appId;
tables["OperatorName"] = string.Empty;
tables["RegionName"] = StringUtility.Concat("s", ServerListCenter.Instance.currentServer.region_flag.ToString());
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"] = await DeviceUtility.GetIp();
tables["ChatChannel"] = channelName;
var sdkLoginResult = LoginManager.Instance.sdkLoginResult;
tables["AccountID"] = sdkLoginResult == null ? LoginManager.Instance.accountBuf : sdkLoginResult.account;
diff --git a/Main/Utility/ShaderUtility.cs b/Main/Utility/ShaderUtility.cs
index 3e11810..c9f1188 100644
--- a/Main/Utility/ShaderUtility.cs
+++ b/Main/Utility/ShaderUtility.cs
@@ -21,19 +21,37 @@
public static void WarmUpAll()
{
// US2: Sync AB loading removed. Use WarmUpAllAsync instead.
+#if !UNITY_EDITOR
Shader.WarmupAllShaders();
+#endif
}
/// <summary>
- /// US2: Async shader warm up via YooAsset. Temporary API 鈥� will be replaced by preload+cache in T044.
+ /// US2: Async shader warm up via YooAsset.
+ /// PackDirectory 瑙勫垯涓嬫墍鏈� shader 鍦ㄥ悓涓�涓� bundle锛�
+ /// 閫氳繃 tag="shader" 鎷垮埌浠绘剰涓�涓湁鏁堝湴鍧�浼犵粰 LoadAllAssetsAsync 鍗冲彲鍔犺浇鏁村寘銆�
+ /// 鍓嶆彁锛欳ollector 鐨� Asset Tags 濉啓 "shader" 骞堕噸鏂版墦 AB銆�
/// </summary>
public static async UniTask WarmUpAllAsync()
{
if (AssetSource.isUseAssetBundle)
{
- await YooAssetService.Instance.LoadAllAssetsAsync<Shader>("Assets/ResourcesOut/Shader");
+ // 閫氳繃 tag 鎵惧埌 shader bundle 鍐呬换鎰忎竴涓湁鏁堝湴鍧�
+ var infos = YooAssetService.Instance.GetAssetInfosByTag("shader");
+ if (infos != null && infos.Length > 0)
+ {
+ // PackDirectory锛氭墍鏈� shader 鍦ㄥ悓涓� bundle锛屼紶浠绘剰鍦板潃鍗冲彲鍔犺浇鏁村寘
+ await YooAssetService.Instance.LoadAllAssetsAsync<Shader>(infos[0].Address);
+ }
+ else
+ {
+ Debug.LogWarning("[ShaderUtility] No asset infos found for tag 'shader'. " +
+ "Please set Asset Tags = 'shader' on the Shader collector in YooAsset and rebuild AB.");
+ }
}
+#if !UNITY_EDITOR
Shader.WarmupAllShaders();
+#endif
}
diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index 1ad12b0..34ba248 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -1473,11 +1473,15 @@
return content;
}
- //澶嶅埗鍒板壀璐存澘
- // TODO 鏆備笉鏀寔web鍚庣画琛ュ厖
+
+
public static void CopyToClipboard(string text)
{
+#if UNITY_WEBGL && !UNITY_EDITOR
+ LaunchUtility.UIHelper_CopyToClipboard(text);
+#else
GUIUtility.systemCopyBuffer = text;
+#endif
Debug.Log("鏂囧瓧宸插鍒跺埌鍓创鏉�: " + text);
}
--
Gitblit v1.8.0