From bc1cb6da854cb2e9144f10ed55330a537ecdca16 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 04 三月 2026 14:35:57 +0800
Subject: [PATCH] 466 h5版本 资源规则修改 打包修改(未完成 勿拉取)
---
Main/System/TianziBillborad/TianziBillboradBossHead.cs | 12
Main/Manager/ManagerBase.cs | 4
Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs | 2
Main/System/Main/AutoFightWin.cs | 6
Main/System/Guild/GuildBossWin.cs | 19
Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs | 9
Main/System/BeautyMM/BeautyMMCell.cs | 2
Main/System/Main/HeroFightingCardCell.cs | 16
Main/System/SkillUI/SkillBaseCell.cs | 30
Main/Core/GameEngine/Launch/RequestPermissionStart.cs | 4
Main/System/Battle/UIComp/BattleHeroInfoBar.cs | 3
Main/System/BillboardRank/GuildRankCell.cs | 2
Main/System/TianziBillborad/TianziBillboradWin.cs | 9
Main/System/HeroUI/HeroDeleteWin.cs | 25
Main/System/PlayerProfile/PlayerProfileWin.cs | 21
Main/System/FirstCharge/FirstChargeManager.cs | 4
Main/System/Battle/BattleResources/BattleResManager.cs | 9
Main/System/Debug/DebugUtility.cs | 4
Main/System/Battle/BattleObject/HeroBattleObject.cs | 7
Main/System/WarlordPavilion/WarlordPavilionSelectGiftGird.cs | 3
Main/System/Guild/GuildCreateWin.cs | 4
Main/System/Settlement/BattleVictoryWin.cs | 4
Main/System/ChallengeTab/TianziBillboradTabHandler.cs | 6
Main/Core/ResModule/ScriptableObjectLoader.cs | 31
Main/System/PhantasmPavilion/PhantasmPavilionFaceItem.cs | 5
Main/System/FuncPreset/FuncPresetChooseCell.cs | 4
Main/System/OfficialRank/OfficialRankManager.cs | 2
Main/Component/UI/Core/ButtonEx.cs | 9
Main/System/Battle/UIComp/BattleBuffCell.cs | 18
Main/System/HeroUI/GiftBaseCell.cs | 20
Main/System/Battle/UIComp/MinggeBuffCell.cs | 22
Main/System/Sound/SoundUtility.cs | 296 +-
Main/System/Battle/BaseBattleWin.cs | 9
Main/System/BeautyMM/BeautyMMShowWin.cs | 10
Main/System/Battle/BattleFieldFactory.cs | 5
Main/System/BillboardRank/PlayerTop3Cell.cs | 3
Main/Component/UI/Common/AdaptiveLayout.cs | 2
Main/System/Video/VideoManager.cs | 7
Main/System/Mingge/MinggeManager.cs | 4
Main/System/OtherPlayerDetail/OtherHeroFightingCardItem.cs | 27
Main/Core/Frame/UIFrameMgr.cs | 41
Main/System/Guild/GuildMemberCell.cs | 7
Main/System/Message/HrefAnalysis.cs | 4
Main/System/HeroUI/HeroTrainWin.cs | 28
Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs | 72
Main/System/Battle/BattleField/TianziBillboradBattleField.cs | 10
Main/System/Horse/HorseController.cs | 8
Main/System/Battle/UIComp/SkillTips.cs | 12
Main/System/Gubao/GubaoBaseWin.cs | 6
Main/System/HeroUI/HeroCollectionCardCell.cs | 8
Main/System/Battle/BattleField/StoryBossBattleField.cs | 13
Main/System/Battle/BattleHUDWin.cs | 13
Main/System/HeroFates/HeroFatesIHItem.cs | 5
Main/System/Settlement/BattleFailWin.cs | 4
Main/Component/UI/Effect/EllipseMask.cs | 36
Main/System/BeautyMM/BeautyMMManager.cs | 4
Main/System/Gubao/GubaoCell.cs | 4
Main/System/ItemTip/ItemTipUtility.cs | 22
Main/System/Main/RightFuncInHome.cs | 14
Main/System/TimeRush/TimeRushTipWin.cs | 2
Main/System/DailySpecials/DailySpecialsBaseWin.cs | 10
Main/Core/GameEngine/Launch/LaunchInHot.cs | 21
Main/Core/NetworkPackage/Socket/ClientSocket.cs | 12
Main/ResModule/AudioLoader.cs | 9
Main/System/HeroUI/HeroPosWin.cs | 46
Main/System/Battle/BattleObject/BattleObjMgr.cs | 19
Main/System/Store/StoreCell.cs | 2
Main/System/Battle/BattleResources/BattleCacheManager.cs | 9
Main/System/Tip/ServerTipDetails.cs | 14
Main/System/WarlordPavilion/WarlordPavilionManager.cs | 13
Main/System/Battle/BattleField/BoneBattleField.cs | 10
Main/ResModule/YooAssetService.cs | 44
Main/Core/GameEngine/Launch/YooAssetInitTask.cs | 15
Main/System/ClientVersion/VersionUtility.cs | 4
Main/Component/UI/Effect/SpringDecorate.cs | 13
Main/System/PlayerProfile/RenameWin.cs | 3
Main/System/HappyXB/HappyXBModel.cs | 2
Main/ResModule/ResManager.cs | 190 -
Main/System/Horse/HorseSkinWin.cs | 3
Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs | 8
Main/System/Main/PlayerMainDate.cs | 6
Main/System/Message/ColorAnalysis.cs | 3
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs | 14
Main/System/Settlement/BattleSettlementManager.cs | 23
Main/System/PhantasmPavilion/PhantasmPavilionManager.cs | 4
Main/Component/UI/Effect/BattleEffectPlayer.cs | 28
Main/System/Horse/HorseSkinGetWin.cs | 3
Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs | 46
Main/Component/UI/Common/WindowConfig.cs | 62
Main/System/Arena/ArenaBattleVictoryWin.cs | 8
Main/System/BoneField/BoneFieldWin.cs | 5
Main/System/ClientVersion/RequestSecretWin.cs | 4
Main/System/HeroUI/HeroCollectionWin.cs | 26
Main/System/TimeRush/TimeRushCell.cs | 3
Main/System/HeroUI/HeroAwakeWin.cs | 8
Main/System/Main/FunctionsBaseWin.cs | 2
Main/System/OSActivity/OSHeroCallBaseWin.cs | 6
Main/System/Guild/GuildHallWin.cs | 10
Main/System/Guild/GuildViewListCell.cs | 2
Main/System/Login/LoginManager.cs | 3
Main/System/Horse/HorseWin.cs | 11
Main/System/ChallengeTab/BoneFieldTabHandler.cs | 6
Main/System/Battle/Sound/BattleSoundManager.cs | 32
Main/System/HeroUI/HeroHeadBaseCell.cs | 24
Main/System/HeroUI/HeroSelectBehaviour.cs | 8
Main/System/Message/RichTextMgr.cs | 27
Main/System/HeroUI/HeroGiftEatWin.cs | 4
Main/System/OtherPlayerDetail/OtherNPCDetailWin.cs | 10
Main/System/Battle/BattleObject/BattleObjectFactory.cs | 78 -
Main/System/Guild/GuildHawkerWin.cs | 2
Main/System/HeroFates/HeroFatesUpgradeWin.cs | 6
Main/System/HeroUI/HeroCardCell.cs | 4
Main/System/MainLevel/MainBossEnterWin.cs | 9
Main/System/Message/ImgAnalysis.cs | 14
Main/System/Arena/ArenaChallengeCell.cs | 7
Main/System/InternalAffairs/GoldRushTentCell.cs | 2
Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs | 33
Main/System/BattlePass/BattlePassBaseCell.cs | 2
Main/System/KnapSack/Logic/ItemLogicUtility.cs | 6
Main/System/Gubao/GubaoCallWin.cs | 6
Main/System/Message/TRichAnalysis.cs | 3
Main/System/Battle/BattleField/WarlordPavilionBattleField.cs | 8
Main/System/BeautyMM/BeautyMMActiveWin.cs | 4
Main/System/HappyXB/HeroCallScoreRuleWin.cs | 24
Main/System/Message/SuitNameAnalysis.cs | 3
Main/System/HeroUI/HeroShowBaseCell.cs | 24
Main/System/ViewNPC/ViewNPCManager.cs | 3
Main/Utility/GMCommand.cs | 4
Main/Component/UI/Common/FunctionButtonConfig.cs | 6
Main/System/Debug/DebugController.cs | 4
Main/System/HappyXB/HeroCallWin.cs | 11
Main/System/WarlordPavilion/WarlordPavilionGiftGird.cs | 3
Main/System/BeautyMM/BeautyMMTravelCell.cs | 3
Main/System/HeroUI/HeroBestWin.cs | 16
Main/System/FuncPreset/FuncPresetWin.cs | 35
Main/System/ChallengeTab/WarlordPavilionTabHandler.cs | 6
Main/System/Settlement/BoneBattleFailWin.cs | 4
Main/System/Store/StoreBaseWin.cs | 4
Main/System/Tip/ScrollTipWin.cs | 4
Main/System/Battle/BattleResources/BattlePreloadManager.cs | 21
Main/System/AssetVersion/InGameDownLoad.cs | 2
Main/System/Gubao/GubaoManager.cs | 4
Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs | 22
Main/System/Arena/ArenaPlayerRankCell.cs | 7
Main/System/SkillUI/SkillWordCell.cs | 20
Main/System/Battle/BoneFieldBattleWin.cs | 7
Main/System/KnapSack/Logic/CommonGetItemWin.cs | 2
Main/System/Guild/GuildJoinWin.cs | 4
Main/Component/UI/Common/FuncOpen.cs | 3
Main/ResModule/UILoader.cs | 123 -
Main/System/Attribute/AttributeManager.cs | 8
Main/System/OSActivity/OSGalaChangeCell.cs | 2
Main/Component/UI/Common/CyclicScroll.cs | 19
Main/System/Message/RichText.cs | 36
Main/Utility/ComponentExtersion.cs | 59
Main/Manager/IManager.cs | 4
Main/System/PhantasmPavilion/PhantasmPavilionFaceWin.cs | 5
Main/System/Message/WordAnalysis.cs | 3
Main/System/KnapSack/New/CommonItemBaisc.cs | 13
Main/System/Arena/ArenaHeroHead.cs | 20
Main/Component/UI/Common/FunctionButtonGroup.cs | 13
Main/System/Mail/MailCell.cs | 2
Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs | 4
Main/Config/ConfigBase.cs | 20
Main/System/InternalAffairs/AffairBaseWin.cs | 6
Main/System/Sound/SoundPlayer.cs | 82
Main/System/HappyXB/HeroCallScoreWin.cs | 3
Main/System/HeroUI/HeroBaseWin.cs | 10
Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs | 3
Main/System/DayMission/DayMissionBaseWin.cs | 6
Main/System/OtherPlayerDetail/OtherEquipCardItem.cs | 2
Main/System/BeautyMM/BeautyMMTravelWin.cs | 3
Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs | 3
Main/System/Battle/StoryBossBattleWin.cs | 7
Main/System/Battle/Skill/SkillBase.cs | 5
Main/System/LineupRecommend/LineupRecommendItem.cs | 16
Main/System/NewBieGuidance/NewBieCenter.cs | 8
Main/System/Equip/EquipModel.cs | 4
Main/Core/GameEngine/Launch/InitSettingTask.cs | 16
Main/System/NewBieGuidance/NewBieMask.cs | 4
Main/System/Login/LoginWin.cs | 24
Main/System/TimingGift/TimingGiftManager.cs | 3
Main/Component/UI/Common/FunctionButton.cs | 13
Main/Component/UI/Core/OutlineEx.cs | 38
Main/System/Guild/GuildFuncCell.cs | 2
Main/Utility/UIUtility.cs | 6
Main/System/FirstCharge/FirstChargeWin.cs | 3
Main/System/Attribute/TotalAttributeWin.cs | 2
Main/System/UIBase/UIJumpManager.cs | 3
Main/Core/ResModule/GameObjectPoolManager.cs | 2
Main/ResModule/YooAssetPackageConfig.cs | 17
Main/System/BillboardRank/GuildTop3Cell.cs | 2
Main/System/OSActivity/OSMainLevelBaseWin.cs | 4
Main/System/BattleDetail/BattleDetailHeroInfoItem.cs | 20
Main/Manager/StageManager.cs | 20
Main/ResModule/BuiltInLoader.cs | 216 --
Main/System/Guild/GuildBossHurtRankCell.cs | 7
Main/System/Arena/HeroCountryComponent.cs | 3
Main/System/NetLink/NetLinkWin.cs | 4
Main/System/InternalAffairs/GoldRushAutoWin.cs | 4
Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs | 4
Main/System/OfficialRank/OfficialTitleCell.cs | 21
Main/System/HeroUI/HeroUIManager.Reborn.cs | 2
Main/System/Tip/FuncRules.cs | 3
Main/Utility/UIHelper.cs | 2
Main/System/HappyXB/HeroCallHopeAddCell.cs | 6
Main/System/PhantasmPavilion/PhantasmPavilionWin.cs | 6
Main/System/Guild/GuildDonateWin.cs | 4
Main/Component/UI/Common/UIPrefabLoader.cs | 17
Main/System/HeroFates/HeroFatesCell.cs | 3
Main/System/FuncPreset/FuncPresetChooseMoreCell.cs | 4
Main/System/Main/MainWin.cs | 25
Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs | 2
Main/System/Guild/GuildBaseWin.cs | 14
Main/System/HeroUI/HeroUIManager.cs | 8
Main/System/ChallengeTab/ArenaTabHandler.cs | 6
Main/Component/UI/Core/ToggleEx.cs | 3
Main/System/Battle/UIComp/TotalDamageDisplayer.cs | 8
Main/System/BeautyMM/BeautyMMBaseWin.cs | 6
Main/System/Arena/ArenaRecordCell.cs | 7
Main/System/FirstCharge/FirstChargeHeroInfoWin.cs | 13
Main/System/Invest/InvestModel.cs | 3
Main/System/Battle/BattleField/StoryBattleField.cs | 21
Main/System/FuncPreset/FuncPresetManager.cs | 8
Main/System/KnapSack/Logic/ComposeGirdCell.cs | 2
Main/Component/UI/Common/PopupWindowsProcessor.cs | 3
Main/System/Horse/HorseSkinCell.cs | 5
Main/System/UIBase/OneLevelWin.cs | 36
Main/System/WarlordPavilion/WarlordPavilionReplaceGiftGird.cs | 3
Main/System/WarlordPavilion/WarlordPavilionWin.cs | 17
Main/System/Arena/ArenaPlayerTop3Cell.cs | 3
Main/System/ItemTip/ItemTipWayWin.cs | 6
Main/System/Tip/ConfirmCancel.cs | 33
Main/System/Mingge/MinggeWin.cs | 40
Main/System/Guild/GuildOPWin.cs | 8
Main/Core/GameEngine/Launch/ConfigInitTask.cs | 13
Main/Manager/UIManager.cs | 127
Main/System/Battle/BattleWin.cs | 7
Main/System/TimingGift/TimingGiftCell.cs | 30
Main/System/Mingge/MinggeAutoSetWin.cs | 5
Main/System/Arena/ArenaWin.cs | 7
Main/System/Battle/WarlordPavilionBattleWin.cs | 7
Main/System/OSActivity/OSGalaBaseWin.cs | 6
Main/System/Settlement/WarlordPavilionFailWin.cs | 4
Main/System/WarlordPavilion/TowerBaseWin.cs | 3
Main/System/Guild/GuildPreviewWin.cs | 7
Main/System/CustomizedGift/CustomizedRechargeModel.cs | 4
Main/System/PhantasmPavilion/PhantasmPavilionModelItem.cs | 11
Main/System/HeroUI/HeroListWin.cs | 27
Main/System/NewBieGuidance/NewBieWin.cs | 6
Main/System/Battle/UIComp/BossHeadCell.cs | 9
Main/Config/ConfigManager.cs | 370 +--
Main/System/InternalAffairs/AffairFuncCell.cs | 10
Main/System/Horse/HorseManager.cs | 6
Main/System/HappyXB/HappyXBModel.Hero.cs | 3
Main/System/Arena/ArenaBattleFailWin.cs | 9
Main/System/HeroUI/HeroConnectionHeadCell.cs | 34
Main/System/Battle/TianziBillboradBattleWin.cs | 23
Main/System/FirstCharge/HeroShowLHWin.cs | 3
Main/System/Battle/BattleField/BattleField.cs | 64
Main/System/Main/HomeWin.cs | 65
Main/Main.cs | 10
Main/System/ItemTip/OwnMoneyCell.cs | 4
Main/Component/UI/Effect/EffectPlayer.cs | 26
Main/System/PhantasmPavilion/AvatarCell.cs | 44
Main/Component/UI/Common/EnableButtonConfig.cs | 9
Main/System/AssetVersion/AssetVersionUtility.cs | 9
Main/System/Tip/ScrollTip.cs | 11
Main/System/Hero/UIHeroController.cs | 13
Main/Component/UI/Common/UIPlaySound.cs | 3
Main/System/Battle/BattleManager.cs | 12
Main/System/Battle/BattleField/ArenaBattleField.cs | 12
Main/System/TimeRush/TimeRushManager.cs | 3
Main/System/Dungeon/DungeonData.cs | 1
Main/System/Chat/ChatPlayerOtherCell.cs | 7
Main/System/TianziBillborad/TianziBillboradRankWin.cs | 3
Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs | 64
Main/System/Equip/BlessLVWin.cs | 4
Main/System/Launch/LaunchWin.cs | 2
Main/System/WarlordPavilion/WarlordPavilionSelectBonusWin.cs | 3
Main/System/HeroUI/HeroSkillWin.cs | 4
Main/System/AssetVersion/InGameDownLoadProgress.cs | 4
Main/System/TianziBillborad/TianziBillboradManager.cs | 3
Main/System/Battle/ArenaBattleWin.cs | 9
284 files changed, 2,305 insertions(+), 2,326 deletions(-)
diff --git a/Main/Component/UI/Common/AdaptiveLayout.cs b/Main/Component/UI/Common/AdaptiveLayout.cs
index f83b7c0..9991acc 100644
--- a/Main/Component/UI/Common/AdaptiveLayout.cs
+++ b/Main/Component/UI/Common/AdaptiveLayout.cs
@@ -49,7 +49,7 @@
{
m_CanvasGroup.alpha = 0;
m_CanvasGroup.interactable = true;
- Co_DelayShow();
+ Co_DelayShow().Forget();
}
}
diff --git a/Main/Component/UI/Common/CyclicScroll.cs b/Main/Component/UI/Common/CyclicScroll.cs
index 699ebb5..ed0d29f 100644
--- a/Main/Component/UI/Common/CyclicScroll.cs
+++ b/Main/Component/UI/Common/CyclicScroll.cs
@@ -599,8 +599,23 @@
{
for (var i = 0; i < dif; i++)
{
- var instance = UIUtility.CreateWidget(m_ChildPrefabName, m_ChildDisplayName);
- instance.transform.SetParentEx(this.m_Content, Vector3.zero, Quaternion.identity, Vector3.one);
+ UIUtility.CreateWidget(m_ChildPrefabName, m_ChildDisplayName).ContinueWith(instance =>
+ {
+ if (this == null)
+ {
+ if (instance != null)
+ {
+ DestroyImmediate(instance);
+ }
+ return;
+ }
+ if (instance == null)
+ {
+ return;
+ }
+ instance.transform.SetParentEx(this.m_Content, Vector3.zero, Quaternion.identity, Vector3.one);
+ }).Forget();
+
}
}
}
diff --git a/Main/Component/UI/Common/EnableButtonConfig.cs b/Main/Component/UI/Common/EnableButtonConfig.cs
index 0605280..34eaf96 100644
--- a/Main/Component/UI/Common/EnableButtonConfig.cs
+++ b/Main/Component/UI/Common/EnableButtonConfig.cs
@@ -3,6 +3,7 @@
using UnityEngine;
using System;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
[CreateAssetMenu(menuName = "Config/EnableButtonConfig")]
public class EnableButtonConfig : ScriptableObject
{
@@ -12,9 +13,9 @@
public static Dictionary<EnableButtonType, EnableButtonConfig> dict = new Dictionary<EnableButtonType, EnableButtonConfig>();
- public static void SetEnable(Button _btn, Text _text, bool _enable, EnableButtonType _type)
+ public static async UniTask SetEnable(Button _btn, Text _text, bool _enable, EnableButtonType _type)
{
- var _cfg = GetEnableButtonCfg(_type);
+ var _cfg = await GetEnableButtonCfg(_type);
var _btnStyle = _enable ? _cfg.enableButton : _cfg.unEnableButton;
_btn.interactable = _enable;
var _colors = _btn.colors;
@@ -25,13 +26,13 @@
_text.color = _btnStyle.fontColor;
}
- public static EnableButtonConfig GetEnableButtonCfg(EnableButtonType _type)
+ public static async UniTask<EnableButtonConfig> GetEnableButtonCfg(EnableButtonType _type)
{
if (dict.ContainsKey(_type))
{
return dict[_type];
}
- var _cfg= BuiltInLoader.LoadScriptableObject<EnableButtonConfig>(StringUtility.Concat("EnableButton_", _type.ToString()));
+ var _cfg = await BuiltInLoader.LoadScriptableObjectAsync<EnableButtonConfig>(StringUtility.Concat("EnableButton_", _type.ToString()));
dict.Add(_type, _cfg);
return _cfg;
}
diff --git a/Main/Component/UI/Common/FuncOpen.cs b/Main/Component/UI/Common/FuncOpen.cs
index 772eebd..d48b4fb 100644
--- a/Main/Component/UI/Common/FuncOpen.cs
+++ b/Main/Component/UI/Common/FuncOpen.cs
@@ -3,6 +3,7 @@
using UnityEngine;
using LitJson;
using System.Linq;
+using Cysharp.Threading.Tasks;
public class FuncOpen
{
@@ -184,7 +185,7 @@
var config = FuncOpenLVConfig.Get(key);
if (config != null)
{
- SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio);
+ SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio).Forget();
var errorCode = 0;
if (!IsFuncOpen(key, out errorCode))
diff --git a/Main/Component/UI/Common/FunctionButton.cs b/Main/Component/UI/Common/FunctionButton.cs
index 965bae3..90230ef 100644
--- a/Main/Component/UI/Common/FunctionButton.cs
+++ b/Main/Component/UI/Common/FunctionButton.cs
@@ -9,6 +9,7 @@
using UnityEngine.EventSystems;
using System;
+using Cysharp.Threading.Tasks;
//鍏宠仈娓告垙鐜╂硶鍔熻兘鎸夐挳锛屽鍗囨槦鍔熻兘
@@ -38,7 +39,7 @@
if (m_State != value)
{
m_State = value;
- OnStateChange();
+ OnStateChange().Forget();
}
}
}
@@ -132,7 +133,7 @@
group.Register(this);
}
- OnStateChange();
+ OnStateChange().Forget();
}
protected override void OnDisable()
@@ -191,16 +192,16 @@
base.onClick.Invoke();
if (eventData != null)
{
- SoundPlayer.Instance.PlayUIAudio(clickAudio);
+ SoundPlayer.Instance.PlayUIAudio(clickAudio).Forget();
}
}
state = TitleBtnState.Click;
}
- private void OnStateChange()
+ private async Cysharp.Threading.Tasks.UniTaskVoid OnStateChange()
{
- var config = useDefaultConfig ? FunctionButtonConfig.GetDefault() : m_AlternativeConfig;
+ var config = useDefaultConfig ? await FunctionButtonConfig.GetDefault() : m_AlternativeConfig;
if (Application.isPlaying)
{
icon.SetSprite(config.GetIconKey(state));
@@ -248,7 +249,7 @@
protected override void OnValidate()
{
base.OnValidate();
- OnStateChange();
+ OnStateChange().Forget();
}
#endif
diff --git a/Main/Component/UI/Common/FunctionButtonConfig.cs b/Main/Component/UI/Common/FunctionButtonConfig.cs
index 9891ba6..90ce120 100644
--- a/Main/Component/UI/Common/FunctionButtonConfig.cs
+++ b/Main/Component/UI/Common/FunctionButtonConfig.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
[CreateAssetMenu(menuName = "Config/FunctionButtonConfig")]
public class FunctionButtonConfig : ScriptableObject
@@ -11,13 +12,12 @@
public UIConfig locked = new UIConfig("Title_Locked", Color.white, 23);
static FunctionButtonConfig m_Default;
- public static FunctionButtonConfig GetDefault()
+ public static async UniTask<FunctionButtonConfig> GetDefault()
{
if (m_Default == null)
{
- m_Default = BuiltInLoader.LoadScriptableObject<FunctionButtonConfig>("FunctionButton_Default");
+ m_Default = await BuiltInLoader.LoadScriptableObjectAsync<FunctionButtonConfig>("FunctionButton_Default");
}
-
return m_Default;
}
diff --git a/Main/Component/UI/Common/FunctionButtonGroup.cs b/Main/Component/UI/Common/FunctionButtonGroup.cs
index 3e8aee6..1cada22 100644
--- a/Main/Component/UI/Common/FunctionButtonGroup.cs
+++ b/Main/Component/UI/Common/FunctionButtonGroup.cs
@@ -8,6 +8,7 @@
using UnityEngine.UI;
using UnityEngine.Events;
using System;
+using Cysharp.Threading.Tasks;
//鍏宠仈娓告垙鐜╂硶鍔熻兘鎸夐挳锛屽鍗囨槦鍔熻兘
public class FunctionButtonGroup : MonoBehaviour
@@ -205,14 +206,22 @@
return a < b ? -1 : 1;
}
- public FunctionButton AddFunction(string pattern, int order, int functionId, string title, int redpointId)
+ public async UniTask<FunctionButton> AddFunction(string pattern, int order, int functionId, string title, int redpointId)
{
if (m_Container == null)
{
return null;
}
- var instance = UIUtility.CreateWidget(pattern, string.Concat("Function_", order));
+ var instance = await UIUtility.CreateWidget(pattern, string.Concat("Function_", order));
+ if (this == null || instance == null)
+ {
+ if (null != instance)
+ {
+ DestroyImmediate(instance);
+ }
+ return null;
+ }
instance.transform.SetParentEx(this.m_Container, Vector3.zero, Quaternion.identity, Vector3.one);
var functionButton = instance.GetComponent<FunctionButton>();
diff --git a/Main/Component/UI/Common/PopupWindowsProcessor.cs b/Main/Component/UI/Common/PopupWindowsProcessor.cs
index c9b541b..0891eda 100644
--- a/Main/Component/UI/Common/PopupWindowsProcessor.cs
+++ b/Main/Component/UI/Common/PopupWindowsProcessor.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
/// <summary>
@@ -153,7 +154,7 @@
currentWindow = targetPopup;
popupWindowQueue.RemoveAt(targetIndex);
- UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId);
+ UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId).Forget();
Debug.LogFormat("鎺ㄩ�佺獥鍙� " + currentWindow.window);
lastTime = Time.realtimeSinceStartup;
diff --git a/Main/Component/UI/Common/UIPlaySound.cs b/Main/Component/UI/Common/UIPlaySound.cs
index 078c787..6779247 100644
--- a/Main/Component/UI/Common/UIPlaySound.cs
+++ b/Main/Component/UI/Common/UIPlaySound.cs
@@ -5,6 +5,7 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class UIPlaySound : MonoBehaviour
@@ -14,7 +15,7 @@
public void Play()
{
- SoundPlayer.Instance.PlayUIAudio(m_Audio);
+ SoundPlayer.Instance.PlayUIAudio(m_Audio).Forget();
}
private void OnEnable()
diff --git a/Main/Component/UI/Common/UIPrefabLoader.cs b/Main/Component/UI/Common/UIPrefabLoader.cs
index a4b351e..92c0e63 100644
--- a/Main/Component/UI/Common/UIPrefabLoader.cs
+++ b/Main/Component/UI/Common/UIPrefabLoader.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Tuesday, March 19, 2019
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
[ExecuteAlways]
@@ -16,17 +17,17 @@
[ExecuteAlways]
private void Awake()
{
- Create();
+ Create().Forget();
}
public void Reload()
{
instance = null;
this.transform.ClearAllChilds();
- Create();
+ Create().Forget();
}
[ContextMenu("Create")]
- public virtual void Create()
+ public virtual async UniTask Create()
{
if (instance != null)
return;
@@ -40,7 +41,15 @@
instance = find.gameObject;
return;
}
- instance = UIUtility.CreateWidget(prefabName, prefabName);
+ instance = await UIUtility.CreateWidget(prefabName, prefabName);
+ if (this == null || instance == null)
+ {
+ if (null != instance)
+ {
+ DestroyImmediate(instance);
+ }
+ return;
+ }
instance.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
}
diff --git a/Main/Component/UI/Common/WindowConfig.cs b/Main/Component/UI/Common/WindowConfig.cs
index 6ec3bc1..d9e1fb5 100644
--- a/Main/Component/UI/Common/WindowConfig.cs
+++ b/Main/Component/UI/Common/WindowConfig.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
[CreateAssetMenu(menuName = "Config/WindowConfig")]
public class WindowConfig : ScriptableObject
@@ -12,11 +13,11 @@
[NonSerialized] public List<string> childWindows = new List<string>();
static WindowConfig config;
- static WindowConfig Get()
+ public static async UniTask<WindowConfig> Get()
{
if (config == null)
{
- config = BuiltInLoader.LoadScriptableObject<WindowConfig>("WindowConfig");
+ config = await BuiltInLoader.LoadScriptableObjectAsync<WindowConfig>("WindowConfig");
foreach (var table in config.windows)
{
var children = config.parentChildrenTable[table.parent] = new List<string>();
@@ -24,12 +25,11 @@
{
children.Add(info.window);
}
-
config.childWindows.AddRange(children);
}
}
-
return config;
+
}
public static void Release()
@@ -37,29 +37,28 @@
config = null;
}
- public static bool FindParentWindow(string child, out string parent)
+ public static async UniTask<(bool found, string parent)> FindParentWindow(string child)
{
- foreach (var table in Get().windows)
+ var cfg = await Get();
+ foreach (var table in cfg.windows)
{
foreach (var orderTable in table.orderTables)
{
if (orderTable.window == child)
{
- parent = table.parent;
- return true;
+ return (true, table.parent);
}
}
}
-
- parent = string.Empty;
- return false;
+ return (false, string.Empty);
}
- public static List<string> GetChildWindows(string parent)
+ public static async UniTask<List<string>> GetChildWindows(string parent)
{
- if (Get().parentChildrenTable.ContainsKey(parent))
+ var cfg = await Get();
+ if (cfg.parentChildrenTable.ContainsKey(parent))
{
- return Get().parentChildrenTable[parent];
+ return cfg.parentChildrenTable[parent];
}
else
{
@@ -67,73 +66,74 @@
}
}
- public static bool IsParentWindow(string name)
+ public static async UniTask<bool> IsParentWindow(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return true;
}
}
-
return false;
}
- public static bool IsChildWindow(string name)
+ public static async UniTask<bool> IsChildWindow(string name)
{
- return Get().childWindows.Contains(name);
+ var cfg = await Get();
+ return cfg.childWindows.Contains(name);
}
- public static WindowLevel GetWindowLevel(string name)
+ public static async UniTask<WindowLevel> GetWindowLevel(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return window.level;
}
}
-
return WindowLevel.None;
}
- public static string GetWindowPattern(string name)
+ public static async UniTask<string> GetWindowPattern(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return window.pattern;
}
}
-
return string.Empty;
}
- public static List<OrderTable> GetWindowFunctionInfos(string parent)
+ public static async UniTask<List<OrderTable>> GetWindowFunctionInfos(string parent)
{
- foreach (var table in Get().windows)
+ var cfg = await Get();
+ foreach (var table in cfg.windows)
{
if (table.parent == parent)
{
return new List<OrderTable>(table.orderTables);
}
}
-
return null;
}
- public static string GetTitleIconKey(string name)
+ public static async UniTask<string> GetTitleIconKey(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return window.titleIconKey;
}
}
-
return string.Empty;
}
diff --git a/Main/Component/UI/Core/ButtonEx.cs b/Main/Component/UI/Core/ButtonEx.cs
index a341eb6..f1ad8e6 100644
--- a/Main/Component/UI/Core/ButtonEx.cs
+++ b/Main/Component/UI/Core/ButtonEx.cs
@@ -2,6 +2,7 @@
using UnityEngine;
using UnityEngine.EventSystems;
using System;
+using Cysharp.Threading.Tasks;
public class ButtonEx : Button
@@ -70,11 +71,11 @@
{
if (customPositiveSound)
{
- SoundPlayer.Instance.PlayUIAudio(positiveSound);
+ SoundPlayer.Instance.PlayUIAudio(positiveSound).Forget();
}
else
{
- SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickPositiveAudio);
+ SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickPositiveAudio).Forget();
}
}
@@ -82,11 +83,11 @@
{
if (customNegativeSound)
{
- SoundPlayer.Instance.PlayUIAudio(negativeSound);
+ SoundPlayer.Instance.PlayUIAudio(negativeSound).Forget();
}
else
{
- SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio);
+ SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio).Forget();
}
}
diff --git a/Main/Component/UI/Core/OutlineEx.cs b/Main/Component/UI/Core/OutlineEx.cs
index e37e4b9..f7a3993 100644
--- a/Main/Component/UI/Core/OutlineEx.cs
+++ b/Main/Component/UI/Core/OutlineEx.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
/// <summary>
@@ -51,15 +52,18 @@
{
// #if UNITY_EDITOR
- var texMaterial = ResManager.Instance.LoadAsset<Material>("Materials", "OutlineMat");
- if (texMaterial != null)
+ ResManager.Instance.LoadAssetAsync<Material>("Materials", "OutlineMat").ContinueWith(texMaterial =>
{
- base.graphic.material = texMaterial;
- }
- else
- {
- Debug.LogError("娌℃湁鎵惧埌鏉愯川OutlineMat.mat");
- }
+ if (texMaterial != null)
+ {
+ base.graphic.material = texMaterial;
+ }
+ else
+ {
+ Debug.LogError("娌℃湁鎵惧埌鏉愯川OutlineMat.mat");
+ }
+ }).Forget();
+
// #else
// var shader = Shader.Find("TSF Shaders/UI/OutlineEx");
// base.graphic.material = new Material(shader);
@@ -108,15 +112,17 @@
{
if (base.graphic.material.shader.name != "TSF Shaders/UI/OutlineEx")
{
- var texMaterial = ResManager.Instance.LoadAsset<Material>("Materials", "OutlineMat");
- if (texMaterial != null)
+ ResManager.Instance.LoadAssetAsync<Material>("Materials", "OutlineMat").ContinueWith(texMaterial =>
{
- base.graphic.material = texMaterial;
- }
- else
- {
- Debug.LogError("娌℃湁鎵惧埌鏉愯川OutlineMat.mat");
- }
+ if (texMaterial != null)
+ {
+ base.graphic.material = texMaterial;
+ }
+ else
+ {
+ Debug.LogError("娌℃湁鎵惧埌鏉愯川OutlineMat.mat");
+ }
+ }).Forget();
//var shader = Shader.Find("TSF Shaders/UI/OutlineEx");
//base.graphic.material = new Material(shader);
}
diff --git a/Main/Component/UI/Core/ToggleEx.cs b/Main/Component/UI/Core/ToggleEx.cs
index a713576..bde557b 100644
--- a/Main/Component/UI/Core/ToggleEx.cs
+++ b/Main/Component/UI/Core/ToggleEx.cs
@@ -2,6 +2,7 @@
using System;
using UnityEngine;
using UnityEngine.EventSystems;
+using Cysharp.Threading.Tasks;
public class ToggleEx : Toggle
{
@@ -51,7 +52,7 @@
{
base.OnPointerClick(eventData);
- SoundPlayer.Instance.PlayUIAudio(clickAudio);
+ SoundPlayer.Instance.PlayUIAudio(clickAudio).Forget();
}
}
diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 2c7e222..5f585de 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -6,6 +6,7 @@
using Spine;
using UnityEngine.UI;
using System.Linq;
+using Cysharp.Threading.Tasks;
// 鐗规晥鎾斁鍣紝瀵硅薄姹犵鐞嗭細unity鐗规晥鍜宻pine鐗规晥閮芥槸鍋氬ソ鐨勯鍒朵綋
// unity鐗规晥棰勫埗浣撴槸鐗规晥甯堝湪鍒朵綔鐨勬椂鍊欑敓鎴愮殑锛寀nity鐗规晥蹇呴』鎸傝浇璁剧疆鎾斁鏃堕暱鑴氭湰 EffectTime
@@ -124,7 +125,7 @@
}
- protected void InitComponent(bool showLog = true)
+ protected async UniTask InitComponent(bool showLog = true)
{
Clear();
if (effectId <= 0)
@@ -156,7 +157,7 @@
// 鍒濆鍖杝pine缁勪欢
if (effectConfig != null && effectConfig.isSpine != 0)
{
- GameObject spineContainerPrefab = ResManager.Instance.LoadAsset<GameObject>("UIComp", "SpineAnimContainer");
+ GameObject spineContainerPrefab = await ResManager.Instance.LoadAssetAsync<GameObject>("UIComp", "SpineAnimContainer");
spineContainer = GameObject.Instantiate(spineContainerPrefab, transform, true);
spineContainer.transform.localPosition = Vector3.zero;
}
@@ -266,11 +267,11 @@
}
}
- public virtual void Play(bool showLog = true)
+ public virtual async void Play(bool showLog = true)
{
if (!isInit)
{
- InitComponent(showLog);
+ await InitComponent(showLog);
isInit = true;
}
else
@@ -349,19 +350,19 @@
{
if (effectConfig.isSpine != 0)
{
- PlaySpineEffect();
+ PlaySpineEffect().Forget();
}
else
{
- PlayUnityEffect();
+ PlayUnityEffect().Forget();
}
- battleField?.soundManager.PlayEffectSound(effectConfig.audio);
+ battleField?.soundManager.PlayEffectSound(effectConfig.audio).Forget();
OnAlphaChanged();
}
- protected void PlaySpineEffect()
+ protected async UniTask PlaySpineEffect()
{
if (spineComp == null)
{
@@ -371,7 +372,7 @@
// ===== 绠�鍖栵細鐩存帴浠庣紦瀛樿幏鍙栵紝缂撳瓨鍐呴儴浼氳嚜鍔ㄥ姞杞� =====
string directory = "UIEffect/" + effectConfig.packageName;
- SkeletonDataAsset skeletonDataAsset = BattleResManager.Instance.GetSpineResource(
+ SkeletonDataAsset skeletonDataAsset = await BattleResManager.Instance.GetSpineResource(
directory,
effectConfig.fxName,
battleField?.guid
@@ -380,6 +381,11 @@
if (skeletonDataAsset == null)
{
Debug.LogError($"BattleEffectPlayer: Failed to load effect spine {effectConfig.fxName}");
+ return;
+ }
+
+ if (this == null || spineComp == null)
+ {
return;
}
// ================================
@@ -433,11 +439,11 @@
return false;
}
- protected void PlayUnityEffect()
+ protected async UniTask PlayUnityEffect()
{
// 杩欓噷鏄函unity鐗规晥鐨勯�昏緫
- var effectPrefab = ResManager.Instance.LoadAsset<GameObject>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
+ var effectPrefab = await ResManager.Instance.LoadAssetAsync<GameObject>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
if (effectPrefab == null)
{
Debug.LogError($"鍔犺浇UI鐗规晥澶辫触: {effectConfig.packageName}");
diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index e12dbe3..cda8d4c 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -195,7 +195,7 @@
//闃茶寖effeid 涓�0
if (effectConfig != null && effectConfig.isSpine != 0)
{
- PlaySpineEffect(closePMA);
+ PlaySpineEffect(closePMA).Forget();
}
return;
}
@@ -222,11 +222,11 @@
// 鍔犺浇spine鐗规晥璧勬簮
if (effectConfig.isSpine != 0)
{
- PlaySpineEffect(closePMA);
+ PlaySpineEffect(closePMA).Forget();
}
else
{
- PlayerEffect();
+ PlayerEffect().Forget();
}
@@ -261,7 +261,7 @@
spineAnimationState.TimeScale = speed;
}
- protected void PlaySpineEffect(bool closePMA = false)
+ protected async UniTask PlaySpineEffect(bool closePMA = false)
{
// 浠庣壒鏁堥鍒朵綋姹犺幏鍙栫壒鏁�
@@ -273,7 +273,7 @@
if (spineComp.skeletonDataAsset == null || spineAnimationState == null)
{
//LoadAsset 宸茬粡鏈夌紦瀛楽keletonDataAsset
- spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
+ spineComp.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
//涓簍rue鏃朵細鏈夐儴鍒嗙壒鏁堜笉鏄剧ず 濡傛弧绾х粡楠屾潯锛涙敼鎴愪冀椹悗閮ㄥ垎鐗规晥姝e父锛岃繕鏈夐儴鍒嗕緷鐒惰鏀规璁剧疆
spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA;
spineComp.raycastTarget = false;
@@ -288,7 +288,17 @@
// {
// spineComp.material = null;
// }
- spineComp.material = ResManager.Instance.LoadAsset<Material>("Materials", "SkeletonGraphicDefault-Straight");
+ ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight").ContinueWith(material =>
+ {
+ if (material != null)
+ {
+ spineComp.material = material;
+ }
+ else
+ {
+ Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName);
+ }
+ }).Forget();
spineAnimationState = spineComp.AnimationState;
spineAnimationState.TimeScale = speedRate;
@@ -341,9 +351,9 @@
//unity鐗规晥
- protected virtual void PlayerEffect()
+ protected virtual async UniTask PlayerEffect()
{
- var effectPrefab = ResManager.Instance.LoadAsset<GameObject>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
+ var effectPrefab = await ResManager.Instance.LoadAssetAsync<GameObject>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
if (effectPrefab == null)
{
Debug.LogError($"鍔犺浇UI鐗规晥澶辫触: {effectConfig.packageName}");
diff --git a/Main/Component/UI/Effect/EllipseMask.cs b/Main/Component/UI/Effect/EllipseMask.cs
index 17c5e09..5c88335 100644
--- a/Main/Component/UI/Effect/EllipseMask.cs
+++ b/Main/Component/UI/Effect/EllipseMask.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 妞渾褰㈤伄缃╃粍浠�
@@ -156,15 +157,17 @@
{
if (m_MaskMaterial == null)
{
- Shader ellipseShader = ResManager.Instance.LoadAsset<Shader>("Shader", "GUI_EllipseMask");
- if (ellipseShader != null)
+ ResManager.Instance.LoadAssetAsync<Shader>("Shader", "GUI_EllipseMask").ContinueWith(ellipseShader =>
{
- m_MaskMaterial = new Material(ellipseShader);
- }
- else
- {
- Debug.LogError("EllipseMask shader not found!");
- }
+ if (ellipseShader != null)
+ {
+ m_MaskMaterial = new Material(ellipseShader);
+ }
+ else
+ {
+ Debug.LogError("EllipseMask shader not found!");
+ }
+ }).Forget();
}
}
@@ -240,14 +243,17 @@
if (graphic.material == null || !graphic.material.shader.name.Contains("EllipseMaskedContent"))
{
// Shader maskedShader = Shader.Find("GUI/EllipseMaskedContent");
- Shader maskedShader = ResManager.Instance.LoadAsset<Shader>("Shader", "GUI_EllipseMaskedContent");
- if (maskedShader != null)
+ ResManager.Instance.LoadAssetAsync<Shader>("Shader", "GUI_EllipseMaskedContent").ContinueWith(maskedShader =>
{
- Material maskedMaterial = new Material(maskedShader);
- maskedMaterial.SetInt("_Stencil", m_StencilID);
- maskedMaterial.SetInt("_StencilComp", 3); // Equal
- graphic.material = maskedMaterial;
- }
+ if (maskedShader != null)
+ {
+ Material maskedMaterial = new Material(maskedShader);
+ maskedMaterial.SetInt("_Stencil", m_StencilID);
+ maskedMaterial.SetInt("_StencilComp", 3); // Equal
+ graphic.material = maskedMaterial;
+ }
+ }).Forget();
+
}
else
{
diff --git a/Main/Component/UI/Effect/SpringDecorate.cs b/Main/Component/UI/Effect/SpringDecorate.cs
index 0fed5e7..57ee2bd 100644
--- a/Main/Component/UI/Effect/SpringDecorate.cs
+++ b/Main/Component/UI/Effect/SpringDecorate.cs
@@ -1,5 +1,6 @@
锘縰sing System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
[RequireComponent(typeof(RectTransform))]
@@ -9,13 +10,21 @@
GameObject springDecorate = null;
- private void Start()
+ private async void Start()
{
if (GeneralDefine.UISpringDecorate != 0)
{
if (springDecorate == null)
{
- springDecorate = UIUtility.CreateWidget("Container_SpringDecorate", "SpringDecorate");
+ springDecorate = await UIUtility.CreateWidget("Container_SpringDecorate", "SpringDecorate");
+ if (this == null || springDecorate == null)
+ {
+ if (null != springDecorate)
+ {
+ DestroyImmediate(springDecorate);
+ }
+ return;
+ }
}
var rectTransform = springDecorate.transform as RectTransform;
rectTransform.MatchWhith(this.transform as RectTransform);
diff --git a/Main/Config/ConfigBase.cs b/Main/Config/ConfigBase.cs
index e51fef1..f78abc7 100644
--- a/Main/Config/ConfigBase.cs
+++ b/Main/Config/ConfigBase.cs
@@ -12,15 +12,8 @@
/// </summary>
public static bool visit = false;
- static ConfigBase()
- {
- if (isInit)
- {
- return;
- }
-
- LazyInit();
- }
+ // 绉婚櫎闈欐�佹瀯閫犲嚱鏁颁腑鐨勫悓姝ユ噿鍔犺浇锛岀姝㈠悓姝ラ樆濉�
+ // static鏋勯�犲嚱鏁颁笉鍐嶈Е鍙慙azyInit
private static Dictionary<U, T> m_dic = new Dictionary<U, T>();
@@ -70,15 +63,16 @@
return m_dic.ContainsKey(key);
}
- public static void LazyInit()
+ // 寮傛鎳掑姞杞藉叆鍙�
+ public static async UniTask LazyInitAsync()
{
if (!isInit)
{
- // 瀹為檯涓婃槸鍚屾鐨�
- ConfigManager.Instance.LoadConfigByType(typeof(T));
+ await ConfigManager.Instance.LoadConfigByTypeAsync(typeof(T));
}
}
+ // 鍚屾鍒濆鍖�
public static void Init(string[] lines)
{
if (isInit)
@@ -114,11 +108,11 @@
#endif
}
-
// foreach (var cfg in m_dic.Values)
// {
// cfg.AllConfigLoadFinish();
// }
+ // Debug.LogError("config " + typeof(T).Name + " load finish! total count:" + m_dic.Count);
isInit = true;
}
diff --git a/Main/Config/ConfigManager.cs b/Main/Config/ConfigManager.cs
index 37cc055..c70f54f 100644
--- a/Main/Config/ConfigManager.cs
+++ b/Main/Config/ConfigManager.cs
@@ -17,12 +17,16 @@
private set;
}
+ private List<Type> preInitConfig = new List<Type>()
+ {
+ typeof (FuncConfigConfig),
+ };
+
private float loadingProgress = 0f;
- public override void Init()
+ public override async UniTask Init()
{
- base.Init();
- InitConfigs().Forget();
+ await InitConfigs();
}
public virtual async UniTask InitConfigs()
@@ -31,33 +35,64 @@
await LoadConfigs();
}
+ public async UniTask PreInit()
+ {
+ List<UniTask> uniTasks = new List<UniTask>();
+ foreach (var type in preInitConfig)
+ {
+ uniTasks.Add(LoadConfigByTypeAsync(type));
+ }
+ await UniTask.WhenAll(uniTasks);
+ }
+
protected async UniTask LoadConfigs()
{
loadingProgress = 0f;
isLoadFinished = false;
- // 鍔犺浇閰嶇疆鏂囦欢
+ // 鑷姩鐢熸垚锛氭敹闆嗘墍鏈夐厤缃被鍨嬶紙姝ゆ灏嗚 ConfigGenerater.Generate 鑷姩瑕嗙洊锛�
+ // 鑷姩鐢熸垚锛氭敹闆嗘墍鏈夐厤缃被鍨�
+ // 鑷姩鐢熸垚锛氭敹闆嗘墍鏈夐厤缃被鍨�
+ // 鑷姩鐢熸垚锛氭敹闆嗘墍鏈夐厤缃被鍨�
HashSet<Type> configTypes = new HashSet<Type>() {
typeof(ActLunhuidianTypeConfig),
typeof(ADAwardConfig),
+ typeof(AppointItemConfig),
+ typeof(AudioConfig),
typeof(BattleMapConfig),
typeof(BeautyConfig),
typeof(BeautyQualityLVConfig),
typeof(BeautySkinConfig),
+ typeof(ChatBubbleBoxConfig),
typeof(ChestsAwardConfig),
+ typeof(ChestsConfig),
typeof(CTGConfig),
+ typeof(CTGSelectItemConfig),
+ typeof(DailyLivenessRewardConfig),
typeof(DailyTaskConfig),
typeof(DamageNumConfig),
+ typeof(DirtyNameConfig),
typeof(DirtyWordConfig),
typeof(DungeonConfig),
typeof(DungeonOpenTimeConfig),
+ typeof(EffectConfig),
+ typeof(EmojiPackConfig),
typeof(FaceConfig),
+ typeof(FamilyConfig),
typeof(FamilyDonateConfig),
+ typeof(FamilyEmblemConfig),
typeof(FBDJGEffectConfig),
typeof(FBDJGLevelConfig),
typeof(FBDJGQuickConfig),
typeof(FightPowerRatioConfig),
typeof(FirstChargeConfig),
+ typeof(FirstGoldConfig),
+ typeof(FrameAnimationConfig),
+ typeof(FuncConfigConfig),
+ typeof(FuncOpenLVConfig),
+ typeof(FunctionTeamSetConfig),
+ typeof(GetItemWaysConfig),
+ typeof(GmCmdConfig),
typeof(GoldRushCampConfig),
typeof(GoldRushItemConfig),
typeof(GoldRushWorkerConfig),
@@ -67,16 +102,30 @@
typeof(GubaoResonanceAttrConfig),
typeof(GubaoResonanceConfig),
typeof(GubaoStarConfig),
+ typeof(GuideConfig),
+ typeof(HeroAwakeConfig),
+ typeof(HeroBreakConfig),
+ typeof(HeroConfig),
typeof(HeroFatesConfig),
typeof(HeroFatesQualityLVConfig),
+ typeof(HeroFetterConfig),
typeof(HeroLineupHaloConfig),
+ typeof(HeroQualityAwakeConfig),
+ typeof(HeroQualityBreakConfig),
+ typeof(HeroQualityConfig),
typeof(HeroQualityLVConfig),
+ typeof(HeroSkinConfig),
+ typeof(HeroTalentConfig),
typeof(HorseClassConfig),
typeof(HorseSkinConfig),
+ typeof(IconConfig),
typeof(ItemCompoundConfig),
typeof(ItemConfig),
+ typeof(KickOutReasonConfig),
+ typeof(LanguageConfig),
typeof(LineupRecommendConfig),
typeof(LLMJConfig),
+ typeof(MailConfig),
typeof(MainChapterConfig),
typeof(MainLevelConfig),
typeof(MGGanwuLVConfig),
@@ -91,14 +140,23 @@
typeof(OrderInfoConfig),
typeof(PlayerAttrConfig),
typeof(PlayerFaceConfig),
+ typeof(PlayerFacePicConfig),
+ typeof(PlayerLVConfig),
+ typeof(PlayerPropertyConfig),
typeof(PresetUnlockConfig),
typeof(PriorBundleConfig),
typeof(RandomNameConfig),
+ typeof(RealmConfig),
+ typeof(RealmLVUPTaskConfig),
+ typeof(RichTextMsgReplaceConfig),
+ typeof(RuleConfig),
typeof(SignInConfig),
+ typeof(SkillConfig),
typeof(SkillSkinConfig),
typeof(StoreConfig),
typeof(SuccessConfig),
typeof(SysInfoConfig),
+ typeof(TaskConfig),
typeof(TianziConfig),
typeof(TimingGiftConfig),
typeof(TimingGiftTypeConfig),
@@ -106,6 +164,8 @@
typeof(TitleStarUpConfig),
typeof(TravelEventConfig),
typeof(TravelSceneryConfig),
+ typeof(TreasureCntAwardConfig),
+ typeof(TreasureItemLibConfig),
typeof(TreasureSetConfig),
typeof(TreeLVConfig),
typeof(WindowSearchConfig),
@@ -113,106 +173,81 @@
typeof(ZhanlingConfig)
};
-#if UNITY_EDITOR
- HashSet<Type> configHashSet = new HashSet<Type>();
- if (System.IO.File.Exists(Application.dataPath + "/fastConfig.txt") && Launch.Instance.isOpenConfigTesting)
- {
- string[] strConfgsArr = System.IO.File.ReadAllLines(Application.dataPath + "/fastConfig.txt");
- foreach (string str in strConfgsArr)
- {
- Type tpy = Type.GetType(str);
- configHashSet.Add(tpy);
- }
- }
- // 缂栬緫鍣ㄤ笅鍔犲叆 璇勪及鍔犺浇鏃跺父
- foreach (var config in configHashSet)
- {
- if (!configTypes.Add(config))
- {
- Debug.LogWarning($"閰嶇疆 {config.Name} 宸茬粡瀛樺湪浜� configTypes 涓紝璺宠繃娣诲姞銆�");
- }
- }
- List<string> fastName = new List<string>();
-#endif
+
int iterator = 0;
int totalConfigs = configTypes.Count;
+
+ List<UniTask> loadTasks = new List<UniTask>();
// 閫愪釜鍔犺浇閰嶇疆骞舵洿鏂拌繘搴�
foreach (var configType in configTypes)
{
+#if UNITY_EDITOR
var sw = System.Diagnostics.Stopwatch.StartNew();
- LoadConfigByType(configType);
- sw.Stop();
-#if UNITY_EDITOR
- if (sw.ElapsedMilliseconds >= 100)
- {
- Debug.LogError($"鍔犺浇閰嶇疆 {configType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms");
- }
- else if (sw.ElapsedMilliseconds <= 5)
- {
- fastName.Add(configType.Name);
- }
- Debug.Log($"鍔犺浇閰嶇疆: {configType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms");
#endif
- loadingProgress = (float)(iterator++ + 1) / totalConfigs;
- }
-#if UNITY_EDITOR
- if (Launch.Instance.isOpenConfigTesting)
- {
- System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
-
- //鍔犺浇瀹屽悗鍗歌浇
- foreach (var configType in configTypes)
+ UniTask uniTask = LoadConfigByTypeAsync(configType).ContinueWith(() =>
{
- var methodInfo = configType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
- if (methodInfo != null)
+#if UNITY_EDITOR
+ if (sw.ElapsedMilliseconds >= 100)
{
- methodInfo.Invoke(null, null);
+ Debug.LogWarning($"鍔犺浇閰嶇疆 {configType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms");
}
- }
- }
+ else
+ {
+ Debug.Log($"鍔犺浇閰嶇疆: {configType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms");
+ }
+ sw.Stop();
#endif
+
+ loadingProgress = (float)(iterator++ + 1) / totalConfigs;
+ });
+
+ loadTasks.Add(uniTask);
+
+ }
+
+ await UniTask.WhenAll(loadTasks);
// 鍔犺浇瀹屾垚鍚庤缃甶sLoadFinished涓簍rue
loadingProgress = 1f;
isLoadFinished = true;
}
- public void LoadConfigByType(Type configType)
- {
- string configName = configType.Name;
- if (configName.EndsWith("Config"))
- {
- configName = configName.Substring(0, configName.Length - 6);
- }
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use LoadConfigByTypeAsync
- string[] texts = ResManager.Instance.LoadConfig(configName);
- #pragma warning restore CS0618
- if (texts != null)
- {
- string[] lines = 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[] { lines });
- // 璁剧疆鍒濆鍖栨爣蹇�
- var isInitField = configType.GetField("isInit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
- if (isInitField != null)
- {
- isInitField.SetValue(null, true);
- }
- Debug.Log($"鍔犺浇閰嶇疆: {configType.Name} 鎴愬姛");
- }
- else
- {
- Debug.LogError($"閰嶇疆绫� {configType.Name} 娌℃湁闈欐�両nit鏂规硶");
- }
- }
- else
- {
- Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {configName}");
- }
- }
+ // public void LoadConfigByType(Type configType)
+ // {
+ // string configName = configType.Name;
+ // if (configName.EndsWith("Config"))
+ // {
+ // configName = configName.Substring(0, configName.Length - 6);
+ // }
+ // #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use LoadConfigByTypeAsync
+ // string[] texts = ResManager.Instance.LoadConfig(configName);
+ // #pragma warning restore CS0618
+ // if (texts != null)
+ // {
+ // string[] lines = 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[] { lines });
+ // // 璁剧疆鍒濆鍖栨爣蹇�
+ // var isInitField = configType.GetField("isInit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
+ // if (isInitField != null)
+ // {
+ // isInitField.SetValue(null, true);
+ // }
+ // Debug.Log($"鍔犺浇閰嶇疆: {configType.Name} 鎴愬姛");
+ // }
+ // else
+ // {
+ // Debug.LogError($"閰嶇疆绫� {configType.Name} 娌℃湁闈欐�両nit鏂规硶");
+ // }
+ // }
+ // else
+ // {
+ // Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {configName}");
+ // }
+ // }
/// <summary>
/// US2: Async variant of LoadConfigByType. Uses UniTask-based config loading.
@@ -227,7 +262,7 @@
string[] texts = await ResManager.Instance.LoadConfigAsync(configName);
if (texts != null)
{
- var methodInfo = configType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
+ 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 });
@@ -248,38 +283,38 @@
}
}
- private async UniTask LoadConfig<T>() where T : class
- {
- string configName = typeof(T).Name;
+ // private async UniTask LoadConfig<T>() where T : class
+ // {
+ // string configName = typeof(T).Name;
- #pragma warning disable CS0618
- string[] texts = ResManager.Instance.LoadConfig(configName);
- #pragma warning restore CS0618
- if (texts != null)
- {
- string[] lines = texts;
- var methodInfo = typeof(T).GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
- if (methodInfo != null)
- {
- methodInfo.Invoke(null, lines);
- // 璁剧疆鍒濆鍖栨爣蹇�
- var isInitField = typeof(T).GetField("isInit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
- if (isInitField != null)
- {
- isInitField.SetValue(null, true);
- }
- Debug.Log($"鍔犺浇閰嶇疆: {typeof(T).Name} 鎴愬姛");
- }
- else
- {
- Debug.LogError($"閰嶇疆绫� {typeof(T).Name} 娌℃湁闈欐�両nit鏂规硶");
- }
- }
- else
- {
- Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {configName}");
- }
- }
+ // #pragma warning disable CS0618
+ // string[] texts = ResManager.Instance.LoadConfig(configName);
+ // #pragma warning restore CS0618
+ // if (texts != null)
+ // {
+ // string[] lines = texts;
+ // var methodInfo = typeof(T).GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
+ // if (methodInfo != null)
+ // {
+ // methodInfo.Invoke(null, lines);
+ // // 璁剧疆鍒濆鍖栨爣蹇�
+ // var isInitField = typeof(T).GetField("isInit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
+ // if (isInitField != null)
+ // {
+ // isInitField.SetValue(null, true);
+ // }
+ // Debug.Log($"鍔犺浇閰嶇疆: {typeof(T).Name} 鎴愬姛");
+ // }
+ // else
+ // {
+ // Debug.LogError($"閰嶇疆绫� {typeof(T).Name} 娌℃湁闈欐�両nit鏂规硶");
+ // }
+ // }
+ // else
+ // {
+ // Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {configName}");
+ // }
+ // }
public float GetLoadingProgress()
{
@@ -446,103 +481,4 @@
ClearConfigDictionary<ZhanlingConfig>();
}
-#if UNITY_EDITOR
- [MenuItem("Tools/Config/鑷")]
- public static void CheckAndGenerateFastConfig()
- {
- // 鑾峰彇 Editor Assembly
- var editorAsm = System.AppDomain.CurrentDomain.GetAssemblies()
- .FirstOrDefault(a => a.FullName.Contains("Editor"));
-
- if (editorAsm == null)
- {
- Debug.LogError("[鑷] 鏈壘鍒� Editor Assembly锛屾棤娉曡嚜妫�銆�");
- return;
- }
-
- // 鍙嶅皠鑾峰彇 ConfigGenerater 绫诲瀷
- var configGeneraterType = editorAsm.GetType("ConfigGenerater");
- if (configGeneraterType == null)
- {
- Debug.LogError("[鑷] 鏈壘鍒� ConfigGenerater 绫诲瀷銆�");
- return;
- }
-
- // 璋冪敤 GetAllConfigClasses 闈欐�佹柟娉�
- var getAllConfigClassesMethod = configGeneraterType.GetMethod("GetAllConfigClasses", BindingFlags.Public | BindingFlags.Static);
- var allConfigClasses = getAllConfigClassesMethod?.Invoke(null, null) as List<string>;
- if (allConfigClasses == null)
- {
- Debug.LogError("[鑷] 鑾峰彇鍏ㄩ儴閰嶇疆绫诲け璐ャ��");
- return;
- }
-
- // 鑾峰彇 ExcludeClassList 瀛楁
- var excludeField = configGeneraterType.GetField("ExcludeClassList", BindingFlags.Public | BindingFlags.Static);
- var excludeClassList = excludeField?.GetValue(null) as List<string> ?? new List<string>();
-
- // 鎺掗櫎涓嶉渶瑕佺殑绫�
- var checkClasses = allConfigClasses.Where(c => !excludeClassList.Contains(c)).ToList();
-
- List<string> fastName = new List<string>();
-
- foreach (var className in checkClasses)
- {
- // 杩欓噷涔熻鐢� Editor Assembly 鑾峰彇绫诲瀷
- var configType = editorAsm.GetType(className) ?? Type.GetType(className);
- if (configType == null)
- {
- Debug.LogWarning($"[鑷] 鏈壘鍒扮被鍨�: {className}");
- continue;
- }
-
- var sw = System.Diagnostics.Stopwatch.StartNew();
-
- // 鍙嶅皠璋冪敤闈欐�両nit鏂规硶
- string configName = configType.Name;
- if (configName.EndsWith("Config"))
- configName = configName.Substring(0, configName.Length - 6);
-
- #pragma warning disable CS0618
- string[] texts = ResManager.Instance.LoadConfig(configName);
- #pragma warning restore CS0618
- if (texts != null)
- {
- string[] lines = 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[] { lines });
- }
- }
-
- sw.Stop();
-
- if (sw.ElapsedMilliseconds >= 100)
- {
- Debug.LogError($"[鑷] 鍔犺浇閰嶇疆 {configType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms");
- }
- else if (sw.ElapsedMilliseconds <= 5)
- {
- fastName.Add(configType.Name);
- }
- Debug.Log($"[鑷] 鍔犺浇閰嶇疆: {configType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms");
- }
-
- // 閲婃斁鎵�鏈夊凡鍔犺浇鐨勯厤缃�
- foreach (var className in checkClasses)
- {
- var configType = editorAsm.GetType(className) ?? Type.GetType(className);
- if (configType == null) continue;
- var methodInfo = configType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
- if (methodInfo != null)
- {
- methodInfo.Invoke(null, null);
- }
- }
-
- System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
- Debug.Log($"[鑷] fastConfig.txt 鐢熸垚瀹屾瘯锛屽揩閫熻〃鏈夛細{string.Join(", ", fastName)}");
- }
-#endif
}
diff --git a/Main/Core/Frame/UIFrameMgr.cs b/Main/Core/Frame/UIFrameMgr.cs
index df23859..841ec8e 100644
--- a/Main/Core/Frame/UIFrameMgr.cs
+++ b/Main/Core/Frame/UIFrameMgr.cs
@@ -1,5 +1,6 @@
锘匡豢using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
/// <summary>
@@ -51,25 +52,43 @@
{
if (allFrameDic.ContainsKey(cfg.name))
return;
+
+ List<UniTask> uniTasks = new List<UniTask>();
- List<Sprite> spriteList = new List<Sprite>();
-
+ List<Sprite> spriteList = new List<Sprite>(new Sprite[cfg.frameCnt]);
for (int i = 1; i <= cfg.frameCnt; i++)
{
+ int index = i;
string spritePath = "Sprite/" + cfg.folder;
string spriteName = StringUtility.Concat(cfg.name, "_", i.ToString());
-
- Sprite sprite = ResManager.Instance.LoadAsset<Sprite>(spritePath, spriteName);
- if (sprite != null)
+
+ var task = ResManager.Instance.LoadAssetAsync<Sprite>(spritePath, spriteName).ContinueWith(sprite =>
{
- spriteList.Add(sprite);
- }
+ if (sprite != null)
+ {
+ spriteList[index - 1] = sprite;
+ }
+ else
+ {
+ Debug.LogError($"鍔犺浇甯у姩鐢昏祫婧愬け璐�: {spritePath}/{spriteName}");
+ }
+ });
+
+ uniTasks.Add(task);
}
-
- if (spriteList.Count > 0)
+
+ UniTask.WhenAll(uniTasks).ContinueWith(() =>
{
- allFrameDic.Add(cfg.name, spriteList);
- }
+ if (this == null) // 妫�鏌ョ鐞嗗櫒鏄惁宸茶閿�姣�
+ return;
+
+ if (spriteList.Count > 0)
+ {
+ allFrameDic.Add(cfg.name, spriteList);
+ }
+ }).Forget();
+
+
}
/// <summary>
diff --git a/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs b/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
index 0a1e816..2dc7886 100644
--- a/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
+++ b/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
@@ -10,17 +10,25 @@
{
bool firstLaunch = false;
+ private bool doneInBegin = true;
+
public override void Begin()
{
+ PriorLanguageConfig.LazyInitAsync().Forget();
+ InitialFunctionConfig.LazyInitAsync().Forget();
+
duration = Mathf.Max(0.2f, expectTime); //闈炲畨鍗撳钩鍙扮殑鏃堕棿锛屽畨鍗撶敱sdk鎷疯礉瀹屾垚鍥炶皟
if (Application.isEditor)
{
EditorCopyAsset();
}
+ else if (Application.platform == RuntimePlatform.WebGLPlayer)
+ {
+ // WebGL骞冲彴鏃犻渶鎷疯礉鏂囦欢锛岀洿鎺ヨ烦杩�
+ }
else
{
- //瀹夊崜姣忔鐢眘dk鍥炶皟鎷疯礉鎴愬姛锛屽叾浠栧钩鍙扮敱unity鑷繁瀛樺偍鏍囪
switch (Application.platform)
{
case RuntimePlatform.Android:
@@ -37,10 +45,10 @@
if (!firstLaunch)
{
- //LoadInitalConfig().Forget();
- done = true;
+ doneInBegin = true;
}
}
+
//搴旇鏄笅杞芥渶鏂扮殑琛ㄦ牸鍚庡啀娆″姞杞� 闈炴嫹璐�
//protected async UniTask LoadInitalConfig()
@@ -60,10 +68,9 @@
LaunchInHot.Instance.InitSystemMgr();
// 杩欓噷杩樻病寮�濮嬪姞杞介厤缃� 浣嗘槸鎻愬墠鍔犺浇浜嗕緵LaunchWin浣跨敤
- PriorLanguageConfig.LazyInit();
- InitialFunctionConfig.LazyInit();
- UIManager.Instance.OpenWindow<LaunchWin>();
+
+ UIManager.Instance.OpenWindowAsync<LaunchWin>().Forget();
}
// ConfigInitiator.SyncInit();
@@ -78,6 +85,18 @@
{
return;
}
+
+ if (!PriorLanguageConfig.isInit || !InitialFunctionConfig.isInit)
+ {
+ return;
+ }
+
+ if (doneInBegin)
+ {
+ done = true;
+ return;
+ }
+
if (!Application.isEditor)
{
//瀹夊崜姣忔鐢眘dk鍥炶皟鎷疯礉鎴愬姛锛屽叾浠栧钩鍙扮敱unity鑷繁瀛樺偍鏍囪
@@ -122,38 +141,14 @@
{
if (!SDKUtils.Instance.AssetCopyFinished)
{
- //姣忔鐢眘dk鍥炶皟鎷疯礉鎴愬姛
firstLaunch = true;
UnityEngine.Debug.Log("寮�濮嬫嫹璐漛uiltin璧勬簮");
SDKUtils.Instance.CopyAsset(1);
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin_assetbundle");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin_assetbundle.manifest");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/musics");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/musics.manifest");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/prefabs");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/prefabs.manifest");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/sprites");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/sprites.manifest");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/animationclips");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/animationclips.manifest");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/materials");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/materials.manifest");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/scriptableobjects");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/scriptableobjects.manifest");
-
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/font");
- //ynmbxxjUtil.Instance.CopyOneAsset("builtin/font.manifest");
-
- //foreach (var config in ConfigInitiator.builtinConfig)
- //{
- // ynmbxxjUtil.Instance.CopyOneAsset("config/" + config);
- //}
-
- //AssetDeCompressTask.Decompress(ResourcesPath.Instance.ExternalStorePath);
- //LocalSave.SetString("BuiltInAssetCopyCompleted_Android", VersionConfig.Get().version);
}
else
+ {
UnityEngine.Debug.Log("builtin璧勬簮宸茬粡鎷疯礉杩囦簡");
+ }
}
private void IosCopyAsset()
@@ -217,17 +212,6 @@
}
var fileNames = new List<string>();
- //var files = new List<FileInfo>();
- //FileExtersion.GetAllDirectoryFileInfos(StringUtility.Concat(ResourcesPath.Instance.StreamingAssetPath, "builtin"), files);
- //foreach (var file in files)
- //{
- // var name = Path.GetFileName(file.FullName);
- // fileNames.Add(StringUtility.Concat("builtin", Path.DirectorySeparatorChar, name));
- //}
-
- //fileNames.Add("builtin_assetbundle");
- //fileNames.Add("builtin_assetbundle.manifest");
-
var configFiles = new List<FileInfo>();
FileExtersion.GetAllDirectoryFileInfos(StringUtility.Concat(ResourcesPath.Instance.StreamingAssetPath, "config"), configFiles);
foreach (var file in configFiles)
diff --git a/Main/Core/GameEngine/Launch/ConfigInitTask.cs b/Main/Core/GameEngine/Launch/ConfigInitTask.cs
index 3b3d4ce..186c45e 100644
--- a/Main/Core/GameEngine/Launch/ConfigInitTask.cs
+++ b/Main/Core/GameEngine/Launch/ConfigInitTask.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class ConfigInitTask : LaunchTask
{
@@ -19,6 +20,11 @@
duration = Mathf.Max(0.5f, expectTime);
threshold = Application.platform == RuntimePlatform.WindowsEditor ? 1f : 0.9f;
+ ConfigManager.Instance.PreInit().ContinueWith(() =>
+ {
+ done = true;
+ }).Forget();
+
// LaunchPostProcess.Instance.Begin();
// InitialFunctionConfig.Init(true); //鏈夋洿鏂板啀鍒濆鍖栦竴娆�
}
@@ -34,6 +40,11 @@
#if UNITY_EDITOR
var config = FuncConfigConfig.Get("HeroAttrFormula");
+ if (config == null)
+ {
+ Debug.LogWarning("ConfigInitTask.End: FuncConfigConfig 'HeroAttrFormula' 鏈姞杞斤紝璺宠繃鍏紡浠g爜鐢熸垚");
+ return;
+ }
var propertyFormula = config.Numerical1;
var fightPropertyFormula = config.Numerical2;
var fightPowerFormula = config.Numerical3;
@@ -225,7 +236,7 @@
// }
// else
{
- done = true;
+ // done = true;
}
ExceptionReport();
diff --git a/Main/Core/GameEngine/Launch/InitSettingTask.cs b/Main/Core/GameEngine/Launch/InitSettingTask.cs
index 87f63a6..dd0e105 100644
--- a/Main/Core/GameEngine/Launch/InitSettingTask.cs
+++ b/Main/Core/GameEngine/Launch/InitSettingTask.cs
@@ -1,5 +1,6 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class InitSettingTask : LaunchTask
@@ -14,17 +15,22 @@
{
ShaderUtility.InitGlobalParams();
// SoundPlayer.CreateSoundPlayer();
- SoundPlayer.Instance.Init();
- SoundPlayer.Instance.PlayLoginMusic();
+ SoundPlayer.CreateSoundPlayer().ContinueWith(() => {
+ SoundPlayer.Instance.Init();
+ SoundPlayer.Instance.PlayLoginMusic();
+
+ SystemSetting.Instance.SetSoundVolume(SystemSetting.Instance.GetSoundVolume());
+ SystemSetting.Instance.SetSoundEffect(SystemSetting.Instance.GetSoundEffect());
+ }).Forget();
+
// SoundPlayer.Instance.PlayBackGroundMusic(41);
- SystemSetting.Instance.SetSoundVolume(SystemSetting.Instance.GetSoundVolume());
- SystemSetting.Instance.SetSoundEffect(SystemSetting.Instance.GetSoundEffect());
+
SystemSetting.Instance.SetGameFps(SystemSetting.Instance.GetGameFps());
SystemSetting.Instance.LetFPSUnLimit();
DebugUtility.Instance.Init();
- DebugUtility.Instance.CreateDebugRoot();
+ DebugUtility.Instance.CreateDebugRoot().Forget();
GameObjectPoolManager.Instance.gameObject.name = "GameObjectPool";
GameObjectPoolManager.Instance.Initialize();
diff --git a/Main/Core/GameEngine/Launch/LaunchInHot.cs b/Main/Core/GameEngine/Launch/LaunchInHot.cs
index 4c16094..2003d76 100644
--- a/Main/Core/GameEngine/Launch/LaunchInHot.cs
+++ b/Main/Core/GameEngine/Launch/LaunchInHot.cs
@@ -31,15 +31,18 @@
{
InitSystemMgr();
- // 杩欓噷杩樻病寮�濮嬪姞杞介厤缃� 浣嗘槸鎻愬墠鍔犺浇浜嗕緵LaunchWin浣跨敤
- PriorLanguageConfig.LazyInit();
- InitialFunctionConfig.LazyInit();
-
- UIManager.Instance.OpenWindow<LaunchWin>();
+ UIManager.Instance.OpenWindowAsync<LaunchWin>().Forget();
+
}
-
+ // US1: Add YooAsset initialization task 鈥� replaces AssetBundleInitTask
+ var yooAssetInitTask = new YooAssetInitTask();
+ tasks.Enqueue(yooAssetInitTask);
+ // AssetBundleInitTask removed 鈥� YooAssetInitTask handles all resource system initialization
+#if !UNITY_WEBGL
var builtInAssetCopyTask = new BuiltInAssetCopyTask();
+ tasks.Enqueue(builtInAssetCopyTask);
+#endif
var requestPermissionStart = new RequestPermissionStart();
var initSettingTask = new InitSettingTask();
var sdkInitedTask = new SDKInitedTask();
@@ -52,7 +55,6 @@
var configInitTask = new ConfigInitTask();
var launchFadeOutTask = new LaunchFadeOutTask();
- tasks.Enqueue(builtInAssetCopyTask);
tasks.Enqueue(requestPermissionStart);
tasks.Enqueue(initSettingTask);
@@ -85,10 +87,7 @@
tasks.Enqueue(checkAssetValidTask);
tasks.Enqueue(downLoadAssetTask);
- // US1: Add YooAsset initialization task 鈥� replaces AssetBundleInitTask
- var yooAssetInitTask = new YooAssetInitTask();
- tasks.Enqueue(yooAssetInitTask);
- // AssetBundleInitTask removed 鈥� YooAssetInitTask handles all resource system initialization
+
tasks.Enqueue(configInitTask);
tasks.Enqueue(launchFadeOutTask);
diff --git a/Main/Core/GameEngine/Launch/RequestPermissionStart.cs b/Main/Core/GameEngine/Launch/RequestPermissionStart.cs
index 6ff6c7d..6ee458a 100644
--- a/Main/Core/GameEngine/Launch/RequestPermissionStart.cs
+++ b/Main/Core/GameEngine/Launch/RequestPermissionStart.cs
@@ -1,4 +1,4 @@
-
+锘�
//鍚屾剰闅愮鏉冮檺鍚庢墠鍙互鐢宠鏉冮檺
public class RequestPermissionStart : LaunchTask
{
@@ -18,7 +18,7 @@
// else
// {
// //鍏堝脊闅愮鏀跨瓥锛屽悓鎰忎箣鍚庢墠鍙互鐢宠鏉冮檺 缁х画娓告垙
- // // UIManager.Instance.OpenWindow<RequestSecretWin>();
+ // // UIManager.Instance.OpenWindowAsync<RequestSecretWin>().Forget();
// //鏀规垚鍚慡DK璇锋眰闅愮鏉冮檺
// SDKUtils.Instance.RequestSecretRule();
diff --git a/Main/Core/GameEngine/Launch/YooAssetInitTask.cs b/Main/Core/GameEngine/Launch/YooAssetInitTask.cs
index ad84d1a..7cce72c 100644
--- a/Main/Core/GameEngine/Launch/YooAssetInitTask.cs
+++ b/Main/Core/GameEngine/Launch/YooAssetInitTask.cs
@@ -40,19 +40,20 @@
EPlayMode playMode;
if (!AssetSource.isUseAssetBundle)
{
-#if UNITY_EDITOR
+ // Editor 涓嶄娇鐢� AB 妯″紡锛欵ditorSimulateMode 鐩存帴璇� AssetDatabase
playMode = EPlayMode.EditorSimulateMode;
-#else
- playMode = EPlayMode.OfflinePlayMode;
-#endif
}
else
{
-#if UNITY_EDITOR
- // 缂栬緫鍣ㄤ笅 AB 妯″紡浣跨敤 OfflinePlayMode锛堥殢鍖呮ā寮忥級锛屼粠 StreamingAssets 鍔犺浇
+#if UNITY_WEBGL
+ // WebGL 骞冲彴锛堝惈 Editor 涓嬪垏鍒� WebGL target锛夛細BuildInFileSystem 涓嶆敮鎸� WebGL锛屽繀椤荤敤 WebPlayMode
+ playMode = EPlayMode.WebPlayMode;
+#elif UNITY_EDITOR
+ // Editor 闈� WebGL target + AB 妯″紡锛氫粠鏈湴 StreamingAssets 鍔犺浇宸叉瀯寤虹殑 AB
playMode = EPlayMode.OfflinePlayMode;
#else
- playMode = EPlayMode.HostPlayMode;
+ // 鍏朵粬骞冲彴 AB 妯″紡
+ playMode = EPlayMode.OfflinePlayMode;
#endif
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
index db2c6b2..b1aaf40 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
@@ -2,6 +2,7 @@
using System.Collections;
using LitJson;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
// B4 24 鍥炲悎鎴樻枟鍒濆鍖� #tagSCTurnFightInit
@@ -67,12 +68,15 @@
JsonData extendData = JsonMapper.ToObject(vNetData.Msg);
string guid = BattleManager.Instance.GetGUID(vNetPack.packUID);
- BattleField battleField = BattleManager.Instance.CreateBattleField(guid, vNetData, extendData, redTeamList, blueTeamList);
- BattleStartAction battleStartAction = new BattleStartAction(battleField);
- battleField.recordPlayer.PlayRecord(battleStartAction);
+ BattleManager.Instance.CreateBattleField(guid, vNetData, extendData, redTeamList, blueTeamList).ContinueWith(battleField =>
+ {
+ BattleStartAction battleStartAction = new BattleStartAction(battleField);
+ battleField.recordPlayer.PlayRecord(battleStartAction);
- BattleDebug.LogError("鍒涘缓鎴樺満 guid:" + guid + " MapID:" + vNetData.MapID + " FuncLineID:" + vNetData.FuncLineID + " " + battleField.GetType().ToString() + " pack uid is " + vNetPack.packUID);
+ BattleDebug.LogError("鍒涘缓鎴樺満 guid:" + guid + " MapID:" + vNetData.MapID + " FuncLineID:" + vNetData.FuncLineID + " " + battleField.GetType().ToString() + " pack uid is " + vNetPack.packUID);
- battleField.ShowWindow(vNetData);
+ battleField.ShowWindow(vNetData);
+ }).Forget();
+
}
}
diff --git a/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs b/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
index 599e1ce..91690fb 100644
--- a/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
+++ b/Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
@@ -105,7 +105,7 @@
{
case NetworkReachability.NotReachable:
GameNetSystem.Instance.Disconnect();
- UIManager.Instance.OpenWindow<DisconnectHintWin>();
+ UIManager.Instance.OpenWindowAsync<DisconnectHintWin>().Forget();
break;
case NetworkReachability.ReachableViaCarrierDataNetwork:
case NetworkReachability.ReachableViaLocalAreaNetwork:
diff --git a/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs b/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs
index 9c25611..d5bde02 100644
--- a/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs
+++ b/Main/Core/NetworkPackage/DataToCtl/RoleLoginState.cs
@@ -28,7 +28,7 @@
if (timer1 > OVERTIME_THRESHOLD_1)
{
GameNetSystem.Instance.Disconnect();
- UIManager.Instance.OpenWindow<DisconnectHintWin>();
+ UIManager.Instance.OpenWindowAsync<DisconnectHintWin>().Forget();
}
@@ -36,7 +36,7 @@
if (timer2 > OVERTIME_THRESHOLD_2)
{
GameNetSystem.Instance.Disconnect();
- UIManager.Instance.OpenWindow<DisconnectHintWin>();
+ UIManager.Instance.OpenWindowAsync<DisconnectHintWin>().Forget();
}
}
diff --git a/Main/Core/NetworkPackage/Socket/ClientSocket.cs b/Main/Core/NetworkPackage/Socket/ClientSocket.cs
index bf072a0..8c64874 100644
--- a/Main/Core/NetworkPackage/Socket/ClientSocket.cs
+++ b/Main/Core/NetworkPackage/Socket/ClientSocket.cs
@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
-#if !UNITY_WEBGL && !H5_VERSION
+#if !UNITY_WEBGL
using System.Net;
using System.Net.Sockets;
using System.Threading;
@@ -20,7 +20,7 @@
{
GameNetEncode encoder = new GameNetEncode();
-#if !UNITY_WEBGL && !H5_VERSION
+#if !UNITY_WEBGL
// TCP Socket 瀹炵幇锛堥潪WebGL骞冲彴锛�
Socket m_Socket;
public Socket socket { get { return m_Socket; } }
@@ -43,7 +43,7 @@
{
get
{
-#if !UNITY_WEBGL && !H5_VERSION
+#if !UNITY_WEBGL
return m_Socket == null ? false : m_Socket.Connected;
#else
return webSocket != null && webSocket.State == WebSocketState.Open;
@@ -66,7 +66,7 @@
this.socketType = type;
}
-#if !UNITY_WEBGL && !H5_VERSION
+#if !UNITY_WEBGL
// ==================== TCP Socket 瀹炵幇 ====================
public void Connect(string _ip, int _port, Action<bool> _onConnected)
@@ -623,9 +623,9 @@
// WebGL闇�瑕佸湪Update涓疆璇㈡秷鎭�
public void DispatchMessageQueue()
{
-// #if !UNITY_EDITOR
+#if UNITY_EDITOR
webSocket?.DispatchMessageQueue();
-// #endif
+#endif
}
#endif
diff --git a/Main/Core/ResModule/GameObjectPoolManager.cs b/Main/Core/ResModule/GameObjectPoolManager.cs
index b9e8433..46d3f34 100644
--- a/Main/Core/ResModule/GameObjectPoolManager.cs
+++ b/Main/Core/ResModule/GameObjectPoolManager.cs
@@ -3,6 +3,8 @@
using System;
using Cysharp.Threading.Tasks;
using System.Linq;
+using YooAsset;
+
#if UNITY_EDITOR
using UnityEngine.Profiling;
diff --git a/Main/Core/ResModule/ScriptableObjectLoader.cs b/Main/Core/ResModule/ScriptableObjectLoader.cs
index bf11edc..70a6916 100644
--- a/Main/Core/ResModule/ScriptableObjectLoader.cs
+++ b/Main/Core/ResModule/ScriptableObjectLoader.cs
@@ -15,36 +15,9 @@
public const string SoNewBieGuide_Suffix = "NewBieGuideStep_";
-
- public static NewBieGuideScriptableObject LoadSoNewBieGuideStep(int _id)
- {
- NewBieGuideScriptableObject config = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var resourcePath = StringUtility.Concat(ResourcesPath.ResourcesOutAssetPath,
- "ScriptableObject/NewBieGuide/",
- SoNewBieGuide_Suffix,
- _id.ToString(),
- ".asset");
- config = AssetDatabase.LoadAssetAtPath<NewBieGuideScriptableObject>(resourcePath);
-#endif
- }
- else
- {
- var assetName = StringUtility.Concat(SoNewBieGuide_Suffix, _id.ToString());
- var assetPath = StringUtility.Concat("Assets/ResourcesOut/ScriptableObject/NewBieGuide/", assetName);
- config = YooAssetService.Instance.LoadAssetSync<NewBieGuideScriptableObject>(assetPath);
- }
-
- if (config == null)
- {
- Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoNewBieGuideStep() => 鍔犺浇涓嶅埌璧勬簮: {0}.", _id);
- }
-
- return config;
- }
+ // 宸茬Щ闄ゅ悓姝ュ姞杞芥帴鍙o紝寮哄埗涓氬姟鍏ㄩ儴璧板紓姝PI銆�
+ // public static NewBieGuideScriptableObject LoadSoNewBieGuideStep(int _id) => throw new NotSupportedException("鍚屾鍔犺浇宸茬鐢紝璇蜂娇鐢ㄥ紓姝ユ帴鍙�");
public static async UniTask<NewBieGuideScriptableObject> LoadSoNewBieGuideStepAsync(int _id)
{
diff --git a/Main/Main.cs b/Main/Main.cs
index ba05126..c43a202 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -37,17 +37,17 @@
SwitchToLoginScene();
}
- private static void SwitchToLoginScene()
+ private static async void SwitchToLoginScene()
{
// Debug.Log("鎵撳紑鐧诲綍鐣岄潰");
- // UIManager.Instance.OpenWindow<LoginWin>();
+ // UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
Debug.Log("鍒囨崲鍒扮櫥褰曞満鏅�");
- ConfigManager.Instance.Init();
+ await ConfigManager.Instance.Init();
GeneralDefine.Init();
#if UNITY_EDITOR
SysNotifyMgr.Instance.BeforePlayerDataInitializeEvent();
#endif
- StageManager.Instance.ToLoginScene();
+ StageManager.Instance.ToLoginScene().Forget();
}
diff --git a/Main/Manager/IManager.cs b/Main/Manager/IManager.cs
index b7fef68..97a21c3 100644
--- a/Main/Manager/IManager.cs
+++ b/Main/Manager/IManager.cs
@@ -1,7 +1,9 @@
+using Cysharp.Threading.Tasks;
+
public interface IManager
{
- void Init();
+ UniTask Init();
void Release();
}
diff --git a/Main/Manager/ManagerBase.cs b/Main/Manager/ManagerBase.cs
index b28427b..45c985c 100644
--- a/Main/Manager/ManagerBase.cs
+++ b/Main/Manager/ManagerBase.cs
@@ -1,7 +1,9 @@
+using Cysharp.Threading.Tasks;
+
public class ManagerBase<T> : Singleton<T>, IManager where T : ManagerBase<T>, new()
{
- public virtual void Init()
+ public virtual async UniTask Init()
{
}
diff --git a/Main/Manager/StageManager.cs b/Main/Manager/StageManager.cs
index fb9c542..861d9f1 100644
--- a/Main/Manager/StageManager.cs
+++ b/Main/Manager/StageManager.cs
@@ -22,7 +22,7 @@
// public Action OnSwitchAccount;
private LaunchWinData launchWinData = null;
- public void Init()
+ public async UniTask Init()
{
UIManager.Instance.OnCloseWindow += OnCloseWindow;
}
@@ -39,7 +39,7 @@
UIManager.Instance.DestroyAllUI();
// US3: Show loading screen FIRST, then load resources with progress
- LoadingWin loadingWin = UIManager.Instance.OpenWindow<LoadingWin>();
+ LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
InitLoadingWinData(loadingWin);
// Phase 1 (0% ~ 30%): YooAsset resource preload
@@ -76,8 +76,8 @@
currentStage = StageName.Login;
- UIManager.Instance.OpenWindow<LaunchBackGroundWin>();
- UIManager.Instance.OpenWindow<LoginWin>();
+ UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().Forget();
+ UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
if (VersionUtility.Instance.NeedDownAsset() && !AssetVersionUtility.hasDownLoadFullAsset)
{
@@ -97,12 +97,12 @@
Main.OnSwitchToLoginScene();
currentStage = StageName.Login;
- UIManager.Instance.OpenWindow<LaunchBackGroundWin>();
- UIManager.Instance.OpenWindow<LoginWin>();
+ UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().Forget();
+ UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
if (ServerForceExitHintWin.reason != 0)
{
- UIManager.Instance.OpenWindow<ServerForceExitHintWin>();
+ UIManager.Instance.OpenWindowAsync<ServerForceExitHintWin>().Forget();
}
// SoundPlayer.Instance.StopBackGroundMusic();
SoundPlayer.Instance.PlayLoginMusic();
@@ -137,7 +137,7 @@
BeforeLoadingGameScene?.Invoke();
// US3: Show loading screen FIRST, then load resources with progress
- LoadingWin loadingWin = UIManager.Instance.OpenWindow<LoadingWin>();
+ LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
InitLoadingWinData(loadingWin);
// Phase 1 (0% ~ 30%): YooAsset resource preload
@@ -179,7 +179,7 @@
AfterLoadingGameScene?.Invoke();
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
//娓告垙鍐呮棩蹇楀叧闂�
#if !UNITY_EDITOR
@@ -200,7 +200,7 @@
{
asyncOperation.allowSceneActivation = false;
- LoadingWin loadingWin = UIManager.Instance.OpenWindow<LoadingWin>();
+ LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
InitLoadingWinData(loadingWin);
while (!asyncOperation.isDone)
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index b589778..35baaf0 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -75,27 +75,21 @@
/// <summary>
/// 鍒濆鍖朥I绠$悊鍣�
/// </summary>
- public override void Init()
+ public override async UniTask Init()
{
- base.Init();
-
- // 鍒濆鍖朥I鏍硅妭鐐�
- InitUIRoot();
-
+ await InitUIRoot();
// 鍒濆鍖栫紦瀛�
layerSortingOrderCache.Clear();
layerTransformCache.Clear();
uiInstanceCounter.Clear();
-
DOTween.SetTweensCapacity(500, 50);
Debug.Log("UI绠$悊鍣ㄥ垵濮嬪寲瀹屾垚");
-
}
/// <summary>
/// 鍒濆鍖朥I鏍硅妭鐐�
/// </summary>
- private void InitUIRoot()
+ private async UniTask InitUIRoot()
{
// 鏌ユ壘UI鏍硅妭鐐�
GameObject root = GameObject.Find("UIRoot");
@@ -103,15 +97,14 @@
// 濡傛灉鍦烘櫙涓病鏈塙I鏍硅妭鐐癸紝鍒欏垱寤轰竴涓�
if (root == null)
{
- root = GameObject.Instantiate(BuiltInLoader.LoadPrefab("UIRoot"));
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRoot");
+ root = GameObject.Instantiate(prefab);
root.name = "UIRoot";
if (root == null)
{
Debug.LogError("鏃犳硶鎵惧埌UI鏍硅妭鐐�");
return;
}
-
- // 娣诲姞DontDestroyOnLoad缁勪欢锛岀‘淇漊I鏍硅妭鐐瑰湪鍦烘櫙鍒囨崲鏃朵笉琚攢姣�
GameObject.DontDestroyOnLoad(root);
}
@@ -552,73 +545,71 @@
#region UI璧勬簮绠$悊
- private UIBase LoadUIResource(string uiName)
- {
+ // private UIBase LoadUIResource(string uiName)
+ // {
- // 浠庤祫婧愮鐞嗗櫒鍔犺浇UI棰勫埗浣�
- GameObject prefab;
- if (uiName == "LaunchWin" || uiName == "DownLoadWin" || uiName == "RequestSecretWin" || uiName == "GameAgeWarnWin")
- {
- prefab = BuiltInLoader.LoadPrefab(uiName);
- }
- else
- {
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use LoadUIResourceAsync
- prefab = ResManager.Instance.LoadAsset<GameObject>("UI", uiName);
- #pragma warning restore CS0618
- }
+ // // 浠庤祫婧愮鐞嗗櫒鍔犺浇UI棰勫埗浣�
+ // GameObject prefab;
+ // if (uiName == "LaunchWin" || uiName == "DownLoadWin" || uiName == "RequestSecretWin" || uiName == "GameAgeWarnWin")
+ // {
+ // prefab = await BuiltInLoader.LoadPrefabAsync(uiName);
+ // }
+ // else
+ // {
+ // prefab = await ResManager.Instance.LoadAssetAsync<GameObject>("UI", uiName);
+ // }
- // 妫�鏌ラ鍒朵綋鏄惁鍔犺浇鎴愬姛
- if (prefab == null)
- {
- // 璁板綍閿欒鏃ュ織
- Debug.LogError($"鍔犺浇UI棰勫埗浣撳け璐�: {uiName}");
- return null;
- }
+ // // 妫�鏌ラ鍒朵綋鏄惁鍔犺浇鎴愬姛
+ // if (prefab == null)
+ // {
+ // // 璁板綍閿欒鏃ュ織
+ // Debug.LogError($"鍔犺浇UI棰勫埗浣撳け璐�: {uiName}");
+ // return null;
+ // }
- // 瀹炰緥鍖朥I瀵硅薄
- GameObject uiObject = GameObject.Instantiate(prefab);
- // 璁剧疆瀵硅薄鍚嶇О
- uiObject.name = uiName;
+ // // 瀹炰緥鍖朥I瀵硅薄
+ // GameObject uiObject = GameObject.Instantiate(prefab);
+ // // 璁剧疆瀵硅薄鍚嶇О
+ // uiObject.name = uiName;
- // 閫氳繃uiName鏄犲皠Type
- Type uiType = Type.GetType(uiName);
- if (uiType == null)
- {
- Debug.LogError($"鎵句笉鍒癠I绫诲瀷: {uiName}");
- return null;
- }
+ // // 閫氳繃uiName鏄犲皠Type
+ // Type uiType = Type.GetType(uiName);
+ // if (uiType == null)
+ // {
+ // Debug.LogError($"鎵句笉鍒癠I绫诲瀷: {uiName}");
+ // return null;
+ // }
- // 鑾峰彇UI鍩虹被缁勪欢
- UIBase uiBase = uiObject.GetComponent(uiType) as UIBase;
+ // // 鑾峰彇UI鍩虹被缁勪欢
+ // UIBase uiBase = uiObject.GetComponent(uiType) as UIBase;
- // 妫�鏌I鍩虹被缁勪欢鏄惁瀛樺湪
- if (uiBase == null)
- {
- // 璁板綍閿欒鏃ュ織
- Debug.LogError($"UI棰勫埗浣� {uiName} 娌℃湁 UIBase 缁勪欢鎴栫被鍨嬩笉鍖归厤");
- return null;
- }
+ // // 妫�鏌I鍩虹被缁勪欢鏄惁瀛樺湪
+ // if (uiBase == null)
+ // {
+ // // 璁板綍閿欒鏃ュ織
+ // Debug.LogError($"UI棰勫埗浣� {uiName} 娌℃湁 UIBase 缁勪欢鎴栫被鍨嬩笉鍖归厤");
+ // return null;
+ // }
- // 璁剧疆UI鍚嶇О
- uiBase.uiName = uiName;
+ // // 璁剧疆UI鍚嶇О
+ // uiBase.uiName = uiName;
- // 璁剧疆鐖惰妭鐐逛负UI鏍硅妭鐐�
- Transform parentTrans = GetTransForLayer(uiBase.uiLayer);
+ // // 璁剧疆鐖惰妭鐐逛负UI鏍硅妭鐐�
+ // Transform parentTrans = GetTransForLayer(uiBase.uiLayer);
- uiObject.transform.SetParent(parentTrans, false);
+ // uiObject.transform.SetParent(parentTrans, false);
- // 璁剧疆鎺掑簭椤哄簭
- int baseSortingOrder = GetBaseSortingOrderForLayer(uiBase.uiLayer);
- uiBase.SetSortingOrder(baseSortingOrder);
+ // // 璁剧疆鎺掑簭椤哄簭
+ // int baseSortingOrder = GetBaseSortingOrderForLayer(uiBase.uiLayer);
+ // uiBase.SetSortingOrder(baseSortingOrder);
- return uiBase;
- }
+ // return uiBase;
+ // }
// 鍔犺浇UI棰勫埗浣�
- private T LoadUIResource<T>(string uiName) where T : UIBase
+ private async UniTask<T> LoadUIResource<T>(string uiName) where T : UIBase
{
- return LoadUIResource(uiName) as T;
+ return await LoadUIResourceAsync(uiName) as T;
}
// ====================================================================
@@ -633,7 +624,7 @@
GameObject root = GameObject.Find("UIRoot");
if (root == null)
{
- var prefab = await BuiltInLoader.LoadPrefabAsync("UIRoot");
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRoot"); // 宸插紓姝ワ紝鏃犻渶淇敼
root = GameObject.Instantiate(prefab);
root.name = "UIRoot";
if (root == null)
@@ -927,7 +918,7 @@
return null;
}
- public UIBase OpenWindow(string uiName, int functionOrder = 0)
+ public async UniTask<UIBase> OpenWindow(string uiName, int functionOrder = 0)
{
// 浼樺厛浠巆losedUIDict涓幏鍙�
UIBase parentUI = null;
@@ -955,7 +946,7 @@
#if UNITY_EDITOR
Debug.Log("OpenWindow getNewLoad " + uiName);
#endif
- returnValue = LoadUIResource(uiName);
+ returnValue = await LoadUIResourceAsync(uiName);
if (returnValue == null)
{
// 璁板綍閿欒鏃ュ織
diff --git a/Main/ResModule/AudioLoader.cs b/Main/ResModule/AudioLoader.cs
index af8bab3..78556a5 100644
--- a/Main/ResModule/AudioLoader.cs
+++ b/Main/ResModule/AudioLoader.cs
@@ -6,14 +6,9 @@
public class AudioLoader
{
- public static AudioClip LoadAudio(string _folderName, string _clipName)
+ public static async UniTask<AudioClip> LoadAudio(string _folderName, string _clipName)
{
- return ResManager.Instance.LoadAsset<AudioClip>("Audio/" + _folderName, _clipName, false);
- }
-
- public static void LoadAudioAsync(string _folderName, string _clipName, Action<bool, UnityEngine.Object> _callBack)
- {
- ResManager.Instance.LoadAssetAsync<AudioClip>("Audio/" + _folderName, _clipName, _callBack, false);
+ return await ResManager.Instance.LoadAssetAsync<AudioClip>("Audio/" + _folderName, _clipName, false);
}
// US2: Async UniTask variant
diff --git a/Main/ResModule/BuiltInLoader.cs b/Main/ResModule/BuiltInLoader.cs
index cf52f32..8c00524 100644
--- a/Main/ResModule/BuiltInLoader.cs
+++ b/Main/ResModule/BuiltInLoader.cs
@@ -14,221 +14,7 @@
readonly static List<string> excludePngs = new List<string>() { "Launch_1.png", "Launch_2.png", "Launch_3.png", "LoginBackGround.png", "TB_DL_Logo.png" };
- public static Sprite LoadSprite(string name)
- {
- Sprite sprite = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- if (excludePngs.Contains(StringUtility.Concat(name, SPRITE_EXTENSION)))
- {
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Sprites/", name, SPRITE_EXTENSION);
- path = System.Text.RegularExpressions.Regex.Replace(path, @"[\p{C}]", "");
- sprite = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(path);
- }
- else
- {
- var spriteAtlas = UnityEditor.AssetDatabase.LoadAssetAtPath<SpriteAtlas>("Assets/ResourcesOut/BuiltIn/Sprites/sprites.spriteatlasv2");
- sprite = spriteAtlas.GetSprite(name);
- }
-#endif
- }
- else
- {
- //if (sprite == null)
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Sprites/", name, SPRITE_EXTENSION);
- #pragma warning disable CS0612
- sprite = YooAssetService.Instance.LoadAssetSync<Sprite>(path);
- #pragma warning restore CS0612
- }
- }
-
- if (sprite == null)
- {
- Debug.LogErrorFormat("BuiltInLoader.LoadSprite() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
- }
-
- return sprite;
- }
-
- public static GameObject LoadPrefab(string name)
- {
- GameObject prefab = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Prefabs/", name, PREFAB_EXTENSION);
- prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(path);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Prefabs/", name, PREFAB_EXTENSION);
- #pragma warning disable CS0612
- prefab = YooAssetService.Instance.LoadAssetSync<GameObject>(path);
- #pragma warning restore CS0612
- }
-
- if (prefab == null)
- {
- Debug.LogErrorFormat("BuiltInLoader.LoadPrefab() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
- }
-
- return prefab;
- }
-
- public static void UnLoadPrefab(string name)
- {
- // US1: No-op. YooAsset manages asset lifecycle via handle-based release.
- }
-
- public static AudioClip LoadMusic(string name)
- {
- AudioClip audioClip = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Musics/", name, ".mp3");
- audioClip = UnityEditor.AssetDatabase.LoadAssetAtPath<AudioClip>(path);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Musics/", name, ".mp3");
- #pragma warning disable CS0612
- audioClip = YooAssetService.Instance.LoadAssetSync<AudioClip>(path);
- #pragma warning restore CS0612
- }
-
- if (audioClip == null)
- {
- Debug.LogErrorFormat("BuiltInLoader.LoadMusic() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
- }
-
- return audioClip;
- }
-
- public static AnimationClip LoadAnimationClip(string name)
- {
- AnimationClip clip = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/AnimationClips/", name, ".anim");
- clip = UnityEditor.AssetDatabase.LoadAssetAtPath<AnimationClip>(path);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/AnimationClips/", name, ".anim");
- #pragma warning disable CS0612
- clip = YooAssetService.Instance.LoadAssetSync<AnimationClip>(path);
- #pragma warning restore CS0612
- }
-
- if (clip == null)
- {
- Debug.LogErrorFormat("BuiltInLoader.LoadAnimationClip() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
- }
-
- return clip;
- }
-
- public static Material LoadMaterial(string name)
- {
- Material material = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Materials/", name, ".mat");
- material = UnityEditor.AssetDatabase.LoadAssetAtPath<Material>(path);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat("Assets/ResourcesOut/BuiltIn/Materials/", name, ".mat");
- #pragma warning disable CS0612
- material = YooAssetService.Instance.LoadAssetSync<Material>(path);
- #pragma warning restore CS0612
- }
-
- if (material == null)
- {
- Debug.LogErrorFormat("BuiltInLoader.LoadMaterial() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
- }
-
- return material;
- }
-
- public static T LoadScriptableObject<T>(string name) where T : ScriptableObject
- {
-
- T config = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var resourcePath = StringUtility.Concat(ResourcesPath.ResourcesOutAssetPath,
- "BuiltIn/ScriptableObjects/", name, ".asset");
-
- config = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(resourcePath);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat(ResourcesPath.ResourcesOutAssetPath,
- "BuiltIn/ScriptableObjects/", name, ".asset");
- #pragma warning disable CS0612
- config = YooAssetService.Instance.LoadAssetSync<T>(path);
- #pragma warning restore CS0612
- }
-
- if (config == null)
- {
- Debug.LogErrorFormat("BuiltIn.LoadScriptableObject() => 鍔犺浇涓嶅埌璧勬簮: {0}.", name);
- }
-
- return config;
- }
-
- public static Font LoadFont(string fontName)
- {
- Font font = null;
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- var path = StringUtility.Concat(ResourcesPath.ResourcesOutAssetPath,
- "Font/", fontName, ".ttf");
- font = UnityEditor.AssetDatabase.LoadAssetAtPath<Font>(path);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper
- var path = StringUtility.Concat(ResourcesPath.ResourcesOutAssetPath,
- "Font/", fontName, ".ttf");
- #pragma warning disable CS0612
- font = YooAssetService.Instance.LoadAssetSync<Font>(path);
- #pragma warning restore CS0612
- }
-
- if (font == null)
- {
- Debug.LogErrorFormat("BuiltInLoader.LoadFont() => 鍔犺浇涓嶅埌璧勬簮: {0}.", fontName);
- }
-
- return font;
- }
-
- // ====================================================================
- // US2: Async UniTask variants
- // ====================================================================
+ // ...existing code...
public static async UniTask<Sprite> LoadSpriteAsync(string name, CancellationToken ct = default)
{
diff --git a/Main/ResModule/ResManager.cs b/Main/ResModule/ResManager.cs
index 524efb3..8ec4613 100644
--- a/Main/ResModule/ResManager.cs
+++ b/Main/ResModule/ResManager.cs
@@ -9,6 +9,8 @@
using Cysharp.Threading.Tasks;
using System.Threading;
using ProjSG.Resource;
+using YooAsset;
+
@@ -86,7 +88,7 @@
public void Init()
{
-
+
}
public void Release()
@@ -129,110 +131,56 @@
}
#endif
- //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
- [System.Obsolete("US2: Use LoadAssetAsync<T>(directory, name, needExt) returning UniTask<T> instead.")]
- public T LoadAsset<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
- {
- directory = directory.Replace("\\", "/");
- name = name.Replace("\\", "/");
- // 鐗规畩澶勭悊 鍥犱负鏈変竴灞傚浘闆嗙殑鍏崇郴 directory瑕佷紶鍏ョ殑搴旇鏄痑tlas鐨勫悕瀛�
- if (typeof(T) == typeof(Sprite))
- {
- return LoadSprite(directory, name) as T;
- }
- else if (typeof(T) == typeof(SkeletonDataAsset))
- {
- //鏂囦欢鐩綍璋冩暣锛宯ame涓寘鍚簡璺緞
- if (name.Contains("/"))
- {
- directory += name.Substring(0, name.LastIndexOf("/"));
- name = name.Substring(name.LastIndexOf("/") + 1);
- }
+ // // needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
+ // [System.Obsolete("US2: Use LoadAssetAsync<T>(directory, name, needExt) returning UniTask<T> instead.")]
+ // public T LoadAsset<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
+ // {
+ // directory = directory.Replace("\\", "/");
+ // name = name.Replace("\\", "/");
+ // // 鐗规畩澶勭悊 鍥犱负鏈変竴灞傚浘闆嗙殑鍏崇郴 directory瑕佷紶鍏ョ殑搴旇鏄痑tlas鐨勫悕瀛�
+ // if (typeof(T) == typeof(Sprite))
+ // {
+ // return LoadSprite(directory, name) as T;
+ // }
+ // else if (typeof(T) == typeof(SkeletonDataAsset))
+ // {
+ // //鏂囦欢鐩綍璋冩暣锛宯ame涓寘鍚簡璺緞
+ // if (name.Contains("/"))
+ // {
+ // directory += name.Substring(0, name.LastIndexOf("/"));
+ // name = name.Substring(name.LastIndexOf("/") + 1);
+ // }
- }
+ // }
- return LoadAssetInternal<T>(directory, name, needExt);
- }
+ // return LoadAssetInternal<T>(directory, name, needExt);
+ // }
- //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
- private T LoadAssetInternal<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
- {
- T asset = null;
- var path = ($"Assets/ResourcesOut/{directory}/{name}" + (needExt ? GetExtension(typeof(T)) : "")).Replace("//", "/").Trim().Replace("\\", "/");
+ // //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
+ // private T LoadAssetInternal<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
+ // {
+ // // 宸茬鐢ㄥ悓姝ュ姞杞斤紝寮哄埗涓氬姟鍏ㄩ儴璧板紓姝PI銆�
+ // throw new NotSupportedException("鍚屾璧勬簮鍔犺浇宸茬鐢紝璇蜂娇鐢ㄥ紓姝ユ帴鍙�");
+ // }
- if (!AssetSource.isUseAssetBundle)
- {
-#if UNITY_EDITOR
- asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path);
-#endif
- }
- else
- {
- // US1: Route through YooAssetService sync wrapper (transitional)
- #pragma warning disable CS0612, CS0618
- asset = YooAssetService.Instance.LoadAssetSync<T>(path);
- #pragma warning restore CS0612, CS0618
- }
+// [System.Obsolete("US2: Use LoadConfigAsync returning UniTask<string[]> instead.")]
+// public string[] LoadConfig(string name)
+// {
+// string path = string.Empty;
+// #if UNITY_EDITOR
+// if (!AssetSource.isUseAssetBundle)
+// {
+// path = ResourcesPath.CONFIG_FODLER + "/" + name + ".txt";
+// }
+// else
+// #endif
+// {
+// path = AssetVersionUtility.GetAssetFilePath($"config/{name}.txt");
+// }
- if (asset == null)
- {
- Debug.LogErrorFormat("LoadAsset() => 鍔犺浇涓嶅埌璧勬簮: {0}", path);
- }
+// return File.ReadAllLines(path);
+// }
- return asset;
- }
-
- [System.Obsolete("US2: Use LoadConfigAsync returning UniTask<string[]> instead.")]
- public string[] LoadConfig(string name)
- {
- string path = string.Empty;
-#if UNITY_EDITOR
- if (!AssetSource.isUseAssetBundle)
- {
- path = ResourcesPath.CONFIG_FODLER + "/" + name + ".txt";
- }
- else
-#endif
- {
- path = AssetVersionUtility.GetAssetFilePath($"config/{name}.txt");
- }
-
- return File.ReadAllLines(path);
- }
-
- private Sprite LoadSprite(string atlasName, string spriteName)
- {
- if (!AssetSource.isUseAssetBundle)
- {
- #pragma warning disable CS0618 // Obsolete 鈥� legacy sync fallback
- SpriteAtlas atlas = LoadAsset<SpriteAtlas>("Sprite", atlasName.Replace("Sprite/", ""));
- #pragma warning restore CS0618
- if (null == atlas)
- {
- return null;
- }
- return atlas.GetSprite(spriteName);
- }
- else
- return LoadAssetInternal<Sprite>(atlasName, spriteName);
- }
-
- //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
- [System.Obsolete("US2: Use LoadAssetAsync<T>(directory, name, needExt) returning UniTask<T> instead.")]
- public void LoadAssetAsync<T>(string directory, string name, Action<bool, UnityEngine.Object> callBack, bool needExt = true) where T : UnityEngine.Object
- {
- directory = directory.Replace("\\", "/");
- name = name.Replace("\\", "/");
-
- // 鐗规畩澶勭悊 鍥犱负鏈変竴灞傚浘闆嗙殑鍏崇郴 directory瑕佷紶鍏ョ殑搴旇鏄痑tlas鐨勫悕瀛�
- if (typeof(T) == typeof(Sprite))
- {
- LoadSpriteAsync<T>(directory, name, callBack);
- return;
- }
-
- LoadAssetAsyncInternal<T>(directory, name, callBack, needExt);
- }
public async UniTask<T> LoadAssetAsync<T>(string directory, string name) where T : UnityEngine.Object
{
@@ -241,18 +189,10 @@
public async UniTask<T> LoadAssetAsync<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
{
- var tcs = new UniTaskCompletionSource<T>();
- LoadAssetAsync<T>(directory, name, (isLoaded, asset) => {
- if (isLoaded)
- {
- tcs.TrySetResult(asset as T);
- }
- else
- {
- tcs.TrySetException(new Exception($"Failed to load asset: {directory}/{name}"));
- }
- }, needExt);
- return await tcs.Task;
+ // 鏂扮増鐩存帴璧� YooAsset/寮傛鍔犺浇
+ // 杩欓噷鍋囪鏈� YooAssetService.Instance.LoadAssetAsync<T>(...) 鍙敤
+ string path = directory.EndsWith("/") ? directory + name : directory + "/" + name;
+ return await YooAssetService.Instance.LoadAssetAsync<T>(path);
}
private void LoadSpriteAsync<T>(string atlasName, string spriteName, Action<bool, UnityEngine.Object> callBack) where T : UnityEngine.Object
@@ -304,17 +244,10 @@
}
}
- [System.Obsolete("US1: Use YooAssetService.ReleaseHandle or UnloadUnusedAssetsAsync instead.")]
- public void UnloadAsset(string assetBundleName, string assetName)
+ public void UnloadAsset(string directory, string assetName)
{
- // US1: AssetBundleUtility unload no longer effective since assets loaded via YooAsset.
- // Proper unload handled via YooAssetService handle-based release.
- }
-
- [System.Obsolete("US1: Use YooAssetService.UnloadUnusedAssetsAsync instead.")]
- public void UnloadAssetBundle(string assetBundleName, bool unloadAllLoadedObjects, bool includeDependenice)
- {
- // US1: AssetBundleUtility unload no longer effective since assets loaded via YooAsset.
+ string path = directory.EndsWith("/") ? directory + assetName : directory + "/" + assetName;
+ YooAssetService.Instance.UnloadAsset(path);
}
public string GetAssetFilePath(string _assetKey)
@@ -413,17 +346,24 @@
/// </summary>
public async UniTask<string[]> LoadConfigAsync(string name, CancellationToken ct = default)
{
- // AB 妯″紡锛堝惈 WebGL锛�: 浣跨敤 YooAsset RawFile 鍔犺浇锛堥厤缃枃浠跺湪 YooAsset 娌欑洅涓級
+ // AB 妯″紡锛堝惈 WebGL锛�: 浣跨敤 YooAsset 鍔犺浇閰嶇疆鏂囦欢
if (AssetSource.isUseAssetBundle)
{
+ var location = $"Assets/ResourcesOut/Config/{name}.txt";
try
{
- var location = $"Assets/ResourcesOut/Config/{name}.txt";
+#if UNITY_WEBGL
+ // WebGL: WebServerFileSystem 涓嶆敮鎸� LoadRawFileAsync锛屾敼鐢� LoadAssetAsync<TextAsset>
+ // .txt 鏂囦欢鍦� Unity 涓互 TextAsset 褰㈠紡瀵煎叆锛學ebGL 鏀寔姝ゅ姞杞芥柟寮�
+ var asset = await ProjSG.Resource.YooAssetService.Instance.LoadAssetAsync(
+ location, typeof(UnityEngine.TextAsset), 0, ct) as UnityEngine.TextAsset;
+ 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);
- }
+#endif
}
catch (System.Exception ex)
{
diff --git a/Main/ResModule/UILoader.cs b/Main/ResModule/UILoader.cs
index 1c8f553..71b3ab3 100644
--- a/Main/ResModule/UILoader.cs
+++ b/Main/ResModule/UILoader.cs
@@ -6,109 +6,44 @@
using System.Threading;
using System.IO;
using UnityEngine.U2D;
+using UnityEngine.UI;
public class UILoader
{
- [System.Obsolete("US2: Use LoadWindowAsync instead.")]
- public static GameObject LoadWindow(string name)
- {
- #pragma warning disable CS0618
- return ResManager.Instance.LoadAsset<GameObject>(ResourcesPath.UI_WINDOW_SUFFIX, name);
- #pragma warning restore CS0618
- }
-
- [System.Obsolete("US2: Use LoadPrefabAsync instead.")]
- public static GameObject LoadPrefab(string _name)
- {
- #pragma warning disable CS0618
- return ResManager.Instance.LoadAsset<GameObject>(ResourcesPath.UI_PREFAB_SUFFIX, _name);
- #pragma warning restore CS0618
- }
-
- [System.Obsolete("US2: Use YooAssetService.ReleaseHandle or UnloadUnusedAssetsAsync instead.")]
- public static void UnLoadPrefab(string _assetName)
- {
- #pragma warning disable CS0618
- ResManager.Instance.UnloadAsset(ResourcesPath.UI_PREFAB_SUFFIX, _assetName);
- #pragma warning restore CS0618
- }
-
- //閫氳繃ICON琛ㄥ姞杞�
- [System.Obsolete("US2: Use LoadSpriteAsync instead.")]
- public static Sprite LoadSprite(string _iconKey)
- {
- var iconConfig = IconConfig.Get(_iconKey);
- if (iconConfig == null)
- {
- return null;
- }
-
- return LoadSprite(iconConfig.folder, iconConfig.sprite);
- }
-
- [System.Obsolete("US2: Use LoadSpriteAsync instead.")]
- public static Sprite LoadSprite(string _folder, string _file)
- {
- #pragma warning disable CS0618
- return ResManager.Instance.LoadAsset<Sprite>(StringUtility.Concat(ResourcesPath.UI_SPRITE_SUFFIX, "/", _folder), _file);
- #pragma warning restore CS0618
- }
-
- [System.Obsolete("US2: Use YooAssetService.ReleaseHandle instead.")]
- public static void UnLoadSprite(string _iconKey)
- {
- var iconConfig = IconConfig.Get(_iconKey);
- if (iconConfig != null)
- {
- var bundleName = StringUtility.Concat(ResourcesPath.UI_SPRITE_SUFFIX, "/", iconConfig.folder);
- #pragma warning disable CS0618
- ResManager.Instance.UnloadAsset(bundleName, iconConfig.sprite);
- #pragma warning restore CS0618
- }
- }
-
- [System.Obsolete("US2: Use LoadFontAsync instead.")]
- public static Font LoadFont(string _fontName)
- {
- #pragma warning disable CS0618
- return ResManager.Instance.LoadAsset<Font>(ResourcesPath.UI_FONT_SUFFIX, _fontName);
- #pragma warning restore CS0618
- }
-
- [System.Obsolete("US2: Use YooAssetService.ReleaseHandle instead.")]
- public static void UnLoadFont(string _fontName)
- {
- #pragma warning disable CS0618
- ResManager.Instance.UnloadAsset(ResourcesPath.UI_FONT_SUFFIX, _fontName);
- #pragma warning restore CS0618
- }
-
- [System.Obsolete("US2: Use LoadTexture2DAsync instead.")]
- public static Texture2D LoadTexture2D(string _iconKey)
- {
- var iconConfig = IconConfig.Get(_iconKey);
- if (iconConfig == null)
- {
- return null;
- }
- #pragma warning disable CS0618
- return ResManager.Instance.LoadAsset<Texture2D>(StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/" + iconConfig.folder), iconConfig.sprite);
- #pragma warning restore CS0618
- }
-
- [System.Obsolete("US2: Use LoadTexture2DPNGAsync instead.")]
- public static Texture2D LoadTexture2DPNG(string name)
- {
- #pragma warning disable CS0618
- return ResManager.Instance.LoadAsset<Texture2D>(StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/FullScreenBg"), name + ".png", false);
- #pragma warning restore CS0618
- }
// ====================================================================
// US2: Async UniTask variants
// ====================================================================
+ public static async UniTask LoadSprite(string directory, string name, Image image)
+ {
+ var sprite = await LoadSpriteAsync(directory, name);
+ if (null != sprite)
+ {
+ if (image != null)
+ {
+ image.overrideSprite = sprite;
+ }
+ }
+ }
+
+ public static async UniTask LoadSprite(string directory, string name, Image image, string failureName)
+ {
+ var sprite = await LoadSpriteAsync(directory, name);
+ if (sprite != null)
+ {
+ if (image != null)
+ {
+ image.overrideSprite = sprite;
+ }
+ }
+ else
+ {
+ image.SetSprite(failureName);
+ }
+ }
+
public static UniTask<GameObject> LoadWindowAsync(string name, CancellationToken ct = default)
{
return ResManager.Instance.LoadAssetAsync<GameObject>(ResourcesPath.UI_WINDOW_SUFFIX, name, ct: ct);
diff --git a/Main/ResModule/YooAssetPackageConfig.cs b/Main/ResModule/YooAssetPackageConfig.cs
index 01d6da5..02e5a89 100644
--- a/Main/ResModule/YooAssetPackageConfig.cs
+++ b/Main/ResModule/YooAssetPackageConfig.cs
@@ -66,6 +66,10 @@
/// <summary>闊抽璧勬簮鍖咃細Audio 鐩綍</summary>
public const string Audio = "Audio";
+ public const string Video = "Video";
+
+ public const string Builtin = "Builtin"; // 鍏煎鏃х増鏈紝鍖呭惈 BuiltIn 鐩綍鐨勮祫婧愶紙Shader銆丮aterials銆丼criptableObject銆丼cenes銆丆onfig 绛夛級
+
/// <summary>
/// 涓诲寘鍚� 鈥� 鍦� YooAssetService/YooAssetInitializer 涓綔涓� DefaultPackage銆�
/// 閫夋嫨 Prefab 鍖咃紝鍥犱负瀹冨寘鍚� BuiltIn/Shader/Materials 绛夊惎鍔ㄥ繀闇�璧勬簮銆�
@@ -82,6 +86,7 @@
UIEffect,
Battle,
Audio,
+ Builtin,
};
// ====================================================================
@@ -102,7 +107,7 @@
{ "font", UI },
// Prefab Package (default 鈥� BuiltIn, Shader, Materials, etc.)
- { "builtin", Prefab },
+ // { "builtin", Prefab }, // 绉婚櫎閲嶅椤癸紝builtin 鍙寚鍚� Builtin 鍖�
{ "shader", Prefab },
{ "materials", Prefab },
{ "graphic", Prefab }, // 鏃ц矾寰勫吋瀹� "Graphic/Shader", "Graphic/Material"
@@ -121,6 +126,12 @@
// Audio Package
{ "audio", Audio },
+
+ // Video Package
+ { "video", Video },
+
+ // Builtin Package锛堝吋瀹规棫鐗堟湰锛屽寘鍚� BuiltIn 鐩綍鐨勮祫婧愶級
+ { "builtin", Builtin },
};
/// <summary>
@@ -180,5 +191,9 @@
public const string Shader = "tag_shader";
public const string Font = "tag_font";
public const string Material = "tag_material";
+
+ public const string Video = "tag_video";
+
+
}
}
diff --git a/Main/ResModule/YooAssetService.cs b/Main/ResModule/YooAssetService.cs
index 6fddd0d..db8d5af 100644
--- a/Main/ResModule/YooAssetService.cs
+++ b/Main/ResModule/YooAssetService.cs
@@ -413,6 +413,29 @@
}, $"LoadAssetAsync<{typeof(T).Name}>('{location}')", ct);
}
+ public void UnloadAsset(string location)
+ {
+ ThrowIfNotInitialized();
+
+ if (string.IsNullOrEmpty(location))
+ {
+ Debug.LogError("[YooAssetService] UnloadAsset: location is null or empty.");
+ return;
+ }
+
+ var package = FindPackageForAsset(location);
+
+ if (null != package)
+ {
+ YooAsset.AssetInfo assetInfo = package.GetAssetInfo(location);
+
+ if (null != assetInfo)
+ {
+ package.TryUnloadUnusedAsset(assetInfo);
+ }
+ }
+ }
+
/// <inheritdoc />
public async UniTask<UnityEngine.Object> LoadAssetAsync(string location, Type type, uint priority = 0,
CancellationToken ct = default)
@@ -426,6 +449,9 @@
}
var package = FindPackageForAsset(location);
+
+ Debug.LogError($"[YooAssetService] LoadAssetAsync: Loading asset '{location}' of package '{package.PackageName}'.");
+
return await ExecuteWithRetryAsync(async () =>
{
var handle = package.LoadAssetAsync(location, type, priority);
@@ -446,23 +472,7 @@
[System.Obsolete("Use LoadAssetAsync instead. Sync loading will be removed in US2.")]
public T LoadAssetSync<T>(string location) where T : UnityEngine.Object
{
- ThrowIfNotInitialized();
-
- if (string.IsNullOrEmpty(location))
- {
- Debug.LogError("[YooAssetService] LoadAssetSync: location is null or empty.");
- return null;
- }
-
- var package = FindPackageForAsset(location);
- var handle = package.LoadAssetSync<T>(location);
- if (handle.Status != EOperationStatus.Succeed)
- {
- Debug.LogError($"[YooAssetService] LoadAssetSync failed for '{location}': {handle.LastError}");
- return null;
- }
-
- return handle.GetAssetObject<T>();
+ throw new NotSupportedException("鍚屾璧勬簮鍔犺浇鎺ュ彛宸茬鐢紝璇蜂娇鐢ㄥ紓姝PI");
}
/// <inheritdoc />
diff --git a/Main/System/Arena/ArenaBattleFailWin.cs b/Main/System/Arena/ArenaBattleFailWin.cs
index 1ddaa6a..79e6b61 100644
--- a/Main/System/Arena/ArenaBattleFailWin.cs
+++ b/Main/System/Arena/ArenaBattleFailWin.cs
@@ -71,11 +71,16 @@
PlayerDatas.Instance.baseData.face,
PlayerDatas.Instance.baseData.facePic));
enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic));
- enemyAvatarCell.SetListener(() =>
+ enemyAvatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ if (this == null) return;
+ enemyAvatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
+
txtMyName.text = PlayerDatas.Instance.baseData.PlayerName;
txtEnemyName.text = UIHelper.ServerStringTrim(info.PlayerName);
txtMyScore.text = Language.Get("Arena17", atkAddScore);
diff --git a/Main/System/Arena/ArenaBattleVictoryWin.cs b/Main/System/Arena/ArenaBattleVictoryWin.cs
index 50311df..4a47ea3 100644
--- a/Main/System/Arena/ArenaBattleVictoryWin.cs
+++ b/Main/System/Arena/ArenaBattleVictoryWin.cs
@@ -65,9 +65,13 @@
PlayerDatas.Instance.baseData.face,
PlayerDatas.Instance.baseData.facePic));
enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic));
- enemyAvatarCell.SetListener(() =>
+ enemyAvatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ if (this == null) return;
+ enemyAvatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
txtMyName.text = PlayerDatas.Instance.baseData.PlayerName;
diff --git a/Main/System/Arena/ArenaChallengeCell.cs b/Main/System/Arena/ArenaChallengeCell.cs
index 5ba1544..8a2dc2c 100644
--- a/Main/System/Arena/ArenaChallengeCell.cs
+++ b/Main/System/Arena/ArenaChallengeCell.cs
@@ -33,9 +33,12 @@
arenaMatchInfo = list[index];
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaMatchInfo.PlayerID, (int)arenaMatchInfo.Face, (int)arenaMatchInfo.FacePic));
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)arenaMatchInfo.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ avatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)arenaMatchInfo.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
txtName.text = UIHelper.ServerStringTrim(arenaMatchInfo.PlayerName);
diff --git a/Main/System/Arena/ArenaHeroHead.cs b/Main/System/Arena/ArenaHeroHead.cs
index 01e96eb..f3f7cfb 100644
--- a/Main/System/Arena/ArenaHeroHead.cs
+++ b/Main/System/Arena/ArenaHeroHead.cs
@@ -15,16 +15,18 @@
var heroSkinConfig = HeroSkinConfig.Get(skinID);
imgQuality.SetSprite("heroheadBG" + heroConfig.Quality);
- var sprite = UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon);
- if (sprite == null)
+ UILoader.LoadSpriteAsync("HeroHead", heroSkinConfig.SquareIcon).ContinueWith(sprite =>
{
- // 鍐呯綉鏈厤缃椂
- imgHeadIcon.SetSprite("herohead_default");
- }
- else
- {
- imgHeadIcon.overrideSprite = sprite;
- }
+ if (this == null) return;
+ if (sprite == null)
+ {
+ imgHeadIcon.SetSprite("herohead_default");
+ }
+ else
+ {
+ imgHeadIcon.overrideSprite = sprite;
+ }
+ }).Forget();
txtHeroLv.text = Language.Get("Arena22", heroLv);
}
diff --git a/Main/System/Arena/ArenaPlayerRankCell.cs b/Main/System/Arena/ArenaPlayerRankCell.cs
index d4f1d64..1c65ba4 100644
--- a/Main/System/Arena/ArenaPlayerRankCell.cs
+++ b/Main/System/Arena/ArenaPlayerRankCell.cs
@@ -51,9 +51,12 @@
officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
avatarCell.SetActive(true);
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ avatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
nameText.text = rankData.name1;
rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue));
diff --git a/Main/System/Arena/ArenaPlayerTop3Cell.cs b/Main/System/Arena/ArenaPlayerTop3Cell.cs
index 3df9027..9e9e306 100644
--- a/Main/System/Arena/ArenaPlayerTop3Cell.cs
+++ b/Main/System/Arena/ArenaPlayerTop3Cell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -24,7 +25,7 @@
rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue));
nameText.text = rankData.name1;
officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
- model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 1);
+ model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 1).Forget();
queryPlayerBtn.SetListener(() =>
{
AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)BattlePreSetType.Arena);
diff --git a/Main/System/Arena/ArenaRecordCell.cs b/Main/System/Arena/ArenaRecordCell.cs
index 36decc3..a362d67 100644
--- a/Main/System/Arena/ArenaRecordCell.cs
+++ b/Main/System/Arena/ArenaRecordCell.cs
@@ -65,9 +65,12 @@
}
avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaGameRec.Value3, (int)arenaGameRec.Value5, (int)arenaGameRec.Value6));
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)arenaGameRec.Value3, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ avatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)arenaGameRec.Value3, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
txtName.text = arenaGameRec.Name;
txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaGameRec.FightPower);
diff --git a/Main/System/Arena/ArenaWin.cs b/Main/System/Arena/ArenaWin.cs
index c5da720..2fcd521 100644
--- a/Main/System/Arena/ArenaWin.cs
+++ b/Main/System/Arena/ArenaWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class ArenaWin : UIBase
{
@@ -23,16 +24,16 @@
protected override void InitComponent()
{
base.InitComponent();
- btnAward.SetListener(() => UIManager.Instance.OpenWindow<ArenaAwardWin>());
+ btnAward.SetListener(() => UIManager.Instance.OpenWindowAsync<ArenaAwardWin>().Forget());
btnRecord.SetListener(() =>
{
ArenaManager.Instance.SendViewGameRecPack();
- UIManager.Instance.OpenWindow<ArenaRecordWin>();
+ UIManager.Instance.OpenWindowAsync<ArenaRecordWin>().Forget();
});
btnChallage.SetListener(() =>
{
ArenaManager.Instance.SendArenaMatch();
- UIManager.Instance.OpenWindow<ArenaChallengeWin>();
+ UIManager.Instance.OpenWindowAsync<ArenaChallengeWin>().Forget();
});
funPresetBtn.AddListener(()=>
{
diff --git a/Main/System/Arena/HeroCountryComponent.cs b/Main/System/Arena/HeroCountryComponent.cs
index 10f3d5b..9b43506 100644
--- a/Main/System/Arena/HeroCountryComponent.cs
+++ b/Main/System/Arena/HeroCountryComponent.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class HeroCountryComponent : MonoBehaviour
{
@@ -15,7 +16,7 @@
{
HeroUIManager.Instance.isCustonHeroFormation = true;
HeroUIManager.Instance.custonTeamHeroes = teamHeroes;
- UIManager.Instance.OpenWindow<HeroFormationWin>();
+ UIManager.Instance.OpenWindowAsync<HeroFormationWin>().Forget();
});
}
diff --git a/Main/System/AssetVersion/AssetVersionUtility.cs b/Main/System/AssetVersion/AssetVersionUtility.cs
index cb0faa2..96dbc31 100644
--- a/Main/System/AssetVersion/AssetVersionUtility.cs
+++ b/Main/System/AssetVersion/AssetVersionUtility.cs
@@ -5,6 +5,7 @@
using System.IO;
using System.Threading;
using System.Linq;
+using Cysharp.Threading.Tasks;
public class AssetVersionUtility
{
@@ -72,8 +73,10 @@
{
if (task.IsDone)
{
- PriorBundleConfig.LazyInit();
- GetAssetVersionFile();
+ PriorBundleConfig.LazyInitAsync().ContinueWith(() =>
+ {
+ GetAssetVersionFile();
+ }).Forget();
}
else
{
@@ -87,7 +90,7 @@
{
if (task.IsDone)
{
- OPConfigConfig.LazyInit();
+ OPConfigConfig.LazyInitAsync().Forget();
}
else
{
diff --git a/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs b/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
index bf430c0..2ec532b 100644
--- a/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
+++ b/Main/System/AssetVersion/DownLoadAndDiscompressHotTask.cs
@@ -73,7 +73,7 @@
if (totalSize > BYTE_PER_MILLIONBYTE)
{
- UIManager.Instance.OpenWindow<DownLoadWin>();
+ UIManager.Instance.OpenWindowAsync<DownLoadWin>().Forget();
}
else
{
diff --git a/Main/System/AssetVersion/InGameDownLoad.cs b/Main/System/AssetVersion/InGameDownLoad.cs
index 6635633..2581672 100644
--- a/Main/System/AssetVersion/InGameDownLoad.cs
+++ b/Main/System/AssetVersion/InGameDownLoad.cs
@@ -255,7 +255,7 @@
state = State.Prepared;
}
dominantState = Dominant.Whole;
- UIManager.Instance.OpenWindow<InGameDownLoadWin>();
+ UIManager.Instance.OpenWindowAsync<InGameDownLoadWin>().Forget();
break;
}
}
diff --git a/Main/System/AssetVersion/InGameDownLoadProgress.cs b/Main/System/AssetVersion/InGameDownLoadProgress.cs
index 53e6e82..dc6d038 100644
--- a/Main/System/AssetVersion/InGameDownLoadProgress.cs
+++ b/Main/System/AssetVersion/InGameDownLoadProgress.cs
@@ -129,10 +129,10 @@
case InGameDownLoad.State.None:
case InGameDownLoad.State.Pause:
case InGameDownLoad.State.Prepared:
- UIManager.Instance.OpenWindow<InGameDownLoadWin>();
+ UIManager.Instance.OpenWindowAsync<InGameDownLoadWin>().Forget();
break;
case InGameDownLoad.State.Award:
- UIManager.Instance.OpenWindow<InGameDownLoadWin>();
+ UIManager.Instance.OpenWindowAsync<InGameDownLoadWin>().Forget();
break;
case InGameDownLoad.State.Completed:
break;
diff --git a/Main/System/Attribute/AttributeManager.cs b/Main/System/Attribute/AttributeManager.cs
index bcd92ba..fb87b23 100644
--- a/Main/System/Attribute/AttributeManager.cs
+++ b/Main/System/Attribute/AttributeManager.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
public class AttributeManager : GameSystemManager<AttributeManager>
{
@@ -8,7 +8,7 @@
this.totalAttrDict = totalAttrDict;
if (!UIManager.Instance.IsOpened<TotalAttributeWin>())
{
- UIManager.Instance.OpenWindow<TotalAttributeWin>(functionOrder);
+ UIManager.Instance.OpenWindowAsync<TotalAttributeWin>(functionOrder).Forget();
}
}
@@ -23,7 +23,7 @@
simpleAttrTitleName = Language.Get(string.IsNullOrEmpty(titleNameKey) ? "AttributeTitle00" : titleNameKey);
if (!UIManager.Instance.IsOpened<SimpleAttributeWin>())
{
- UIManager.Instance.OpenWindow<SimpleAttributeWin>();
+ UIManager.Instance.OpenWindowAsync<SimpleAttributeWin>().Forget();
}
}
@@ -46,7 +46,7 @@
skillList.Sort();
if (!UIManager.Instance.IsOpened<SimpleMinggeAttributeWin>())
{
- UIManager.Instance.OpenWindow<SimpleMinggeAttributeWin>();
+ UIManager.Instance.OpenWindowAsync<SimpleMinggeAttributeWin>().Forget();
}
}
diff --git a/Main/System/Attribute/TotalAttributeWin.cs b/Main/System/Attribute/TotalAttributeWin.cs
index 7bdebba..ed1a0b8 100644
--- a/Main/System/Attribute/TotalAttributeWin.cs
+++ b/Main/System/Attribute/TotalAttributeWin.cs
@@ -89,7 +89,7 @@
{
SmallTipWin.showText = PlayerPropertyConfig.Get(id).desc;
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
}
diff --git a/Main/System/Battle/ArenaBattleWin.cs b/Main/System/Battle/ArenaBattleWin.cs
index 5150f26..0a25800 100644
--- a/Main/System/Battle/ArenaBattleWin.cs
+++ b/Main/System/Battle/ArenaBattleWin.cs
@@ -73,7 +73,7 @@
}
else
{
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
}
if (isClickSkip)
@@ -204,9 +204,12 @@
txtEnemyName.text = UIHelper.ServerStringTrim(info.PlayerName);
txtEnemyFightPonit.text = UIHelper.ReplaceLargeArtNum(GetFightPonit(enemyTeam));
enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)info.PlayerID, (int)info.Face, (int)info.FacePic));
- enemyAvatarCell.SetListener(() =>
+ enemyAvatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)info.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ enemyAvatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)info.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
var team = GetTeamHeroList(enemyTeam);
enemyCountry.RefreshOnTeamCountry(team, true);
diff --git a/Main/System/Battle/BaseBattleWin.cs b/Main/System/Battle/BaseBattleWin.cs
index 8a7e672..b39f7d3 100644
--- a/Main/System/Battle/BaseBattleWin.cs
+++ b/Main/System/Battle/BaseBattleWin.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -83,7 +84,7 @@
cell.Init(buffData, () =>
{
// 鐐瑰嚮buff鍥炬爣 鏄剧ずbuff鎻忚堪/褰撳墠韬笂鎵�鏈塨uff
- });
+ }).Forget();
}
else
{
@@ -180,7 +181,7 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get((int)buff.SkillID)?.SkillName, SkillConfig.Get((int)buff.SkillID)?.Description);
SmallTipWin.worldPos = cell.transform.position;
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
protected virtual void UnbindMingge()
@@ -340,7 +341,7 @@
BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
if (null == ui)
{
- ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
+ ui = UIManager.Instance.OpenWindowAsync<BattleHUDWin>().Forget();
}
ui.SetBattleField(battleField);
@@ -610,7 +611,7 @@
protected virtual void PlayBackGroundMusic()
{
- SoundPlayer.Instance.PlayBackGroundMusic(39);
+ SoundPlayer.Instance.PlayBackGroundMusic(39).Forget();
}
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/ArenaBattleField.cs b/Main/System/Battle/BattleField/ArenaBattleField.cs
index 6c263ce..f0286e2 100644
--- a/Main/System/Battle/BattleField/ArenaBattleField.cs
+++ b/Main/System/Battle/BattleField/ArenaBattleField.cs
@@ -1,7 +1,8 @@
-using System;
+锘縰sing System;
using LitJson;
using UnityEngine;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
public class ArenaBattleField : BattleField
@@ -9,7 +10,6 @@
protected int chapter;// 绔犺妭
protected int wave;// 娉㈡暟
protected int level;// 鍏冲崱
- protected JsonData extendData;
protected MainChapterConfig chapterConfig;
@@ -20,10 +20,10 @@
}
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
- base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
chapter = FuncLineID / 10000;
wave = MapID == 1 ? FuncLineID % 100 : 1;//绗嚑娉㈡��
@@ -79,7 +79,7 @@
if (UIManager.Instance.IsOpened<ArenaBattleWin>())
{
UIManager.Instance.CloseWindow<ArenaBattleWin>();
- UIManager.Instance.OpenWindow<ArenaWin>();
+ UIManager.Instance.OpenWindowAsync<ArenaWin>().Forget();
}
}
@@ -109,7 +109,7 @@
ArenaBattleWin fsBattleWin = UIManager.Instance.GetUI<ArenaBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<ArenaBattleWin>();
+ fsBattleWin = UIManager.Instance.OpenWindowAsync<ArenaBattleWin>().Forget();
}
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 a670582..04293c2 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -88,13 +88,6 @@
{
guid = _guid;
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy constructor, use CreateAsync for new code
- GameObject go = ResManager.Instance.LoadAsset<GameObject>("Battle/Prefabs", "BattleRootNode");
- #pragma warning restore CS0618
- GameObject battleRootNodeGO = GameObject.Instantiate(go);
- battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>();
- battleRootNodeGO.name = this.GetType().Name;
-
battleObjMgr = new BattleObjMgr();
battleEffectMgr = new BattleEffectMgr();
battleTweenMgr = new BattleTweenMgr();
@@ -107,30 +100,13 @@
/// <summary>
/// US2: Static async factory method. Creates BattleField with async resource loading.
/// </summary>
- public static async UniTask<BattleField> CreateAsync(string _guid)
+ public async UniTask LoadRoot()
{
- var field = new BattleField(_guid, skipResourceLoad: true);
GameObject go = await ResManager.Instance.LoadAssetAsync<GameObject>("Battle/Prefabs", "BattleRootNode");
GameObject battleRootNodeGO = GameObject.Instantiate(go);
- field.battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>();
- battleRootNodeGO.name = field.GetType().Name;
- return field;
+ battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>();
+ battleRootNodeGO.name = GetType().Name;
}
-
- /// <summary>
- /// US2: Protected constructor without resource loading (for async factory).
- /// </summary>
- protected BattleField(string _guid, bool skipResourceLoad)
- {
- guid = _guid;
- battleObjMgr = new BattleObjMgr();
- battleEffectMgr = new BattleEffectMgr();
- battleTweenMgr = new BattleTweenMgr();
- recordPlayer = new RecordPlayer();
- soundManager = new BattleSoundManager(this);
- processingDeathObjIds = new HashSet<uint>();
- }
-
public void AddCastingSkill(long objID, SkillBase skill)
{
List<SkillBase> skillBases = null;
@@ -167,7 +143,7 @@
return castingSkillDict.ContainsKey(objID);
}
- public virtual void Init(int _MapID, int _FuncLineID, JsonData _extendData,
+ public async virtual UniTask Init(int _MapID, int _FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte _turnMax)
{
SetData(_MapID, _FuncLineID, _extendData, _redTeamList, _blueTeamList, _turnMax);
@@ -177,15 +153,15 @@
if (blueTeamList == null)
{
- battleObjMgr.Init(this, redTeamList[redTeamIndex], null);
+ await battleObjMgr.Init(this, redTeamList[redTeamIndex], null);
HaveRest();
}
else
{
- battleObjMgr.Init(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]);
+ await battleObjMgr.Init(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]);
}
- LoadMap(MapID);
+ await LoadMap(MapID);
SetBattleStartState();
SetRootNodePosition();
@@ -235,7 +211,7 @@
}
- public virtual void Reload(int _MapID, int _FuncLineID, JsonData _extendData,
+ public async virtual UniTask Reload(int _MapID, int _FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte _turnMax)
{
SetData(_MapID, _FuncLineID, _extendData, _redTeamList, _blueTeamList, _turnMax);
@@ -245,15 +221,15 @@
if (blueTeamList == null)
{
- battleObjMgr.Reload(this, redTeamList[redTeamIndex], null);
+ await battleObjMgr.Reload(this, redTeamList[redTeamIndex], null);
HaveRest();
}
else
{
- battleObjMgr.Reload(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]);
+ await battleObjMgr.Reload(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]);
}
- LoadMap(MapID);
+ await LoadMap(MapID);
SetBattleStartState();
@@ -327,22 +303,7 @@
}
}
- protected virtual void LoadMap(int mapID)
- {
- BattleMapConfig battleMapConfig = BattleMapConfig.Get(mapID);
- if (battleMapConfig != null)
- {
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use LoadMapAsync
- Texture texture = ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", battleMapConfig.MapBg);
- #pragma warning restore CS0618
- battleRootNode.SetBackground(texture);
- }
- }
-
- /// <summary>
- /// US2: Async map loading.
- /// </summary>
- protected virtual async UniTask LoadMapAsync(int mapID)
+ protected virtual async UniTask LoadMap(int mapID)
{
BattleMapConfig battleMapConfig = BattleMapConfig.Get(mapID);
if (battleMapConfig != null)
@@ -352,6 +313,7 @@
}
}
+
public void SetSpeedRatio(float ratio)
{
bool isChange = speedRatio != ratio;
diff --git a/Main/System/Battle/BattleField/BoneBattleField.cs b/Main/System/Battle/BattleField/BoneBattleField.cs
index e861272..1ed3adb 100644
--- a/Main/System/Battle/BattleField/BoneBattleField.cs
+++ b/Main/System/Battle/BattleField/BoneBattleField.cs
@@ -1,20 +1,20 @@
+锘縰sing Cysharp.Threading.Tasks;
using LitJson;
using System.Collections.Generic;
using System.Linq;
public class BoneBattleField : BattleField
{
- protected JsonData extendData;
protected MainLevelConfig levelConfig;
public BoneBattleField(string _guid) : base(_guid)
{
}
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
- base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
int level = FuncLineID;// 鍏冲崱
extendData = _extendData;
@@ -67,7 +67,7 @@
if (UIManager.Instance.IsOpened<BoneFieldBattleWin>())
{
UIManager.Instance.CloseWindow<BoneFieldBattleWin>();
- UIManager.Instance.OpenWindow<BoneFieldWin>();
+ UIManager.Instance.OpenWindowAsync<BoneFieldWin>().Forget();
}
}
@@ -95,7 +95,7 @@
BoneFieldBattleWin fsBattleWin = UIManager.Instance.GetUI<BoneFieldBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<BoneFieldBattleWin>();
+ fsBattleWin = UIManager.Instance.OpenWindowAsync<BoneFieldBattleWin>().Forget();
}
fsBattleWin.SetBattleField(this);
diff --git a/Main/System/Battle/BattleField/StoryBattleField.cs b/Main/System/Battle/BattleField/StoryBattleField.cs
index c64f4a6..e7b2852 100644
--- a/Main/System/Battle/BattleField/StoryBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBattleField.cs
@@ -37,10 +37,10 @@
}
- public override void Init(int _MapID, int _FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int _MapID, int _FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte _turnMax)
{
- base.Init(_MapID, _FuncLineID, _extendData, _redTeamList, _blueTeamList, _turnMax);
+ await base.Init(_MapID, _FuncLineID, _extendData, _redTeamList, _blueTeamList, _turnMax);
// 闃叉閲嶅娉ㄥ唽鐨勯棶棰�
TeamManager.Instance.OnTeamChange += OnTeamChange;
@@ -74,21 +74,7 @@
lastPresetID = TeamManager.Instance.GetMainTeamID();
}
- protected override void LoadMap(int mapID)
- {
- if (chapterConfig != null)
- {
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use LoadMapAsync
- Texture texture = ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", chapterConfig.MapBG);
- #pragma warning restore CS0618
- battleRootNode.SetBackground(texture);
- }
- }
-
- /// <summary>
- /// US2: Async map loading.
- /// </summary>
- protected override async UniTask LoadMapAsync(int mapID)
+ protected override async UniTask LoadMap(int mapID)
{
if (chapterConfig != null)
{
@@ -97,6 +83,7 @@
}
}
+
public override void Release()
{
base.Release();
diff --git a/Main/System/Battle/BattleField/StoryBossBattleField.cs b/Main/System/Battle/BattleField/StoryBossBattleField.cs
index 32e8ec9..5d3ec7d 100644
--- a/Main/System/Battle/BattleField/StoryBossBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBossBattleField.cs
@@ -1,8 +1,9 @@
-using System;
+锘縰sing System;
using LitJson;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
public class StoryBossBattleField : BattleField
@@ -16,7 +17,7 @@
}
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
int level = FuncLineID;// 鍏冲崱
@@ -24,16 +25,16 @@
levelConfig = MainLevelConfig.Get(level);
chapterConfig = MainChapterConfig.Get(levelConfig.ChapterID);
- base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
SetBattleMode(BattleMode.Record);
}
- protected override void LoadMap(int mapID)
+ protected override async UniTask LoadMap(int mapID)
{
if (chapterConfig != null)
{
- Texture texture = ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", chapterConfig.MapBG);
+ Texture texture = await ResManager.Instance.LoadAssetAsync<Texture>("Texture/FullScreenBg", chapterConfig.MapBG);
battleRootNode.SetBackground(texture);
}
}
@@ -129,7 +130,7 @@
StoryBossBattleWin fsBattleWin = UIManager.Instance.GetUI<StoryBossBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<StoryBossBattleWin>();
+ fsBattleWin = UIManager.Instance.OpenWindowAsync<StoryBossBattleWin>().Forget();
}
fsBattleWin.SetBattleField(this);
}
diff --git a/Main/System/Battle/BattleField/TianziBillboradBattleField.cs b/Main/System/Battle/BattleField/TianziBillboradBattleField.cs
index 68fba4c..52688eb 100644
--- a/Main/System/Battle/BattleField/TianziBillboradBattleField.cs
+++ b/Main/System/Battle/BattleField/TianziBillboradBattleField.cs
@@ -1,3 +1,4 @@
+锘縰sing Cysharp.Threading.Tasks;
using LitJson;
using System;
using System.Collections.Generic;
@@ -5,17 +6,16 @@
public class TianziBillboradBattleField : BattleField
{
- protected JsonData extendData;
protected MainLevelConfig levelConfig;
public TianziBillboradBattleField(string _guid) : base(_guid)
{
}
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
- base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
TianziBillboradManager.Instance.battleLineID = TianziBillboradManager.Instance.todayLineID;
int level = FuncLineID;// 鍏冲崱
@@ -69,7 +69,7 @@
if (UIManager.Instance.IsOpened<TianziBillboradBattleWin>())
{
UIManager.Instance.CloseWindow<TianziBillboradBattleWin>();
- UIManager.Instance.OpenWindow<TianziBillboradWin>();
+ UIManager.Instance.OpenWindowAsync<TianziBillboradWin>().Forget();
}
}
@@ -97,7 +97,7 @@
TianziBillboradBattleWin fsBattleWin = UIManager.Instance.GetUI<TianziBillboradBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<TianziBillboradBattleWin>();
+ fsBattleWin = UIManager.Instance.OpenWindowAsync<TianziBillboradBattleWin>().Forget();
}
fsBattleWin.SetBattleField(this);
diff --git a/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs b/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs
index d9b5c39..1724d87 100644
--- a/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs
+++ b/Main/System/Battle/BattleField/WarlordPavilionBattleField.cs
@@ -1,20 +1,20 @@
+锘縰sing Cysharp.Threading.Tasks;
using LitJson;
using System.Collections.Generic;
using System.Linq;
public class WarlordPavilionBattleField : BattleField
{
- protected JsonData extendData;
protected MainLevelConfig levelConfig;
public WarlordPavilionBattleField(string _guid) : base(_guid)
{
}
WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } }
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+ public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax)
{
- base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
+ await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax);
int level = FuncLineID;// 鍏冲崱
extendData = _extendData;
@@ -90,7 +90,7 @@
WarlordPavilionBattleWin fsBattleWin = UIManager.Instance.GetUI<WarlordPavilionBattleWin>();// as FullScreenBattleWin;
if (null == fsBattleWin)
{
- fsBattleWin = UIManager.Instance.OpenWindow<WarlordPavilionBattleWin>();
+ fsBattleWin = UIManager.Instance.OpenWindowAsync<WarlordPavilionBattleWin>().Forget();
}
fsBattleWin.SetBattleField(this);
diff --git a/Main/System/Battle/BattleFieldFactory.cs b/Main/System/Battle/BattleFieldFactory.cs
index d752c89..3363314 100644
--- a/Main/System/Battle/BattleFieldFactory.cs
+++ b/Main/System/Battle/BattleFieldFactory.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
using LitJson;
using System;
using System.Collections;
@@ -7,7 +8,7 @@
public static class BattleFieldFactory
{
- public static BattleField CreateBattleField(string guid, int MapID, int FuncLineID, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
+ public static async UniTask<BattleField> CreateBattleField(string guid, int MapID, int FuncLineID, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
{
BattleField battleField = null;
@@ -36,6 +37,8 @@
break;
}
+ await battleField.LoadRoot();
+
return battleField;
}
diff --git a/Main/System/Battle/BattleHUDWin.cs b/Main/System/Battle/BattleHUDWin.cs
index 8bc9877..9caf522 100644
--- a/Main/System/Battle/BattleHUDWin.cs
+++ b/Main/System/Battle/BattleHUDWin.cs
@@ -25,6 +25,8 @@
private BattleField battleField;
private List<DamageContent> damageContentList = new List<DamageContent>();
+ private bool isPoolReady = false;
+
protected override void InitComponent()
{
base.InitComponent();
@@ -76,19 +78,12 @@
EventBroadcast.Instance.RemoveListener<string, JsonData>(EventName.BATTLE_END, OnBattleEnd);
}
- private void InitializePools()
- {
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use InitializePoolsAsync
- damagePrefabPool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("DamageContent"));
- #pragma warning restore CS0618
- }
-
- private async UniTask InitializePoolsAsync()
+ private async void InitializePools()
{
damagePrefabPool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("DamageContent"));
- if (this == null) return;
}
+
public void SetBattleField(BattleField _battleField)
{
CleanupBattleField();
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index b961f00..684a399 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using LitJson;
using System;
@@ -497,7 +497,7 @@
}
#endregion
- public BattleField CreateBattleField(string guid, HB424_tagSCTurnFightInit vNetData, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
+ public async UniTask<BattleField> CreateBattleField(string guid, HB424_tagSCTurnFightInit vNetData, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
{
BattleField battleField = null;
@@ -534,7 +534,7 @@
if (isCreate)
{
- battleField = BattleFieldFactory.CreateBattleField(guid, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+ battleField = await BattleFieldFactory.CreateBattleField(guid, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
if (string.IsNullOrEmpty(guid))
{
@@ -542,12 +542,12 @@
}
battleFields.Add(guid, battleField);
onBattleFieldCreate?.Invoke(guid, battleField);
- battleField.Init(MapID, FuncLineID, extendData, redTeamList, blueTeamList, vNetData.TurnMax);
+ await battleField.Init(MapID, FuncLineID, extendData, redTeamList, blueTeamList, vNetData.TurnMax);
}
else
{
- battleField.Reload(MapID, FuncLineID, extendData, redTeamList, blueTeamList, vNetData.TurnMax);
+ await battleField.Reload(MapID, FuncLineID, extendData, redTeamList, blueTeamList, vNetData.TurnMax);
}
@@ -700,7 +700,7 @@
Debug.Log("鎴樻枟鏃跺簭 鍙戣捣 " + Time.time);
if (mapID != 1)
{
- UIManager.Instance.OpenWindow<MapLoadingWin>();
+ UIManager.Instance.OpenWindowAsync<MapLoadingWin>().Forget();
}
}
diff --git a/Main/System/Battle/BattleObject/BattleObjMgr.cs b/Main/System/Battle/BattleObject/BattleObjMgr.cs
index 87813b2..9fdadf0 100644
--- a/Main/System/Battle/BattleObject/BattleObjMgr.cs
+++ b/Main/System/Battle/BattleObject/BattleObjMgr.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
+using Cysharp.Threading.Tasks;
public class BattleObjMgr
{
@@ -20,26 +21,26 @@
protected BattleField battleField;
- public void Init(BattleField _battleField, TeamBase _redTeam, TeamBase _blueTeam)
+ public async UniTask Init(BattleField _battleField, TeamBase _redTeam, TeamBase _blueTeam)
{
- Reload(_battleField, _redTeam, _blueTeam);
+ await Reload(_battleField, _redTeam, _blueTeam);
}
- public void Reload(BattleField _battleField, TeamBase _redTeam, TeamBase _blueTeam)
+ public async UniTask Reload(BattleField _battleField, TeamBase _redTeam, TeamBase _blueTeam)
{
Release();
battleField = _battleField;
- ReloadTeam(_redTeam, BattleCamp.Red);
- ReloadTeam(_blueTeam, BattleCamp.Blue, false); }
+ await ReloadTeam(_redTeam, BattleCamp.Red);
+ await ReloadTeam(_blueTeam, BattleCamp.Blue, false); }
- public void ReloadTeam(TeamBase teamBase, BattleCamp _camp, bool active = true)
+ public async UniTask ReloadTeam(TeamBase teamBase, BattleCamp _camp, bool active = true)
{
var posNodeList = _camp == BattleCamp.Red ? battleField.battleRootNode.redTeamNodeList : battleField.battleRootNode.blueTeamNodeList;
var campDict = _camp == BattleCamp.Red ? redCampDict : blueCampDict;
- CreateTeam(posNodeList, campDict, teamBase, _camp, active);
+ await CreateTeam(posNodeList, campDict, teamBase, _camp, active);
}
- protected void CreateTeam(List<GameObject> posNodeList, Dictionary<int, BattleObject> campDict, TeamBase teamBase, BattleCamp _Camp, bool active)
+ protected async UniTask CreateTeam(List<GameObject> posNodeList, Dictionary<int, BattleObject> campDict, TeamBase teamBase, BattleCamp _Camp, bool active)
{
DestroyTeam(campDict);
if (teamBase == null)
@@ -53,7 +54,7 @@
TeamHero teamHero = teamBase.serverHeroes[i];
if (teamHero != null)
{
- BattleObject battleObj = BattleObjectFactory.CreateBattleObject(battleField, posNodeList, teamHero, _Camp);
+ BattleObject battleObj = await BattleObjectFactory.CreateBattleObjectAsync(battleField, posNodeList, teamHero, _Camp);
battleObj.SetActive(active);
allBattleObjDict.Add(battleObj.ObjID, battleObj);
campDict.Add(battleObj.GetPositionNum(), battleObj);
diff --git a/Main/System/Battle/BattleObject/BattleObjectFactory.cs b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
index dacfe8e..229695b 100644
--- a/Main/System/Battle/BattleObject/BattleObjectFactory.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
@@ -22,84 +22,6 @@
return m_modelScaleRate;
}
}
- // 杩欓噷鎶ラ敊浜嗘鏌ヤ竴涓�
- public static BattleObject CreateBattleObject(BattleField _battleField, List<GameObject> posNodeList, TeamHero teamHero, BattleCamp _Camp)
- {
- var skinCfg = HeroSkinConfig.Get(teamHero.SkinID);
- if (skinCfg == null)
- {
- Debug.LogError($"BattleObjectFactory: skinCfg is null for SkinID {teamHero.SkinID}");
- return null;
- }
-
- // ===== 鐩存帴鍔犺浇璧勬簮锛堥潪棰勫姞杞界殑璧勬簮涓嶈蛋缂撳瓨绯荤粺锛�=====
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, async path exists in CreateBattleObjectAsync
- SkeletonDataAsset skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>(
- "Hero/SpineRes/",
- skinCfg.SpineRes
- );
- #pragma warning restore CS0618
-
- if (skeletonDataAsset == null)
- {
- Debug.LogError($"BattleObjectFactory: Failed to load SkeletonDataAsset for {skinCfg.SpineRes}");
- return null;
- }
-
- // Debug.LogError($"{teamHero.SkinID} : {skinCfg.SpineRes}");
-
- // ==============================================
-
- #pragma warning disable CS0618
- GameObject battleGO = ResManager.Instance.LoadAsset<GameObject>("Hero/SpineRes", "Hero_001"/*skinCfg.SpineRes*/);
- #pragma warning restore CS0618
-
- GameObject goParent = posNodeList[teamHero.positionNum];
- BattleObject battleObject = Produce(teamHero.positionNum, _battleField);
- battleObject.ObjID = teamHero.ObjID;
-
- GameObject realGO = GameObject.Instantiate(battleGO, goParent.transform);
- SkeletonAnimation skeletonAnimation = realGO.GetComponentInChildren<SkeletonAnimation>(true);
-
-
- float finalScaleRate = modelScaleRate * teamHero.modelScale;
-
- skeletonAnimation.initialSkinName = skinCfg.InitialSkinName;
- skeletonAnimation.skeletonDataAsset = skeletonDataAsset;
- skeletonAnimation.Initialize(true);
-
- // 鍒濆鍖栧畬鎴愬悗璁剧疆鐨偆
- if (!string.IsNullOrEmpty(skinCfg.InitialSkinName))
- {
- var skeleton = skeletonAnimation.Skeleton;
- skeleton.SetSkin(skinCfg.InitialSkinName);
- skeleton.SetSlotsToSetupPose();
- skeletonAnimation.Update(0);
- }
-
- realGO.name = battleObject.ObjID.ToString();
- realGO.transform.localScale = new Vector3(finalScaleRate, finalScaleRate, finalScaleRate);
- RectTransform rectTrans = realGO.GetComponent<RectTransform>();
- rectTrans.anchoredPosition = Vector2.zero;
-
- // HeroBattleObject 鎵嶆湁 GameObject 鍙傛暟鐨� Init 鏂规硶
- if (battleObject is HeroBattleObject heroBattleObject)
- {
- heroBattleObject.Init(realGO, teamHero, _Camp);
- }
- // 鍏朵粬绫诲瀷锛堝MinggeBattleObject锛変笉鍦ㄨ繖閲屽垱寤猴紝鏈夊崟鐙殑鍒涘缓閫昏緫
-
-#if UNITY_EDITOR
- BattleDebug.LogError(
- "鍒濆鍖� 鏈鍔�" +
- (battleObject.Camp == BattleCamp.Red ? "銆愮孩鏂广��" : "銆愯摑鏂广�� ") +
- $"姝﹀皢: {battleObject.GetName()}\n" +
- $"褰撳墠琛�閲�: {battleObject.GetCurHp()} -> 鏈�澶ц閲弡battleObject.GetMaxHp()}\n"
- );
-#endif
-
- return battleObject;
- }
/// <summary>
/// US2: Async version of CreateBattleObject.
diff --git a/Main/System/Battle/BattleObject/HeroBattleObject.cs b/Main/System/Battle/BattleObject/HeroBattleObject.cs
index 8b6f0ad..7db9465 100644
--- a/Main/System/Battle/BattleObject/HeroBattleObject.cs
+++ b/Main/System/Battle/BattleObject/HeroBattleObject.cs
@@ -8,6 +8,7 @@
using Spine.Unity;
using UnityEngine.UI;
using System.Linq;
+using Cysharp.Threading.Tasks;
public class HeroBattleObject : BattleObject
{
@@ -392,7 +393,7 @@
{
if (!buffMgr.isControled[BattleConst.HardControlGroup])
{
- battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX, false);
+ battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX, false).Forget();
motionBase.PlayAnimation(MotionName.hit, false);
}
}
@@ -444,7 +445,7 @@
motionBase.ShowIllusionShadow(false);
};
- battleField.soundManager.PlayEffectSound(BattleConst.DodgeSoundID);
+ battleField.soundManager.PlayEffectSound(BattleConst.DodgeSoundID).Forget();
battleField.battleTweenMgr.OnPlayTween(tween);
}
@@ -468,7 +469,7 @@
public override void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false)
{
buffMgr.RemoveAllBuff();
- battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false);
+ battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false).Forget();
if (withoutAnime)
{
SetDeath();
diff --git a/Main/System/Battle/BattleResources/BattleCacheManager.cs b/Main/System/Battle/BattleResources/BattleCacheManager.cs
index 1217833..f9716f3 100644
--- a/Main/System/Battle/BattleResources/BattleCacheManager.cs
+++ b/Main/System/Battle/BattleResources/BattleCacheManager.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using System.Collections.Generic;
using Spine.Unity;
+using Cysharp.Threading.Tasks;
public class BattleCacheManager
{
@@ -186,7 +187,7 @@
/// <summary>
/// 鑾峰彇鎴栧姞杞絊pine璧勬簮
/// </summary>
- public SkeletonDataAsset GetSpineResource(string directory, string assetName, string battleGuid = "")
+ public async UniTask<SkeletonDataAsset> GetSpineResource(string directory, string assetName, string battleGuid = "")
{
string key = $"{directory}/{assetName}";
@@ -197,7 +198,7 @@
// 鑷姩鍔犺浇
Debug.LogWarning($"BattleCacheManager: Spine cache miss for {key}, loading on-demand...");
- var asset = ResManager.Instance.LoadAsset<SkeletonDataAsset>(directory, assetName);
+ var asset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>(directory, assetName);
if (asset != null)
{
@@ -221,7 +222,7 @@
/// <summary>
/// 鑾峰彇鎴栧姞杞紸udio璧勬簮
/// </summary>
- public AudioClip GetAudioResource(string directory, string assetName, string battleGuid = "")
+ public async UniTask<AudioClip> GetAudioResource(string directory, string assetName, string battleGuid = "")
{
string key = $"{directory}/{assetName}";
@@ -232,7 +233,7 @@
// 鑷姩鍔犺浇
Debug.LogWarning($"BattleCacheManager: Audio cache miss for {key}, loading on-demand...");
- var asset = ResManager.Instance.LoadAsset<AudioClip>(directory, assetName, false);
+ var asset = await ResManager.Instance.LoadAssetAsync<AudioClip>(directory, assetName, false);
if (asset != null)
{
diff --git a/Main/System/Battle/BattleResources/BattlePreloadManager.cs b/Main/System/Battle/BattleResources/BattlePreloadManager.cs
index b0ee233..3c331cb 100644
--- a/Main/System/Battle/BattleResources/BattlePreloadManager.cs
+++ b/Main/System/Battle/BattleResources/BattlePreloadManager.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using Spine.Unity;
+using Cysharp.Threading.Tasks;
public class BattlePreloadManager
{
@@ -184,12 +185,9 @@
{
string key = identifier.GetKey();
- ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>(
- identifier.Directory,
- identifier.AssetName,
- (success, asset) =>
+ ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>(identifier.Directory, identifier.AssetName).ContinueWith((asset) =>
{
- if (success && asset != null)
+ if (asset != null)
{
var skeletonData = asset as SkeletonDataAsset;
if (skeletonData != null)
@@ -205,7 +203,7 @@
}
onComplete?.Invoke();
}
- );
+ ).Forget();
}
private void LoadAudioAsync(BattleResCache.ResourceIdentifier identifier, string battleGuid, Action onComplete)
@@ -214,10 +212,10 @@
ResManager.Instance.LoadAssetAsync<AudioClip>(
identifier.Directory,
- identifier.AssetName,
- (success, asset) =>
+ identifier.AssetName).ContinueWith(
+ (asset) =>
{
- if (success && asset != null)
+ if (asset != null)
{
var audioClip = asset as AudioClip;
if (audioClip != null)
@@ -232,8 +230,7 @@
Debug.LogError($"BattlePreloadManager: Failed to load audio: {key}");
}
onComplete?.Invoke();
- },
- false // needExt = false
- );
+ }
+ ).Forget();
}
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleResources/BattleResManager.cs b/Main/System/Battle/BattleResources/BattleResManager.cs
index 548a9d3..266bb7a 100644
--- a/Main/System/Battle/BattleResources/BattleResManager.cs
+++ b/Main/System/Battle/BattleResources/BattleResManager.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using Spine.Unity;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鎴樻枟璧勬簮鎬荤鐞嗗櫒
@@ -31,16 +32,16 @@
/// <summary>
/// 鑾峰彇Spine璧勬簮
/// </summary>
- public SkeletonDataAsset GetSpineResource(string directory, string assetName, string battleGuid = "")
+ public async UniTask<SkeletonDataAsset> GetSpineResource(string directory, string assetName, string battleGuid = "")
{
- return preloadManager.CacheManager.GetSpineResource(directory, assetName, battleGuid);
+ return await preloadManager.CacheManager.GetSpineResource(directory, assetName, battleGuid);
}
/// <summary>
/// 鑾峰彇闊抽璧勬簮
/// </summary>
- public AudioClip GetAudioResource(string directory, string assetName, string battleGuid = "")
+ public async UniTask<AudioClip> GetAudioResource(string directory, string assetName, string battleGuid = "")
{
- return preloadManager.CacheManager.GetAudioResource(directory, assetName, battleGuid);
+ return await preloadManager.CacheManager.GetAudioResource(directory, assetName, battleGuid);
}
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleWin.cs b/Main/System/Battle/BattleWin.cs
index d38bfbb..221b3c2 100644
--- a/Main/System/Battle/BattleWin.cs
+++ b/Main/System/Battle/BattleWin.cs
@@ -148,7 +148,12 @@
if (null == ui)
{
- ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
+ UIManager.Instance.OpenWindowAsync<BattleHUDWin>().ContinueWith(w =>
+ {
+ w.SetBattleField(battleField);
+ battleField.UpdateCanvas(canvas);
+ }).Forget();
+ return;
}
ui.SetBattleField(battleField);
diff --git a/Main/System/Battle/BoneFieldBattleWin.cs b/Main/System/Battle/BoneFieldBattleWin.cs
index 0a0c529..647569d 100644
--- a/Main/System/Battle/BoneFieldBattleWin.cs
+++ b/Main/System/Battle/BoneFieldBattleWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BoneFieldBattleWin : BaseBattleWin
{
@@ -45,7 +46,7 @@
}
else
{
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
}
if (bossBattleObject != null)
@@ -239,8 +240,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 3988cad..ba8647d 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -4,6 +4,7 @@
using Spine;
using System.Linq;
using System;
+using Cysharp.Threading.Tasks;
public class SkillBase
{
@@ -268,7 +269,7 @@
if (skillSkinConfig.SkinllSFX1 != 0)
{
- battleField.soundManager.PlayEffectSound(skillSkinConfig.SkinllSFX1, false);
+ battleField.soundManager.PlayEffectSound(skillSkinConfig.SkinllSFX1, false).Forget();
}
if (caster != null)
@@ -415,7 +416,7 @@
{
if (skillSkinConfig.CastDistance < 9999 && skillSkinConfig.SkinllSFX2 != 0)
{
- battleField.soundManager.PlayEffectSound(skillSkinConfig.SkinllSFX2, false);
+ battleField.soundManager.PlayEffectSound(skillSkinConfig.SkinllSFX2, false).Forget();
}
TurnBack(() =>
diff --git a/Main/System/Battle/Sound/BattleSoundManager.cs b/Main/System/Battle/Sound/BattleSoundManager.cs
index e52c232..ee5f0aa 100644
--- a/Main/System/Battle/Sound/BattleSoundManager.cs
+++ b/Main/System/Battle/Sound/BattleSoundManager.cs
@@ -122,19 +122,19 @@
/// 鎾斁鐗规晥闊虫晥
/// </summary>
/// <param name="audioId">闊虫晥ID</param>
- public void PlayEffectSound(int audioId, bool pitchControl = true)
+ public async UniTask PlayEffectSound(int audioId, bool pitchControl = true)
{
if (audioId <= 0)
{
return;
}
- PlaySound(audioId, pitchControl);
+ await PlaySound(audioId, pitchControl);
}
/// <summary>
/// 鏍稿績鎾斁鏂规硶
/// </summary>
- private void PlaySound(int audioId, bool pitchControl)
+ private async UniTask PlaySound(int audioId, bool pitchControl)
{
// 妫�鏌ユ槸鍚︽湁鐒︾偣锛屾棤鐒︾偣鏃朵笉鎾斁
if (!hasFocus)
@@ -150,7 +150,7 @@
return;
}
- var audioClip = GetAudioClip(audioId);
+ var audioClip = await GetAudioClip(audioId);
if (audioClip == null)
{
Debug.Log($"<color=red>BattleSoundManager [{battleField.guid}]: 鏃犳硶鍔犺浇闊虫晥 {audioId}</color>");
@@ -203,11 +203,11 @@
/// <summary>
/// 鑾峰彇闊抽鍓緫锛堟瘡娆′粠ResManager鍔犺浇锛屼緷璧栧叾鍐呴儴缂撳瓨锛�
/// </summary>
- private AudioClip GetAudioClip(int audioId)
+ private async UniTask<AudioClip> GetAudioClip(int audioId)
{
// 涓嶅湪姝ゅ缂撳瓨锛岀洿鎺ヤ粠 ResManager 鍔犺浇
// ResManager 鍐呴儴浼氬鐞嗙紦瀛橈紝杩欐牱鍙互閬垮厤 AudioClip 澶辨晥闂
- return LoadAudioClip(audioId);
+ return await LoadAudioClipAsync(audioId);
}
/// <summary>
@@ -226,26 +226,6 @@
// 妫�鏌ュ悓鏃舵挱鏀剧殑鏁伴噺
return sources.Count < MAX_SAME_AUDIO_COUNT;
- }
-
- /// <summary>
- /// 鍔犺浇闊抽鍓緫
- /// </summary>
- private AudioClip LoadAudioClip(int audioId)
- {
- var config = AudioConfig.Get(audioId);
- if (config == null)
- return null;
-
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback, use LoadAudioClipAsync
- AudioClip audioClip = ResManager.Instance.LoadAsset<AudioClip>(
- "Audio/" + config.Folder,
- config.Audio,
- false
- );
- #pragma warning restore CS0618
-
- return audioClip;
}
/// <summary>
diff --git a/Main/System/Battle/StoryBossBattleWin.cs b/Main/System/Battle/StoryBossBattleWin.cs
index b24b89f..10b32b7 100644
--- a/Main/System/Battle/StoryBossBattleWin.cs
+++ b/Main/System/Battle/StoryBossBattleWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class StoryBossBattleWin : BaseBattleWin
{
@@ -33,7 +34,7 @@
base.OnPreClose();
UIManager.Instance.OnOpenWindow -= OnOpenWindow;
if (!UIManager.Instance.IsOpened<MainWin>())
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
if (null != bossBattleObject)
{
@@ -219,8 +220,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/System/Battle/TianziBillboradBattleWin.cs b/Main/System/Battle/TianziBillboradBattleWin.cs
index 8983e62..d586287 100644
--- a/Main/System/Battle/TianziBillboradBattleWin.cs
+++ b/Main/System/Battle/TianziBillboradBattleWin.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using LitJson;
using UnityEngine;
using UnityEngine.UI;
@@ -64,7 +65,7 @@
}
else
{
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
}
if (bossBattleObject != null)
@@ -131,14 +132,24 @@
- private void OnStageUp(int stage)
+ private async void OnStageUp(int stage)
{
GameObject hero = bossBattleObject.GetGameObject();
if (hero == null || stage <= 1)
return;
- GameObject prefab = UIUtility.CreateWidget("TianziBillboradBox", "TianziBillboradBox");
+ GameObject prefab = await UIUtility.CreateWidget("TianziBillboradBox", "TianziBillboradBox");
+
+ if (this == null || prefab == null)
+ {
+ if (null != prefab)
+ {
+ DestroyImmediate(prefab);
+ }
+ return;
+ }
+
prefab.transform.SetParentEx(hero.transform, Vector3.zero, Quaternion.identity, Vector3.one);
TianziBillboradBox boxAnimator = prefab.GetComponent<TianziBillboradBox>();
if (boxAnimator != null)
@@ -289,8 +300,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
@@ -325,6 +336,6 @@
protected override void PlayBackGroundMusic()
{
- SoundPlayer.Instance.PlayBackGroundMusic(40);
+ SoundPlayer.Instance.PlayBackGroundMusic(40).Forget();
}
}
diff --git a/Main/System/Battle/UIComp/BattleBuffCell.cs b/Main/System/Battle/UIComp/BattleBuffCell.cs
index 5376f81..90e2946 100644
--- a/Main/System/Battle/UIComp/BattleBuffCell.cs
+++ b/Main/System/Battle/UIComp/BattleBuffCell.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System;
+using Cysharp.Threading.Tasks;
public class BattleBuffCell : MonoBehaviour
{
@@ -51,7 +52,7 @@
GameObject cellContainer;
- private void LoadPrefab()
+ private async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -65,7 +66,16 @@
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("BattleBuffCell", "Container_BuffCell");
+ cellContainer = await UIUtility.CreateWidget("BattleBuffCell", "Container_BuffCell");
+ if (this == null)
+ {
+ if (null != cellContainer)
+ {
+ DestroyImmediate(cellContainer);
+ }
+ return;
+ }
+
if (cellContainer != null)
{
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
@@ -92,13 +102,13 @@
// cellContainer.transform.localScale = cellContainer.transform.localScale * scale;
}
- public void Init(HB428_tagSCBuffRefresh buffData, Action onclick = null, bool showType = false)
+ public async UniTask Init(HB428_tagSCBuffRefresh buffData, Action onclick = null, bool showType = false)
{
if (null == buffData || gameObject == null)
{
return;
}
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
var config = SkillConfig.Get((int)buffData.SkillID);
if (config == null)
{
diff --git a/Main/System/Battle/UIComp/BattleHeroInfoBar.cs b/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
index 6872a06..bc3e8c8 100644
--- a/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
+++ b/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
@@ -3,6 +3,7 @@
using UnityEngine.UI;
using System;
using DG.Tweening;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鎴樻枟瑙掕壊淇℃伅鏍�
@@ -191,7 +192,7 @@
cell.Init(buffData, () =>
{
// 鐐瑰嚮buff鍥炬爣 鏄剧ずbuff鎻忚堪/褰撳墠韬笂鎵�鏈塨uff
- });
+ }).Forget();
}
else
{
diff --git a/Main/System/Battle/UIComp/BossHeadCell.cs b/Main/System/Battle/UIComp/BossHeadCell.cs
index 9d2caea..a6d6b0d 100644
--- a/Main/System/Battle/UIComp/BossHeadCell.cs
+++ b/Main/System/Battle/UIComp/BossHeadCell.cs
@@ -23,7 +23,14 @@
}
HeroSkinConfig heroSkinConfig = teamHero.skinConfig;
- imgIcon.sprite = UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon);
+ UILoader.LoadSpriteAsync("HeroHead", heroSkinConfig.SquareIcon).ContinueWith(sprite =>
+ {
+ if (imgIcon == null || this == null)
+ {
+ return;
+ }
+ imgIcon.sprite = sprite;
+ }).Forget();
txtLv.text = Language.Get("Arena22", teamHero.level);
// TODO YYL
diff --git a/Main/System/Battle/UIComp/MinggeBuffCell.cs b/Main/System/Battle/UIComp/MinggeBuffCell.cs
index bd49b47..56454ca 100644
--- a/Main/System/Battle/UIComp/MinggeBuffCell.cs
+++ b/Main/System/Battle/UIComp/MinggeBuffCell.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System;
+using Cysharp.Threading.Tasks;
public class MinggeBuffCell : MonoBehaviour
{
@@ -51,7 +52,7 @@
GameObject cellContainer;
- private void LoadPrefab()
+ private async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -65,7 +66,15 @@
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("MinggeBuffCell", "Container_BuffCell");
+ cellContainer = await UIUtility.CreateWidget("MinggeBuffCell", "Container_BuffCell");
+ if (this == null)
+ {
+ if (null != cellContainer)
+ {
+ DestroyImmediate(cellContainer);
+ }
+ return;
+ }
if (cellContainer != null)
{
cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
@@ -92,13 +101,18 @@
// cellContainer.transform.localScale = cellContainer.transform.localScale * scale;
}
- public void Init(HB428_tagSCBuffRefresh buffData, Action onclick = null, bool showType = false)
+ public async UniTask Init(HB428_tagSCBuffRefresh buffData, Action onclick = null, bool showType = false)
{
if (null == buffData || gameObject == null)
{
return;
}
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (null == this || cellContainer == null)
+ {
+ return;
+ }
+
var config = SkillConfig.Get((int)buffData.SkillID);
if (config == null)
{
diff --git a/Main/System/Battle/UIComp/SkillTips.cs b/Main/System/Battle/UIComp/SkillTips.cs
index d9648fb..ac68de4 100644
--- a/Main/System/Battle/UIComp/SkillTips.cs
+++ b/Main/System/Battle/UIComp/SkillTips.cs
@@ -35,9 +35,15 @@
KillAllTweens();
- imgIcon.sprite = UILoader.LoadSprite("HeroHead", teamHero.skinConfig.SquareIcon);
- imgSkillName.sprite = UILoader.LoadSprite("SkillNameIcon", skillConfig.SkillTipsName);
- imgSkillName.SetNativeSize();
+ UILoader.LoadSprite("HeroHead", teamHero.skinConfig.SquareIcon, imgIcon).Forget();
+ UILoader.LoadSprite("SkillNameIcon", skillConfig.SkillTipsName, imgSkillName).ContinueWith(() =>
+ {
+ if (this == null || imgSkillName == null)
+ {
+ return;
+ }
+ imgSkillName.SetNativeSize();
+ }).Forget();
// 淇濊瘉寮�濮嬫椂鎵�鏈夊浘鐗囦负鍙锛坅lpha=1锛�
if (imageBg != null) { var c = imageBg.color; c.a = 1f; imageBg.color = c; }
if (imgIcon != null) { var c = imgIcon.color; c.a = 1f; imgIcon.color = c; }
diff --git a/Main/System/Battle/UIComp/TotalDamageDisplayer.cs b/Main/System/Battle/UIComp/TotalDamageDisplayer.cs
index 24a077b..5e48926 100644
--- a/Main/System/Battle/UIComp/TotalDamageDisplayer.cs
+++ b/Main/System/Battle/UIComp/TotalDamageDisplayer.cs
@@ -46,8 +46,8 @@
heal += h;
}
textDamage.text = BattleUtility.DisplayDamageNum(heal, BattleConst.BattleTotalRecoverType);
- damageBackground.sprite = UILoader.LoadSprite("Fight", "Fight1_img_83");
- imgTotalDesc.sprite = UILoader.LoadSprite("Fight", "Fight1_img_80");
+ UILoader.LoadSprite("Fight", "Fight1_img_83", damageBackground).Forget();
+ UILoader.LoadSprite("Fight", "Fight1_img_80", imgTotalDesc).Forget();
}
else if (dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsType(DamageType.Realdamage))
{
@@ -57,8 +57,8 @@
damage += d;
}
textDamage.text = BattleUtility.DisplayDamageNum(damage, BattleConst.BattleTotalDamageType);
- imgTotalDesc.sprite = UILoader.LoadSprite("Fight", "Fight1_img_85");
- damageBackground.sprite = UILoader.LoadSprite("Fight", "Fight1_img_88");
+ UILoader.LoadSprite("Fight", "Fight1_img_85", imgTotalDesc).Forget();
+ UILoader.LoadSprite("Fight", "Fight1_img_88", damageBackground).Forget();
}
else
{
diff --git a/Main/System/Battle/WarlordPavilionBattleWin.cs b/Main/System/Battle/WarlordPavilionBattleWin.cs
index 54d2d7b..14dc843 100644
--- a/Main/System/Battle/WarlordPavilionBattleWin.cs
+++ b/Main/System/Battle/WarlordPavilionBattleWin.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionBattleWin : BaseBattleWin
{
@@ -45,7 +46,7 @@
}
else
{
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
}
if (bossBattleObject != null)
@@ -242,8 +243,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/System/BattleDetail/BattleDetailHeroInfoItem.cs b/Main/System/BattleDetail/BattleDetailHeroInfoItem.cs
index 1556664..9948c6a 100644
--- a/Main/System/BattleDetail/BattleDetailHeroInfoItem.cs
+++ b/Main/System/BattleDetail/BattleDetailHeroInfoItem.cs
@@ -47,15 +47,19 @@
imgHeadBg.SetSprite("heroheadBG" + heroConfig.Quality);
- var sprite = UILoader.LoadSprite("HeroHead", skinConfig.SquareIcon);
- if (sprite == null)
+ UILoader.LoadSpriteAsync("HeroHead", skinConfig.SquareIcon).ContinueWith(sprite =>
{
- imgHead.SetSprite("herohead_default");
- }
- else
- {
- imgHead.overrideSprite = sprite;
- }
+ if (this == null || imgHead == null) return;
+ if (sprite == null)
+ {
+ imgHead.SetSprite("herohead_default");
+ }
+ else
+ {
+ imgHead.overrideSprite = sprite;
+ }
+ }).Forget();
+
imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
txtHeroName.text = heroConfig.Name;
diff --git a/Main/System/BattlePass/BattlePassBaseCell.cs b/Main/System/BattlePass/BattlePassBaseCell.cs
index db08dbd..c7b9090 100644
--- a/Main/System/BattlePass/BattlePassBaseCell.cs
+++ b/Main/System/BattlePass/BattlePassBaseCell.cs
@@ -20,7 +20,7 @@
redPoint.redpointId = MainRedDot.RedPoint_FundKey * 100 + type;
btn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<BattlePassCommonWin>(type);
+ UIManager.Instance.OpenWindowAsync<BattlePassCommonWin>(type).Forget();
});
}
diff --git a/Main/System/BeautyMM/BeautyMMActiveWin.cs b/Main/System/BeautyMM/BeautyMMActiveWin.cs
index cffa2cc..753dd61 100644
--- a/Main/System/BeautyMM/BeautyMMActiveWin.cs
+++ b/Main/System/BeautyMM/BeautyMMActiveWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -26,7 +26,7 @@
SmallTipWin.showText = mmConfig.Desc;
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
}
diff --git a/Main/System/BeautyMM/BeautyMMBaseWin.cs b/Main/System/BeautyMM/BeautyMMBaseWin.cs
index 048ea6c..e6af6da 100644
--- a/Main/System/BeautyMM/BeautyMMBaseWin.cs
+++ b/Main/System/BeautyMM/BeautyMMBaseWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -11,12 +11,12 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<BeautyMMListWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<BeautyMMListWin>().Forget();
ylBG.SetActive(false);
break;
case 1:
// 鍏呭�肩晫闈�
- currentSubUI = UIManager.Instance.OpenWindow<BeautyMMTravelWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<BeautyMMTravelWin>().Forget();
ylBG.SetActive(true);
break;
default:
diff --git a/Main/System/BeautyMM/BeautyMMCell.cs b/Main/System/BeautyMM/BeautyMMCell.cs
index aaa3bd1..55124ca 100644
--- a/Main/System/BeautyMM/BeautyMMCell.cs
+++ b/Main/System/BeautyMM/BeautyMMCell.cs
@@ -104,7 +104,7 @@
mmBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<BeautyMMShowWin>(mmID);
+ UIManager.Instance.OpenWindowAsync<BeautyMMShowWin>(mmID).Forget();
});
}
diff --git a/Main/System/BeautyMM/BeautyMMManager.cs b/Main/System/BeautyMM/BeautyMMManager.cs
index b8781dc..73668e5 100644
--- a/Main/System/BeautyMM/BeautyMMManager.cs
+++ b/Main/System/BeautyMM/BeautyMMManager.cs
@@ -151,11 +151,11 @@
if (activeMMID > 0)
{
- UIManager.Instance.OpenWindow<BeautyMMActiveWin>(activeMMID);
+ UIManager.Instance.OpenWindowAsync<BeautyMMActiveWin>(activeMMID).Forget();
}
else if (activeSkinID > 0)
{
- UIManager.Instance.OpenWindow<BeautyMMSkinActiveWin>(activeSkinID);
+ UIManager.Instance.OpenWindowAsync<BeautyMMSkinActiveWin>(activeSkinID).Forget();
}
}
diff --git a/Main/System/BeautyMM/BeautyMMShowWin.cs b/Main/System/BeautyMM/BeautyMMShowWin.cs
index 08c5fa3..803c858 100644
--- a/Main/System/BeautyMM/BeautyMMShowWin.cs
+++ b/Main/System/BeautyMM/BeautyMMShowWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -56,7 +56,7 @@
SmallTipWin.showText = mmConfig.Desc;
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
leftBtn.AddListener(() =>
@@ -88,12 +88,12 @@
skinBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<BeautyMMSkinWin>(mmID);
+ UIManager.Instance.OpenWindowAsync<BeautyMMSkinWin>(mmID).Forget();
});
seeAttrBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<BeautyMMTalentWin>(mmID);
+ UIManager.Instance.OpenWindowAsync<BeautyMMTalentWin>(mmID).Forget();
});
activeBtn.AddListener(ActiveMM);
@@ -136,7 +136,7 @@
var nowRank = mmData != null ? mmData.LV / BeautyMMManager.Instance.needLVForTalent : 0;
if (beforeRank != nowRank)
{
- UIManager.Instance.OpenWindow<BeautyMMUpgradeWin>(mmID);
+ UIManager.Instance.OpenWindowAsync<BeautyMMUpgradeWin>(mmID).Forget();
}
Display();
}
diff --git a/Main/System/BeautyMM/BeautyMMTravelCell.cs b/Main/System/BeautyMM/BeautyMMTravelCell.cs
index 20464d9..43a9f48 100644
--- a/Main/System/BeautyMM/BeautyMMTravelCell.cs
+++ b/Main/System/BeautyMM/BeautyMMTravelCell.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -122,7 +123,7 @@
////鐘舵�侊細0-鏈偣鍑伙紱1-宸插紑鍚紱2-瑁傜汗
if (grid.State == 0 || grid.State == 2)
{
- SoundPlayer.Instance.PlayUIAudio(25);
+ SoundPlayer.Instance.PlayUIAudio(25).Forget();
if (BeautyMMManager.Instance.m_Energy == 0)
{
SysNotifyMgr.Instance.ShowTip("BeautyMM4");
diff --git a/Main/System/BeautyMM/BeautyMMTravelWin.cs b/Main/System/BeautyMM/BeautyMMTravelWin.cs
index c695d90..0a68e2d 100644
--- a/Main/System/BeautyMM/BeautyMMTravelWin.cs
+++ b/Main/System/BeautyMM/BeautyMMTravelWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -99,7 +100,7 @@
}
else if (result == 4 && BeautyMMManager.Instance.m_SceneryLVInfo == 0)
{
- SoundPlayer.Instance.PlayUIAudio(23);
+ SoundPlayer.Instance.PlayUIAudio(23).Forget();
}
}
diff --git a/Main/System/BillboardRank/GuildRankCell.cs b/Main/System/BillboardRank/GuildRankCell.cs
index e88568d..09d9d32 100644
--- a/Main/System/BillboardRank/GuildRankCell.cs
+++ b/Main/System/BillboardRank/GuildRankCell.cs
@@ -52,7 +52,7 @@
if (!UIManager.Instance.IsOpened<GuildPreviewWin>())
{
- UIManager.Instance.OpenWindow<GuildPreviewWin>(familyID);
+ UIManager.Instance.OpenWindowAsync<GuildPreviewWin>(familyID).Forget();
}
});
}
diff --git a/Main/System/BillboardRank/GuildTop3Cell.cs b/Main/System/BillboardRank/GuildTop3Cell.cs
index ed97c8a..8c35d1a 100644
--- a/Main/System/BillboardRank/GuildTop3Cell.cs
+++ b/Main/System/BillboardRank/GuildTop3Cell.cs
@@ -49,7 +49,7 @@
if (!UIManager.Instance.IsOpened<GuildPreviewWin>())
{
- UIManager.Instance.OpenWindow<GuildPreviewWin>(familyID);
+ UIManager.Instance.OpenWindowAsync<GuildPreviewWin>(familyID).Forget();
}
});
}
diff --git a/Main/System/BillboardRank/PlayerTop3Cell.cs b/Main/System/BillboardRank/PlayerTop3Cell.cs
index 90a1e91..f9d277e 100644
--- a/Main/System/BillboardRank/PlayerTop3Cell.cs
+++ b/Main/System/BillboardRank/PlayerTop3Cell.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Wednesday, September 26, 2018
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -29,7 +30,7 @@
rankValueText.text = RankModel.Instance.GetCmpValueStr(rankType, rankData.cmpValue);
nameText.text = rankData.name1;
officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
- model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f);
+ model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
{
AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id);
diff --git a/Main/System/BoneField/BoneFieldWin.cs b/Main/System/BoneField/BoneFieldWin.cs
index 47ec57b..1cce980 100644
--- a/Main/System/BoneField/BoneFieldWin.cs
+++ b/Main/System/BoneField/BoneFieldWin.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class BoneFieldWin : UIBase
{
[SerializeField] float modelSize;
@@ -289,8 +290,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/System/ChallengeTab/ArenaTabHandler.cs b/Main/System/ChallengeTab/ArenaTabHandler.cs
index 72d02ee..256eb12 100644
--- a/Main/System/ChallengeTab/ArenaTabHandler.cs
+++ b/Main/System/ChallengeTab/ArenaTabHandler.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using UnityEngine;
public class ArenaTabHandler : BaseChallengeTabHandler
@@ -31,7 +31,7 @@
ArenaBattleWin battleWin;
if (!UIManager.Instance.IsOpened<ArenaBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindow<ArenaBattleWin>();
+ battleWin = UIManager.Instance.OpenWindowAsync<ArenaBattleWin>().Forget();
}
else
{
@@ -41,7 +41,7 @@
}
else
{
- UIManager.Instance.OpenWindow<ArenaWin>();
+ UIManager.Instance.OpenWindowAsync<ArenaWin>().Forget();
}
}
diff --git a/Main/System/ChallengeTab/BoneFieldTabHandler.cs b/Main/System/ChallengeTab/BoneFieldTabHandler.cs
index d3f48a6..47f01cc 100644
--- a/Main/System/ChallengeTab/BoneFieldTabHandler.cs
+++ b/Main/System/ChallengeTab/BoneFieldTabHandler.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using UnityEngine;
public class BoneFieldTabHandler : BaseChallengeTabHandler
@@ -33,7 +33,7 @@
BoneFieldBattleWin battleWin;
if (!UIManager.Instance.IsOpened<BoneFieldBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindow<BoneFieldBattleWin>();
+ battleWin = UIManager.Instance.OpenWindowAsync<BoneFieldBattleWin>().Forget();
}
else
{
@@ -43,7 +43,7 @@
}
else
{
- UIManager.Instance.OpenWindow<BoneFieldWin>();
+ UIManager.Instance.OpenWindowAsync<BoneFieldWin>().Forget();
}
}
diff --git a/Main/System/ChallengeTab/TianziBillboradTabHandler.cs b/Main/System/ChallengeTab/TianziBillboradTabHandler.cs
index a432e2a..67e0d1c 100644
--- a/Main/System/ChallengeTab/TianziBillboradTabHandler.cs
+++ b/Main/System/ChallengeTab/TianziBillboradTabHandler.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using UnityEngine;
public class TianziBillboradTabHandler : BaseChallengeTabHandler
@@ -31,7 +31,7 @@
TianziBillboradBattleWin battleWin;
if (!UIManager.Instance.IsOpened<TianziBillboradBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindow<TianziBillboradBattleWin>();
+ battleWin = UIManager.Instance.OpenWindowAsync<TianziBillboradBattleWin>().Forget();
}
else
{
@@ -41,7 +41,7 @@
}
else
{
- UIManager.Instance.OpenWindow<TianziBillboradWin>();
+ UIManager.Instance.OpenWindowAsync<TianziBillboradWin>().Forget();
}
}
diff --git a/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs b/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs
index 2734406..5ad70eb 100644
--- a/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs
+++ b/Main/System/ChallengeTab/WarlordPavilionTabHandler.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
public class WarlordPavilionTabHandler : BaseChallengeTabHandler
@@ -31,7 +31,7 @@
WarlordPavilionBattleWin battleWin;
if (!UIManager.Instance.IsOpened<WarlordPavilionBattleWin>())
{
- battleWin = UIManager.Instance.OpenWindow<WarlordPavilionBattleWin>();
+ battleWin = UIManager.Instance.OpenWindowAsync<WarlordPavilionBattleWin>().Forget();
}
else
{
@@ -41,7 +41,7 @@
}
else
{
- UIManager.Instance.OpenWindow<TowerBaseWin>();
+ UIManager.Instance.OpenWindowAsync<TowerBaseWin>().Forget();
}
}
diff --git a/Main/System/Chat/ChatPlayerOtherCell.cs b/Main/System/Chat/ChatPlayerOtherCell.cs
index 5aa1011..c15f2cd 100644
--- a/Main/System/Chat/ChatPlayerOtherCell.cs
+++ b/Main/System/Chat/ChatPlayerOtherCell.cs
@@ -48,9 +48,12 @@
m_PlayerName.text = Language.Get("Chat08", serverName, data.Name);
}
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo((int)data.PlayerID, serverID: (int)data.ServerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ avatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo((int)data.PlayerID, serverID: (int)data.ServerID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
+ });
});
}
diff --git a/Main/System/ClientVersion/RequestSecretWin.cs b/Main/System/ClientVersion/RequestSecretWin.cs
index 51eb80d..8610d00 100644
--- a/Main/System/ClientVersion/RequestSecretWin.cs
+++ b/Main/System/ClientVersion/RequestSecretWin.cs
@@ -33,12 +33,12 @@
m_Fuwu.SetListener(() =>
{
// GameAgeWarnWin.data = 1;
- // UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ // UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
});
m_Yinsi.SetListener(() =>
{
// GameAgeWarnWin.data = 2;
- // UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ // UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
});
}
diff --git a/Main/System/ClientVersion/VersionUtility.cs b/Main/System/ClientVersion/VersionUtility.cs
index 4b1a20b..1ad3e53 100644
--- a/Main/System/ClientVersion/VersionUtility.cs
+++ b/Main/System/ClientVersion/VersionUtility.cs
@@ -1,4 +1,4 @@
-//--------------------------------------------------------
+锘�//--------------------------------------------------------
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Thursday, March 15, 2018
//--------------------------------------------------------
@@ -117,7 +117,7 @@
public void RequestApkDownConfigs()
{
// YLTODO
- // UIManager.Instance.OpenWindow<VersionUpdateWin>();
+ // UIManager.Instance.OpenWindowAsync<VersionUpdateWin>().Forget();
// // WindowCenter.Instance.OpenFromLocal<VersionUpdateWin>();
}
diff --git a/Main/System/CustomizedGift/CustomizedRechargeModel.cs b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
index dd09e16..e960f89 100644
--- a/Main/System/CustomizedGift/CustomizedRechargeModel.cs
+++ b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
@@ -154,7 +154,7 @@
//鍙嚜閫�
chooseWinIndex = index - goodsCount;
chooseCTGID = ctgID;
- UIManager.Instance.OpenWindow<CustomizedGiftChooseWin>();
+ UIManager.Instance.OpenWindowAsync<CustomizedGiftChooseWin>().Forget();
}
});
@@ -166,7 +166,7 @@
{
chooseWinIndex = index - goodsCount;
chooseCTGID = ctgID;
- UIManager.Instance.OpenWindow<CustomizedGiftChooseWin>();
+ UIManager.Instance.OpenWindowAsync<CustomizedGiftChooseWin>().Forget();
});
}
}
diff --git a/Main/System/DailySpecials/DailySpecialsBaseWin.cs b/Main/System/DailySpecials/DailySpecialsBaseWin.cs
index 66a9253..476f98f 100644
--- a/Main/System/DailySpecials/DailySpecialsBaseWin.cs
+++ b/Main/System/DailySpecials/DailySpecialsBaseWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using UnityEngine;
using UnityEngine.UI;
@@ -168,20 +168,20 @@
{
case 0:
// 姣忔棩鐗规儬
- currentSubUI = UIManager.Instance.OpenWindow<DailySpecialsWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsWin>().Forget();
break;
case 1:
// 鐗规儬鍟嗗煄
StoreModel.Instance.selectStoreFuncType = StoreFunc.SpecialStore;
- currentSubUI = UIManager.Instance.OpenWindow<DailySpecialsShopWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsShopWin>().Forget();
break;
case 2:
// 姣忔棩绀煎寘
- currentSubUI = UIManager.Instance.OpenWindow<DailySpecialsDayGiftWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsDayGiftWin>().Forget();
break;
case 3:
// 姣忓懆绀煎寘
- currentSubUI = UIManager.Instance.OpenWindow<DailySpecialsWeekGiftWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<DailySpecialsWeekGiftWin>().Forget();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/DayMission/DayMissionBaseWin.cs b/Main/System/DayMission/DayMissionBaseWin.cs
index 7ccb3f8..c2699f0 100644
--- a/Main/System/DayMission/DayMissionBaseWin.cs
+++ b/Main/System/DayMission/DayMissionBaseWin.cs
@@ -17,17 +17,17 @@
{
case 0:
//鏃ュ父浠诲姟
- currentSubUI = UIManager.Instance.OpenWindow<DayMissionWin>();
+ UIManager.Instance.OpenWindowAsync<DayMissionWin>().ContinueWith(w => currentSubUI = w).Forget();
titleText.text = Language.Get("DayMission2");
break;
case 1:
//鍛ㄥ鍔�
- currentSubUI = UIManager.Instance.OpenWindow<WeekBattlePassWin>();
+ UIManager.Instance.OpenWindowAsync<WeekBattlePassWin>().ContinueWith(w => currentSubUI = w).Forget();
titleText.text = Language.Get("DayMission3");
break;
case 2:
//涓荤嚎浠诲姟锛堣嫳闆勪箣璺級
- currentSubUI = UIManager.Instance.OpenWindow<MissionHeroRoadWin>();
+ UIManager.Instance.OpenWindowAsync<MissionHeroRoadWin>().ContinueWith(w => currentSubUI = w).Forget();
titleText.text = Language.Get("DayMission4");
break;
default:
diff --git a/Main/System/Debug/DebugController.cs b/Main/System/Debug/DebugController.cs
index 78c0fa3..0f232db 100644
--- a/Main/System/Debug/DebugController.cs
+++ b/Main/System/Debug/DebugController.cs
@@ -29,13 +29,13 @@
{
if (!UIManager.Instance.IsOpened<GMInputWin>())
{
- UIManager.Instance.OpenWindow<GMInputWin>();
+ UIManager.Instance.OpenWindowAsync<GMInputWin>().Forget();
}
}
public void OpenGMCommond()
{
- UIManager.Instance.OpenWindow<GMCmdPanel>();
+ UIManager.Instance.OpenWindowAsync<GMCmdPanel>().Forget();
}
public void CleanNewBranchSet()
diff --git a/Main/System/Debug/DebugUtility.cs b/Main/System/Debug/DebugUtility.cs
index 33953f7..6fc4385 100644
--- a/Main/System/Debug/DebugUtility.cs
+++ b/Main/System/Debug/DebugUtility.cs
@@ -87,11 +87,11 @@
}
- public void CreateDebugRoot()
+ public async UniTask CreateDebugRoot()
{
if (debugRoot == null)
{
- var prefab = BuiltInLoader.LoadPrefab("UIRootDebug");
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRootDebug");
debugRoot = GameObject.Instantiate(prefab);
MonoBehaviour.DontDestroyOnLoad(debugRoot);
debugRoot.name = "UIRootDebug";
diff --git a/Main/System/Dungeon/DungeonData.cs b/Main/System/Dungeon/DungeonData.cs
index e2ba073..356a544 100644
--- a/Main/System/Dungeon/DungeonData.cs
+++ b/Main/System/Dungeon/DungeonData.cs
@@ -24,7 +24,6 @@
{
return _lhs.mapId != _rhs.mapId || _lhs.lineId != _rhs.lineId;
}
-
}
public class DungeonResult
diff --git a/Main/System/Equip/BlessLVWin.cs b/Main/System/Equip/BlessLVWin.cs
index 9c3d647..b0d7f3a 100644
--- a/Main/System/Equip/BlessLVWin.cs
+++ b/Main/System/Equip/BlessLVWin.cs
@@ -35,14 +35,14 @@
timeUpBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<BlessLVTimeUpWin>();
+ UIManager.Instance.OpenWindowAsync<BlessLVTimeUpWin>().Forget();
});
upgradeButton.AddListener(OnUpgrade);
freeBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<BlessLVADWin>();
+ UIManager.Instance.OpenWindowAsync<BlessLVADWin>().Forget();
});
}
diff --git a/Main/System/Equip/EquipModel.cs b/Main/System/Equip/EquipModel.cs
index 548cb93..abd3c3e 100644
--- a/Main/System/Equip/EquipModel.cs
+++ b/Main/System/Equip/EquipModel.cs
@@ -262,7 +262,7 @@
// {
// // if (!UIManager.Instance.IsOpened<EquipExchangeWin>())
// // {
- // // UIManager.Instance.OpenWindow<EquipExchangeWin>();
+ // // UIManager.Instance.OpenWindowAsync<EquipExchangeWin>().Forget();
// // }
// //缁х画澶勭悊涓嬩竴浠惰澶� 閲嶆柊鍒ゆ柇
@@ -405,7 +405,7 @@
{
return false;
}
- UIManager.Instance.OpenWindow<EquipExchangeWin>();
+ UIManager.Instance.OpenWindowAsync<EquipExchangeWin>().Forget();
return true;
}
diff --git a/Main/System/FirstCharge/FirstChargeHeroInfoWin.cs b/Main/System/FirstCharge/FirstChargeHeroInfoWin.cs
index 59990e4..c8ca37f 100644
--- a/Main/System/FirstCharge/FirstChargeHeroInfoWin.cs
+++ b/Main/System/FirstCharge/FirstChargeHeroInfoWin.cs
@@ -1,4 +1,5 @@
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class FirstChargeHeroInfoWin : UIBase
{
@@ -20,13 +21,13 @@
{
SmallTipWin.showText = Language.Get("herocard47");
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
};
txtHeroAddPer.OnClick = () =>
{
SmallTipWin.showText = Language.Get("herocard48");
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
};
}
@@ -49,12 +50,12 @@
normalSkillCell.Init(heroInfo.heroConfig.AtkSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(heroInfo.heroId);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(heroInfo.heroId).Forget();
+ }, true).Forget();
angerSkillCell.Init(heroInfo.heroConfig.AngerSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(heroInfo.heroId);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(heroInfo.heroId).Forget();
+ }, true).Forget();
itemCell.Init(new ItemCellModel((int)FirstChargeManager.Instance.heroItemID, true, 1));
txtName.text = Language.Get("FirstCharge09", Language.Get("CommonQuality" + heroInfo.Quality),heroInfo.heroConfig.Name);
diff --git a/Main/System/FirstCharge/FirstChargeManager.cs b/Main/System/FirstCharge/FirstChargeManager.cs
index 68ece5d..78cb92a 100644
--- a/Main/System/FirstCharge/FirstChargeManager.cs
+++ b/Main/System/FirstCharge/FirstChargeManager.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
using UnityEngine;
@@ -157,7 +157,7 @@
SetLocalFailTime(TimeUtility.AllSeconds);
if (!UIManager.Instance.IsOpened<FirstChargeWin>())
{
- UIManager.Instance.OpenWindow<FirstChargeWin>();
+ UIManager.Instance.OpenWindowAsync<FirstChargeWin>().Forget();
}
}
// 濡傛灉鍚屼竴澶╁凡缁忔浜¤繃锛屽垯涓嶅脊绐�
diff --git a/Main/System/FirstCharge/FirstChargeWin.cs b/Main/System/FirstCharge/FirstChargeWin.cs
index 8a65f97..afcc7c9 100644
--- a/Main/System/FirstCharge/FirstChargeWin.cs
+++ b/Main/System/FirstCharge/FirstChargeWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class FirstChargeWin : FunctionsBaseWin
{
@@ -105,7 +106,7 @@
private void OnClickPreviewHero()
{
HeroUIManager.Instance.selectForPreviewHeroID = model.mainItemId;
- UIManager.Instance.OpenWindow<HeroBestWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestWin>().Forget();
}
private void InitRedPoint()
{
diff --git a/Main/System/FirstCharge/HeroShowLHWin.cs b/Main/System/FirstCharge/HeroShowLHWin.cs
index a465076..fe16948 100644
--- a/Main/System/FirstCharge/HeroShowLHWin.cs
+++ b/Main/System/FirstCharge/HeroShowLHWin.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -47,7 +48,7 @@
return;
}
var hero = HeroConfig.Get(heroID);
- roleLHModel.Create(hero.SkinIDList[0], 1, motionName: "", isLh: true);
+ roleLHModel.Create(hero.SkinIDList[0], 1, motionName: "", isLh: true).Forget();
qualityImg.SetSprite("HeroCallQuality" + hero.Quality);
newMarkLHImg.SetActive(HeroUIManager.Instance.IsNewHero(heroID));
showLHResultCell.Display(heroID, 0, true);
diff --git a/Main/System/FuncPreset/FuncPresetChooseCell.cs b/Main/System/FuncPreset/FuncPresetChooseCell.cs
index 7dbc9f8..9893811 100644
--- a/Main/System/FuncPreset/FuncPresetChooseCell.cs
+++ b/Main/System/FuncPreset/FuncPresetChooseCell.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
//鏂规棰勮 鏂规閫夋嫨缁勪欢
@@ -78,7 +78,7 @@
void ChangeName(int funcType, int id)
{
- UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(funcType*100 + id);
+ UIManager.Instance.OpenWindowAsync<FuncPresetChangeNameWin>(funcType*100 + id).Forget();
}
void Fold(int funcType, int id)
diff --git a/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs b/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs
index deee07c..7da5c76 100644
--- a/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs
+++ b/Main/System/FuncPreset/FuncPresetChooseMoreCell.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
//鏂规棰勮 鏂规閫夋嫨缁勪欢, 闅愯棌鐨勬柟妗�
@@ -62,7 +62,7 @@
void ChangeName(int funcType, int id)
{
- UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(funcType*100 + id);
+ UIManager.Instance.OpenWindowAsync<FuncPresetChangeNameWin>(funcType*100 + id).Forget();
}
diff --git a/Main/System/FuncPreset/FuncPresetManager.cs b/Main/System/FuncPreset/FuncPresetManager.cs
index 1652915..32d4e33 100644
--- a/Main/System/FuncPreset/FuncPresetManager.cs
+++ b/Main/System/FuncPreset/FuncPresetManager.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using LitJson;
using System;
@@ -333,17 +333,17 @@
{
if (battleType > 1)
{
- UIManager.Instance.OpenWindow<FuncPresetWin>(battleType);
+ UIManager.Instance.OpenWindowAsync<FuncPresetWin>(battleType).Forget();
return;
}
if (!IsOpen())
{
- UIManager.Instance.OpenWindow<FuncPresetUnLockWin>(battleType);
+ UIManager.Instance.OpenWindowAsync<FuncPresetUnLockWin>(battleType).Forget();
}
else
{
- UIManager.Instance.OpenWindow<FuncPresetWin>(battleType);
+ UIManager.Instance.OpenWindowAsync<FuncPresetWin>(battleType).Forget();
}
}
diff --git a/Main/System/FuncPreset/FuncPresetWin.cs b/Main/System/FuncPreset/FuncPresetWin.cs
index fadde68..8cd0ea3 100644
--- a/Main/System/FuncPreset/FuncPresetWin.cs
+++ b/Main/System/FuncPreset/FuncPresetWin.cs
@@ -34,13 +34,36 @@
}
globalPresetObj.SetActive(true);
});
- var presetObj = UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells");
- presetObj.transform.SetParentEx(heroCases, Vector3.zero, Quaternion.identity, Vector3.one);
- heroPresetCells = presetObj.GetComponent<FuncPresetChooseCells>();
+ UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells").ContinueWith(presetObj =>
+ {
+ if (this == null || presetObj == null)
+ {
+ if (presetObj != null)
+ {
+ GameObject.DestroyImmediate(presetObj);
+ }
+ return ;
+ }
- var presetObj1 = UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells");
- presetObj1.transform.SetParentEx(minggeCases, Vector3.zero, Quaternion.identity, Vector3.one);
- minggePresetCells = presetObj1.GetComponent<FuncPresetChooseCells>();
+ presetObj.transform.SetParentEx(heroCases, Vector3.zero, Quaternion.identity, Vector3.one);
+ heroPresetCells = presetObj.GetComponent<FuncPresetChooseCells>();
+ }).Forget();
+
+
+ UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells").ContinueWith(presetObj1 =>
+ {
+ if (this == null || presetObj1 == null)
+ {
+ if (presetObj1 != null)
+ {
+ GameObject.DestroyImmediate(presetObj1);
+ }
+ return ;
+ }
+ presetObj1.transform.SetParentEx(minggeCases, Vector3.zero, Quaternion.identity, Vector3.one);
+ minggePresetCells = presetObj1.GetComponent<FuncPresetChooseCells>();
+ }).Forget();
+
}
protected override void OnPreOpen()
diff --git a/Main/System/Gubao/GubaoBaseWin.cs b/Main/System/Gubao/GubaoBaseWin.cs
index eb93451..9989103 100644
--- a/Main/System/Gubao/GubaoBaseWin.cs
+++ b/Main/System/Gubao/GubaoBaseWin.cs
@@ -12,17 +12,17 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<GubaoListWin>();
+ UIManager.Instance.OpenWindowAsync<GubaoListWin>().ContinueWith(w => currentSubUI = w).Forget();
jbbg.SetActive(false);
bg.SetActive(true);
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<GubaoCallWin>();
+ UIManager.Instance.OpenWindowAsync<GubaoCallWin>().ContinueWith(w => currentSubUI = w).Forget();
jbbg.SetActive(true);
bg.SetActive(false);
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindow<GubaoSuiteListWin>();
+ UIManager.Instance.OpenWindowAsync<GubaoSuiteListWin>().ContinueWith(w => currentSubUI = w).Forget();
jbbg.SetActive(false);
bg.SetActive(true);
break;
diff --git a/Main/System/Gubao/GubaoCallWin.cs b/Main/System/Gubao/GubaoCallWin.cs
index 7b6734b..4f71b0f 100644
--- a/Main/System/Gubao/GubaoCallWin.cs
+++ b/Main/System/Gubao/GubaoCallWin.cs
@@ -77,8 +77,8 @@
skipToggle.isOn = LocalSave.GetBool(GubaoManager.skipKey + PlayerDatas.Instance.baseData.PlayerID, false);
opObj.SetActive(true);
resultObj.SetActive(false);
- timingGiftCell.InitUI();
-
+ timingGiftCell.InitUI().Forget();
+
ShowVenderTalk(0).Forget();
Display();
}
@@ -92,7 +92,7 @@
private void OnShowGiftIdListAddEvent()
{
- timingGiftCell.InitUI();
+ timingGiftCell.InitUI().Forget();
}
diff --git a/Main/System/Gubao/GubaoCell.cs b/Main/System/Gubao/GubaoCell.cs
index 276924d..64fb177 100644
--- a/Main/System/Gubao/GubaoCell.cs
+++ b/Main/System/Gubao/GubaoCell.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -45,7 +45,7 @@
{
gbBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GubaoDetailWin>(gubaoID);
+ UIManager.Instance.OpenWindowAsync<GubaoDetailWin>(gubaoID).Forget();
});
var config = GubaoConfig.Get(gubaoID);
diff --git a/Main/System/Gubao/GubaoManager.cs b/Main/System/Gubao/GubaoManager.cs
index 5d817d0..b8be16f 100644
--- a/Main/System/Gubao/GubaoManager.cs
+++ b/Main/System/Gubao/GubaoManager.cs
@@ -125,7 +125,7 @@
UpdateGubaoEvent?.Invoke();
if (DTC0403_tagPlayerLoginLoadOK.finishedLogin && waitActiveGubao != 0 && gubaoDict.ContainsKey(waitActiveGubao))
{
- UIManager.Instance.OpenWindow<GubaoActiveWin>(waitActiveGubao);
+ UIManager.Instance.OpenWindowAsync<GubaoActiveWin>(waitActiveGubao).Forget();
waitActiveGubao = 0;
}
RefreshAllAttr();
@@ -397,7 +397,7 @@
public void ShowTip(int gubaoID, int type)
{
tipType = type;
- UIManager.Instance.OpenWindow<GubaoTipWin>(gubaoID);
+ UIManager.Instance.OpenWindowAsync<GubaoTipWin>(gubaoID).Forget();
}
diff --git a/Main/System/Guild/GuildBaseWin.cs b/Main/System/Guild/GuildBaseWin.cs
index a8f700e..ab9cd79 100644
--- a/Main/System/Guild/GuildBaseWin.cs
+++ b/Main/System/Guild/GuildBaseWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
@@ -43,23 +43,23 @@
{
guildBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildHallWin>();
+ UIManager.Instance.OpenWindowAsync<GuildHallWin>().Forget();
});
requestBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildApplyListWin>();
+ UIManager.Instance.OpenWindowAsync<GuildApplyListWin>().Forget();
});
guildHawkerBtn.AddListener(OpenHawker);
storeBtn.AddListener(() =>
{
StoreModel.Instance.selectStoreFuncType = StoreFunc.Guild;
- UIManager.Instance.OpenWindow<StoreBaseWin>();
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>().Forget();
});
rankBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildRankWin>();
+ UIManager.Instance.OpenWindowAsync<GuildRankWin>().Forget();
});
InitHawker();
talkBtn.AddListener(OnClickTalkButton);
@@ -127,7 +127,7 @@
SysNotifyMgr.Instance.ShowTip("GuildSys17");
return;
}
- UIManager.Instance.OpenWindow<GuildHawkerWin>();
+ UIManager.Instance.OpenWindowAsync<GuildHawkerWin>().Forget();
}
void ShowHawkerTime(bool modelPlay = false)
@@ -221,7 +221,7 @@
{
ChatManager.Instance.nowChatTab = ChatTab.Guild;
ChatManager.Instance.nowChatChannel = ChatChannel.Guild;
- UIManager.Instance.OpenWindow<ChatWin>();
+ UIManager.Instance.OpenWindowAsync<ChatWin>().Forget();
}
public string GetGuildChatAreaContent(TalkData talkData)
diff --git a/Main/System/Guild/GuildBossHurtRankCell.cs b/Main/System/Guild/GuildBossHurtRankCell.cs
index 185a4e7..e631f92 100644
--- a/Main/System/Guild/GuildBossHurtRankCell.cs
+++ b/Main/System/Guild/GuildBossHurtRankCell.cs
@@ -45,9 +45,12 @@
int playerID = (int)rankData.Value1;
var playerData = GuildBossManager.Instance.GetMemberData(playerID);
avatarCell.InitUI(AvatarHelper.GetAvatarModel(playerID, playerData.Face, playerData.FacePic));
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- AvatarHelper.TryViewOtherPlayerInfo(playerID);
+ avatarCell.SetListener(() =>
+ {
+ AvatarHelper.TryViewOtherPlayerInfo(playerID);
+ });
});
officialTitleCell.InitUI(playerData.RealmLV, playerData.TitleID);
nameText.text = playerData.Name;
diff --git a/Main/System/Guild/GuildBossWin.cs b/Main/System/Guild/GuildBossWin.cs
index 656caba..45760a0 100644
--- a/Main/System/Guild/GuildBossWin.cs
+++ b/Main/System/Guild/GuildBossWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -93,16 +93,16 @@
bzBtn.AddListener(OnBzBtnClick);
bzRecordBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildBossPowerUPWin>();
+ UIManager.Instance.OpenWindowAsync<GuildBossPowerUPWin>().Forget();
});
atkBtn.AddListener(OnAtkBtnClick);
scoreBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildBossHurtRankWin>();
+ UIManager.Instance.OpenWindowAsync<GuildBossHurtRankWin>().Forget();
});
awardBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildBossAwardWin>();
+ UIManager.Instance.OpenWindowAsync<GuildBossAwardWin>().Forget();
});
bossModel.Create(GuildBossManager.Instance.bossSkinID, 1, motionName: "chuxian");
@@ -131,7 +131,7 @@
}
protected override void NextFrameAfterOpen()
{
- SoundPlayer.Instance.PlayUIAudio(28);
+ SoundPlayer.Instance.PlayUIAudio(28).Forget();
}
@@ -530,8 +530,13 @@
void InitAttack()
{
var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID(false));
- heroModel.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID(), 1.2f);
- heroModel.GetHero().SetSpeed(heroAtkSpeed);
+ heroModel.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID(), 1.2f).ContinueWith(() =>
+ {
+ if (this != null)
+ {
+ heroModel.GetHero().SetSpeed(heroAtkSpeed);
+ }
+ }).Forget();
for (int i = 0; i < hurtValues.Length; i++)
{
hurtValues[i].transform.localScale = Vector3.zero;
diff --git a/Main/System/Guild/GuildCreateWin.cs b/Main/System/Guild/GuildCreateWin.cs
index c63f925..5d1c3d8 100644
--- a/Main/System/Guild/GuildCreateWin.cs
+++ b/Main/System/Guild/GuildCreateWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -19,7 +19,7 @@
{
changeEmblemBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildEmblemWin>(1);
+ UIManager.Instance.OpenWindowAsync<GuildEmblemWin>(1).Forget();
});
createBtn.AddListener(CreateGuild);
}
diff --git a/Main/System/Guild/GuildDonateWin.cs b/Main/System/Guild/GuildDonateWin.cs
index dd5f759..9c78150 100644
--- a/Main/System/Guild/GuildDonateWin.cs
+++ b/Main/System/Guild/GuildDonateWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -17,7 +17,7 @@
{
detailBtn.AddListener(() =>
{
- // UIManager.Instance.OpenWindow<GuildDonateDetailWin>();
+ // UIManager.Instance.OpenWindowAsync<GuildDonateDetailWin>().Forget();
});
}
diff --git a/Main/System/Guild/GuildFuncCell.cs b/Main/System/Guild/GuildFuncCell.cs
index c74f66d..01e2686 100644
--- a/Main/System/Guild/GuildFuncCell.cs
+++ b/Main/System/Guild/GuildFuncCell.cs
@@ -41,7 +41,7 @@
if (funcID == (int)FuncOpenEnum.GuildBoss)
{
- UIManager.Instance.OpenWindow<GuildBossWin>();
+ UIManager.Instance.OpenWindowAsync<GuildBossWin>().Forget();
}
diff --git a/Main/System/Guild/GuildHallWin.cs b/Main/System/Guild/GuildHallWin.cs
index 7f34388..7a36f1e 100644
--- a/Main/System/Guild/GuildHallWin.cs
+++ b/Main/System/Guild/GuildHallWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -38,11 +38,11 @@
opBtn.AddListener(() =>
{
//绠$悊鎸夐挳
- UIManager.Instance.OpenWindow<GuildOPWin>();
+ UIManager.Instance.OpenWindowAsync<GuildOPWin>().Forget();
});
guildLVBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildLevelWin>();
+ UIManager.Instance.OpenWindowAsync<GuildLevelWin>().Forget();
});
noticeBtn.AddListener(() =>
@@ -50,13 +50,13 @@
var needLV = GuildManager.Instance.GetNeedGuildJobLV((int)GuildFuncType.PublishNotice);
if (PlayerDatas.Instance.fairyData.mine.FmLV >= needLV)
{
- UIManager.Instance.OpenWindow<GuildChangeBroadcastWin>();
+ UIManager.Instance.OpenWindowAsync<GuildChangeBroadcastWin>().Forget();
}
});
donateBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildDonateWin>();
+ UIManager.Instance.OpenWindowAsync<GuildDonateWin>().Forget();
});
}
diff --git a/Main/System/Guild/GuildHawkerWin.cs b/Main/System/Guild/GuildHawkerWin.cs
index 5439919..1e44da6 100644
--- a/Main/System/Guild/GuildHawkerWin.cs
+++ b/Main/System/Guild/GuildHawkerWin.cs
@@ -26,7 +26,7 @@
memberOnlineBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildHawkerNoCutWin>();
+ UIManager.Instance.OpenWindowAsync<GuildHawkerNoCutWin>().Forget();
});
cutBtn.AddListener(OnCut);
diff --git a/Main/System/Guild/GuildJoinWin.cs b/Main/System/Guild/GuildJoinWin.cs
index 476e0c3..d685dbd 100644
--- a/Main/System/Guild/GuildJoinWin.cs
+++ b/Main/System/Guild/GuildJoinWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -138,7 +138,7 @@
private void OnCreateGuildBtnClick()
{
- UIManager.Instance.OpenWindow<GuildCreateWin>();
+ UIManager.Instance.OpenWindowAsync<GuildCreateWin>().Forget();
}
private void OnQuicklyJoinGuildBtnClick()
diff --git a/Main/System/Guild/GuildMemberCell.cs b/Main/System/Guild/GuildMemberCell.cs
index 32cbf9c..05078b8 100644
--- a/Main/System/Guild/GuildMemberCell.cs
+++ b/Main/System/Guild/GuildMemberCell.cs
@@ -47,9 +47,12 @@
fightPowerText.text = UIHelper.ReplaceLargeArtNum(playerInfo.FightPower);
- avatarCell.AddListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- OtherPlayerDetailManager.Instance.ViewPlayerDetail(playerID, playerInfo.ServerID);
+ avatarCell.AddListener(() =>
+ {
+ OtherPlayerDetailManager.Instance.ViewPlayerDetail(playerID, playerInfo.ServerID);
+ });
});
contribText.text = playerInfo.ContribDay + "/" + playerInfo.ContribTotal;
diff --git a/Main/System/Guild/GuildOPWin.cs b/Main/System/Guild/GuildOPWin.cs
index 7e272b7..6cba609 100644
--- a/Main/System/Guild/GuildOPWin.cs
+++ b/Main/System/Guild/GuildOPWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -23,7 +23,7 @@
changeEmblemBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildEmblemWin>();
+ UIManager.Instance.OpenWindowAsync<GuildEmblemWin>().Forget();
});
changeNameBtn.AddListener(() =>
@@ -33,7 +33,7 @@
SysNotifyMgr.Instance.ShowTip("GuildSys16");
return;
}
- UIManager.Instance.OpenWindow<GuildChangeNameWin>();
+ UIManager.Instance.OpenWindowAsync<GuildChangeNameWin>().Forget();
});
quitBtn.AddListener(() =>
@@ -43,7 +43,7 @@
noteBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildNoteWin>();
+ UIManager.Instance.OpenWindowAsync<GuildNoteWin>().Forget();
});
}
diff --git a/Main/System/Guild/GuildPreviewWin.cs b/Main/System/Guild/GuildPreviewWin.cs
index bb219c9..3688d40 100644
--- a/Main/System/Guild/GuildPreviewWin.cs
+++ b/Main/System/Guild/GuildPreviewWin.cs
@@ -46,9 +46,12 @@
SysNotifyMgr.Instance.ShowTip("GuildSys8");
});
- leaderAvatar.AddListener(() =>
+ leaderAvatar.SetOnLoaded(() =>
{
- OtherPlayerDetailManager.Instance.ViewPlayerDetail(leaderID, leaderServerID);
+ leaderAvatar.AddListener(() =>
+ {
+ OtherPlayerDetailManager.Instance.ViewPlayerDetail(leaderID, leaderServerID);
+ });
});
}
diff --git a/Main/System/Guild/GuildViewListCell.cs b/Main/System/Guild/GuildViewListCell.cs
index 50d99e2..4e42aed 100644
--- a/Main/System/Guild/GuildViewListCell.cs
+++ b/Main/System/Guild/GuildViewListCell.cs
@@ -71,7 +71,7 @@
seeGuildBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<GuildPreviewWin>(guildID);
+ UIManager.Instance.OpenWindowAsync<GuildPreviewWin>(guildID).Forget();
});
}
diff --git a/Main/System/HappyXB/HappyXBModel.Hero.cs b/Main/System/HappyXB/HappyXBModel.Hero.cs
index a2b6220..28d5a12 100644
--- a/Main/System/HappyXB/HappyXBModel.Hero.cs
+++ b/Main/System/HappyXB/HappyXBModel.Hero.cs
@@ -5,6 +5,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
//姝﹀皢鐩稿叧鎷涘嫙
public partial class HappyXBModel : GameSystemManager<HappyXBModel>
@@ -177,7 +178,7 @@
{
if (isOk)
{
- UIManager.Instance.OpenWindow<HeroCallHopeWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallHopeWin>().Forget();
}
else
{
diff --git a/Main/System/HappyXB/HappyXBModel.cs b/Main/System/HappyXB/HappyXBModel.cs
index 095a33a..1286a66 100644
--- a/Main/System/HappyXB/HappyXBModel.cs
+++ b/Main/System/HappyXB/HappyXBModel.cs
@@ -176,7 +176,7 @@
{
if (!UIManager.Instance.IsOpened<HeroCallResultWin>())
{
- UIManager.Instance.OpenWindow<HeroCallResultWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallResultWin>().Forget();
}
}
}
diff --git a/Main/System/HappyXB/HeroCallHopeAddCell.cs b/Main/System/HappyXB/HeroCallHopeAddCell.cs
index 5f2e272..e77e43c 100644
--- a/Main/System/HappyXB/HeroCallHopeAddCell.cs
+++ b/Main/System/HappyXB/HeroCallHopeAddCell.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
@@ -97,7 +97,7 @@
// return;
// }
- UIManager.Instance.OpenWindow<HeroCallHopeWin>(quality == 4 ? 1 : 0);
+ UIManager.Instance.OpenWindowAsync<HeroCallHopeWin>(quality == 4 ? 1 : 0).Forget();
};
}
@@ -147,7 +147,7 @@
// SysNotifyMgr.Instance.ShowTip("HeroWishFinish");
// return;
// }
- UIManager.Instance.OpenWindow<HeroCallHopeWin>(quality == 4 ? 1 : 0);
+ UIManager.Instance.OpenWindowAsync<HeroCallHopeWin>(quality == 4 ? 1 : 0).Forget();
return;
}
else
diff --git a/Main/System/HappyXB/HeroCallScoreRuleWin.cs b/Main/System/HappyXB/HeroCallScoreRuleWin.cs
index 0f8d567..1687367 100644
--- a/Main/System/HappyXB/HeroCallScoreRuleWin.cs
+++ b/Main/System/HappyXB/HeroCallScoreRuleWin.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -15,7 +16,7 @@
protected override void InitComponent()
{
- fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
+
}
@@ -35,7 +36,26 @@
public override void Refresh()
{
- fiterManager.Display(0, SelectJobCountry);
+ if (null != fiterManager)
+ {
+ fiterManager.Display(0, SelectJobCountry);
+ }
+ else
+ {
+ HeroSelectBehaviour.Create(heroSelectBehaviour).ContinueWith(fmgr =>
+ {
+ if (this == null)
+ {
+ if (fmgr != null)
+ {
+ GameObject.DestroyImmediate(fmgr.gameObject);
+ }
+ return;
+ }
+ fiterManager = fmgr;
+ fiterManager.Display(0, SelectJobCountry);
+ }).Forget();
+ }
}
/// 鍥炶皟鍙傛暟锛� 鑱屼笟锛屽浗瀹讹紝浼ゅ绫诲瀷锛�6澶ф垬鏂楀睘鎬э紝鐗规畩灞炴��
diff --git a/Main/System/HappyXB/HeroCallScoreWin.cs b/Main/System/HappyXB/HeroCallScoreWin.cs
index 9d57df1..9b869d4 100644
--- a/Main/System/HappyXB/HeroCallScoreWin.cs
+++ b/Main/System/HappyXB/HeroCallScoreWin.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 绉垎鎷涘嫙
@@ -21,7 +22,7 @@
call1Btn.AddListener(SendHeroCall);
ruleBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HeroCallScoreRuleWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallScoreRuleWin>().Forget();
});
}
diff --git a/Main/System/HappyXB/HeroCallWin.cs b/Main/System/HappyXB/HeroCallWin.cs
index d5013b7..033293e 100644
--- a/Main/System/HappyXB/HeroCallWin.cs
+++ b/Main/System/HappyXB/HeroCallWin.cs
@@ -1,8 +1,9 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
+using Cysharp.Threading.Tasks;
using UnityEngine.UI;
/// <summary>
@@ -60,12 +61,12 @@
//绛栧垝鏀瑰彉闇�姹� 鏆傛椂鍏抽棴
// scoreBtn.AddListener(() =>
// {
- // UIManager.Instance.OpenWindow<HeroCallScoreWin>();
+ // UIManager.Instance.OpenWindowAsync<HeroCallScoreWin>().Forget();
// });
ruleBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HeroCallRuleWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallRuleWin>().Forget();
});
}
@@ -80,7 +81,7 @@
HappyXBModel.Instance.RefreshXBTypeInfoAct += Refresh;
InvestModel.Instance.onInvestUpdate += OnInvestUpdate;
TimingGiftManager.Instance.OnShowGiftIdListAddEvent += OnShowGiftIdListAddEvent;
- timingGiftCell.InitUI();
+ timingGiftCell.InitUI().Forget();
skipToggle.isOn = LocalSave.GetBool(HeroUIManager.skipKey + PlayerDatas.Instance.baseData.PlayerID, false);
Refresh();
openPrivilegeTip.SetActive(!InvestModel.Instance.IsInvested(InvestModel.foreverCardType));
@@ -95,7 +96,7 @@
private void OnShowGiftIdListAddEvent()
{
- timingGiftCell.InitUI();
+ timingGiftCell.InitUI().Forget();
}
void OnInvestUpdate(int type)
diff --git a/Main/System/Hero/UIHeroController.cs b/Main/System/Hero/UIHeroController.cs
index 0d72b60..d274488 100644
--- a/Main/System/Hero/UIHeroController.cs
+++ b/Main/System/Hero/UIHeroController.cs
@@ -16,7 +16,7 @@
private GameObject instanceGO;
public Action onComplete;
- public void Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false)
+ public async UniTask Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false)
{
if (skinID == _skinID)
{
@@ -90,7 +90,7 @@
}
onComplete = _onComplete;
- pool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("UIHero"));
+ pool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero"));
if (!transform.gameObject.activeSelf)
{
@@ -111,11 +111,11 @@
skeletonGraphic = instanceGO.GetComponentInChildren<SkeletonGraphic>(true);
if (isLh)
{
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.Tachie);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.Tachie);
}
else
{
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.SpineRes);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.SpineRes);
}
if (skeletonGraphic.skeletonDataAsset == null)
{
@@ -248,15 +248,14 @@
skeletonGraphic = instanceGO.GetComponentInChildren<SkeletonGraphic>(true);
if (isLh)
{
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.Tachie);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.Tachie);
}
else
{
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.SpineRes);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.SpineRes);
}
if (skeletonGraphic.skeletonDataAsset == null)
{
-
transform.SetActive(false);
if (pool != null)
pool.Release(instanceGO);
diff --git a/Main/System/HeroFates/HeroFatesCell.cs b/Main/System/HeroFates/HeroFatesCell.cs
index 1adf79a..6522970 100644
--- a/Main/System/HeroFates/HeroFatesCell.cs
+++ b/Main/System/HeroFates/HeroFatesCell.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class HeroFatesCell : MonoBehaviour
{
@@ -95,7 +96,7 @@
if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HeroFatesUpgrade, true))
return;
manager.chooseHeroFatesId = fatesId;
- UIManager.Instance.OpenWindow<HeroFatesUpgradeWin>();
+ UIManager.Instance.OpenWindowAsync<HeroFatesUpgradeWin>().Forget();
});
}
diff --git a/Main/System/HeroFates/HeroFatesIHItem.cs b/Main/System/HeroFates/HeroFatesIHItem.cs
index 0149e13..858fe93 100644
--- a/Main/System/HeroFates/HeroFatesIHItem.cs
+++ b/Main/System/HeroFates/HeroFatesIHItem.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class HeroFatesIHItem : MonoBehaviour
{
@@ -48,12 +49,12 @@
}
HeroInfo heroInfo = nowMaxStarHeroDict[heroId];
HeroUIManager.Instance.selectHeroGuid = heroInfo.itemHero.guid;
- UIManager.Instance.OpenWindow<HeroTrainWin>();
+ UIManager.Instance.OpenWindowAsync<HeroTrainWin>().Forget();
}
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroId;
- UIManager.Instance.OpenWindow<HeroBestWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestWin>().Forget();
}
});
}
diff --git a/Main/System/HeroFates/HeroFatesUpgradeWin.cs b/Main/System/HeroFates/HeroFatesUpgradeWin.cs
index 072fb63..97b7332 100644
--- a/Main/System/HeroFates/HeroFatesUpgradeWin.cs
+++ b/Main/System/HeroFates/HeroFatesUpgradeWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -27,7 +27,7 @@
btnPut.SetListener(() =>
{
manager.InitChooseList();
- UIManager.Instance.OpenWindow<HeroFatesPutWin>();
+ UIManager.Instance.OpenWindowAsync<HeroFatesPutWin>().Forget();
});
btnQualityHeroClear.SetListener(() =>
@@ -45,7 +45,7 @@
SysNotifyMgr.Instance.ShowTip("HeroFates04");
return;
}
- UIManager.Instance.OpenWindow<HeroFatesFastPutPreviewWin>();
+ UIManager.Instance.OpenWindowAsync<HeroFatesFastPutPreviewWin>().Forget();
});
btnUpdate.SetListener(() =>
{
diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index cf7b6cc..31b83cf 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
public class GiftBaseCell : MonoBehaviour
{
@@ -175,18 +176,18 @@
}
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
else if (giftID == 0)
{
SmallTipWin.showText = Language.Get("HeroGift1");
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
else if (giftID == -1)
{
SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index));
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
}
@@ -242,7 +243,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -255,7 +256,16 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+ cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+
+ if (this == null)
+ {
+ if (null != cellContainer)
+ {
+ GameObject.DestroyImmediate(cellContainer);
+ }
+ return;
+ }
if (cellContainer != null)
{
diff --git a/Main/System/HeroUI/HeroAwakeWin.cs b/Main/System/HeroUI/HeroAwakeWin.cs
index 3f18f99..89c4813 100644
--- a/Main/System/HeroUI/HeroAwakeWin.cs
+++ b/Main/System/HeroUI/HeroAwakeWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -23,7 +23,7 @@
awakeBtn.AddListener(AwakeHero);
watchBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HeroAwakePrivewWin>();
+ UIManager.Instance.OpenWindowAsync<HeroAwakePrivewWin>().Forget();
});
}
@@ -50,7 +50,7 @@
}
if (hero.talentAwakeRandomIDList.Count > 0)
{
- UIManager.Instance.OpenWindow<HeroAwakeSelectGiftWin>();
+ UIManager.Instance.OpenWindowAsync<HeroAwakeSelectGiftWin>().Forget();
}
}
@@ -129,7 +129,7 @@
if (hero.talentAwakeRandomIDList.Count > 0)
{
//闃茶寖鏈�夋嫨澶╄祴
- UIManager.Instance.OpenWindow<HeroAwakeSelectGiftWin>();
+ UIManager.Instance.OpenWindowAsync<HeroAwakeSelectGiftWin>().Forget();
return;
}
diff --git a/Main/System/HeroUI/HeroBaseWin.cs b/Main/System/HeroUI/HeroBaseWin.cs
index 422fab3..c9571aa 100644
--- a/Main/System/HeroUI/HeroBaseWin.cs
+++ b/Main/System/HeroUI/HeroBaseWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -19,7 +19,7 @@
callBtn.AddListener(() =>
{
//鎵撳紑鎷涘嫙鐣岄潰
- UIManager.Instance.OpenWindow<HeroCallWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCallWin>().Forget();
});
}
@@ -52,13 +52,13 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<HeroListWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<HeroListWin>().Forget();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<HeroCollectionWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<HeroCollectionWin>().Forget();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindow<HeroFatesWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<HeroFatesWin>().Forget();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/HeroUI/HeroBestWin.cs b/Main/System/HeroUI/HeroBestWin.cs
index 71c98ef..1bca2d2 100644
--- a/Main/System/HeroUI/HeroBestWin.cs
+++ b/Main/System/HeroUI/HeroBestWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using System.Linq;
using Cysharp.Threading.Tasks;
using UnityEngine;
@@ -92,13 +92,13 @@
{
SmallTipWin.showText = Language.Get("herocard47");
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
};
heroAddPerText.OnClick = () =>
{
SmallTipWin.showText = Language.Get("herocard48");
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
};
attrBtn.AddListener(() =>
{
@@ -113,7 +113,7 @@
SmallTipWin.showText = Language.Get("HeroGift14",
HeroUIManager.Instance.GetMaxStarCount(HeroUIManager.Instance.selectForPreviewHeroID, config.Quality));
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
potentialCellList = new List<GameObject>();
@@ -145,12 +145,12 @@
RefreshConn();
normalSkillCell.Init(heroConfig.AtkSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(HeroUIManager.Instance.selectForPreviewHeroID);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(HeroUIManager.Instance.selectForPreviewHeroID).Forget();
+ }, true).Forget();
angerSkillCell.Init(heroConfig.AngerSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(HeroUIManager.Instance.selectForPreviewHeroID);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(HeroUIManager.Instance.selectForPreviewHeroID).Forget();
+ }, true).Forget();
RefreshName();
diff --git a/Main/System/HeroUI/HeroCardCell.cs b/Main/System/HeroUI/HeroCardCell.cs
index e59a19f..f9f4fcc 100644
--- a/Main/System/HeroUI/HeroCardCell.cs
+++ b/Main/System/HeroUI/HeroCardCell.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
@@ -92,7 +92,7 @@
heroCardBtn.AddListener(() =>
{
HeroUIManager.Instance.selectHeroGuid = guid;
- UIManager.Instance.OpenWindow<HeroTrainWin>(funcState == 3 ? 1 : 0);
+ UIManager.Instance.OpenWindowAsync<HeroTrainWin>(funcState == 3 ? 1 : 0).Forget();
});
}
}
diff --git a/Main/System/HeroUI/HeroCollectionCardCell.cs b/Main/System/HeroUI/HeroCollectionCardCell.cs
index 28de4b4..c764852 100644
--- a/Main/System/HeroUI/HeroCollectionCardCell.cs
+++ b/Main/System/HeroUI/HeroCollectionCardCell.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
@@ -77,19 +77,19 @@
var state = HeroUIManager.Instance.GetHeroBookState(heroID, quality);
if (state == 1 || state == 3 || state == 4)
{
- UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
+ UIManager.Instance.OpenWindowAsync<HeroCollectionLvUpWin>().Forget();
}
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroID;
- UIManager.Instance.OpenWindow<HeroBestWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestWin>().Forget();
}
});
// bookLVBtn.AddListener(() =>
// {
// HeroUIManager.Instance.selectCollectHeroID = heroID;
- // UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
+ // UIManager.Instance.OpenWindowAsync<HeroCollectionLvUpWin>().Forget();
// });
}
}
diff --git a/Main/System/HeroUI/HeroCollectionWin.cs b/Main/System/HeroUI/HeroCollectionWin.cs
index 16a2331..9c69e79 100644
--- a/Main/System/HeroUI/HeroCollectionWin.cs
+++ b/Main/System/HeroUI/HeroCollectionWin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -26,15 +27,13 @@
{
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.showText = Language.Get("herocard6");
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
heroPackBtn.AddListener(() =>
{
HeroUIManager.Instance.QueryUnLockHeroPack();
});
-
- fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
}
protected override void OnPreOpen()
@@ -60,7 +59,26 @@
void Display()
{
- fiterManager.Display(0, SelectJobCountry);
+ if (null != fiterManager)
+ {
+ fiterManager.Display(0, SelectJobCountry);
+ }
+ else
+ {
+ HeroSelectBehaviour.Create(heroSelectBehaviour).ContinueWith(fmgr =>
+ {
+ if (this == null)
+ {
+ if (fmgr != null)
+ {
+ GameObject.DestroyImmediate(fmgr.gameObject);
+ }
+ return;
+ }
+ fiterManager = fmgr;
+ fiterManager.Display(0, SelectJobCountry);
+ }).Forget();
+ }
// CreateScroller();
// RefreshTotalAttr();
diff --git a/Main/System/HeroUI/HeroConnectionHeadCell.cs b/Main/System/HeroUI/HeroConnectionHeadCell.cs
index 498a80a..178e840 100644
--- a/Main/System/HeroUI/HeroConnectionHeadCell.cs
+++ b/Main/System/HeroUI/HeroConnectionHeadCell.cs
@@ -33,23 +33,29 @@
nameText.text = heroConfig.Name;
qualityImg.SetSprite("heroheadBG" + heroConfig.Quality);
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(skinID).SquareIcon);
- if (sprite == null)
+
+ UILoader.LoadSpriteAsync("HeroHead", HeroSkinConfig.Get(skinID).SquareIcon).ContinueWith(sprite =>
{
- // 鍐呯綉鏈厤缃椂
- heroIcon.SetSprite("herohead_default");
- }
- else
- {
- heroIcon.overrideSprite = sprite;
- }
+ if (this == null || heroIcon == null) return;
+ if (sprite == null)
+ {
+ // 鍐呯綉鏈厤缃椂
+ heroIcon.SetSprite("herohead_default");
+ }
+ else
+ {
+ heroIcon.overrideSprite = sprite;
+ }
- if (showCollect)
- {
- //鏈幏寰楁灏嗚缃伆
- heroIcon.gray = !HeroManager.Instance.HasHero(heroID);
+ if (showCollect)
+ {
+ //鏈幏寰楁灏嗚缃伆
+ heroIcon.gray = !HeroManager.Instance.HasHero(heroID);
- }
+ }
+
+ connMarkImg.SetActive(index != 0);
+ }).Forget();
connMarkImg.SetActive(index != 0);
}
diff --git a/Main/System/HeroUI/HeroDeleteWin.cs b/Main/System/HeroUI/HeroDeleteWin.cs
index ee7189a..26032ad 100644
--- a/Main/System/HeroUI/HeroDeleteWin.cs
+++ b/Main/System/HeroUI/HeroDeleteWin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -23,11 +24,10 @@
storeBtn.AddListener(() =>
{
StoreModel.Instance.selectStoreFuncType = StoreFunc.Hero;
- UIManager.Instance.OpenWindow<StoreBaseWin>();
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>().Forget();
});
quickSelectBtn.AddListener(QuickSelect);
deleteBtn.AddListener(DeleteHero);
- fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
}
protected override void OnPreOpen()
@@ -44,7 +44,26 @@
{
HeroUIManager.Instance.SelectDeleteHero(HeroManager.Instance.GetHero(HeroUIManager.Instance.jumpDeleteHeroGuid));
}
- fiterManager.Display(0, SelectJobCountry);
+ if (null != fiterManager)
+ {
+ fiterManager.Display(0, SelectJobCountry);
+ }
+ else
+ {
+ HeroSelectBehaviour.Create(heroSelectBehaviour).ContinueWith(fmgr =>
+ {
+ if (this == null)
+ {
+ if (fmgr != null)
+ {
+ GameObject.DestroyImmediate(fmgr.gameObject);
+ }
+ return;
+ }
+ fiterManager = fmgr;
+ fiterManager.Display(0, SelectJobCountry);
+ }).Forget();
+ }
RefreshEmptyTip();
// CreateScroller();
diff --git a/Main/System/HeroUI/HeroGiftEatWin.cs b/Main/System/HeroUI/HeroGiftEatWin.cs
index 852e1cf..bf0d3d8 100644
--- a/Main/System/HeroUI/HeroGiftEatWin.cs
+++ b/Main/System/HeroUI/HeroGiftEatWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -189,6 +189,6 @@
SysNotifyMgr.Instance.ShowTip("HeroGift1");
return;
}
- UIManager.Instance.OpenWindow<HeroGiftRoleListWin>();
+ UIManager.Instance.OpenWindowAsync<HeroGiftRoleListWin>().Forget();
}
}
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroHeadBaseCell.cs b/Main/System/HeroUI/HeroHeadBaseCell.cs
index 2104662..4422cf0 100644
--- a/Main/System/HeroUI/HeroHeadBaseCell.cs
+++ b/Main/System/HeroUI/HeroHeadBaseCell.cs
@@ -156,16 +156,7 @@
// {
// skinID = heroConfig.SkinIDList[0];
// }
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(skinID).SquareIcon);
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- heroIcon.SetSprite("herohead_default");
- }
- else
- {
- heroIcon.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(skinID).SquareIcon, heroIcon, "herohead_default").Forget();
if (star == 0)
@@ -261,7 +252,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -274,7 +265,16 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell");
+ cellContainer = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell");
+
+ if (this == null)
+ {
+ if (cellContainer != null)
+ {
+ DestroyImmediate(cellContainer);
+ return;
+ }
+ }
if (cellContainer != null)
{
diff --git a/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs b/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
index 5168d96..446b672 100644
--- a/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
+++ b/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
@@ -89,20 +89,22 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
// 姝﹀皢灏忓ご鍍忥紝锛堣亴涓氬拰鍚嶇О涓嶅啀姝ょ鐞嗭紝鍚勪釜鐣岄潰鎺掔増涓嶅悓锛�
- public void Init(int heroID, bool _gray = false, UnityAction onclick = null)
+ public async UniTask Init(int heroID, bool _gray = false, UnityAction onclick = null)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab();
clickBtn.AddListener(onclick);
var heroConfig = HeroConfig.Get(heroID);
qualityBG.SetSprite("heroheadBG" + heroConfig.Quality);
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(heroConfig.SkinIDList[0]).SquareIcon);
- heroIcon.overrideSprite = sprite;
- heroIcon.gray = _gray;
+ UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(heroConfig.SkinIDList[0]).SquareIcon, heroIcon).ContinueWith(() =>
+ {
+ heroIcon.gray = _gray;
+ }).Forget();
+
qualityBG.gray = _gray;
countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
@@ -112,28 +114,9 @@
}
- public async UniTask InitAsync(int heroID, bool _gray = false, UnityAction onclick = null)
- {
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
- clickBtn.AddListener(onclick);
- var heroConfig = HeroConfig.Get(heroID);
- qualityBG.SetSprite("heroheadBG" + heroConfig.Quality);
-
- var sprite = await UILoader.LoadSpriteAsync("HeroHead", HeroSkinConfig.Get(heroConfig.SkinIDList[0]).SquareIcon);
- if (this == null) return;
- heroIcon.overrideSprite = sprite;
- heroIcon.gray = _gray;
- qualityBG.gray = _gray;
-
- countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
- jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
- nameText.text = heroConfig.Name;
-
-
- }
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -146,7 +129,16 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell");
+ cellContainer = await UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell");
+
+ if (this == null)
+ {
+ if (cellContainer != null)
+ {
+ DestroyImmediate(cellContainer);
+ }
+ return;
+ }
if (cellContainer != null)
{
diff --git a/Main/System/HeroUI/HeroListWin.cs b/Main/System/HeroUI/HeroListWin.cs
index e31e90e..d801b33 100644
--- a/Main/System/HeroUI/HeroListWin.cs
+++ b/Main/System/HeroUI/HeroListWin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -35,17 +36,16 @@
changeHeroPosBtn.AddListener(() =>
{
HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetMainTeamID();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
attrOnTipBtn.AddListener(() =>
{
attrOnTip.SetActive(!attrOnTip.activeSelf);
});
- fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
lineupRecommendBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<LineupRecommendWin>();
+ UIManager.Instance.OpenWindowAsync<LineupRecommendWin>().Forget();
});
}
@@ -63,7 +63,26 @@
FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
// CreateScroller();
Refresh();
- fiterManager.Display(0, SelectJobCountry);
+ if (null != fiterManager)
+ {
+ fiterManager.Display(0, SelectJobCountry);
+ }
+ else
+ {
+ HeroSelectBehaviour.Create(heroSelectBehaviour).ContinueWith(fmgr =>
+ {
+ if (this == null)
+ {
+ if (fmgr != null)
+ {
+ GameObject.DestroyImmediate(fmgr.gameObject);
+ }
+ return;
+ }
+ fiterManager = fmgr;
+ fiterManager.Display(0, SelectJobCountry);
+ }).Forget();
+ }
}
diff --git a/Main/System/HeroUI/HeroPosWin.cs b/Main/System/HeroUI/HeroPosWin.cs
index c79fbf2..7bb4492 100644
--- a/Main/System/HeroUI/HeroPosWin.cs
+++ b/Main/System/HeroUI/HeroPosWin.cs
@@ -83,21 +83,32 @@
countryOnBtn.AddListener(() =>
{
HeroUIManager.Instance.isCustonHeroFormation = false;
- UIManager.Instance.OpenWindow<HeroFormationWin>();
+ UIManager.Instance.OpenWindowAsync<HeroFormationWin>().Forget();
});
lineupRecommendBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<LineupRecommendWin>();
+ UIManager.Instance.OpenWindowAsync<LineupRecommendWin>().Forget();
});
m_IsToggleOn = LocalSave.GetBool("ShowConn" + PlayerDatas.Instance.baseData.PlayerID, false);
- fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
- var presetObj = UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells");
- presetObj.transform.SetParentEx(caseesObj, Vector3.zero, Quaternion.identity, Vector3.one);
- presetChooseCells = presetObj.GetComponent<FuncPresetChooseCells>();
- presetChooseCells.ChangeAlignment(TextAnchor.MiddleCenter);
+
+ UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells").ContinueWith(presetObj =>
+ {
+ if (this == null)
+ {
+ if (presetObj != null)
+ {
+ GameObject.DestroyImmediate(presetObj);
+ }
+ return;
+ }
+ presetObj.transform.SetParentEx(caseesObj, Vector3.zero, Quaternion.identity, Vector3.one);
+ presetChooseCells = presetObj.GetComponent<FuncPresetChooseCells>();
+ presetChooseCells.ChangeAlignment(TextAnchor.MiddleCenter);
+ }).Forget();
+
funPresetBtn.AddListener(()=>
{
@@ -166,7 +177,26 @@
RefreshEmptyTip();
showConnTipToggleBtn.isOn = isToggleOn;
- fiterManager.Display(0, SelectJobCountry);
+ if (null != fiterManager)
+ {
+ fiterManager.Display(0, SelectJobCountry);
+ }
+ else
+ {
+ HeroSelectBehaviour.Create(heroSelectBehaviour).ContinueWith(fmgr =>
+ {
+ if (this == null)
+ {
+ if (fmgr != null)
+ {
+ GameObject.DestroyImmediate(fmgr.gameObject);
+ }
+ return;
+ }
+ fiterManager = fmgr;
+ fiterManager.Display(0, SelectJobCountry);
+ }).Forget();
+ }
fightPowerText.text = UIHelper.ReplaceLargeArtNum(FightPowerManager.Instance.GetTeamFightPower(HeroUIManager.Instance.selectTeamType, true));
presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Team);
diff --git a/Main/System/HeroUI/HeroSelectBehaviour.cs b/Main/System/HeroUI/HeroSelectBehaviour.cs
index 61b2213..168c5ab 100644
--- a/Main/System/HeroUI/HeroSelectBehaviour.cs
+++ b/Main/System/HeroUI/HeroSelectBehaviour.cs
@@ -189,9 +189,13 @@
}
}
- public static HeroSelectBehaviour Create(Transform heroSelectBehaviour)
+ public static async UniTask<HeroSelectBehaviour> Create(Transform heroSelectBehaviour)
{
- var instanceGO = UIUtility.CreateWidget("HeroSelectBehaviour", "HeroSelectBehaviour");
+ var instanceGO = await UIUtility.CreateWidget("HeroSelectBehaviour", "HeroSelectBehaviour");
+ if (null == instanceGO)
+ {
+ return null;
+ }
instanceGO.transform.SetParentEx(heroSelectBehaviour, Vector3.zero, Quaternion.identity, Vector3.one);
return instanceGO.GetComponent<HeroSelectBehaviour>();
}
diff --git a/Main/System/HeroUI/HeroShowBaseCell.cs b/Main/System/HeroUI/HeroShowBaseCell.cs
index 6d89639..84b1c13 100644
--- a/Main/System/HeroUI/HeroShowBaseCell.cs
+++ b/Main/System/HeroUI/HeroShowBaseCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
//姝﹀皢妯″瀷绔欏彴妯″潡
public class HeroShowBaseCell : MonoBehaviour
@@ -133,13 +134,13 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
// 姝﹀皢妯″瀷绔欏彴鏄剧ず
- public void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
+ public async void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
var heroConfig = HeroConfig.Get(heroID);
qualityBG.SetSprite("herodz" + heroConfig.Quality);
// int skinID = 0;
@@ -153,7 +154,7 @@
// skinID = heroConfig.SkinIDList[0];
// }
- heroModel.Create(skinID, heroConfig.UIScale);
+ heroModel.Create(skinID, heroConfig.UIScale).Forget();
if (star == 0)
{
@@ -202,12 +203,12 @@
{
SmallTipWin.showText = Language.Get("HeroGift14", star);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -220,7 +221,16 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow");
+ cellContainer = await UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow");
+
+ if (this == null)
+ {
+ if (cellContainer != null)
+ {
+ DestroyImmediate(cellContainer);
+ return;
+ }
+ }
if (cellContainer != null)
{
diff --git a/Main/System/HeroUI/HeroSkillWin.cs b/Main/System/HeroUI/HeroSkillWin.cs
index 248c9ea..1dedf0a 100644
--- a/Main/System/HeroUI/HeroSkillWin.cs
+++ b/Main/System/HeroUI/HeroSkillWin.cs
@@ -41,13 +41,13 @@
var heroConfig = HeroConfig.Get(heroID);
if (!SkillConfig.HasKey(heroConfig.AtkSkillID))
return;
- normalSkillCell.Init(heroConfig.AtkSkillID);
+ normalSkillCell.Init(heroConfig.AtkSkillID).Forget();
var skillConfig = SkillConfig.Get(heroConfig.AtkSkillID);
nameText.text = skillConfig.SkillName;
skillTypeText.text = Language.Get("L1100", Language.Get("L1108"), Language.Get(skillConfig.FuncType == 1 ? "HeroSkillType_1" : "HeroSkillType_2"));
descText.text = skillConfig.Description;
- angerSkillCell.Init(heroConfig.AngerSkillID);
+ angerSkillCell.Init(heroConfig.AngerSkillID).Forget();
var skillConfig2 = SkillConfig.Get(heroConfig.AngerSkillID);
name2Text.text = skillConfig2.SkillName;
skillType2Text.text = Language.Get("L1100", Language.Get("L1108"), Language.Get(skillConfig2.FuncType == 1 ? "HeroSkillType_1" : "HeroSkillType_2"));
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 6677ab2..e0b5aaf 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using System.Linq;
using Cysharp.Threading.Tasks;
using UnityEngine;
@@ -152,19 +152,19 @@
return;
}
HeroUIManager.Instance.selectAwakeHeroGuid = guid;
- UIManager.Instance.OpenWindow<HeroAwakeWin>();
+ UIManager.Instance.OpenWindowAsync<HeroAwakeWin>().Forget();
});
inheritText.OnClick = () =>
{
SmallTipWin.showText = Language.Get("herocard47");
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
};
heroAddPerText.OnClick = () =>
{
SmallTipWin.showText = Language.Get("herocard48");
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
};
attrBtn.AddListener(() =>
{
@@ -184,7 +184,7 @@
totalGiftBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HeroGiftWin>();
+ UIManager.Instance.OpenWindowAsync<HeroGiftWin>().Forget();
});
starUPBtn.AddListener(StarUP);
@@ -194,7 +194,7 @@
{
SmallTipWin.showText = Language.Get("HeroGift14", hero.heroStar);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
potentialCellList = new List<GameObject>();
@@ -277,12 +277,12 @@
RefreshConn();
normalSkillCell.Init(hero.heroConfig.AtkSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(hero.heroId);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(hero.heroId).Forget();
+ }, true).Forget();
angerSkillCell.Init(hero.heroConfig.AngerSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(hero.heroId);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(hero.heroId).Forget();
+ }, true).Forget();
awakeBtn.SetActive(HeroAwakeConfig.CanAwake(hero.heroId, 1));
@@ -417,7 +417,7 @@
{
HeroUIManager.Instance.jumpDeleteHeroGuid = "";
}
- UIManager.Instance.OpenWindow<HeroDeleteWin>();
+ UIManager.Instance.OpenWindowAsync<HeroDeleteWin>().Forget();
}
@@ -555,7 +555,7 @@
// if (!UIManager.Instance.IsOpened<HeroLVBreakWin>())
// {
// HeroUIManager.Instance.selectHeroGuid = guid;
- // UIManager.Instance.OpenWindow<HeroLVBreakWin>();
+ // UIManager.Instance.OpenWindowAsync<HeroLVBreakWin>().Forget();
// }
// }
// else
@@ -749,7 +749,7 @@
}
HeroUIManager.Instance.selectHeroGuidForGiftFunc = hero.itemHero.guid;
- UIManager.Instance.OpenWindow<HeroGiftEatWin>();
+ UIManager.Instance.OpenWindowAsync<HeroGiftEatWin>().Forget();
}
void Wash()
@@ -761,7 +761,7 @@
}
HeroUIManager.Instance.selectWashHeroGUID = hero.itemHero.guid;
- UIManager.Instance.OpenWindow<HeroGiftWashWin>();
+ UIManager.Instance.OpenWindowAsync<HeroGiftWashWin>().Forget();
}
diff --git a/Main/System/HeroUI/HeroUIManager.Reborn.cs b/Main/System/HeroUI/HeroUIManager.Reborn.cs
index ad3aa62..9870322 100644
--- a/Main/System/HeroUI/HeroUIManager.Reborn.cs
+++ b/Main/System/HeroUI/HeroUIManager.Reborn.cs
@@ -260,7 +260,7 @@
}
selectRebornHeroGuid = hero.itemHero.guid;
- UIManager.Instance.OpenWindow<HeroRebornWin>();
+ UIManager.Instance.OpenWindowAsync<HeroRebornWin>().Forget();
}
public void SendReborn(HeroInfo hero, bool islvon, bool isbreakon, bool isawakeon)
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 68f9182..c97b74f 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -144,14 +144,14 @@
if (waitResponse.type == HeroFuncType.Break)
{
- UIManager.Instance.OpenWindow<HeroLVBreakSuccessWin>();
+ UIManager.Instance.OpenWindowAsync<HeroLVBreakSuccessWin>().Forget();
}
else if (waitResponse.type == HeroFuncType.Gift)
{
// 瀹㈡埛绔嚜宸卞仛鐨勬壒閲忓悶鍣渶绛夊緟澶氫釜鍚炲櫖缁撴灉锛岃繖閲岄渶瑕乺eturn
if (!UIManager.Instance.IsOpened<HeroGiftEatSuccessWin>())
{
- UIManager.Instance.OpenWindow<HeroGiftEatSuccessWin>();
+ UIManager.Instance.OpenWindowAsync<HeroGiftEatSuccessWin>().Forget();
}
else
{
@@ -165,11 +165,11 @@
var config = HeroAwakeConfig.GetHeroAwakeConfig(hero.heroId, hero.awakeLevel);
if (hero.talentAwakeRandomIDList.Count > 0)
{
- UIManager.Instance.OpenWindow<HeroAwakeSelectGiftWin>();
+ UIManager.Instance.OpenWindowAsync<HeroAwakeSelectGiftWin>().Forget();
}
else if (config.SkillID != 0 || config.UnlockTalentSlot != 0)
{
- UIManager.Instance.OpenWindow<HeroAwakeSuccessWin>();
+ UIManager.Instance.OpenWindowAsync<HeroAwakeSuccessWin>().Forget();
}
}
waitResponse = default;
diff --git a/Main/System/Horse/HorseController.cs b/Main/System/Horse/HorseController.cs
index ae9ab44..6605e3b 100644
--- a/Main/System/Horse/HorseController.cs
+++ b/Main/System/Horse/HorseController.cs
@@ -21,9 +21,9 @@
private bool isHeroShowBefore = false;
// 鍒涘缓鍧愰獞 锛歩d涓�0绌哄潗楠戜篃鏈夐厤缃�
- public void Create(int _skinID, int _heroSkinID = 0, float scale = 1f, Action _onComplete = null, string motionName = "idle")
+ public async UniTask Create(int _skinID, int _heroSkinID = 0, float scale = 1f, Action _onComplete = null, string motionName = "idle")
{
- pool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("UIHorse"));
+ pool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHorse"));
if (instanceGO == null)
{
instanceGO = pool.Request();
@@ -70,7 +70,7 @@
return;
}
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine);
if (skeletonGraphic.skeletonDataAsset == null)
{
@@ -148,7 +148,7 @@
return;
}
- skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine);
+ skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine);
if (skeletonGraphic.skeletonDataAsset == null)
{
diff --git a/Main/System/Horse/HorseManager.cs b/Main/System/Horse/HorseManager.cs
index 73ac403..0687bec 100644
--- a/Main/System/Horse/HorseManager.cs
+++ b/Main/System/Horse/HorseManager.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using LitJson;
using System.Collections.Generic;
@@ -126,7 +126,7 @@
OnHorseUpdateEvent?.Invoke();
if (isOpenSuccess)
{
- UIManager.Instance.OpenWindow<HorseSuccessWin>();
+ UIManager.Instance.OpenWindowAsync<HorseSuccessWin>().Forget();
}
}
@@ -150,7 +150,7 @@
if (DTC0403_tagPlayerLoginLoadOK.finishedLogin && netPack.HorseSkinList[0].Star == 0)
{
- UIManager.Instance.OpenWindow<HorseSkinGetWin>(netPack.HorseSkinList[0].HorseSkinID);
+ UIManager.Instance.OpenWindowAsync<HorseSkinGetWin>(netPack.HorseSkinList[0].HorseSkinID).Forget();
}
}
diff --git a/Main/System/Horse/HorseSkinCell.cs b/Main/System/Horse/HorseSkinCell.cs
index 013193b..2d67347 100644
--- a/Main/System/Horse/HorseSkinCell.cs
+++ b/Main/System/Horse/HorseSkinCell.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing Cysharp.Threading.Tasks;
+using UnityEngine;
using UnityEngine.UI;
public class HorseSkinCell : MonoBehaviour
@@ -30,7 +31,7 @@
public void Display(int _skinID)
{
skinID = _skinID;
- horseModel.Create(skinID, 0, 0.6f);
+ horseModel.Create(skinID, 0, 0.6f).Forget();
emptyImg.SetActive(skinID == 0);
usingObj.SetActive(HorseManager.Instance.GetUsingHorseSkinID() == skinID);
bool isShowRed = HorseManager.Instance.IsShowTheHorseRedImg(skinID);
diff --git a/Main/System/Horse/HorseSkinGetWin.cs b/Main/System/Horse/HorseSkinGetWin.cs
index 51e0637..6728251 100644
--- a/Main/System/Horse/HorseSkinGetWin.cs
+++ b/Main/System/Horse/HorseSkinGetWin.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -30,7 +31,7 @@
{
var skinID = functionOrder;
var skinConfig = HorseSkinConfig.Get(skinID);
- horseModel.Create(skinID);
+ horseModel.Create(skinID).Forget();
horseName.text = skinConfig.Name;
if (skinConfig.AttrIDList.IsNullOrEmpty())
diff --git a/Main/System/Horse/HorseSkinWin.cs b/Main/System/Horse/HorseSkinWin.cs
index 10d1ec7..e465bbe 100644
--- a/Main/System/Horse/HorseSkinWin.cs
+++ b/Main/System/Horse/HorseSkinWin.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -80,7 +81,7 @@
void Display()
{
var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.selectSkinID);
- horseModel.Create(HorseManager.Instance.selectSkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID());
+ horseModel.Create(HorseManager.Instance.selectSkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID()).Forget();
if (string.IsNullOrEmpty(skinConfig.getWay))
{
getWayText.text = "";
diff --git a/Main/System/Horse/HorseWin.cs b/Main/System/Horse/HorseWin.cs
index 4400858..849a1d3 100644
--- a/Main/System/Horse/HorseWin.cs
+++ b/Main/System/Horse/HorseWin.cs
@@ -1,7 +1,8 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -37,7 +38,7 @@
{
skinBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<HorseSkinWin>();
+ UIManager.Instance.OpenWindowAsync<HorseSkinWin>().Forget();
});
lvupBtn.AddListener(HorseUpgrade);
lvupBtn.onPress.AddListener(HorseUpgrade);
@@ -109,13 +110,13 @@
// }
// var pack = new CB202_tagCSHorseClassUP();
// GameNetSystem.Instance.SendInfo(pack);
- UIManager.Instance.OpenWindow<HorseRankUPWin>();
+ UIManager.Instance.OpenWindowAsync<HorseRankUPWin>().Forget();
}
void Display()
{
var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID());
- modelImg.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID());
+ modelImg.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID()).Forget();
nameText.text = skinConfig.Name;
specialAttrText.text = GetSpecialAttr();
@@ -236,7 +237,7 @@
{
case PlayerDataType.EquipShowSwitch:
var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID());
- modelImg.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID());
+ modelImg.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID()).Forget();
nameText.text = skinConfig.Name;
break;
}
diff --git a/Main/System/InternalAffairs/AffairBaseWin.cs b/Main/System/InternalAffairs/AffairBaseWin.cs
index b2726f0..bb6ecd2 100644
--- a/Main/System/InternalAffairs/AffairBaseWin.cs
+++ b/Main/System/InternalAffairs/AffairBaseWin.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+锘縰sing System.Collections;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
@@ -32,7 +32,7 @@
{
bagBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<RolePackWin>();
+ UIManager.Instance.OpenWindowAsync<RolePackWin>().Forget();
}
);
@@ -46,7 +46,7 @@
{
if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.GoldRush, true))
{
- UIManager.Instance.OpenWindow<GoldRushAutoWin>();
+ UIManager.Instance.OpenWindowAsync<GoldRushAutoWin>().Forget();
}
}
);
diff --git a/Main/System/InternalAffairs/AffairFuncCell.cs b/Main/System/InternalAffairs/AffairFuncCell.cs
index b632253..baf4724 100644
--- a/Main/System/InternalAffairs/AffairFuncCell.cs
+++ b/Main/System/InternalAffairs/AffairFuncCell.cs
@@ -41,23 +41,23 @@
if (funcID == 8)
{
- UIManager.Instance.OpenWindow<GoldRushWorkerWin>();
+ UIManager.Instance.OpenWindowAsync<GoldRushWorkerWin>().Forget();
}
else if (funcID == 42)
{
- UIManager.Instance.OpenWindow<PhantasmPavilionWin>();
+ UIManager.Instance.OpenWindowAsync<PhantasmPavilionWin>().Forget();
}
else if (funcID == 7)
{
- UIManager.Instance.OpenWindow<BeautyMMBaseWin>();
+ UIManager.Instance.OpenWindowAsync<BeautyMMBaseWin>().Forget();
}
else if (funcID == 28)
{
- UIManager.Instance.OpenWindow<GubaoBaseWin>();
+ UIManager.Instance.OpenWindowAsync<GubaoBaseWin>().Forget();
}
else if (funcID == 54)
{
- UIManager.Instance.OpenWindow<MinggeWin>();
+ UIManager.Instance.OpenWindowAsync<MinggeWin>().Forget();
}
diff --git a/Main/System/InternalAffairs/GoldRushAutoWin.cs b/Main/System/InternalAffairs/GoldRushAutoWin.cs
index 112a92e..0b09cc7 100644
--- a/Main/System/InternalAffairs/GoldRushAutoWin.cs
+++ b/Main/System/InternalAffairs/GoldRushAutoWin.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+锘縰sing System.Linq;
using UnityEngine;
using UnityEngine.UI;
@@ -142,7 +142,7 @@
if (endTime > 0 && TimeUtility.AllSeconds < endTime)
{
//缁垂
- UIManager.Instance.OpenWindow<GoldRushAutoBuyWin>();
+ UIManager.Instance.OpenWindowAsync<GoldRushAutoBuyWin>().Forget();
}
else
{
diff --git a/Main/System/InternalAffairs/GoldRushTentCell.cs b/Main/System/InternalAffairs/GoldRushTentCell.cs
index 39b64f6..e3d0144 100644
--- a/Main/System/InternalAffairs/GoldRushTentCell.cs
+++ b/Main/System/InternalAffairs/GoldRushTentCell.cs
@@ -613,7 +613,7 @@
if (goldID != 0)
{
GoldRushManager.Instance.selectCampID = campID;
- UIManager.Instance.OpenWindow<GoldRushRefreshWin>();
+ UIManager.Instance.OpenWindowAsync<GoldRushRefreshWin>().Forget();
return;
}
diff --git a/Main/System/Invest/InvestModel.cs b/Main/System/Invest/InvestModel.cs
index 0dfa8b1..a8bb58c 100644
--- a/Main/System/Invest/InvestModel.cs
+++ b/Main/System/Invest/InvestModel.cs
@@ -4,6 +4,7 @@
using UnityEngine.UI;
using System.Linq;
using LitJson;
+using Cysharp.Threading.Tasks;
public class InvestModel : GameSystemManager<InvestModel>
{
@@ -128,7 +129,7 @@
if (count < rechargeCount.totalCount)
{
lastTotalBuyCountDict[type] = rechargeCount.totalCount;
- UIManager.Instance.OpenWindow<PrivilegeActiveCardWin>(type);
+ UIManager.Instance.OpenWindowAsync<PrivilegeActiveCardWin>(type).Forget();
}
}
}
diff --git a/Main/System/ItemTip/ItemTipUtility.cs b/Main/System/ItemTip/ItemTipUtility.cs
index 315e69b..626aa8f 100644
--- a/Main/System/ItemTip/ItemTipUtility.cs
+++ b/Main/System/ItemTip/ItemTipUtility.cs
@@ -171,7 +171,7 @@
mainTipData.getWay.defaultUnfold = item.unfoldGetWay;
if (mainTipData.getWay.defaultUnfold)
{
- UIManager.Instance.OpenWindow<ItemTipWayWin>(itemId);
+ UIManager.Instance.OpenWindowAsync<ItemTipWayWin>(itemId).Forget();
return;
}
@@ -179,7 +179,7 @@
switch (tipType)
{
case TipType.Equip:
- UIManager.Instance.OpenWindow<EquipTipWin>();
+ UIManager.Instance.OpenWindowAsync<EquipTipWin>().Forget();
break;
// case TipType.PetMount:
@@ -187,19 +187,19 @@
// break;
case TipType.Hero:
FirstChargeManager.Instance.heroItemID = itemId;
- UIManager.Instance.OpenWindow<FirstChargeHeroInfoWin>();
+ UIManager.Instance.OpenWindowAsync<FirstChargeHeroInfoWin>().Forget();
break;
case TipType.BoxItem:
- UIManager.Instance.OpenWindow<BoxItemWin>();
+ UIManager.Instance.OpenWindowAsync<BoxItemWin>().Forget();
break;
case TipType.BoxChooseItem:
- UIManager.Instance.OpenWindow<ChooseItemsWin>();
+ UIManager.Instance.OpenWindowAsync<ChooseItemsWin>().Forget();
break;
case TipType.TreasurePavilion:
GubaoManager.Instance.ShowTip(itemId, 0);
break;
default:
- UIManager.Instance.OpenWindow<ItemTipWin>();
+ UIManager.Instance.OpenWindowAsync<ItemTipWin>().Forget();
break;
}
}
@@ -246,22 +246,22 @@
switch (tipType)
{
case TipType.Equip:
- UIManager.Instance.OpenWindow<EquipTipWin>();
+ UIManager.Instance.OpenWindowAsync<EquipTipWin>().Forget();
break;
// case TipType.PetMount:
// WindowCenter.Instance.Open<PetMountTipWin>();
// break;
case TipType.BoxItem:
- UIManager.Instance.OpenWindow<BoxItemWin>();
+ UIManager.Instance.OpenWindowAsync<BoxItemWin>().Forget();
break;
case TipType.BoxChooseItem:
- UIManager.Instance.OpenWindow<ChooseItemsWin>();
+ UIManager.Instance.OpenWindowAsync<ChooseItemsWin>().Forget();
break;
case TipType.Mingge:
- UIManager.Instance.OpenWindow<MinggeSmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<MinggeSmallTipWin>().Forget();
break;
default:
- UIManager.Instance.OpenWindow<ItemTipWin>();
+ UIManager.Instance.OpenWindowAsync<ItemTipWin>().Forget();
break;
}
diff --git a/Main/System/ItemTip/ItemTipWayWin.cs b/Main/System/ItemTip/ItemTipWayWin.cs
index 83e601e..1ef06c6 100644
--- a/Main/System/ItemTip/ItemTipWayWin.cs
+++ b/Main/System/ItemTip/ItemTipWayWin.cs
@@ -102,7 +102,7 @@
if (StoreModel.Instance.CheckPopBuyWin(shopID))
{
StoreModel.Instance.buyShopID = shopID;
- UIManager.Instance.OpenWindow<BuyItemWin>();
+ UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
}
break;
case 2:
@@ -116,7 +116,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(1).Forget();
}
break;
case 3:
@@ -127,7 +127,7 @@
}
if (!UIManager.Instance.IsOpened<TimingGiftWin>())
{
- UIManager.Instance.OpenWindow<TimingGiftWin>(int.Parse(way.CustomValue));
+ UIManager.Instance.OpenWindowAsync<TimingGiftWin>(int.Parse(way.CustomValue)).Forget();
}
break;
case 0:
diff --git a/Main/System/ItemTip/OwnMoneyCell.cs b/Main/System/ItemTip/OwnMoneyCell.cs
index 6b3daa7..ed0f456 100644
--- a/Main/System/ItemTip/OwnMoneyCell.cs
+++ b/Main/System/ItemTip/OwnMoneyCell.cs
@@ -31,7 +31,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(1).Forget();
}
}
}
@@ -47,7 +47,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(1).Forget();
}
}
}
diff --git a/Main/System/KnapSack/Logic/CommonGetItemWin.cs b/Main/System/KnapSack/Logic/CommonGetItemWin.cs
index ce19880..417f20f 100644
--- a/Main/System/KnapSack/Logic/CommonGetItemWin.cs
+++ b/Main/System/KnapSack/Logic/CommonGetItemWin.cs
@@ -17,7 +17,7 @@
ItemLogicUtility.Instance.OnGetItemShowEvent += OnGetItemShowEvent;
scroller.OnRefreshCell += OnRefreshCell;
CreateScroller();
- SoundPlayer.Instance.PlayUIAudio(20);
+ SoundPlayer.Instance.PlayUIAudio(20).Forget();
if (string.IsNullOrEmpty(ItemLogicUtility.Instance.sourceTip))
{
tipText.text = "";
diff --git a/Main/System/KnapSack/Logic/ComposeGirdCell.cs b/Main/System/KnapSack/Logic/ComposeGirdCell.cs
index 3d62ca7..22615bf 100644
--- a/Main/System/KnapSack/Logic/ComposeGirdCell.cs
+++ b/Main/System/KnapSack/Logic/ComposeGirdCell.cs
@@ -22,7 +22,7 @@
itemCell.button.AddListener(() =>
{
//鍚堟垚鐣岄潰
- UIManager.Instance.OpenWindow<ComposeWin>(makeID);
+ UIManager.Instance.OpenWindowAsync<ComposeWin>(makeID).Forget();
});
var config = ItemCompoundConfig.GetItemCompoundConfig(makeID);
diff --git a/Main/System/KnapSack/Logic/ItemLogicUtility.cs b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
index 696d42a..56a327d 100644
--- a/Main/System/KnapSack/Logic/ItemLogicUtility.cs
+++ b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -115,7 +115,7 @@
{
if (!UIManager.Instance.IsOpenedInList<HeroShowLHWin>())
{
- UIManager.Instance.OpenWindow<HeroShowLHWin>();
+ UIManager.Instance.OpenWindowAsync<HeroShowLHWin>().Forget();
}
}
}
@@ -177,7 +177,7 @@
OnGetItemShowEvent?.Invoke();
if (!UIManager.Instance.IsOpenedInList<CommonGetItemWin>())
{
- UIManager.Instance.OpenWindow<CommonGetItemWin>();
+ UIManager.Instance.OpenWindowAsync<CommonGetItemWin>().Forget();
}
ShowHeroLHWin(items);//鏈変紶濂囦互涓婅嫳闆勬樉绀虹珛缁�
@@ -306,7 +306,7 @@
ItemBatchUseWin.itemID = itemID;
ItemBatchUseWin.ShowTextEvent = showTipEvent;
ItemBatchUseWin.btnName = btnName;
- UIManager.Instance.OpenWindow<ItemBatchUseWin>();
+ UIManager.Instance.OpenWindowAsync<ItemBatchUseWin>().Forget();
}
}
diff --git a/Main/System/KnapSack/New/CommonItemBaisc.cs b/Main/System/KnapSack/New/CommonItemBaisc.cs
index 3f0adfb..605f887 100644
--- a/Main/System/KnapSack/New/CommonItemBaisc.cs
+++ b/Main/System/KnapSack/New/CommonItemBaisc.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -156,7 +157,7 @@
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -169,7 +170,7 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell");
+ cellContainer = await UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell");
if (cellContainer != null)
{
@@ -184,7 +185,7 @@
void OnEnable()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
/// <summary>
@@ -244,15 +245,15 @@
public virtual void Init(ItemCellModel model)
{
itemId = model.itemId;
- InitUI(model.guid, model.itemId, model.count, false, model.packType, model.isCompare, model.useDataDic);
+ InitUI(model.guid, model.itemId, model.count, false, model.packType, model.isCompare, model.useDataDic).Forget();
}
- private void InitUI(string guid, int itemId, long count, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic)
+ private async UniTask InitUI(string guid, int itemId, long count, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic)
{
var config = ItemConfig.Get(itemId);
if (config == null) return;
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
itemIcon.SetActive(true);
bgIcon.SetActive(true);
diff --git a/Main/System/Launch/LaunchWin.cs b/Main/System/Launch/LaunchWin.cs
index 5eceb48..a8984ef 100644
--- a/Main/System/Launch/LaunchWin.cs
+++ b/Main/System/Launch/LaunchWin.cs
@@ -190,7 +190,7 @@
private void OpenUserHelp()
{
// TODO YYL
- // UIManager.Instance.OpenWindow<UserHelpWin>();
+ // UIManager.Instance.OpenWindowAsync<UserHelpWin>().Forget();
}
private void UpdateProgress()
diff --git a/Main/System/LineupRecommend/LineupRecommendItem.cs b/Main/System/LineupRecommend/LineupRecommendItem.cs
index 26c3629..4a89907 100644
--- a/Main/System/LineupRecommend/LineupRecommendItem.cs
+++ b/Main/System/LineupRecommend/LineupRecommendItem.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using Cysharp.Threading.Tasks;
public class LineupRecommendItem : MonoBehaviour
@@ -30,15 +30,7 @@
if (!manager.TryGetHeroSkinConfig(heroID, out HeroSkinConfig heroSkinConfig))
return;
- var sprite = UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon);
- if (sprite == null)
- {
- imgHeroHead.SetSprite("herohead_default");
- }
- else
- {
- imgHeroHead.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon, imgHeroHead, "herohead_default").Forget();
imgSquareIcon.SetSprite("heroheadBG" + heroConfig.Quality);
imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
@@ -67,7 +59,7 @@
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID;
- UIManager.Instance.OpenWindow<HeroBestWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestWin>().Forget();
}
});
@@ -123,7 +115,7 @@
else
{
HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID;
- UIManager.Instance.OpenWindow<HeroBestWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestWin>().Forget();
}
});
diff --git a/Main/System/Login/LoginManager.cs b/Main/System/Login/LoginManager.cs
index ff3a6bc..0c6f8d2 100644
--- a/Main/System/Login/LoginManager.cs
+++ b/Main/System/Login/LoginManager.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
@@ -62,7 +63,7 @@
public bool isLogined { get; set; }
- public override void Init()
+ public override async UniTask Init()
{
SDKUtils.Instance.onFreePlatformLoginOk += OnSDKAccountLoginOk;
SDKUtils.Instance.onFreePlatformLogoutOk += OnSDKAccountLoginOutOk;
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index c844753..01cc657 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/Main/System/Login/LoginWin.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
using System.IO;
using Cysharp.Threading.Tasks;
@@ -65,20 +65,20 @@
serverRead.SetListener(() =>
{
// GameAgeWarnWin.data = 1;
- // UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ // UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
SDKUtils.Instance.OpenUrl(OPConfigConfig.Get("yhxy").content);
});
hideRead.SetListener(() =>
{
// GameAgeWarnWin.data = 2;
- // UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ // UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
SDKUtils.Instance.OpenUrl(OPConfigConfig.Get("yszc").content);
});
ageWarn.SetListener(() =>
{
GameAgeWarnWin.data = 3;
- UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
});
checkRead.onValueChanged.AddListener((bool value) =>
{
@@ -145,11 +145,13 @@
//鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
verInfo.text = LoginManager.Instance.GetVersionStr();
- var sprite = BuiltInLoader.LoadSprite("TB_DL_Logo");
- m_Logo.overrideSprite = sprite;
- m_Logo.SetNativeSize();
- m_Logo.rectTransform.anchoredPosition = VersionConfig.Get().logoPosition;
- m_Notice.SetActive(GameNotice.HasNotice());
+ BuiltInLoader.LoadSpriteAsync("TB_DL_Logo").ContinueWith(sprite =>
+ {
+ m_Logo.overrideSprite = sprite;
+ m_Logo.SetNativeSize();
+ m_Logo.rectTransform.anchoredPosition = VersionConfig.Get().logoPosition;
+ m_Notice.SetActive(GameNotice.HasNotice());
+ }).Forget();
bool hasNotice = GameNotice.HasNotice();
@@ -322,7 +324,7 @@
private void OpenServerListWin()
{
- UIManager.Instance.OpenWindow<ServerListWin>();
+ UIManager.Instance.OpenWindowAsync<ServerListWin>().Forget();
}
private void SwitchAccount()
@@ -339,7 +341,7 @@
//private void OpenUserHelp()
//{
// // TODO YYL
- // // UIManager.Instance.OpenWindow<UserHelpWin>();
+ // // UIManager.Instance.OpenWindowAsync<UserHelpWin>().Forget();
//}
protected void Login()
diff --git a/Main/System/Mail/MailCell.cs b/Main/System/Mail/MailCell.cs
index ec8e9ff..725a067 100644
--- a/Main/System/Mail/MailCell.cs
+++ b/Main/System/Mail/MailCell.cs
@@ -49,6 +49,6 @@
{
model.ReadMail(uuid);
}
- UIManager.Instance.OpenWindow<MailInfoWin>();
+ UIManager.Instance.OpenWindowAsync<MailInfoWin>().Forget();
}
}
diff --git a/Main/System/Main/AutoFightWin.cs b/Main/System/Main/AutoFightWin.cs
index 2a3a72b..8ea6a57 100644
--- a/Main/System/Main/AutoFightWin.cs
+++ b/Main/System/Main/AutoFightWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using UnityEngine;
using UnityEngine.UI;
@@ -139,7 +139,7 @@
recordBtn.SetListener(() =>
{
- UIManager.Instance.OpenWindow<EquipRecordWin>();
+ UIManager.Instance.OpenWindowAsync<EquipRecordWin>().Forget();
});
}
@@ -172,7 +172,7 @@
SmallTipWin.showText = Language.Get(key);
SmallTipWin.worldPos = worldPos;
SmallTipWin.isDownShow = false;
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
void Display()
diff --git a/Main/System/Main/FunctionsBaseWin.cs b/Main/System/Main/FunctionsBaseWin.cs
index a648552..9282c60 100644
--- a/Main/System/Main/FunctionsBaseWin.cs
+++ b/Main/System/Main/FunctionsBaseWin.cs
@@ -114,6 +114,8 @@
public void ClickFuncBtn(int index)
{
+ if (tabButtons == null || index >= tabButtons.Length)
+ return;
if (tabButtons[index].isLock)
{
return;
diff --git a/Main/System/Main/HeroFightingCardCell.cs b/Main/System/Main/HeroFightingCardCell.cs
index bb27300..1981f33 100644
--- a/Main/System/Main/HeroFightingCardCell.cs
+++ b/Main/System/Main/HeroFightingCardCell.cs
@@ -80,16 +80,8 @@
var heroConfig = HeroConfig.Get(heroID);
qualityBG.SetSprite("herocBG" + heroConfig.Quality);
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon);
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- heroIcon.SetSprite("herohead_big_default");
- }
- else
- {
- heroIcon.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon, heroIcon, "herohead_big_default").Forget();
+
if (star == 0)
{
@@ -207,7 +199,7 @@
{
HeroUIManager.Instance.SortHeroList();
HeroUIManager.Instance.selectHeroGuid = guid;
- UIManager.Instance.OpenWindow<HeroTrainWin>();
+ UIManager.Instance.OpenWindowAsync<HeroTrainWin>().Forget();
}
void ClickEmpty()
@@ -226,7 +218,7 @@
}
return;
}
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
}
void OnSkillCast(bool isfighting)
{
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index da47121..f514112 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -112,7 +112,7 @@
changeHeroPosBtn.AddListener(() =>
{
HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetMainTeamID();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
autoBtn.AddListener(() =>
@@ -121,7 +121,7 @@
{
return;
}
- UIManager.Instance.OpenWindow<AutoFightWin>();
+ UIManager.Instance.OpenWindowAsync<AutoFightWin>().Forget();
});
@@ -129,7 +129,7 @@
FirstChargeBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<FirstChargeWin>();
+ UIManager.Instance.OpenWindowAsync<FirstChargeWin>().Forget();
});
blessLVBtn.AddListener(() =>
@@ -138,21 +138,21 @@
{
return;
}
- UIManager.Instance.OpenWindow<BlessLVWin>();
+ UIManager.Instance.OpenWindowAsync<BlessLVWin>().Forget();
});
mailBtn.AddListener(() =>
{
if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mail, true))
return;
- UIManager.Instance.OpenWindow<MailWin>();
+ UIManager.Instance.OpenWindowAsync<MailWin>().Forget();
});
officialUpBtn.AddListener(() =>
{
if (RealmConfig.GetKeys().Count <= PlayerDatas.Instance.baseData.realmLevel)
return;
- UIManager.Instance.OpenWindow<OfficialUpWin>();
+ UIManager.Instance.OpenWindowAsync<OfficialUpWin>().Forget();
});
restBtn.AddListener(GotoRest);
@@ -175,7 +175,7 @@
// {
// transFastChat.SetActive(false);
// transChatInfo.SetActive(true);
- // UIManager.Instance.OpenWindow<ChatWin>();
+ // UIManager.Instance.OpenWindowAsync<ChatWin>().Forget();
// });
// btnFastChatSend.SetListener(() =>
@@ -201,20 +201,20 @@
osMainLevelBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<OSMainLevelBaseWin>();
+ UIManager.Instance.OpenWindowAsync<OSMainLevelBaseWin>().Forget();
});
osHeroCallBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<OSHeroCallBaseWin>();
+ UIManager.Instance.OpenWindowAsync<OSHeroCallBaseWin>().Forget();
});
osGalaBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<OSGalaBaseWin>();
+ UIManager.Instance.OpenWindowAsync<OSGalaBaseWin>().Forget();
});
DailySpecialsBtns.AddListener(() =>
{
- UIManager.Instance.OpenWindow<DailySpecialsBaseWin>();
+ UIManager.Instance.OpenWindowAsync<DailySpecialsBaseWin>().Forget();
});
}
@@ -276,7 +276,7 @@
Display();
DisplayFirstChargeBtn();
DisplayOSActivity();
- timingGiftCell.InitUI();
+ timingGiftCell.InitUI().Forget();
DisplayTimeRush();
@@ -320,7 +320,7 @@
private void OnShowGiftIdListAddEvent()
{
- timingGiftCell.InitUI();
+ timingGiftCell.InitUI().Forget();
}
private void OnAutoAttackEvent()
@@ -381,7 +381,7 @@
break;
}
}
- UIManager.Instance.OpenWindow<ChatWin>();
+ UIManager.Instance.OpenWindowAsync<ChatWin>().Forget();
}
public string GetMainChatAreaContent(TalkData talkData)
@@ -453,9 +453,28 @@
{
if (chatBulletViewPrefab == null)
{
- chatBulletViewPrefab = UIUtility.CreateWidget("ChatBulletView", "ChatBulletView");
+ //chatBulletViewPrefab = UIUtility.CreateWidget("ChatBulletView", "ChatBulletView");
+
+ UIUtility.CreateWidget("ChatBulletView", "ChatBulletView").ContinueWith(prefab =>
+ {
+ if (this == null)
+ {
+ if (prefab != null)
+ {
+ GameObject.DestroyImmediate(prefab);
+ }
+ return;
+ }
+
+ chatBulletViewPrefab = prefab;
+ chatBulletViewPrefab.transform.SetParentEx(transChatBulletView.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ }).Forget();
}
- chatBulletViewPrefab.transform.SetParentEx(transChatBulletView.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ else
+ {
+ chatBulletViewPrefab.transform.SetParentEx(transChatBulletView.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ }
+
// 鏂板锛氱‘淇� ChatBulletView 缁勪欢鍚敤
// var chatBulletView = chatBulletViewPrefab.GetComponent<ChatBulletView>();
// if (chatBulletView != null)
@@ -474,7 +493,7 @@
await UniTask.Delay(1200);
if (this == null) return; // destroyed during await
if (!SoundPlayer.Instance.IsPlayBackGroundMuisic())
- SoundPlayer.Instance.PlayBackGroundMusic(38);
+ await SoundPlayer.Instance.PlayBackGroundMusic(38);
}
@@ -484,12 +503,12 @@
// if (null != battleField)
// {
- // StoryBossBattleWin fsBattleWin = UIManager.Instance.OpenWindow<StoryBossBattleWin>();
+ // StoryBossBattleWin fsBattleWin = UIManager.Instance.OpenWindowAsync<StoryBossBattleWin>().Forget();
// fsBattleWin.SetBattleField(battleField);
// return;
// }
- UIManager.Instance.OpenWindow<MainBossEnterWin>();
+ UIManager.Instance.OpenWindowAsync<MainBossEnterWin>().Forget();
}
int lastLV = 0;
@@ -805,7 +824,7 @@
}
else if (funcId == (int)FuncOpenEnum.TimingGift)
{
- timingGiftCell.InitUI();
+ timingGiftCell.InitUI().Forget();
}
else if (funcId == (int)FuncOpenEnum.TimeRush)
{
@@ -837,7 +856,7 @@
horseBGImg.SetActive(true);
//equipShowSwitch;//褰撳墠閰嶇疆鐨勫潗楠戝瑙侷D瀛樺偍鍦紙鏈�澶ф敮鎸� 1~999锛�
var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID(true));
- horseImg.Create(skinConfig.SkinID, 0, 0.6f);
+ horseImg.Create(skinConfig.SkinID, 0, 0.6f).Forget();
horseLVText.text = Language.Get("Horse8", HorseManager.Instance.classLV, HorseManager.Instance.horseLV);
}
else
@@ -850,7 +869,7 @@
{
if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Horse, true))
{
- UIManager.Instance.OpenWindow<HorseWin>();
+ UIManager.Instance.OpenWindowAsync<HorseWin>().Forget();
}
}
diff --git a/Main/System/Main/MainWin.cs b/Main/System/Main/MainWin.cs
index 5ebb182..5177284 100644
--- a/Main/System/Main/MainWin.cs
+++ b/Main/System/Main/MainWin.cs
@@ -40,10 +40,13 @@
protected override void InitComponent()
{
base.InitComponent();
- avatarCell.redpoint.redpointId = MainRedDot.PhantasmPavilionRepoint;
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- UIManager.Instance.OpenWindow<PlayerProfileWin>();
+ avatarCell.redpoint.redpointId = MainRedDot.PhantasmPavilionRepoint;
+ avatarCell.SetListener(() =>
+ {
+ UIManager.Instance.OpenWindowAsync<PlayerProfileWin>().Forget();
+ });
});
}
@@ -250,7 +253,7 @@
else if (index == 4 && !PlayerDatas.Instance.fairyData.HasFairy)
{
//鏈姞鍏ュ叕浼氫笉鍒囨崲鏍囩锛屾墦寮�鐢宠鐣岄潰
- UIManager.Instance.OpenWindow<GuildJoinWin>();
+ UIManager.Instance.OpenWindowAsync<GuildJoinWin>().Forget();
return;
}
@@ -263,7 +266,7 @@
if (index == 3)
{
//鎸戞垬鐗规畩鏄剧ず閫昏緫
- UIManager.Instance.OpenWindow<ChallengeTabWin>();
+ UIManager.Instance.OpenWindowAsync<ChallengeTabWin>().Forget();
return;
}
@@ -304,18 +307,18 @@
// 鎵撳紑涓婚〉鐣岄潰
if (!UIManager.Instance.IsOpened<BattleWin>())
{
- BattleWin battleWin = UIManager.Instance.OpenWindow<BattleWin>();
- battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
+ UIManager.Instance.OpenWindowAsync<BattleWin>().ContinueWith(battleWin =>
+ battleWin.SetBattleField(BattleManager.Instance.storyBattleField)).Forget();
}
else
{
BattleWin battleWin = UIManager.Instance.GetUI<BattleWin>();
battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
}
- currentSubUI = UIManager.Instance.OpenWindow<HomeWin>();
+ UIManager.Instance.OpenWindowAsync<HomeWin>().ContinueWith(w => currentSubUI = w).Forget();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<AffairBaseWin>();
+ UIManager.Instance.OpenWindowAsync<AffairBaseWin>().ContinueWith(w => currentSubUI = w).Forget();
break;
case 2:
if (gameTip.gameObject.activeSelf)
@@ -325,14 +328,14 @@
HappyXBModel.Instance.startTenCallGuide = true;
}
}
- currentSubUI = UIManager.Instance.OpenWindow<HeroBaseWin>(0);
+ UIManager.Instance.OpenWindowAsync<HeroBaseWin>(0).ContinueWith(w => currentSubUI = w).Forget();
break;
// case 3:
// 鎸戞垬鐣岄潰涓嶈烦杞�
// Debug.Log("鎵撳紑鎸戞垬鐣岄潰");
// break;
case 4:
- currentSubUI = UIManager.Instance.OpenWindow<GuildBaseWin>();
+ UIManager.Instance.OpenWindowAsync<GuildBaseWin>().ContinueWith(w => currentSubUI = w).Forget();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/Main/PlayerMainDate.cs b/Main/System/Main/PlayerMainDate.cs
index 76fb4cb..14589d2 100644
--- a/Main/System/Main/PlayerMainDate.cs
+++ b/Main/System/Main/PlayerMainDate.cs
@@ -79,7 +79,7 @@
AddPowerEvent?.Invoke();
return;
}
- UIManager.Instance.OpenWindow<PowerAddWin>();
+ UIManager.Instance.OpenWindowAsync<PowerAddWin>().Forget();
}
else
{
@@ -98,7 +98,7 @@
// AddPowerEvent?.Invoke();
// return;
// }
- // UIManager.Instance.OpenWindow<PowerAddWin>();
+ // UIManager.Instance.OpenWindowAsync<PowerAddWin>().Forget();
// }
/// <summary>
@@ -127,7 +127,7 @@
AddPowerEvent?.Invoke();
return;
}
- UIManager.Instance.OpenWindow<PowerAddWin>();
+ UIManager.Instance.OpenWindowAsync<PowerAddWin>().Forget();
}
}
diff --git a/Main/System/Main/RightFuncInHome.cs b/Main/System/Main/RightFuncInHome.cs
index 4eb474d..daff21e 100644
--- a/Main/System/Main/RightFuncInHome.cs
+++ b/Main/System/Main/RightFuncInHome.cs
@@ -28,13 +28,13 @@
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("PrivilegeCardWin");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
});
storeBtn.AddListener(() =>
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("StoreBaseWin");
- UIManager.Instance.OpenWindow<StoreBaseWin>();
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>().Forget();
});
clickScreenOtherSpaceEvent.AddListener(() =>
@@ -57,35 +57,35 @@
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("DayMissionBaseWin");
- UIManager.Instance.OpenWindow<DayMissionBaseWin>();
+ UIManager.Instance.OpenWindowAsync<DayMissionBaseWin>().Forget();
});
battlePassBtn.AddListener(() =>
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("BattlePassBaseWin");
- UIManager.Instance.OpenWindow<BattlePassBaseWin>();
+ UIManager.Instance.OpenWindowAsync<BattlePassBaseWin>().Forget();
});
llmjBtn.AddListener(() =>
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("ExpSecretCollectionWin");
- UIManager.Instance.OpenWindow<ExpSecretCollectionWin>();
+ UIManager.Instance.OpenWindowAsync<ExpSecretCollectionWin>().Forget();
});
signBtn.AddListener(() =>
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("SignWin");
- UIManager.Instance.OpenWindow<SignWin>();
+ UIManager.Instance.OpenWindowAsync<SignWin>().Forget();
});
previewBtn.AddListener(() =>
{
//鐢ㄤ簬鐩戝惉鐣岄潰锛屾墦寮�鏃剁缉杩涘彸杈瑰姛鑳芥爮锛屽叧闂椂鏄剧ず
ListenWindow("FunctionPreviewWin");
- UIManager.Instance.OpenWindow<FunctionPreviewWin>();
+ UIManager.Instance.OpenWindowAsync<FunctionPreviewWin>().Forget();
});
}
diff --git a/Main/System/MainLevel/MainBossEnterWin.cs b/Main/System/MainLevel/MainBossEnterWin.cs
index 634ef81..474a644 100644
--- a/Main/System/MainLevel/MainBossEnterWin.cs
+++ b/Main/System/MainLevel/MainBossEnterWin.cs
@@ -8,6 +8,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class MainBossEnterWin : UIBase
@@ -35,7 +36,7 @@
{
RankModel.Instance.ResetQueryParam();
RankModel.Instance.QueryRankByPage(0, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
- UIManager.Instance.OpenWindow<PlayerRankWin>(0);
+ UIManager.Instance.OpenWindowAsync<PlayerRankWin>(0).Forget();
});
@@ -43,7 +44,7 @@
heroRoadBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<DayMissionBaseWin>(2);
+ UIManager.Instance.OpenWindowAsync<DayMissionBaseWin>(2).Forget();
});
funPresetBtn.AddListener(()=>
@@ -104,8 +105,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat",SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description) ;
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/System/Message/ColorAnalysis.cs b/Main/System/Message/ColorAnalysis.cs
index 6047ab5..0bb78fa 100644
--- a/Main/System/Message/ColorAnalysis.cs
+++ b/Main/System/Message/ColorAnalysis.cs
@@ -1,13 +1,14 @@
锘縰sing System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class ColorAnalysis : TRichAnalysis<ColorAnalysis>
{
public static Regex Color_Start_Regex = new Regex(@"<color=#([0-9a-zA-Z]+)>", RegexOptions.Singleline);
- public override string Analysis(string val, bool IsRich)
+ public override async UniTask<string> Analysis(string val, bool IsRich)
{
return val;
// if (!Color_Start_Regex.IsMatch(val) || RichTextMgr.Inst.presentRichText == null)
diff --git a/Main/System/Message/HrefAnalysis.cs b/Main/System/Message/HrefAnalysis.cs
index ff1c108..4c5f902 100644
--- a/Main/System/Message/HrefAnalysis.cs
+++ b/Main/System/Message/HrefAnalysis.cs
@@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
-
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class HrefAnalysis : TRichAnalysis<HrefAnalysis>
{
@@ -15,7 +15,7 @@
static int insertIndex = 0;
- public override string Analysis(string val, bool IsRich)
+ public override async UniTask<string> Analysis(string val, bool IsRich)
{
if (!HrefRegex.IsMatch(val))
{
diff --git a/Main/System/Message/ImgAnalysis.cs b/Main/System/Message/ImgAnalysis.cs
index b678705..1b03ee0 100644
--- a/Main/System/Message/ImgAnalysis.cs
+++ b/Main/System/Message/ImgAnalysis.cs
@@ -13,7 +13,7 @@
private RichTextMgr.ImgInfo presentImgInfo = null;
- public override string Analysis(string val, bool IsRich)
+ public override async UniTask<string> Analysis(string val, bool IsRich)
{
if (!Img_Regex.IsMatch(val))
{
@@ -31,7 +31,7 @@
presentImgInfo = imgInfo;
m_StringBuilder.Append(val.Substring(index, match.Index - index));
- AnalysisSplitEvent(match.Groups[1].Value);
+ await AnalysisSplitEvent(match.Groups[1].Value);
if (IsRich)
{
@@ -93,7 +93,7 @@
return val;
}
- private void AnalysisSplitEvent(string val)
+ private async UniTask AnalysisSplitEvent(string val)
{
string[] array = GetSplitEvent(val);
if (array.Length > 0)
@@ -103,7 +103,7 @@
AnalysisSplitData(split_event);
}
}
- LoadSprite();
+ await LoadSprite();
}
private void AnalysisSplitData(string val)
@@ -190,18 +190,18 @@
m_StringBuilder.Append("/></color>");
}
- private void LoadSprite()
+ private async UniTask LoadSprite()
{
if (presentImgInfo.IsFace) return;
if (IconConfig.isInit)
{
if (!string.IsNullOrEmpty(presentImgInfo.folderName))
{
- presentImgInfo.sprite = UILoader.LoadSprite(presentImgInfo.folderName, presentImgInfo.spriteName);
+ presentImgInfo.sprite = await UILoader.LoadSpriteAsync(presentImgInfo.folderName, presentImgInfo.spriteName);
}
else
{
- presentImgInfo.sprite = UILoader.LoadSprite(presentImgInfo.spriteName);
+ presentImgInfo.sprite = await UILoader.LoadSpriteAsync(presentImgInfo.spriteName);
}
}
diff --git a/Main/System/Message/RichText.cs b/Main/System/Message/RichText.cs
index 5bd0ba7..a77d2c9 100644
--- a/Main/System/Message/RichText.cs
+++ b/Main/System/Message/RichText.cs
@@ -182,13 +182,23 @@
unline = transform.GetComponentInChildren<TextUnline>();
if (unline == null)
{
- GameObject obj = BuiltInLoader.LoadPrefab("TextUnline");
- // GameObject obj = UILoader.LoadPrefab("TextUnline") as GameObject;
- obj = Instantiate(obj);
- obj.transform.SetParent(transform);
- obj.transform.localScale = Vector3.one;
- unline = obj.GetComponent<TextUnline>();
- unline.raycastTarget = false;
+ // GameObject obj = await BuiltInLoader.LoadPrefabAsync("TextUnline");
+ // if (this == null) return;
+ // obj = Instantiate(obj);
+ // obj.transform.SetParent(transform);
+ // obj.transform.localScale = Vector3.one;
+ // unline = obj.GetComponent<TextUnline>();
+ // unline.raycastTarget = false;
+
+ BuiltInLoader.LoadPrefabAsync("TextUnline").ContinueWith(prefab =>
+ {
+ if (this == null) return;
+ GameObject obj = Instantiate(prefab);
+ obj.transform.SetParent(transform);
+ obj.transform.localScale = Vector3.one;
+ unline = obj.GetComponent<TextUnline>();
+ unline.raycastTarget = false;
+ }).Forget();
}
}
@@ -285,12 +295,14 @@
#endregion
#region 瑙f瀽
- private string GetOutputText(string _text)
+ private async UniTask<string> GetOutputText(string _text)
{
string result = _text;
result = GetExtenalData(result);
result = GetTaskInfo(result);
- result = RichTextMgr.Inst.Analysis(result, out m_ImgList, out m_HrefList, this);
+ result = await RichTextMgr.Inst.Analysis(result, this);
+ m_ImgList = RichTextMgr.Inst.GetImgList();
+ m_HrefList = RichTextMgr.Inst.GetHrefList();
return result;
}
#endregion
@@ -1033,7 +1045,7 @@
value = string.Empty;
}
m_RichText = value;
- SetRichTextDirty();
+ SetRichTextDirty().Forget();
}
}
@@ -1044,10 +1056,10 @@
}
#endif
- private void SetRichTextDirty()
+ private async UniTask SetRichTextDirty()
{
m_RichText = UIHelper.ReplaceNewLine(m_RichText);
- m_OutputText = GetOutputText(m_RichText);
+ m_OutputText = await GetOutputText(m_RichText);
if (AutoNewLine)
{
SetFitterSize();
diff --git a/Main/System/Message/RichTextMgr.cs b/Main/System/Message/RichTextMgr.cs
index 991ffca..b566100 100644
--- a/Main/System/Message/RichTextMgr.cs
+++ b/Main/System/Message/RichTextMgr.cs
@@ -1,5 +1,6 @@
锘縰sing System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class RichTextMgr {
@@ -30,41 +31,39 @@
/// </summary>
/// <param name="_text"></param>
/// <returns></returns>
- public string Analysis(string _text,out List<ImgInfo> imgList,out List<HrefInfo> hrefList,RichText text=null)
+ public async UniTask<string> Analysis(string _text, RichText text=null)
{
- imgList = new List<ImgInfo>();
- m_ImgInfoList = imgList;
- hrefList = new List<HrefInfo>();
- m_HrefInfoList = hrefList;
+ m_ImgInfoList = new List<ImgInfo>();
+ m_HrefInfoList = new List<HrefInfo>();
presentRichText = text;
- string result=GetAnalysis(_text);
+ string result= await GetAnalysis(_text);
//for (int i = 0; i < m_ImgInfoList.Count; i++) {
ImgAnalysis.Inst.CalculateTextIndex(result, 0);
//}
return result;
}
- public string Analysis(string val)
+ public async UniTask<string> Analysis(string val)
{
m_HrefInfoList = null;
m_ImgInfoList = null;
- return GetAnalysis(val);
+ return await GetAnalysis(val);
}
- private string GetAnalysis(string val)
+ private async UniTask<string> GetAnalysis(string val)
{
string result = ImgAnalysis.ReplaceFace(val);
try
{
- result = ColorAnalysis.Inst.Analysis(result, true);
+ result = await ColorAnalysis.Inst.Analysis(result, true);
result = WordAnalysis.Inst.ReplaceSpace(result);
- result = ImgAnalysis.Inst.Analysis(result, true);
- result = WordAnalysis.Inst.Analysis(result, true);
- result = HrefAnalysis.Inst.Analysis(result, true);
- result = SuitNameAnalysis.Inst.Analysis(result, true);
+ result = await ImgAnalysis.Inst.Analysis(result, true);
+ result = await WordAnalysis.Inst.Analysis(result, true);
+ result = await HrefAnalysis.Inst.Analysis(result, true);
+ result = await SuitNameAnalysis.Inst.Analysis(result, true);
result = HrefAnalysis.Inst.CalculateTextIndex(result, 0);
}
catch (System.Exception e)
diff --git a/Main/System/Message/SuitNameAnalysis.cs b/Main/System/Message/SuitNameAnalysis.cs
index 0b73356..593b830 100644
--- a/Main/System/Message/SuitNameAnalysis.cs
+++ b/Main/System/Message/SuitNameAnalysis.cs
@@ -2,12 +2,13 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class SuitNameAnalysis : TRichAnalysis<SuitNameAnalysis>
{
public static Regex SuitName_Regex = new Regex(@"<Suitname=(.*?)/>\|{0,1}");
- public override string Analysis(string val, bool IsRich)
+ public override async UniTask<string> Analysis(string val, bool IsRich)
{
if (!SuitName_Regex.IsMatch(val))
{
diff --git a/Main/System/Message/TRichAnalysis.cs b/Main/System/Message/TRichAnalysis.cs
index 1cdb7b8..e578895 100644
--- a/Main/System/Message/TRichAnalysis.cs
+++ b/Main/System/Message/TRichAnalysis.cs
@@ -1,6 +1,7 @@
锘縰sing System.Collections;
using System.Collections.Generic;
using System.Text;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public abstract class TRichAnalysis<T> where T:class,new()
@@ -20,7 +21,7 @@
protected static Dictionary<string, string> displayDic = new Dictionary<string, string>();
- public abstract string Analysis(string val,bool IsRich);
+ public abstract UniTask<string> Analysis(string val,bool IsRich);
public abstract string CalculateTextIndex(string val,int index);
diff --git a/Main/System/Message/WordAnalysis.cs b/Main/System/Message/WordAnalysis.cs
index f2ec290..d543282 100644
--- a/Main/System/Message/WordAnalysis.cs
+++ b/Main/System/Message/WordAnalysis.cs
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class WordAnalysis : TRichAnalysis<WordAnalysis>
{
@@ -18,7 +19,7 @@
private static int presentColor = 0;
private static bool hasColor = false;
- public override string Analysis(string val, bool IsRich)
+ public override async UniTask<string> Analysis(string val, bool IsRich)
{
if (!Word_Regex.IsMatch(val))
{
diff --git a/Main/System/Mingge/MinggeAutoSetWin.cs b/Main/System/Mingge/MinggeAutoSetWin.cs
index c9ddb48..26ab8b1 100644
--- a/Main/System/Mingge/MinggeAutoSetWin.cs
+++ b/Main/System/Mingge/MinggeAutoSetWin.cs
@@ -3,6 +3,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class MinggeAutoSetWin : UIBase
@@ -128,7 +129,7 @@
{
speedUPToggle.SetIsOnWithoutNotify(false);
SysNotifyMgr.Instance.ShowTip("MinggeAuto5");
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
return;
}
MinggeManager.Instance.autoSpeedUP = isOn;
@@ -148,7 +149,7 @@
if (isOK)
{
CloseWindow();
- UIManager.Instance.OpenWindow<MinggePrayWin>();
+ UIManager.Instance.OpenWindowAsync<MinggePrayWin>().Forget();
}
else
{
diff --git a/Main/System/Mingge/MinggeManager.cs b/Main/System/Mingge/MinggeManager.cs
index 9c9ffed..9ef3020 100644
--- a/Main/System/Mingge/MinggeManager.cs
+++ b/Main/System/Mingge/MinggeManager.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using UnityEngine;
using LitJson;
using System;
@@ -292,7 +292,7 @@
}
if (!UIManager.Instance.IsOpened<MinggeEquipWin>())
{
- UIManager.Instance.OpenWindow<MinggeEquipWin>();
+ UIManager.Instance.OpenWindowAsync<MinggeEquipWin>().Forget();
}
else
{
diff --git a/Main/System/Mingge/MinggeWin.cs b/Main/System/Mingge/MinggeWin.cs
index 5bf1b64..67760d7 100644
--- a/Main/System/Mingge/MinggeWin.cs
+++ b/Main/System/Mingge/MinggeWin.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class MinggeWin : UIBase
@@ -33,12 +34,29 @@
FuncPresetChooseCells presetChooseCells;
int lastLV = 0;
int lastExp = 0;
+
+ UniTask loadPresetChooseCellsTask;
+
protected override void InitComponent()
{
- var presetObj = UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells");
- presetObj.transform.SetParentEx(caseesObj, Vector3.zero, Quaternion.identity, Vector3.one);
- presetChooseCells = presetObj.GetComponent<FuncPresetChooseCells>();
- presetChooseCells.ChangeAlignment(TextAnchor.MiddleCenter);
+ loadPresetChooseCellsTask = UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells").ContinueWith(presetObj =>
+ {
+ if (this == null)
+ {
+ if (presetObj != null)
+ {
+ GameObject.DestroyImmediate(presetObj.gameObject);
+ }
+ return;
+ }
+
+ presetObj.transform.SetParentEx(caseesObj, Vector3.zero, Quaternion.identity, Vector3.one);
+ presetChooseCells = presetObj.GetComponent<FuncPresetChooseCells>();
+ presetChooseCells.ChangeAlignment(TextAnchor.MiddleCenter);
+ });
+
+ loadPresetChooseCellsTask.Forget();
+
seeAttrBtn.AddListener(() =>
{
var skillTypeDict = MinggeManager.Instance.GetMinggeSkillTypeIDDict();
@@ -60,7 +78,7 @@
}
prayBtn.AddListener(() =>
{
- UIManager.Instance.OpenWindow<MinggePrayWin>();
+ UIManager.Instance.OpenWindowAsync<MinggePrayWin>().Forget();
});
autoBtn.AddListener(AutoTY);
@@ -145,6 +163,12 @@
DisplayCostItem();
moneyMoveByPathCell.SetActive(false);
+
+ if (presetChooseCells == null)
+ {
+
+ }
+
presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge);
funPresetBtn.SetActive(FuncPresetManager.Instance.IsPreShow());
@@ -256,7 +280,7 @@
{
if (isOK)
{
- UIManager.Instance.OpenWindow<MinggePrayWin>();
+ UIManager.Instance.OpenWindowAsync<MinggePrayWin>().Forget();
}
else
{
@@ -372,12 +396,12 @@
if (InvestModel.Instance.IsInvested(InvestModel.monthCardType) ||
PlayerDatas.Instance.baseData.realmLevel >= MinggeManager.Instance.needOfficialRank)
{
- UIManager.Instance.OpenWindow<MinggeAutoSetWin>();
+ UIManager.Instance.OpenWindowAsync<MinggeAutoSetWin>().Forget();
}
else
{
SysNotifyMgr.Instance.ShowTip("MinggeAuto6", RealmConfig.Get(MinggeManager.Instance.needOfficialRank).Name);
- UIManager.Instance.OpenWindow<PrivilegeCardWin>();
+ UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget();
}
}
}
diff --git a/Main/System/NetLink/NetLinkWin.cs b/Main/System/NetLink/NetLinkWin.cs
index 9d795e9..3bdaec3 100644
--- a/Main/System/NetLink/NetLinkWin.cs
+++ b/Main/System/NetLink/NetLinkWin.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
@@ -80,7 +80,7 @@
{
linkOverTime = _delay;
- UIManager.Instance.OpenWindow<NetLinkWin>();
+ UIManager.Instance.OpenWindowAsync<NetLinkWin>().Forget();
}
public static void Hide()
diff --git a/Main/System/NewBieGuidance/NewBieCenter.cs b/Main/System/NewBieGuidance/NewBieCenter.cs
index 3a4ead7..f289d78 100644
--- a/Main/System/NewBieGuidance/NewBieCenter.cs
+++ b/Main/System/NewBieGuidance/NewBieCenter.cs
@@ -300,7 +300,7 @@
Debug.Log($"寮�濮嬪紩瀵糏D锛歿_id}");
guideStep = config.Steps.Length > 0 ? config.Steps[0] : 0;
- var stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStep(guideStep);
+ // var stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStepAsync(guideStep);
TryPauseStoryBattle();
@@ -311,7 +311,7 @@
if (!UIManager.Instance.IsOpened<NewBieWin>())
{
- UIManager.Instance.OpenWindow<NewBieWin>();
+ UIManager.Instance.OpenWindowAsync<NewBieWin>().Forget();
}
else
{
@@ -322,9 +322,9 @@
}
- public void TryPauseStoryBattle()
+ public async void TryPauseStoryBattle()
{
- var stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStep(guideStep);
+ var stepConfig = await ScriptableObjectLoader.LoadSoNewBieGuideStepAsync(guideStep);
if (!(stepConfig.guideType == GuideType.NewBie && stepConfig.clickCompleteNoMask))
{
// 闈炲己鍒跺紩瀵间笉鏆傚仠鎴樻枟锛屽鏈夊叿浣撻渶瑕佸彲浠ュ鍔犲瓧娈�
diff --git a/Main/System/NewBieGuidance/NewBieMask.cs b/Main/System/NewBieGuidance/NewBieMask.cs
index 481f05c..dfee74a 100644
--- a/Main/System/NewBieGuidance/NewBieMask.cs
+++ b/Main/System/NewBieGuidance/NewBieMask.cs
@@ -10,9 +10,9 @@
[SerializeField] GuideCircleHollowImage m_Mask;
public GuideCircleHollowImage mask { get { return m_Mask; } }
- public void Display(int _guideStep, Transform _target)
+ public async void Display(int _guideStep, Transform _target)
{
- var config = ScriptableObjectLoader.LoadSoNewBieGuideStep(_guideStep);
+ var config = await ScriptableObjectLoader.LoadSoNewBieGuideStepAsync(_guideStep);
if (_target == null)
{
return;
diff --git a/Main/System/NewBieGuidance/NewBieWin.cs b/Main/System/NewBieGuidance/NewBieWin.cs
index 407cdcc..a8bf757 100644
--- a/Main/System/NewBieGuidance/NewBieWin.cs
+++ b/Main/System/NewBieGuidance/NewBieWin.cs
@@ -96,7 +96,7 @@
}
#endregion
- void Display()
+ async void Display()
{
config = GuideConfig.Get(NewBieCenter.Instance.currentGuide);
if (config == null)
@@ -106,7 +106,7 @@
}
var step = NewBieCenter.Instance.guideStep;
- stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStep(step);
+ stepConfig = await ScriptableObjectLoader.LoadSoNewBieGuideStepAsync(step);
if (stepConfig == null)
{
CloseWindow();
@@ -205,7 +205,7 @@
DisplayGuide();
}
//PlayNewBieAudio 涓嶄細琚玼i闊虫晥鎵撴柇 PlayUIAudio
- SoundPlayer.Instance.PlayNewBieAudio(stepConfig.voice);
+ SoundPlayer.Instance.PlayNewBieAudio(stepConfig.voice).Forget();
}
int tryGuideCount = 0;
diff --git a/Main/System/OSActivity/OSGalaBaseWin.cs b/Main/System/OSActivity/OSGalaBaseWin.cs
index 1482eec..2797a0a 100644
--- a/Main/System/OSActivity/OSGalaBaseWin.cs
+++ b/Main/System/OSActivity/OSGalaBaseWin.cs
@@ -43,13 +43,13 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<OSGalaMissionWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSGalaMissionWin>().Forget();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<OSGalaChangeWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSGalaChangeWin>().Forget();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindow<OSGalaGiftWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSGalaGiftWin>().Forget();
break;
}
}
diff --git a/Main/System/OSActivity/OSGalaChangeCell.cs b/Main/System/OSActivity/OSGalaChangeCell.cs
index fcccb6f..72bb402 100644
--- a/Main/System/OSActivity/OSGalaChangeCell.cs
+++ b/Main/System/OSActivity/OSGalaChangeCell.cs
@@ -56,7 +56,7 @@
{
// StoreModel.Instance.SendBuyShopItem(storeConfig, 1);
StoreModel.Instance.buyShopID = id;
- UIManager.Instance.OpenWindow<BuyItemWin>();
+ UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
});
}
var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(id);
diff --git a/Main/System/OSActivity/OSHeroCallBaseWin.cs b/Main/System/OSActivity/OSHeroCallBaseWin.cs
index 516b9ff..9f5eaa9 100644
--- a/Main/System/OSActivity/OSHeroCallBaseWin.cs
+++ b/Main/System/OSActivity/OSHeroCallBaseWin.cs
@@ -28,13 +28,13 @@
case 0:
RankModel.Instance.ResetQueryParam();
RankModel.Instance.QueryRankByPage(4, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
- currentSubUI = UIManager.Instance.OpenWindow<OSRankWin>(4);
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankWin>(4).Forget();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankHeroCallAwardWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankHeroCallAwardWin>().Forget();
break;
case 2:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankHeroCallGiftWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankHeroCallGiftWin>().Forget();
break;
}
}
diff --git a/Main/System/OSActivity/OSMainLevelBaseWin.cs b/Main/System/OSActivity/OSMainLevelBaseWin.cs
index fb630d4..3d17abc 100644
--- a/Main/System/OSActivity/OSMainLevelBaseWin.cs
+++ b/Main/System/OSActivity/OSMainLevelBaseWin.cs
@@ -37,10 +37,10 @@
case 0:
RankModel.Instance.ResetQueryParam();
RankModel.Instance.QueryRankByPage(3, watchID: (int)PlayerDatas.Instance.baseData.PlayerID);
- currentSubUI = UIManager.Instance.OpenWindow<OSRankWin>(3);
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankWin>(3).Forget();
break;
case 1:
- currentSubUI = UIManager.Instance.OpenWindow<OSRankMainLeveAwardWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<OSRankMainLeveAwardWin>().Forget();
break;
}
}
diff --git a/Main/System/OfficialRank/OfficialRankManager.cs b/Main/System/OfficialRank/OfficialRankManager.cs
index 2359348..8774f7e 100644
--- a/Main/System/OfficialRank/OfficialRankManager.cs
+++ b/Main/System/OfficialRank/OfficialRankManager.cs
@@ -75,7 +75,7 @@
//鍗囩骇鎴愬姛琛ㄧ幇
if (!UIManager.Instance.IsOpened<OfficialLVUPSuccessWin>())
{
- UIManager.Instance.OpenWindow<OfficialLVUPSuccessWin>();
+ UIManager.Instance.OpenWindowAsync<OfficialLVUPSuccessWin>().Forget();
}
}
}
diff --git a/Main/System/OfficialRank/OfficialTitleCell.cs b/Main/System/OfficialRank/OfficialTitleCell.cs
index 88548e5..7a2656b 100644
--- a/Main/System/OfficialRank/OfficialTitleCell.cs
+++ b/Main/System/OfficialRank/OfficialTitleCell.cs
@@ -1,4 +1,5 @@
锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -9,7 +10,7 @@
private void Awake()
{
//濡傛灉鏈夐渶瑕佹寜閽偣鍑婚�昏緫锛屽湪澶栧眰鍒涘缓锛屾澶勪笉澶勭悊鐐瑰嚮閫昏緫
- LoadPrefab();
+ LoadPrefab().Forget();
}
@@ -86,7 +87,7 @@
GameObject prefab;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (prefab != null)
return;
@@ -97,16 +98,26 @@
prefab = tmp.gameObject;
return;
}
- prefab = UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell");
+ prefab = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell");
+
+ if (this == null)
+ {
+ if (prefab != null)
+ {
+ GameObject.DestroyImmediate(prefab);
+ }
+ return;
+ }
+
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
}
- public void InitUI(int offcialRank, int titleID)
+ public async UniTask InitUI(int offcialRank, int titleID)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
if (!TitleConfig.HasKey(titleID))
{
officialRankObj.SetActive(true);
diff --git a/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs b/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs
index 7d2b9b0..1515352 100644
--- a/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs
+++ b/Main/System/OtherPlayerDetail/OtherEquipCardItem.cs
@@ -50,7 +50,7 @@
manager.otherPlayerViewEquip = equip;
if (!UIManager.Instance.IsOpened<OtherEquipTipWin>())
{
- UIManager.Instance.OpenWindow<OtherEquipTipWin>();
+ UIManager.Instance.OpenWindowAsync<OtherEquipTipWin>().Forget();
}
});
}
diff --git a/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs b/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs
index 5fdc57b..45b29c1 100644
--- a/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs
+++ b/Main/System/OtherPlayerDetail/OtherHeroDetailWin.cs
@@ -584,12 +584,12 @@
angerSkillCell.SetActive(true);
normalSkillCell.Init(atkSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(heroID);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(heroID).Forget();
+ }, true).Forget();
angerSkillCell.Init(angerSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(heroID);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(heroID).Forget();
+ }, true).Forget();
}
/// <summary>
/// 寮哄埗鍒锋柊Layout锛岃В鍐冲祵濂桳ayout鍜孋ontentSizeFitter鐨勯噸鍙犻棶棰�
diff --git a/Main/System/OtherPlayerDetail/OtherHeroFightingCardItem.cs b/Main/System/OtherPlayerDetail/OtherHeroFightingCardItem.cs
index 388fe5c..b5a7acb 100644
--- a/Main/System/OtherPlayerDetail/OtherHeroFightingCardItem.cs
+++ b/Main/System/OtherPlayerDetail/OtherHeroFightingCardItem.cs
@@ -41,34 +41,9 @@
void DisplayHero(OtherPlayerDetailManager.RolePlusData.HeroData heroData)
{
-#pragma warning disable CS0618
- var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(heroData.SkinID).RectangleIcon);
-#pragma warning restore CS0618
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- imgHero.SetSprite("herohead_big_default");
- }
- else
- {
- imgHero.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(heroData.SkinID).RectangleIcon, imgHero, "herohead_big_default").Forget();
}
- async UniTask DisplayHeroAsync(OtherPlayerDetailManager.RolePlusData.HeroData heroData)
- {
- var sprite = await UILoader.LoadSpriteAsync("HeroHead", HeroSkinConfig.Get(heroData.SkinID).RectangleIcon);
- if (this == null) return;
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- imgHero.SetSprite("herohead_big_default");
- }
- else
- {
- imgHero.overrideSprite = sprite;
- }
- }
void DisplayStars(OtherPlayerDetailManager.RolePlusData.HeroData heroData)
{
diff --git a/Main/System/OtherPlayerDetail/OtherNPCDetailWin.cs b/Main/System/OtherPlayerDetail/OtherNPCDetailWin.cs
index 777e954..20ec382 100644
--- a/Main/System/OtherPlayerDetail/OtherNPCDetailWin.cs
+++ b/Main/System/OtherPlayerDetail/OtherNPCDetailWin.cs
@@ -269,7 +269,7 @@
private void DisplayHeroShow(int heroID, int skinID, int breakLevel, int star, int awakeLevel, int lv)
{
- heroShow.Init(heroID, skinID, breakLevel, star, awakeLevel, lv);
+ heroShow.Init(heroID, skinID, breakLevel, star, awakeLevel, lv).Forget();
}
private void DisplaySkill(int heroID, int atkSkillID, int angerSkillID)
@@ -292,12 +292,12 @@
skill.SetActive(true);
normalSkillCell.Init(atkSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(heroID);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(heroID).Forget();
+ }, true).Forget();
angerSkillCell.Init(angerSkillID, () =>
{
- UIManager.Instance.OpenWindow<HeroSkillWin>(heroID);
- }, true);
+ UIManager.Instance.OpenWindowAsync<HeroSkillWin>(heroID).Forget();
+ }, true).Forget();
}
/// <summary>
diff --git a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
index aa7e674..a2f86dc 100644
--- a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
+++ b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
//姝﹀皢妯″瀷鏃犵珯鍙版ā鍧�
public class OtherNpcHeroCell : MonoBehaviour
@@ -120,13 +121,13 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
// 姝﹀皢妯″瀷绔欏彴鏄剧ず
- public void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
+ public async UniTask Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
var heroConfig = HeroConfig.Get(heroID);
heroModel.Create(skinID, 1.2f);
@@ -178,12 +179,12 @@
{
SmallTipWin.showText = Language.Get("HeroGift14", star);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
});
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -196,7 +197,16 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("OtherNpcHeroCell", "Container_HeroShow");
+ cellContainer = await UIUtility.CreateWidget("OtherNpcHeroCell", "Container_HeroShow");
+
+ if (this == null)
+ {
+ if (null != cellContainer)
+ {
+ DestroyImmediate(cellContainer);
+ }
+ return;
+ }
if (cellContainer != null)
{
diff --git a/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs b/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs
index 7223cd5..323cf14 100644
--- a/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs
+++ b/Main/System/OtherPlayerDetail/OtherPlayerDetailManager.cs
@@ -138,7 +138,7 @@
{
UIManager.Instance.CloseWindow<OtherPlayerDetailWin>();
}
- UIManager.Instance.OpenWindow<OtherPlayerDetailWin>(viewPreSetType);
+ UIManager.Instance.OpenWindowAsync<OtherPlayerDetailWin>(viewPreSetType).Forget();
}
OnRevPackage?.Invoke(viewPlayerType, playerID);
@@ -152,7 +152,7 @@
this.viewHeroDetailData = viewHeroDetailData;
if (!UIManager.Instance.IsOpened<OtherHeroDetailWin>())
{
- UIManager.Instance.OpenWindow<OtherHeroDetailWin>();
+ UIManager.Instance.OpenWindowAsync<OtherHeroDetailWin>().Forget();
}
}
diff --git a/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs b/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs
index 5334d56..1317fb3 100644
--- a/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs
+++ b/Main/System/OtherPlayerDetail/OtherPlayerDetailWin.cs
@@ -1,5 +1,6 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class OtherPlayerDetailWin : UIBase
@@ -74,7 +75,7 @@
if (!UIManager.Instance.IsOpened<GuildPreviewWin>())
{
- UIManager.Instance.OpenWindow<GuildPreviewWin>(viewPlayerData.FamilyID);
+ UIManager.Instance.OpenWindowAsync<GuildPreviewWin>(viewPlayerData.FamilyID).Forget();
}
}
@@ -184,14 +185,14 @@
var modelConfig = ModelConfig.Get(modelMark);
int heroSkinID = modelConfig.SkinID;
- horseModel.Create(horseSkinID, heroSkinID, 1);
+ horseModel.Create(horseSkinID, heroSkinID, 1).Forget();
OtherPlayerDetailManager.RolePlusData.HorseData horseData = manager.GetHorseData(viewPlayerData.PlayerID);
imgHorseBG.SetActive(horseData != null);
if (horseData != null)
{
txtHorseLV.text = Language.Get("Horse8", horseData.ClassLV, horseData.LV);
- horseController.Create(horseSkinID <= 0 ? 1 : horseSkinID, scale: 0.6f);
+ horseController.Create(horseSkinID <= 0 ? 1 : horseSkinID, scale: 0.6f).Forget();
}
}
diff --git a/Main/System/PhantasmPavilion/AvatarCell.cs b/Main/System/PhantasmPavilion/AvatarCell.cs
index 43edb69..19b8f5f 100644
--- a/Main/System/PhantasmPavilion/AvatarCell.cs
+++ b/Main/System/PhantasmPavilion/AvatarCell.cs
@@ -1,4 +1,5 @@
using System;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.Events;
@@ -148,9 +149,24 @@
GameObject prefab;
AvatarModel avatarModel;
PhantasmPavilionManager manager { get { return PhantasmPavilionManager.Instance; } }
+ bool isLoaded { get { return prefab != null; } }
+ Action onLoaded = null;
+
private void Awake()
{
LoadPrefab();
+ }
+
+ public void SetOnLoaded(Action _onloaded)
+ {
+ if (isLoaded)
+ {
+ _onloaded?.Invoke();
+ }
+ else
+ {
+ onLoaded += _onloaded;
+ }
}
void OnEnable()
@@ -175,7 +191,7 @@
}
}
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (prefab != null)
return;
@@ -186,7 +202,16 @@
prefab = tmp.gameObject;
return;
}
- prefab = UIUtility.CreateWidget("AvatarCell", "AvatarCell");
+ prefab = await UIUtility.CreateWidget("AvatarCell", "AvatarCell");
+
+ if (this == null)
+ {
+ if (prefab != null)
+ {
+ GameObject.DestroyImmediate(prefab);
+ return;
+ }
+ }
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
@@ -199,17 +224,26 @@
prefabRect.anchorMax = new Vector2(0.5f, 0.5f);
prefabRect.sizeDelta = new Vector2(parentRect.rect.width, parentRect.rect.height);
}
+
+ onLoaded?.Invoke();
+ onLoaded = null;
+
}
- public void InitUI(AvatarModel model)
+ public async void InitUI(AvatarModel model)
{
if (model == null)
return;
avatarModel = model;
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+
+ if (this == null)
+ {
+ return;
+ }
int faceID = model.faceID;
int facePicID = model.facePicID;
- manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID);
+ manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID).Forget();
string str = AvatarHelper.GetAvatarBgColorStr(faceID);
faceBGImage.SetSprite(str);
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionFaceItem.cs b/Main/System/PhantasmPavilion/PhantasmPavilionFaceItem.cs
index 81e2b52..302551e 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionFaceItem.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionFaceItem.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing Cysharp.Threading.Tasks;
+using UnityEngine;
using UnityEngine.UI;
public class PhantasmPavilionFaceItem : MonoBehaviour
@@ -39,7 +40,7 @@
string str = AvatarHelper.GetAvatarBgColorStr(id);
imgBg.SetSprite(str);
- manager.ShowFace(imgFace, spine, uiFrame, mask, id);
+ manager.ShowFace(imgFace, spine, uiFrame, mask, id).Forget();
manager.UpdateItemRedPoint(imgRed, type, id);
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionFaceWin.cs b/Main/System/PhantasmPavilion/PhantasmPavilionFaceWin.cs
index 3963e99..79c7ae0 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionFaceWin.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionFaceWin.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class PhantasmPavilionFaceWin : UIBase
@@ -290,7 +291,7 @@
switch (type)
{
case PhantasmPavilionType.Face:
- manager.ShowFace(imgNowFace, effectPlayerNowFace, uiFrameNowFace, maskNowFace, id);
+ manager.ShowFace(imgNowFace, effectPlayerNowFace, uiFrameNowFace, maskNowFace, id).Forget();
imgNowFaceBg.SetSprite(str);
if (resourceType == 1)
{
@@ -300,7 +301,7 @@
case PhantasmPavilionType.FacePic:
if (!manager.TryGetNowShowID(PhantasmPavilionType.Face, out int faceID))
return;
- manager.ShowFace(imgNowFacePicFace, UIEffectPlayerNowFacePicFace, uiFrameNowFacePicFace, maskNowFacePicFace, faceID);
+ manager.ShowFace(imgNowFacePicFace, UIEffectPlayerNowFacePicFace, uiFrameNowFacePicFace, maskNowFacePicFace, faceID).Forget();
str = AvatarHelper.GetAvatarBgColorStr(faceID);
imgNowFacePicFaceBg.SetSprite(str);
manager.Show(imgNowFacePic, UIEffectPlayerNowFacePic, uiFrameNowFacePic, resourceType, resourceValue);
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs b/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs
index 984f6ca..38c4134 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionManager.cs
@@ -194,7 +194,7 @@
- public void ShowFace(ImageEx imgFace, UIEffectPlayer spine, UIFrame uiFrame, EllipseMask ellipseMask, int id)
+ public async UniTask ShowFace(ImageEx imgFace, UIEffectPlayer spine, UIFrame uiFrame, EllipseMask ellipseMask, int id)
{
PhantasmPavilionType type = PhantasmPavilionType.Face;
int UnlockWay = GetUnlockWay(type, id);
@@ -211,7 +211,7 @@
if (!HeroSkinConfig.HasKey(skinID))
return;
HeroSkinConfig skinConfig = HeroSkinConfig.Get(skinID);
- var sprite = UILoader.LoadSprite("HeroHead", skinConfig.SquareIcon);
+ var sprite = await UILoader.LoadSpriteAsync("HeroHead", skinConfig.SquareIcon);
if (sprite == null)
{
Show(imgFace, spine, uiFrame, resourceType, "herohead_default", null, ellipseMask);
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionModelItem.cs b/Main/System/PhantasmPavilion/PhantasmPavilionModelItem.cs
index 76c099f..12241f2 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionModelItem.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionModelItem.cs
@@ -43,16 +43,7 @@
if (!HeroSkinConfig.HasKey(skinID))
return;
HeroSkinConfig skinConfig = HeroSkinConfig.Get(skinID);
- var sprite = UILoader.LoadSprite("HeroHead", skinConfig.SquareIcon);
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- imgFace.SetSprite("herohead_default");
- }
- else
- {
- imgFace.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", skinConfig.SquareIcon, imgFace, "herohead_default").Forget();
int resourceType = manager.GetResourceType(type, id);
string resourceValue = manager.GetResourceValue(type, id);
diff --git a/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs b/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs
index 5e6ad9e..6f279d5 100644
--- a/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs
+++ b/Main/System/PhantasmPavilion/PhantasmPavilionWin.cs
@@ -26,17 +26,17 @@
{
case 0:
//褰㈣薄
- currentSubUI = UIManager.Instance.OpenWindow<PhantasmPavilionModelWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<PhantasmPavilionModelWin>().Forget();
manager.nowType = PhantasmPavilionType.Model;
break;
case 1:
//澶村儚
- currentSubUI = UIManager.Instance.OpenWindow<PhantasmPavilionFaceWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<PhantasmPavilionFaceWin>().Forget();
manager.nowType = PhantasmPavilionType.Face;
break;
case 2:
//绉板彿
- currentSubUI = UIManager.Instance.OpenWindow<PhantasmPavilionTitleWin>();
+ currentSubUI = UIManager.Instance.OpenWindowAsync<PhantasmPavilionTitleWin>().Forget();
manager.nowType = PhantasmPavilionType.Title;
break;
default:
diff --git a/Main/System/PlayerProfile/PlayerProfileWin.cs b/Main/System/PlayerProfile/PlayerProfileWin.cs
index ab17e8e..abb29ed 100644
--- a/Main/System/PlayerProfile/PlayerProfileWin.cs
+++ b/Main/System/PlayerProfile/PlayerProfileWin.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using UnityEngine;
public class PlayerProfileWin : UIBase
@@ -26,37 +26,40 @@
protected override void InitComponent()
{
base.InitComponent();
- btnSetting.SetListener(() => { UIManager.Instance.OpenWindow<SystemSetWin>(); });
+ btnSetting.SetListener(() => { UIManager.Instance.OpenWindowAsync<SystemSetWin>().Forget(); });
btnAnnouncement.SetListener(() => { GameNotice.OpenGameNoticeForce(); });
btnSwitchServer.SetListener(() => { GameNetSystem.Instance.LoginOut(); });
btnRedemptionCode.SetListener(() =>
{
if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mail, true))
return;
- UIManager.Instance.OpenWindow<ExchangeCodeWin>();
+ UIManager.Instance.OpenWindowAsync<ExchangeCodeWin>().Forget();
});
btnCopy.SetListener(() =>
{
UIHelper.CopyToClipboard(PlayerDatas.Instance.baseData.PlayerID.ToString());
SysNotifyMgr.Instance.ShowTip("CopySuccess");
});
- btnChangeName.SetListener(() => { UIManager.Instance.OpenWindow<RenameWin>(); });
+ btnChangeName.SetListener(() => { UIManager.Instance.OpenWindowAsync<RenameWin>().Forget(); });
btnText1.SetListener(() =>
{
// GameAgeWarnWin.data = 1;
- // UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ // UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
SDKUtils.Instance.OpenUrl(OPConfigConfig.Get("yhxy").content);
});
btnText2.SetListener(() =>
{
// GameAgeWarnWin.data = 2;
- // UIManager.Instance.OpenWindow<GameAgeWarnWin>();
+ // UIManager.Instance.OpenWindowAsync<GameAgeWarnWin>().Forget();
SDKUtils.Instance.OpenUrl(OPConfigConfig.Get("yszc").content);
});
- avatarCell.redpoint.redpointId = MainRedDot.PhantasmPavilionRepoint;
- avatarCell.SetListener(() =>
+ avatarCell.SetOnLoaded(() =>
{
- UIManager.Instance.OpenWindow<PhantasmPavilionWin>();
+ avatarCell.redpoint.redpointId = MainRedDot.PhantasmPavilionRepoint;
+ avatarCell.SetListener(() =>
+ {
+ UIManager.Instance.OpenWindowAsync<PhantasmPavilionWin>().Forget();
+ });
});
}
diff --git a/Main/System/PlayerProfile/RenameWin.cs b/Main/System/PlayerProfile/RenameWin.cs
index e758684..13aff3b 100644
--- a/Main/System/PlayerProfile/RenameWin.cs
+++ b/Main/System/PlayerProfile/RenameWin.cs
@@ -1,6 +1,7 @@
using System;
using UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class RenameWin : UIBase
{
@@ -39,7 +40,7 @@
}
else
{
- UIManager.Instance.OpenWindow<StoreBaseWin>(1);
+ UIManager.Instance.OpenWindowAsync<StoreBaseWin>(1).Forget();
}
}
});
diff --git a/Main/System/Settlement/BattleFailWin.cs b/Main/System/Settlement/BattleFailWin.cs
index 3282750..dea9780 100644
--- a/Main/System/Settlement/BattleFailWin.cs
+++ b/Main/System/Settlement/BattleFailWin.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
//鎴樺満缁撶畻鐣岄潰锛屽瓨鍦ㄥ涓殑鎯呭喌
@@ -25,7 +25,7 @@
tipHeroPosBtn.AddListener(() =>
{
CloseWindow();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
detailBtn.SetListener(() =>
diff --git a/Main/System/Settlement/BattleSettlementManager.cs b/Main/System/Settlement/BattleSettlementManager.cs
index 29bfb86..199809f 100644
--- a/Main/System/Settlement/BattleSettlementManager.cs
+++ b/Main/System/Settlement/BattleSettlementManager.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using Cysharp.Threading.Tasks;
using LitJson;
using UnityEngine;
@@ -68,53 +69,53 @@
case BattleConst.ArenaBattleField:
if (isWin)
{
- UIManager.Instance.OpenWindow<ArenaBattleVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<ArenaBattleVictoryWin>().Forget();
}
else
{
- UIManager.Instance.OpenWindow<ArenaBattleFailWin>();
+ UIManager.Instance.OpenWindowAsync<ArenaBattleFailWin>().Forget();
}
break;
case BattleConst.BoneBattleField:
if (isWin)
{
- UIManager.Instance.OpenWindow<BoneBattleVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<BoneBattleVictoryWin>().Forget();
}
else
{
- UIManager.Instance.OpenWindow<BoneBattleFailWin>();
+ UIManager.Instance.OpenWindowAsync<BoneBattleFailWin>().Forget();
}
break;
case BattleConst.TianziBillboradBattleField:
TianziBillboradManager.Instance.isSweepVictory = false;
- UIManager.Instance.OpenWindow<TianziBillboradVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<TianziBillboradVictoryWin>().Forget();
break;
case BattleConst.WarlordPavilionBattleField:
WarlordPavilionManager.Instance.isAutoNext = isWin;
if (isWin)
{
- UIManager.Instance.OpenWindow<WarlordPavilionVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionVictoryWin>().Forget();
}
else
{
- UIManager.Instance.OpenWindow<WarlordPavilionFailWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionFailWin>().Forget();
}
break;
default:
if (isWin)
{
- UIManager.Instance.OpenWindow<BattleVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<BattleVictoryWin>().Forget();
}
else
{
- UIManager.Instance.OpenWindow<BattleFailWin>();
+ UIManager.Instance.OpenWindowAsync<BattleFailWin>().Forget();
}
break;
}
if (isWin)
{
- SoundPlayer.Instance.PlayUIAudio(57);
+ SoundPlayer.Instance.PlayUIAudio(57).Forget();
}
}
@@ -330,7 +331,7 @@
return;
BattleDetailBattleName = battleName;
- UIManager.Instance.OpenWindow<BattleDetailWin>();
+ UIManager.Instance.OpenWindowAsync<BattleDetailWin>().Forget();
}
//鎴樻枟缁撴灉璇︽儏鐣岄潰鑾峰彇 鎴戞柟鍙戣捣鐨勬垬鏂楃殑涓晫鏂瑰悕瀛�
diff --git a/Main/System/Settlement/BattleVictoryWin.cs b/Main/System/Settlement/BattleVictoryWin.cs
index fc93fd1..833d48f 100644
--- a/Main/System/Settlement/BattleVictoryWin.cs
+++ b/Main/System/Settlement/BattleVictoryWin.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
@@ -152,7 +152,7 @@
{
if (PlayerDatas.Instance.baseData.ExAttr1 / 100 % 100 == 1)
{
- UIManager.Instance.OpenWindow<MapLoadingWin>(1);
+ UIManager.Instance.OpenWindowAsync<MapLoadingWin>(1).Forget();
}
}
}
\ No newline at end of file
diff --git a/Main/System/Settlement/BoneBattleFailWin.cs b/Main/System/Settlement/BoneBattleFailWin.cs
index 9dabd6f..2dd83fc 100644
--- a/Main/System/Settlement/BoneBattleFailWin.cs
+++ b/Main/System/Settlement/BoneBattleFailWin.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
//鎴樺満缁撶畻鐣岄潰锛屽瓨鍦ㄥ涓殑鎯呭喌
@@ -25,7 +25,7 @@
tipHeroPosBtn.AddListener(() =>
{
CloseWindow();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
detailBtn.SetListener(() =>
diff --git a/Main/System/Settlement/WarlordPavilionFailWin.cs b/Main/System/Settlement/WarlordPavilionFailWin.cs
index 38554be..a991dbe 100644
--- a/Main/System/Settlement/WarlordPavilionFailWin.cs
+++ b/Main/System/Settlement/WarlordPavilionFailWin.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+锘縰sing UnityEngine;
using UnityEngine.UI;
//鎴樺満缁撶畻鐣岄潰锛屽瓨鍦ㄥ涓殑鎯呭喌
@@ -25,7 +25,7 @@
tipHeroPosBtn.AddListener(() =>
{
CloseWindow();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
detailBtn.SetListener(() =>
diff --git a/Main/System/SkillUI/SkillBaseCell.cs b/Main/System/SkillUI/SkillBaseCell.cs
index 934ef53..1540573 100644
--- a/Main/System/SkillUI/SkillBaseCell.cs
+++ b/Main/System/SkillUI/SkillBaseCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
public class SkillBaseCell : MonoBehaviour
{
@@ -61,12 +62,13 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
- public void Init(int skillID, UnityAction onclick = null, bool showType = false)
+ public async UniTask Init(int skillID, UnityAction onclick = null, bool showType = false)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
var config = SkillConfig.Get(skillID);
if (config == null)
{
@@ -100,7 +102,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -111,15 +113,19 @@
cellContainer = tmp.gameObject;
return;
}
- if (cellContainer == null)
- {
- cellContainer = UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
- if (cellContainer != null)
- {
- cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
- cellContainer.transform.SetAsFirstSibling();
- }
+ cellContainer = await UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
+
+ if (this == null)
+ {
+ if (null != cellContainer) DestroyImmediate(cellContainer);
+ return;
+ }
+
+ if (cellContainer != null)
+ {
+ cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ cellContainer.transform.SetAsFirstSibling();
}
//缂╂斁鍒板拰鐖秗ect涓�鏍峰ぇ
diff --git a/Main/System/SkillUI/SkillWordCell.cs b/Main/System/SkillUI/SkillWordCell.cs
index 3658500..fa00e2e 100644
--- a/Main/System/SkillUI/SkillWordCell.cs
+++ b/Main/System/SkillUI/SkillWordCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
public class SkillWordCell : MonoBehaviour
{
@@ -47,12 +48,12 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
- public void Init(int skillID, UnityAction onclick = null, bool showType = false)
+ public async UniTask Init(int skillID, UnityAction onclick = null, bool showType = false)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
var config = SkillConfig.Get(skillID);
if (config == null)
{
@@ -77,7 +78,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -90,7 +91,16 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell");
+ cellContainer = await UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell");
+
+ if (this == null)
+ {
+ if (null != cellContainer)
+ {
+ DestroyImmediate(cellContainer);
+ }
+ return;
+ }
if (cellContainer != null)
{
diff --git a/Main/System/Sound/SoundPlayer.cs b/Main/System/Sound/SoundPlayer.cs
index 5d7c388..52a353d 100644
--- a/Main/System/Sound/SoundPlayer.cs
+++ b/Main/System/Sound/SoundPlayer.cs
@@ -24,7 +24,7 @@
{
if (m_Instance == null)
{
- CreateSoundPlayer();
+ CreateSoundPlayer().Forget();
}
}
}
@@ -74,25 +74,10 @@
public void Init()
{
- //鍒濆鍖栫敤
+
}
- public static void CreateSoundPlayer()
- {
- if (m_Instance != null)
- {
- return;
- }
-
- var gameObject = GameObject.Instantiate(BuiltInLoader.LoadPrefab("SoundPlayer"));
- m_Instance = gameObject.GetComponent<SoundPlayer>();
- m_Instance.name = "SoundPlayer";
- m_Instance.SetActive(true);
- DontDestroyOnLoad(gameObject);
- Debug.Log("CreateSoundPlayer");
- }
-
- public static async UniTask CreateSoundPlayerAsync()
+ public static async UniTask CreateSoundPlayer()
{
if (m_Instance != null)
{
@@ -105,10 +90,10 @@
m_Instance.name = "SoundPlayer";
m_Instance.SetActive(true);
DontDestroyOnLoad(gameObject);
- Debug.Log("CreateSoundPlayer");
+ Debug.Log("SoundPlayer 鍒涘缓瀹屾垚");
}
- public void PlayBackGroundMusic(int _audioId)
+ public async UniTask PlayBackGroundMusic(int _audioId)
{
if (_audioId <= 0)
{
@@ -122,22 +107,18 @@
var config = AudioConfig.Get(_audioId);
if (config != null)
{
- AudioLoader.LoadAudioAsync(config.Folder, config.Audio, (bool _ok, UnityEngine.Object _object) =>
+ AudioLoader.LoadAudio(config.Folder, config.Audio).ContinueWith(clip =>
{
- if (_ok && _object != null)
+ if (clip != null)
{
- clip = _object as AudioClip;
- if (clip != null)
+ if (!musicAudioClipDict.ContainsKey(_audioId))
{
- if (!musicAudioClipDict.ContainsKey(_audioId))
- {
- musicAudioClipDict[_audioId] = clip;
- }
-
- StartCoroutine(Co_BackGroundMusicFadeOutIn(clip, false));
+ musicAudioClipDict[_audioId] = clip;
}
+
+ StartCoroutine(Co_BackGroundMusicFadeOutIn(clip, false));
}
- });
+ }).Forget();
}
}
else
@@ -150,7 +131,7 @@
}
int backGroudAudioIdRef = 0;
- public void PlayBackGroundMusicOneShot(int _audioId)
+ public async void PlayBackGroundMusicOneShot(int _audioId)
{
var config = AudioConfig.Get(_audioId);
if (config == null)
@@ -158,7 +139,7 @@
return;
}
- var clip = AudioLoader.LoadAudio(config.Folder, config.Audio);
+ var clip = await AudioLoader.LoadAudio(config.Folder, config.Audio);
if (clip == null)
{
return;
@@ -193,9 +174,7 @@
if (key != _exclude)
{
var config = AudioConfig.Get(key);
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy unload
ResManager.Instance.UnloadAsset("Audio/" + config.Folder, config.Audio);
- #pragma warning restore CS0618
}
}
@@ -215,10 +194,10 @@
{
await UniTask.Delay(1);
if (this == null) return; // destroyed during await
- PlayUIAudio(_audioId);
+ await PlayUIAudio(_audioId);
}
- public void PlayUIAudio(int _audioId)
+ public async UniTask PlayUIAudio(int _audioId)
{
if (_audioId <= 0)
{
@@ -231,7 +210,7 @@
var config = AudioConfig.Get(_audioId);
if (config != null)
{
- clip = AudioLoader.LoadAudio(config.Folder, config.Audio);
+ clip = await AudioLoader.LoadAudio(config.Folder, config.Audio);
if (clip != null)
{
if (commonUseAudioSet.Contains(_audioId))
@@ -261,7 +240,7 @@
}
}
- public void PlayAudio(AudioSource _source, int _audioId)
+ public async void PlayAudio(AudioSource _source, int _audioId)
{
if (_audioId <= 0)
{
@@ -279,7 +258,7 @@
var config = AudioConfig.Get(_audioId);
if (config != null)
{
- clip = AudioLoader.LoadAudio(config.Folder, config.Audio);
+ clip = await AudioLoader.LoadAudio(config.Folder, config.Audio);
if (clip != null)
{
if (commonUseAudioSet.Contains(_audioId))
@@ -313,7 +292,7 @@
}
}
- public void PlayNewBieAudio(int _audioId)
+ public async UniTask PlayNewBieAudio(int _audioId)
{
if (_audioId <= 0)
{
@@ -324,7 +303,7 @@
var config = AudioConfig.Get(_audioId);
if (config != null)
{
- clip = AudioLoader.LoadAudio(config.Folder, config.Audio);
+ clip = await AudioLoader.LoadAudio(config.Folder, config.Audio);
}
if (clip != null)
@@ -343,7 +322,7 @@
}
}
- public void PlayNpcAudio(int _audioId)
+ public async void PlayNpcAudio(int _audioId)
{
if (_audioId <= 0)
{
@@ -354,7 +333,7 @@
var config = AudioConfig.Get(_audioId);
if (config != null)
{
- clip = AudioLoader.LoadAudio(config.Folder, config.Audio);
+ clip = await AudioLoader.LoadAudio(config.Folder, config.Audio);
}
if (clip != null)
@@ -383,11 +362,14 @@
public void PlayLoginMusic()
{
- var loginMusic = BuiltInLoader.LoadMusic("login");
- if (!m_MusicAudioSource.isPlaying || m_MusicAudioSource.clip != loginMusic)
- {
- StartCoroutine(Co_BackGroundMusicFadeOutIn(loginMusic, false));
- }
+ BuiltInLoader.LoadMusicAsync("login").ContinueWith(loginMusic =>
+ {
+ if (this == null) return;
+ if (!m_MusicAudioSource.isPlaying || m_MusicAudioSource.clip != loginMusic)
+ {
+ StartCoroutine(Co_BackGroundMusicFadeOutIn(loginMusic, false));
+ }
+ }).Forget();
}
public async UniTask PlayLoginMusicAsync()
@@ -474,6 +456,6 @@
IEnumerator Co_DelayPlayBackGrondMusic(float _delay, int _audioId)
{
yield return new WaitForSeconds(_delay);
- PlayBackGroundMusic(_audioId);
+ PlayBackGroundMusic(_audioId).Forget();
}
}
diff --git a/Main/System/Sound/SoundUtility.cs b/Main/System/Sound/SoundUtility.cs
index f727a0e..56d2c20 100644
--- a/Main/System/Sound/SoundUtility.cs
+++ b/Main/System/Sound/SoundUtility.cs
@@ -1,180 +1,180 @@
-锘�//--------------------------------------------------------
-// [Author]: 鐜╀釜娓告垙
-// [ Date ]: Tuesday, January 30, 2018
-//--------------------------------------------------------
-using UnityEngine;
-using System.Collections;
-using UnityEngine.UI;
-using System;
+锘�// //--------------------------------------------------------
+// // [Author]: 鐜╀釜娓告垙
+// // [ Date ]: Tuesday, January 30, 2018
+// //--------------------------------------------------------
+// using UnityEngine;
+// using System.Collections;
+// using UnityEngine.UI;
+// using System;
-using System.Collections.Generic;
+// using System.Collections.Generic;
-public class SoundUtility
-{
- static DateTime lastHitAudioPlayTime = DateTime.Now;
- static int hitAudioTimeInterval = 50;//姣
+// public class SoundUtility
+// {
+// static DateTime lastHitAudioPlayTime = DateTime.Now;
+// static int hitAudioTimeInterval = 50;//姣
- static int hitAudioPoolMax = 2;
- static int hitAudioCountPool = 2;
+// static int hitAudioPoolMax = 2;
+// static int hitAudioCountPool = 2;
- static Dictionary<int, List<int>> jobHitAudio = new Dictionary<int, List<int>>() {
- { 1,new List<int>(){101,102,103,104} },
- { 2,new List<int>(){146,147,148,149} },
- { 3,new List<int>(){101,102,103,104} },
- };
+// static Dictionary<int, List<int>> jobHitAudio = new Dictionary<int, List<int>>() {
+// { 1,new List<int>(){101,102,103,104} },
+// { 2,new List<int>(){146,147,148,149} },
+// { 3,new List<int>(){101,102,103,104} },
+// };
- public static void PlayHitAudio(AudioSource _audioSource)
- {
- if (_audioSource == null)
- {
- return;
- }
+// public static void PlayHitAudio(AudioSource _audioSource)
+// {
+// if (_audioSource == null)
+// {
+// return;
+// }
- if (hitAudioCountPool < hitAudioPoolMax)
- {
- hitAudioCountPool = Mathf.Clamp(hitAudioCountPool + (int)((DateTime.Now - lastHitAudioPlayTime).TotalMilliseconds / hitAudioTimeInterval), 0, hitAudioPoolMax);
- }
+// if (hitAudioCountPool < hitAudioPoolMax)
+// {
+// hitAudioCountPool = Mathf.Clamp(hitAudioCountPool + (int)((DateTime.Now - lastHitAudioPlayTime).TotalMilliseconds / hitAudioTimeInterval), 0, hitAudioPoolMax);
+// }
- if (hitAudioCountPool > 0)
- {
- var job = PlayerDatas.Instance.baseData.Job;
- if (jobHitAudio.ContainsKey(job))
- {
- var audios = jobHitAudio[job];
- var index = UnityEngine.Random.Range(0, audios.Count);
- SoundPlayer.Instance.PlayAudio(_audioSource, audios[index]);
- lastHitAudioPlayTime = DateTime.Now;
- hitAudioCountPool--;
- }
- }
- }
+// if (hitAudioCountPool > 0)
+// {
+// var job = PlayerDatas.Instance.baseData.Job;
+// if (jobHitAudio.ContainsKey(job))
+// {
+// var audios = jobHitAudio[job];
+// var index = UnityEngine.Random.Range(0, audios.Count);
+// SoundPlayer.Instance.PlayAudio(_audioSource, audios[index]);
+// lastHitAudioPlayTime = DateTime.Now;
+// hitAudioCountPool--;
+// }
+// }
+// }
- static Dictionary<int, int[]> fightRoars = new Dictionary<int, int[]>() {
- { 1,new int[]{ 97,98,99 } },
- { 2,new int[]{ 142,143,144 } },
- };
+// static Dictionary<int, int[]> fightRoars = new Dictionary<int, int[]>() {
+// { 1,new int[]{ 97,98,99 } },
+// { 2,new int[]{ 142,143,144 } },
+// };
- public static void PlayFightRoar(AudioSource _audioSource, int _job)
- {
- var ableIndex = UnityEngine.Random.Range(0, 3);
- if (ableIndex != 1)
- {
- return;
- }
+// public static void PlayFightRoar(AudioSource _audioSource, int _job)
+// {
+// var ableIndex = UnityEngine.Random.Range(0, 3);
+// if (ableIndex != 1)
+// {
+// return;
+// }
- int[] audioList = null;
- if (fightRoars.ContainsKey(_job))
- {
- audioList = fightRoars[_job];
- }
+// int[] audioList = null;
+// if (fightRoars.ContainsKey(_job))
+// {
+// audioList = fightRoars[_job];
+// }
- if (audioList == null)
- {
- return;
- }
+// if (audioList == null)
+// {
+// return;
+// }
- var randomIndex = UnityEngine.Random.Range(0, audioList.Length);
- var audio = audioList[randomIndex];
+// var randomIndex = UnityEngine.Random.Range(0, audioList.Length);
+// var audio = audioList[randomIndex];
- SoundPlayer.Instance.PlayAudio(_audioSource, audio);
+// SoundPlayer.Instance.PlayAudio(_audioSource, audio);
- }
+// }
- static Dictionary<int, int> deadAudios = new Dictionary<int, int>()
- {
- { 1,100},
- { 2,145},
- { 3,100},
- };
+// static Dictionary<int, int> deadAudios = new Dictionary<int, int>()
+// {
+// { 1,100},
+// { 2,145},
+// { 3,100},
+// };
- public static void PlayDeadAudio(AudioSource _audioSource, int _job)
- {
- SoundPlayer.Instance.PlayAudio(_audioSource, deadAudios[_job]);
- }
+// public static void PlayDeadAudio(AudioSource _audioSource, int _job)
+// {
+// SoundPlayer.Instance.PlayAudio(_audioSource, deadAudios[_job]);
+// }
- static Dictionary<int, int[]> stateFootAudios = new Dictionary<int, int[]>()
- {
- { 1,new int[]{ 130, 131, 132,133} },
- { 2,new int[]{ 134, 135, 136, 137 } },
- { 3,new int[]{ 138, 139, 140, 141 } },
- };
+// static Dictionary<int, int[]> stateFootAudios = new Dictionary<int, int[]>()
+// {
+// { 1,new int[]{ 130, 131, 132,133} },
+// { 2,new int[]{ 134, 135, 136, 137 } },
+// { 3,new int[]{ 138, 139, 140, 141 } },
+// };
- static Dictionary<int, int[]> rideAudios = new Dictionary<int, int[]>();
+// static Dictionary<int, int[]> rideAudios = new Dictionary<int, int[]>();
- static FootAudioType currentState = FootAudioType.Walk;
- static int audioIndex = 0;
- static Dictionary<int, DateTime> stateFootAudioLastPlayTimes = new Dictionary<int, DateTime>();
+// static FootAudioType currentState = FootAudioType.Walk;
+// static int audioIndex = 0;
+// static Dictionary<int, DateTime> stateFootAudioLastPlayTimes = new Dictionary<int, DateTime>();
- const float overTime = 2f;
+// const float overTime = 2f;
- public static void PlayFootAudio(AudioSource _audioSource, FootAudioType _state, int _horseId = 0)
- {
- var stateInt = (int)_state;
- if (!stateFootAudios.ContainsKey(stateInt))
- {
- return;
- }
+// public static void PlayFootAudio(AudioSource _audioSource, FootAudioType _state, int _horseId = 0)
+// {
+// var stateInt = (int)_state;
+// if (!stateFootAudios.ContainsKey(stateInt))
+// {
+// return;
+// }
- if (currentState != _state)
- {
- audioIndex = 0;
- currentState = _state;
- }
+// if (currentState != _state)
+// {
+// audioIndex = 0;
+// currentState = _state;
+// }
- if (stateFootAudioLastPlayTimes.ContainsKey(stateInt))
- {
- var lastPlayTime = stateFootAudioLastPlayTimes[stateInt];
- if ((DateTime.Now - lastPlayTime).TotalSeconds > 2f)
- {
- audioIndex = 0;
- }
- }
- else
- {
- audioIndex = 0;
- }
+// if (stateFootAudioLastPlayTimes.ContainsKey(stateInt))
+// {
+// var lastPlayTime = stateFootAudioLastPlayTimes[stateInt];
+// if ((DateTime.Now - lastPlayTime).TotalSeconds > 2f)
+// {
+// audioIndex = 0;
+// }
+// }
+// else
+// {
+// audioIndex = 0;
+// }
- int[] audios = null;
- switch (stateInt)
- {
- case 1:
- case 3:
- audios = stateFootAudios[(int)_state];
- break;
- // case 2:
- // if (rideAudios.ContainsKey(_horseId))
- // {
- // audios = rideAudios[_horseId];
- // }
- // else
- // {
- // var config = HorseConfig.Get(_horseId);
- // audios = new int[config.RideAudios.Length];
- // Array.Copy(config.RideAudios, audios, config.RideAudios.Length);
- // rideAudios[_horseId] = audios;
- // }
- // break;
- default:
- break;
- }
+// int[] audios = null;
+// switch (stateInt)
+// {
+// case 1:
+// case 3:
+// audios = stateFootAudios[(int)_state];
+// break;
+// // case 2:
+// // if (rideAudios.ContainsKey(_horseId))
+// // {
+// // audios = rideAudios[_horseId];
+// // }
+// // else
+// // {
+// // var config = HorseConfig.Get(_horseId);
+// // audios = new int[config.RideAudios.Length];
+// // Array.Copy(config.RideAudios, audios, config.RideAudios.Length);
+// // rideAudios[_horseId] = audios;
+// // }
+// // break;
+// default:
+// break;
+// }
- if (audioIndex < audios.Length)
- {
- var audio = audios[audioIndex];
- SoundPlayer.Instance.PlayAudio(_audioSource, audio);
- stateFootAudioLastPlayTimes[stateInt] = DateTime.Now;
- audioIndex++;
- }
+// if (audioIndex < audios.Length)
+// {
+// var audio = audios[audioIndex];
+// SoundPlayer.Instance.PlayAudio(_audioSource, audio);
+// stateFootAudioLastPlayTimes[stateInt] = DateTime.Now;
+// audioIndex++;
+// }
- if (audioIndex >= audios.Length)
- {
- audioIndex = 0;
- }
- }
+// if (audioIndex >= audios.Length)
+// {
+// audioIndex = 0;
+// }
+// }
-}
+// }
diff --git a/Main/System/Store/StoreBaseWin.cs b/Main/System/Store/StoreBaseWin.cs
index 732b9e3..940df2d 100644
--- a/Main/System/Store/StoreBaseWin.cs
+++ b/Main/System/Store/StoreBaseWin.cs
@@ -11,11 +11,11 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<StoreWin>();
+ UIManager.Instance.OpenWindowAsync<StoreWin>().ContinueWith(w => currentSubUI = w).Forget();
break;
case 1:
// 鍏呭�肩晫闈�
- currentSubUI = UIManager.Instance.OpenWindow<RechargeWin>();
+ UIManager.Instance.OpenWindowAsync<RechargeWin>().ContinueWith(w => currentSubUI = w).Forget();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/Store/StoreCell.cs b/Main/System/Store/StoreCell.cs
index aa9e3f1..fd123a3 100644
--- a/Main/System/Store/StoreCell.cs
+++ b/Main/System/Store/StoreCell.cs
@@ -137,7 +137,7 @@
else
{
StoreModel.Instance.buyShopID = shopID;
- UIManager.Instance.OpenWindow<BuyItemWin>();
+ UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
}
}
}
diff --git a/Main/System/TianziBillborad/TianziBillboradBossHead.cs b/Main/System/TianziBillborad/TianziBillboradBossHead.cs
index 44a28fb..15e57ad 100644
--- a/Main/System/TianziBillborad/TianziBillboradBossHead.cs
+++ b/Main/System/TianziBillborad/TianziBillboradBossHead.cs
@@ -39,16 +39,8 @@
imgQuality.SetSprite("heroheadBG" + heroConfig.Quality);
imgQuality.gray = !isTodayBoss;
- var sprite = UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon);
- if (sprite == null)
- {
- // 鍐呯綉鏈厤缃椂
- imgHeadIcon.SetSprite("herohead_default");
- }
- else
- {
- imgHeadIcon.overrideSprite = sprite;
- }
+ UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon, imgHeadIcon, "herohead_default").Forget();
+
imgHeadIcon.gray = !isTodayBoss;
txtTime.SetActive(isTodayBoss);
diff --git a/Main/System/TianziBillborad/TianziBillboradManager.cs b/Main/System/TianziBillborad/TianziBillboradManager.cs
index 93c47f8..c6b774f 100644
--- a/Main/System/TianziBillborad/TianziBillboradManager.cs
+++ b/Main/System/TianziBillborad/TianziBillboradManager.cs
@@ -3,6 +3,7 @@
using System.Linq;
using LitJson;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TianziBillboradManager : GameSystemManager<TianziBillboradManager>
{
public readonly int rankType = 2; // 姒滃崟绫诲瀷
@@ -349,7 +350,7 @@
}
}
isSweepVictory = true;
- UIManager.Instance.OpenWindow<TianziBillboradVictoryWin>();
+ UIManager.Instance.OpenWindowAsync<TianziBillboradVictoryWin>().Forget();
}
public void SendBBeginFBWipeOut()
diff --git a/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs b/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs
index 8fad005..e0d4b13 100644
--- a/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs
+++ b/Main/System/TianziBillborad/TianziBillboradPlayerTop3Cell.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Wednesday, September 26, 2018
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -31,7 +32,7 @@
nameText.text = rankData.name1;
officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
model.SetActive(true);
- model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f);
+ model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
{
AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id);
diff --git a/Main/System/TianziBillborad/TianziBillboradRankWin.cs b/Main/System/TianziBillborad/TianziBillboradRankWin.cs
index f8f4654..fee8a50 100644
--- a/Main/System/TianziBillborad/TianziBillboradRankWin.cs
+++ b/Main/System/TianziBillborad/TianziBillboradRankWin.cs
@@ -91,8 +91,9 @@
_cell?.Display(cell.index);
}
- void Refresh()
+ public override void Refresh()
{
+ base.Refresh();
ShowTop3();
scrollerController.m_Scorller.RefreshActiveCellViews();
DisplayMyRank();
diff --git a/Main/System/TianziBillborad/TianziBillboradWin.cs b/Main/System/TianziBillborad/TianziBillboradWin.cs
index f03ce8f..b256bed 100644
--- a/Main/System/TianziBillborad/TianziBillboradWin.cs
+++ b/Main/System/TianziBillborad/TianziBillboradWin.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class TianziBillboradWin : UIBase
@@ -38,7 +39,7 @@
{
base.InitComponent();
btnClose.SetListener(CloseWindow);
- btnRank.SetListener(() => { UIManager.Instance.OpenWindow<TianziBillboradRankWin>(); });
+ btnRank.SetListener(() => { UIManager.Instance.OpenWindowAsync<TianziBillboradRankWin>().Forget(); });
btnAds.SetListener(() =>
{
if (!model.TryGetADAwardConfigByMapId(model.DataMapID, out ADAwardConfig adAwardConfig))
@@ -61,7 +62,7 @@
}
else
{
- UIManager.Instance.OpenWindow<TianziBillboradSweepTipWin>();
+ UIManager.Instance.OpenWindowAsync<TianziBillboradSweepTipWin>().Forget();
}
});
funPresetBtn.AddListener(()=>
@@ -235,8 +236,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/System/TimeRush/TimeRushCell.cs b/Main/System/TimeRush/TimeRushCell.cs
index af22af1..06fa6c3 100644
--- a/Main/System/TimeRush/TimeRushCell.cs
+++ b/Main/System/TimeRush/TimeRushCell.cs
@@ -1,5 +1,6 @@
using System.Linq;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TimeRushCell : MonoBehaviour
{
@@ -24,7 +25,7 @@
{
if (!UIManager.Instance.IsOpened<TimeRushWin>())
{
- UIManager.Instance.OpenWindow<TimeRushWin>(0);
+ UIManager.Instance.OpenWindowAsync<TimeRushWin>(0).Forget();
}
});
}
diff --git a/Main/System/TimeRush/TimeRushManager.cs b/Main/System/TimeRush/TimeRushManager.cs
index 32e850c..70eb289 100644
--- a/Main/System/TimeRush/TimeRushManager.cs
+++ b/Main/System/TimeRush/TimeRushManager.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TimeRushManager : GameSystemManager<TimeRushManager>, IOpenServerActivity
{
@@ -280,7 +281,7 @@
newAwardIndex = Award.AwardIndex;
if (!UIManager.Instance.IsOpened<TimeRushTipWin>())
{
- UIManager.Instance.OpenWindow<TimeRushTipWin>();
+ UIManager.Instance.OpenWindowAsync<TimeRushTipWin>().Forget();
}
OnNewAwardHaveEvent?.Invoke();
}
diff --git a/Main/System/TimeRush/TimeRushTipWin.cs b/Main/System/TimeRush/TimeRushTipWin.cs
index 129df72..483ac7c 100644
--- a/Main/System/TimeRush/TimeRushTipWin.cs
+++ b/Main/System/TimeRush/TimeRushTipWin.cs
@@ -44,7 +44,7 @@
return;
if (!ActLunhuidianTypeConfig.TryGetConfig(roundType, 1, out var config) || !list.Contains(config.ID))
return;
- UIManager.Instance.OpenWindow<TimeRushWin>(config.ID);
+ UIManager.Instance.OpenWindowAsync<TimeRushWin>(config.ID).Forget();
});
}
diff --git a/Main/System/TimingGift/TimingGiftCell.cs b/Main/System/TimingGift/TimingGiftCell.cs
index 25be424..44df006 100644
--- a/Main/System/TimingGift/TimingGiftCell.cs
+++ b/Main/System/TimingGift/TimingGiftCell.cs
@@ -1,14 +1,21 @@
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TimingGiftCell : MonoBehaviour
{
private void Awake()
{
- //濡傛灉鏈夐渶瑕佹寜閽偣鍑婚�昏緫锛屽湪澶栧眰鍒涘缓锛屾澶勪笉澶勭悊鐐瑰嚮閫昏緫
- LoadPrefab();
+ InitAsync().Forget();
+ }
+
+ private async UniTask InitAsync()
+ {
+ //濡傛灉鏈夐渶瑕佹寜閳曠偣鍑婚�昏緫锛屽湪澶栧眰鍒涘缓锛屾澶勪笉澶勭悊鐐瑰嚮閫昏緫
+ await LoadPrefab();
+ if (this == null) return;
button.SetListener(() =>
{
- UIManager.Instance.OpenWindow<TimingGiftWin>(type);
+ UIManager.Instance.OpenWindowAsync<TimingGiftWin>(type).Forget();
});
}
@@ -110,7 +117,7 @@
}
}
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (prefab != null)
return;
@@ -121,16 +128,23 @@
prefab = tmp.gameObject;
return;
}
- prefab = UIUtility.CreateWidget("TimingGiftCell", "TimingGiftCell");
+
+ prefab = await UIUtility.CreateWidget("TimingGiftCell", "TimingGiftCell");
+
+ if (this == null)
+ {
+ if (null != prefab) DestroyImmediate(prefab);
+ return;
+ }
prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
prefab.transform.SetAsFirstSibling();
-
}
- public void InitUI()
+ public async UniTask InitUI()
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
Display();
}
diff --git a/Main/System/TimingGift/TimingGiftManager.cs b/Main/System/TimingGift/TimingGiftManager.cs
index d7b2483..6a816e4 100644
--- a/Main/System/TimingGift/TimingGiftManager.cs
+++ b/Main/System/TimingGift/TimingGiftManager.cs
@@ -3,6 +3,7 @@
using System.Linq;
using LitJson;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TimingGiftManager : GameSystemManager<TimingGiftManager>
{
@@ -138,7 +139,7 @@
{
if (!UIManager.Instance.IsOpened<TimingGiftWin>())
{
- UIManager.Instance.OpenWindow<TimingGiftWin>(type);
+ UIManager.Instance.OpenWindowAsync<TimingGiftWin>(type).Forget();
}
}
diff --git a/Main/System/Tip/ConfirmCancel.cs b/Main/System/Tip/ConfirmCancel.cs
index dfd4ad4..84a374c 100644
--- a/Main/System/Tip/ConfirmCancel.cs
+++ b/Main/System/Tip/ConfirmCancel.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
public class ConfirmCancel
{
@@ -26,7 +27,7 @@
CancelName = null;
if (!UIManager.Instance.IsOpened<PopConfirmWin>())
{
- UIManager.Instance.OpenWindow<PopConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<PopConfirmWin>().Forget();
}
}
@@ -43,7 +44,7 @@
CancelName = null;
if (!UIManager.Instance.IsOpened<PopConfirmWin>())
{
- UIManager.Instance.OpenWindow<PopConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<PopConfirmWin>().Forget();
}
}
@@ -59,7 +60,7 @@
CancelName = null;
if (!UIManager.Instance.IsOpened<PopConfirmWin>())
{
- UIManager.Instance.OpenWindow<PopConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<PopConfirmWin>().Forget();
}
}
@@ -75,7 +76,7 @@
CancelName = cancelName;
if (!UIManager.Instance.IsOpened<PopConfirmWin>())
{
- UIManager.Instance.OpenWindow<PopConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<PopConfirmWin>().Forget();
}
}
@@ -90,7 +91,7 @@
// IsSingleConfirm = true;
// if (!UIManager.Instance.IsOpened<RealmPopConfirmWin>())
// {
- // UIManager.Instance.OpenWindow<RealmPopConfirmWin>();
+ // UIManager.Instance.OpenWindowAsync<RealmPopConfirmWin>().Forget();
// }
// }
@@ -107,7 +108,7 @@
IsSingleConfirm = false;
checkItemID = _itemID;
checkItemCount = _cnt;
- UIManager.Instance.OpenWindow<UseItemConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<UseItemConfirmWin>().Forget();
}
@@ -118,7 +119,7 @@
// OnPopConfirmClickEvent = func;
// OnPopSingleConfirmEvent = null;
// IsSingleConfirm = false;
- // UIManager.Instance.OpenWindow<CancelAuctionConfirmWin>();
+ // UIManager.Instance.OpenWindowAsync<CancelAuctionConfirmWin>().Forget();
// }
public static string generalTitle;
@@ -141,7 +142,7 @@
CancelName = null;
if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
{
- UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<ToggleConfirmWin>().Forget();
}
}
@@ -158,7 +159,7 @@
CancelName = null;
if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
{
- UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<ToggleConfirmWin>().Forget();
}
}
@@ -176,7 +177,7 @@
CancelName = null;
if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
{
- UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<ToggleConfirmWin>().Forget();
}
}
@@ -193,7 +194,7 @@
CancelName = cancelName;
if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
{
- UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<ToggleConfirmWin>().Forget();
}
}
@@ -245,7 +246,7 @@
// OnIconToggleConfirmAct = func;
// if (!UIManager.Instance.IsOpened<IconConfirmWin>())
// {
- // UIManager.Instance.OpenWindow<IconConfirmWin>();
+ // UIManager.Instance.OpenWindowAsync<IconConfirmWin>().Forget();
// }
// }
@@ -256,7 +257,7 @@
// OnFairyLeagueGuideEvent = func;
// if (!UIManager.Instance.IsOpened<FairyLeagueGuideSelectWin>())
// {
- // UIManager.Instance.OpenWindow<FairyLeagueGuideSelectWin>();
+ // UIManager.Instance.OpenWindowAsync<FairyLeagueGuideSelectWin>().Forget();
// }
// }
@@ -293,7 +294,7 @@
replaceItemName = itemName;
if (!UIManager.Instance.IsOpened<ItemsConfirmWin>())
{
- UIManager.Instance.OpenWindow<ItemsConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<ItemsConfirmWin>().Forget();
}
}
@@ -332,7 +333,7 @@
moneyNeedCount = moneyCnt;
if (!UIManager.Instance.IsOpened<MoneyIconToggleConfirmWin>())
{
- UIManager.Instance.OpenWindow<MoneyIconToggleConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<MoneyIconToggleConfirmWin>().Forget();
}
}
@@ -346,7 +347,7 @@
moneyNeedCount = moneyCnt;
if (!UIManager.Instance.IsOpened<MoneyIconToggleConfirmWin>())
{
- UIManager.Instance.OpenWindow<MoneyIconToggleConfirmWin>();
+ UIManager.Instance.OpenWindowAsync<MoneyIconToggleConfirmWin>().Forget();
}
}
diff --git a/Main/System/Tip/FuncRules.cs b/Main/System/Tip/FuncRules.cs
index 059e067..8bf62f8 100644
--- a/Main/System/Tip/FuncRules.cs
+++ b/Main/System/Tip/FuncRules.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class FuncRules : MonoBehaviour
{
[SerializeField] Button m_Button;
@@ -16,7 +17,7 @@
var rule = RuleConfig.Get(m_RuleId);
if (!UIManager.Instance.IsOpened<FuncRuleWin>())
{
- UIManager.Instance.OpenWindow<FuncRuleWin>(m_RuleId);
+ UIManager.Instance.OpenWindowAsync<FuncRuleWin>(m_RuleId).Forget();
}
}
diff --git a/Main/System/Tip/ScrollTip.cs b/Main/System/Tip/ScrollTip.cs
index f5103cd..24b63ca 100644
--- a/Main/System/Tip/ScrollTip.cs
+++ b/Main/System/Tip/ScrollTip.cs
@@ -57,7 +57,7 @@
if (!UIManager.Instance.IsOpened<ScrollTipWin>())
{
- UIManager.Instance.OpenWindow<ScrollTipWin>();
+ UIManager.Instance.OpenWindowAsync<ScrollTipWin>().Forget();
}
}
@@ -69,13 +69,16 @@
return true;
}
- public static ScrollTipDetail Request()
+ public static async UniTask<ScrollTipDetail> Request()
{
ScrollTipDetail tip = null;
if (pool == null)
{
- var _prefab = UILoader.LoadPrefab("Tip");
- pool = GameObjectPoolManager.Instance.GetPool(_prefab);
+ var _prefab = await UILoader.LoadPrefabAsync("Tip");
+ if (pool != null)
+ {
+ pool = GameObjectPoolManager.Instance.GetPool(_prefab);
+ }
}
if (pool != null)
{
diff --git a/Main/System/Tip/ScrollTipWin.cs b/Main/System/Tip/ScrollTipWin.cs
index d576ef5..ca98f71 100644
--- a/Main/System/Tip/ScrollTipWin.cs
+++ b/Main/System/Tip/ScrollTipWin.cs
@@ -93,7 +93,7 @@
}
}
- private void OnTipReceiveEvent()
+ private async UniTask OnTipReceiveEvent()
{
if (ScrollTip.m_Hints.Count > 0 && IsCanAdd())
{
@@ -110,7 +110,7 @@
// {
// ScrollTip.m_ActiveTips[i].Play(ScrollTip.ScrollTipState.Move);
// }
- ScrollTipDetail tipDetail = ScrollTip.Request();
+ ScrollTipDetail tipDetail = await ScrollTip.Request();
if (tipDetail != null)
{
tipDetail.SetTipConfig(m_TipShowTime, m_TipHideTime, m_TipDistance);
diff --git a/Main/System/Tip/ServerTipDetails.cs b/Main/System/Tip/ServerTipDetails.cs
index 56e7a02..ab0fb67 100644
--- a/Main/System/Tip/ServerTipDetails.cs
+++ b/Main/System/Tip/ServerTipDetails.cs
@@ -29,7 +29,7 @@
if (!UIManager.Instance.IsOpened<MarqueeWin>())
{
- UIManager.Instance.OpenWindow<MarqueeWin>();
+ UIManager.Instance.OpenWindowAsync<MarqueeWin>().Forget();
}
}
@@ -50,7 +50,7 @@
{
if (!UIManager.Instance.IsOpened<MarqueeWin>())
{
- UIManager.Instance.OpenWindow<MarqueeWin>();
+ UIManager.Instance.OpenWindowAsync<MarqueeWin>().Forget();
}
}
}
@@ -95,7 +95,7 @@
if (!UIManager.Instance.IsOpened<MessageWin>())
{
- UIManager.Instance.OpenWindow<MessageWin>();
+ UIManager.Instance.OpenWindowAsync<MessageWin>().Forget();
}
}
@@ -130,7 +130,7 @@
}
if (!UIManager.Instance.IsOpened<MessageWin>())
{
- UIManager.Instance.OpenWindow<MessageWin>();
+ UIManager.Instance.OpenWindowAsync<MessageWin>().Forget();
}
}
@@ -165,7 +165,7 @@
}
if (!UIManager.Instance.IsOpened<MessageWin>())
{
- UIManager.Instance.OpenWindow<MessageWin>();
+ UIManager.Instance.OpenWindowAsync<MessageWin>().Forget();
}
}
@@ -205,7 +205,7 @@
requireOpenGM = true;
if (!UIManager.Instance.IsOpened<MessageWin>())
{
- UIManager.Instance.OpenWindow<MessageWin>();
+ UIManager.Instance.OpenWindowAsync<MessageWin>().Forget();
}
else
{
@@ -233,7 +233,7 @@
// queueTrumpetTips.Enqueue(trumpetData);
// if (!UIManager.Instance.IsOpened<TrumpetWin>())
// {
- // UIManager.Instance.OpenWindow<TrumpetWin>();
+ // UIManager.Instance.OpenWindowAsync<TrumpetWin>().Forget();
// }
// }
// public static ChatTrumpetData RequireTrumpetTip()
diff --git a/Main/System/UIBase/OneLevelWin.cs b/Main/System/UIBase/OneLevelWin.cs
index be5cde9..02feaa8 100644
--- a/Main/System/UIBase/OneLevelWin.cs
+++ b/Main/System/UIBase/OneLevelWin.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System;
+using Cysharp.Threading.Tasks;
// 涓�绾х晫闈㈠甫棰勫埗浣擄紝搴曢儴鍔熻兘鎸夐挳鏍峰紡
public class OneLevelWin : FunctionsBaseWin
@@ -8,10 +9,40 @@
[NonSerialized] GroupButtonEx tabBtn;
public FuncBtnData[] funcBtnDatas;
[NonSerialized] Button closeBtn;
+
+ bool isComponentReady = false;
+
protected override void InitComponent()
{
+ InitComponentAsync().Forget();
+ }
+
+ protected override void OnPreOpen()
+ {
+ if (!isComponentReady)
+ {
+ WaitReadyThenOpen().Forget();
+ return;
+ }
+ base.OnPreOpen();
+ }
+
+ private async UniTaskVoid WaitReadyThenOpen()
+ {
+ await UniTask.WaitUntil(() => isComponentReady || this == null);
+ if (this == null) return;
+ base.OnPreOpen();
+ }
+
+ private async UniTask InitComponentAsync()
+ {
// 鍒涘缓
- var instance = UIUtility.CreateWidget("OneLevelWin", "BottomTabs");
+ var instance = await UIUtility.CreateWidget("OneLevelWin", "BottomTabs");
+ if (this == null)
+ {
+ if (instance != null) DestroyImmediate(instance);
+ return;
+ }
instance.transform.SetParent(_rectTransform, false);
closeBtn = _rectTransform.GetComponent<Button>("BottomTabs/bg/backbtn");
tabBtn = _rectTransform.GetComponent<GroupButtonEx>("BottomTabs/bg/btns/funcbtn");
@@ -33,8 +64,9 @@
tabButtons[i].SetActive(true);
}
base.InitComponent();
-
closeBtn.AddListener(CloseWindow);
+
+ isComponentReady = true;
}
protected override void OpenSubUIByTabIndex()
diff --git a/Main/System/UIBase/UIJumpManager.cs b/Main/System/UIBase/UIJumpManager.cs
index 5ebadfb..74810c0 100644
--- a/Main/System/UIBase/UIJumpManager.cs
+++ b/Main/System/UIBase/UIJumpManager.cs
@@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
/// <summary>
/// 鍏宠仈鐣岄潰绱㈠紩琛紝鐢ㄤ簬鑾峰彇閫斿緞锛屽瘜鏂囨湰鎵撳紑鐣岄潰绛夋儏鍐�
@@ -54,7 +55,7 @@
if (!UIManager.Instance.IsOpened(config.WinName))
{
- UIManager.Instance.OpenWindow(config.WinName, config.TabIndex);
+ UIManager.Instance.OpenWindow(config.WinName, config.TabIndex).Forget();
}
else
{
diff --git a/Main/System/Video/VideoManager.cs b/Main/System/Video/VideoManager.cs
index 18f7ac3..b06b74d 100644
--- a/Main/System/Video/VideoManager.cs
+++ b/Main/System/Video/VideoManager.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class VideoManager : Singleton<VideoManager>
@@ -14,8 +15,10 @@
public void Init()
{
- GameObject uiVideoPrefab = UILoader.LoadPrefab("UIVideoPlayer");
- uiVideoPool = GameObjectPoolManager.Instance.GetPool(uiVideoPrefab);
+ UILoader.LoadPrefabAsync("UIVideoPlayer").ContinueWith(prefab =>
+ {
+ uiVideoPool = GameObjectPoolManager.Instance.GetPool(prefab);
+ }).Forget();
}
public void Release()
diff --git a/Main/System/ViewNPC/ViewNPCManager.cs b/Main/System/ViewNPC/ViewNPCManager.cs
index 4a0e255..f5a08d8 100644
--- a/Main/System/ViewNPC/ViewNPCManager.cs
+++ b/Main/System/ViewNPC/ViewNPCManager.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using LitJson;
+using Cysharp.Threading.Tasks;
public class ViewNPCManager : GameSystemManager<ViewNPCManager>
{
@@ -137,7 +138,7 @@
this.viewNPCAttr = viewNPCAttr;
if (!UIManager.Instance.IsOpened<OtherNPCDetailWin>())
{
- UIManager.Instance.OpenWindow<OtherNPCDetailWin>();
+ UIManager.Instance.OpenWindowAsync<OtherNPCDetailWin>().Forget();
}
}
diff --git a/Main/System/WarlordPavilion/TowerBaseWin.cs b/Main/System/WarlordPavilion/TowerBaseWin.cs
index 40e5ab0..0616054 100644
--- a/Main/System/WarlordPavilion/TowerBaseWin.cs
+++ b/Main/System/WarlordPavilion/TowerBaseWin.cs
@@ -1,4 +1,5 @@
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class TowerBaseWin : OneLevelWin
{
@@ -9,7 +10,7 @@
switch (functionOrder)
{
case 0:
- currentSubUI = UIManager.Instance.OpenWindow<WarlordPavilionWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionWin>().ContinueWith(w => currentSubUI = w).Forget();
break;
default:
Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
diff --git a/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs b/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs
index 10e3eca..f273e9e 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionGiftCell.cs
@@ -1,5 +1,6 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionGiftCell : MonoBehaviour
{
@@ -111,13 +112,14 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
//showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
- public void Init(int giftID, int lv, int showState = 0, bool isShowTip = true)
+ public async UniTask Init(int giftID, int lv, int showState = 0, bool isShowTip = true)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (FBDJGEffectConfig.HasKey(giftID))
{
var config = FBDJGEffectConfig.Get(giftID);
@@ -157,7 +159,7 @@
var giftConfig = FBDJGEffectConfig.Get(giftID);
SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV),
Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue * giftLV)));
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
}
@@ -214,7 +216,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -225,15 +227,19 @@
cellContainer = tmp.gameObject;
return;
}
- if (cellContainer == null)
- {
- cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
- if (cellContainer != null)
- {
- cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
- cellContainer.transform.SetAsFirstSibling();
- }
+ cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+
+ if (this == null)
+ {
+ if (null != cellContainer) DestroyImmediate(cellContainer);
+ return;
+ }
+
+ if (cellContainer != null)
+ {
+ cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ cellContainer.transform.SetAsFirstSibling();
}
//缂╂斁鍒板拰鐖秗ect涓�鏍峰ぇ
@@ -249,7 +255,6 @@
{
width = grid.cellSize.x;
}
-
}
scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = cellContainer.transform.localScale * scale;
diff --git a/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs b/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs
index 612d0c7..f155f19 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionGiftDiyButtonCell.cs
@@ -1,6 +1,8 @@
-锘縰sing UnityEngine;
+锘縰sing System;
+using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionGiftDiyButtonCell : MonoBehaviour
{
@@ -112,21 +114,41 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
+
+ bool isLoaded { get { return cellContainer != null; } }
+ Action onLoaded = null;
+
+ public void SetOnLoaded(Action _onloaded)
+ {
+ if (isLoaded)
+ {
+ _onloaded?.Invoke();
+ }
+ else
+ {
+ onLoaded += _onloaded;
+ }
+ }
+
private bool hasCustomListener = false;
// 璁剧疆鑷畾涔夌洃鍚櫒
public void SetListener(UnityAction action)
{
- hasCustomListener = true; // 鏍囪宸茶缃嚜瀹氫箟鐩戝惉
- giftBtn.SetListener(action);
+ hasCustomListener = true; // 绔嬪嵆鏍囪锛岄槻姝� Init 瑕嗙洊
+ SetOnLoaded(() =>
+ {
+ giftBtn.SetListener(action);
+ });
}
//showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
- public void Init(int giftID, int lv, int showState = 0)
+ public async UniTask Init(int giftID, int lv, int showState = 0)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (FBDJGEffectConfig.HasKey(giftID))
{
var config = FBDJGEffectConfig.Get(giftID);
@@ -167,7 +189,7 @@
var giftConfig = FBDJGEffectConfig.Get(giftID);
SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV),
Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue * giftLV)));
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
}
@@ -224,7 +246,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -233,17 +255,23 @@
if (tmp != null)
{
cellContainer = tmp.gameObject;
+ onLoaded?.Invoke();
+ onLoaded = null;
return;
}
- if (cellContainer == null)
- {
- cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
- if (cellContainer != null)
- {
- cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
- cellContainer.transform.SetAsFirstSibling();
- }
+ cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+
+ if (this == null)
+ {
+ if (null != cellContainer) DestroyImmediate(cellContainer);
+ return;
+ }
+
+ if (cellContainer != null)
+ {
+ cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ cellContainer.transform.SetAsFirstSibling();
}
//缂╂斁鍒板拰鐖秗ect涓�鏍峰ぇ
@@ -259,10 +287,12 @@
{
width = grid.cellSize.x;
}
-
}
scale = width / rect.sizeDelta.x;
cellContainer.transform.localScale = cellContainer.transform.localScale * scale;
+
+ onLoaded?.Invoke();
+ onLoaded = null;
}
}
diff --git a/Main/System/WarlordPavilion/WarlordPavilionGiftGird.cs b/Main/System/WarlordPavilion/WarlordPavilionGiftGird.cs
index 84fe416..2278a63 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionGiftGird.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionGiftGird.cs
@@ -1,5 +1,6 @@
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionGiftGird : MonoBehaviour
{
[SerializeField] ImageEx imgBG;
@@ -29,7 +30,7 @@
{
if (!manager.TryGetEff(index, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff))
return;
- cell.Init(eff.EffID, eff.EffLV);
+ cell.Init(eff.EffID, eff.EffLV).Forget();
}
if (isPlay)
{
diff --git a/Main/System/WarlordPavilion/WarlordPavilionManager.cs b/Main/System/WarlordPavilion/WarlordPavilionManager.cs
index 179ce22..847a1d1 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionManager.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionManager.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using LitJson;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionManager : GameSystemManager<WarlordPavilionManager>
{
@@ -742,12 +743,12 @@
}
else
{
- UIManager.Instance.OpenWindow<MainWin>();
+ UIManager.Instance.OpenWindowAsync<MainWin>().Forget();
}
if (!IsAutoFuncOpen(false))
{
- UIManager.Instance.OpenWindow<TowerBaseWin>();
+ UIManager.Instance.OpenWindowAsync<TowerBaseWin>().Forget();
return;
}
@@ -755,7 +756,7 @@
bool hasNext = FBDJGLevelConfig.TryGetNextLevel(layerNum, levelNum, out int nextLayerNum, out int nextLevelNum);
if (!hasNext)
{
- UIManager.Instance.OpenWindow<TowerBaseWin>();
+ UIManager.Instance.OpenWindowAsync<TowerBaseWin>().Forget();
return;
}
@@ -763,14 +764,14 @@
bool isAutoPresetOn = IsAutoPresetOn();
if (hasBonusToSelect && !isAutoPresetOn)
{
- UIManager.Instance.OpenWindow<TowerBaseWin>();
- UIManager.Instance.OpenWindow<WarlordPavilionSelectBonusWin>();
+ UIManager.Instance.OpenWindowAsync<TowerBaseWin>().Forget();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionSelectBonusWin>().Forget();
return;
}
if (!isAutoNext)
{
- UIManager.Instance.OpenWindow<TowerBaseWin>();
+ UIManager.Instance.OpenWindowAsync<TowerBaseWin>().Forget();
return;
}
diff --git a/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs b/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs
index a11646b..8f92bb9 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionPlayerTop3Cell.cs
@@ -2,6 +2,7 @@
// [Author]: 鐜╀釜娓告垙
// [ Date ]: Wednesday, September 26, 2018
//--------------------------------------------------------
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -31,7 +32,7 @@
nameText.text = rankData.name1;
officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
model.SetActive(true);
- model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f);
+ model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
queryPlayerBtn.SetListener(() =>
{
AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id);
diff --git a/Main/System/WarlordPavilion/WarlordPavilionReplaceGiftGird.cs b/Main/System/WarlordPavilion/WarlordPavilionReplaceGiftGird.cs
index 9ef105b..e92fd1b 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionReplaceGiftGird.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionReplaceGiftGird.cs
@@ -1,4 +1,5 @@
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionReplaceGiftGird : MonoBehaviour
{
@@ -30,7 +31,7 @@
{
if (!manager.TryGetEff(index, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff))
return;
- cell.Init(eff.EffID, eff.EffLV);
+ cell.Init(eff.EffID, eff.EffLV).Forget();
cell.SetListener(() =>
{
if (manager.selectReplaceIndex == index)
diff --git a/Main/System/WarlordPavilion/WarlordPavilionSelectBonusWin.cs b/Main/System/WarlordPavilion/WarlordPavilionSelectBonusWin.cs
index 3db007b..073db2a 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionSelectBonusWin.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionSelectBonusWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionSelectBonusWin : UIBase
{
@@ -31,7 +32,7 @@
TryClose();
return;
}
- UIManager.Instance.OpenWindow<WarlordPavilionReplaceBonusWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionReplaceBonusWin>().Forget();
});
btnGiveup.SetListener(() =>
{
diff --git a/Main/System/WarlordPavilion/WarlordPavilionSelectGiftGird.cs b/Main/System/WarlordPavilion/WarlordPavilionSelectGiftGird.cs
index ac026b8..6f6d282 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionSelectGiftGird.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionSelectGiftGird.cs
@@ -1,4 +1,5 @@
using UnityEngine;
+using Cysharp.Threading.Tasks;
public class WarlordPavilionSelectGiftGird : MonoBehaviour
{
[SerializeField] ImageEx imgChoose;
@@ -10,7 +11,7 @@
{
imgChoose.SetActive(isChoose);
imgUp.SetActive(isUp);
- cell.Init(effID, 1);//鏄剧ず1绾х殑
+ cell.Init(effID, 1).Forget();//鏄剧ず1绾х殑
cell.SetListener(() =>
{
manager.selectEffID = effID;
diff --git a/Main/System/WarlordPavilion/WarlordPavilionWin.cs b/Main/System/WarlordPavilion/WarlordPavilionWin.cs
index d638622..ecf5594 100644
--- a/Main/System/WarlordPavilion/WarlordPavilionWin.cs
+++ b/Main/System/WarlordPavilion/WarlordPavilionWin.cs
@@ -1,5 +1,6 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class WarlordPavilionWin : UIBase
@@ -33,16 +34,16 @@
{
btnRank.SetListener(() =>
{
- UIManager.Instance.OpenWindow<WarlordPavilionRankWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionRankWin>().Forget();
});
btnAward.SetListener(() =>
{
- UIManager.Instance.OpenWindow<WarlordPavilionAwardWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionAwardWin>().Forget();
});
btnFormation.SetListener(() =>
{
HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetMainTeamID();
- UIManager.Instance.OpenWindow<HeroPosWin>();
+ UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
});
btnSelectOneClick.SetListener(() =>
{
@@ -58,13 +59,13 @@
});
btnSelectBonus.SetListener(() =>
{
- UIManager.Instance.OpenWindow<WarlordPavilionSelectBonusWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionSelectBonusWin>().Forget();
});
btnBonusPreset.SetListener(() =>
{
if (!manager.IsFuncOpen(true))
return;
- UIManager.Instance.OpenWindow<WarlordPavilionBonusPresetWin>();
+ UIManager.Instance.OpenWindowAsync<WarlordPavilionBonusPresetWin>().Forget();
});
funPresetBtn.AddListener(() =>
@@ -269,8 +270,8 @@
SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description);
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
SmallTipWin.isDownShow = true;
- UIManager.Instance.OpenWindow<SmallTipWin>();
- });
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+ }).Forget();
}
else
{
diff --git a/Main/Utility/ComponentExtersion.cs b/Main/Utility/ComponentExtersion.cs
index 3f25b7c..a162fd7 100644
--- a/Main/Utility/ComponentExtersion.cs
+++ b/Main/Utility/ComponentExtersion.cs
@@ -330,8 +330,13 @@
return;
}
- var sprite = UILoader.LoadSprite(_id);
- _image.overrideSprite = sprite;
+ UILoader.LoadSpriteAsync(_id).ContinueWith(sprite =>
+ {
+ if (_image != null && sprite != null)
+ {
+ _image.overrideSprite = sprite;
+ }
+ }).Forget();
}
public static async UniTask SetSpriteAsync(this Image _image, string _id)
@@ -366,8 +371,8 @@
return;
}
- var sprite = UILoader.LoadSprite(_id);
- _textImage.sprite = sprite;
+ UILoader.LoadSpriteAsync(_id).ContinueWith(sprite => _textImage.sprite = sprite).Forget();
+ // _textImage.sprite = sprite;
}
public static async UniTask SetSpriteAsync(this TextImage _textImage, string _id)
@@ -402,27 +407,7 @@
return;
}
- var sprite = UILoader.LoadSprite(folderName, iconName);
- if (null == sprite) return;
- _image.overrideSprite = sprite;
- }
-
- public static async UniTask SetOrgSpriteAsync(this Image _image, string iconName, string folderName = "icon")
- {
- if (_image == null)
- {
- return;
- }
-
- if (string.IsNullOrEmpty(iconName))
- {
- Debug.LogError("SetOrgSpriteAsync iconName is null or empty " + iconName);
- return;
- }
-
- var sprite = await UILoader.LoadSpriteAsync(folderName, iconName);
- if (_image != null && sprite != null)
- _image.overrideSprite = sprite;
+ UILoader.LoadSprite(folderName, iconName, _image).Forget();
}
public static void SetItemSprite(this Image _image, int itemID)
@@ -468,8 +453,8 @@
return;
}
- var sprite = UILoader.LoadSprite("SkillIcon", skillConfig.IconName);
- _image.overrideSprite = sprite;
+ UILoader.LoadSprite("SkillIcon", skillConfig.IconName, _image).Forget();
+ // _image.overrideSprite = sprite;
}
public static async UniTask SetSkillSpriteAsync(this Image _image, int skillID)
@@ -512,15 +497,20 @@
}
- public static void SetTexture2D(this RawImage _image, string _id)
+ public static async void SetTexture2D(this RawImage _image, string _id)
{
if (_image == null)
{
return;
}
- var texture = UILoader.LoadTexture2D(_id);
- _image.texture = texture;
+ UILoader.LoadTexture2DAsync(_id).ContinueWith(texture =>
+ {
+ if (_image != null && texture != null)
+ {
+ _image.texture = texture;
+ }
+ }).Forget();
}
public static async UniTask SetTexture2DAsync(this RawImage _image, string _id)
@@ -549,7 +539,12 @@
return;
}
- var texture = UILoader.LoadTexture2DPNG(_id);
- _image.texture = texture;
+ UILoader.LoadTexture2DPNGAsync(_id).ContinueWith(texture =>
+ {
+ if (_image != null && texture != null)
+ {
+ _image.texture = texture;
+ }
+ }).Forget();
}
}
diff --git a/Main/Utility/GMCommand.cs b/Main/Utility/GMCommand.cs
index 5ee129a..adb7b6a 100644
--- a/Main/Utility/GMCommand.cs
+++ b/Main/Utility/GMCommand.cs
@@ -12,7 +12,7 @@
{
if (!UIManager.Instance.IsOpened<GMInputWin>())
{
- UIManager.Instance.OpenWindow<GMInputWin>();
+ UIManager.Instance.OpenWindowAsync<GMInputWin>().Forget();
}
else
{
@@ -24,7 +24,7 @@
{
if (!UIManager.Instance.IsOpened<GMCmdPanel>())
{
- UIManager.Instance.OpenWindow<GMCmdPanel>();
+ UIManager.Instance.OpenWindowAsync<GMCmdPanel>().Forget();
}
else
{
diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index 15927ac..1ad12b0 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -1516,7 +1516,7 @@
UIManager.Instance.CloseWindow<ServersSmallTipWin>();
}
ServersSmallTipWin.serverIDList = serverIDList;
- UIManager.Instance.OpenWindow<ServersSmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<ServersSmallTipWin>().Forget();
}
}
diff --git a/Main/Utility/UIUtility.cs b/Main/Utility/UIUtility.cs
index 7096f2f..2c3d6ac 100644
--- a/Main/Utility/UIUtility.cs
+++ b/Main/Utility/UIUtility.cs
@@ -10,11 +10,9 @@
public static class UIUtility
{
- public static GameObject CreateWidget(string _sourceName, string _name)
+ public static async UniTask<GameObject> CreateWidget(string _sourceName, string _name)
{
- #pragma warning disable CS0618 // Obsolete 鈥� sync legacy fallback
- var prefab = UILoader.LoadPrefab(_sourceName);
- #pragma warning restore CS0618
+ var prefab = await UILoader.LoadPrefabAsync(_sourceName);
if (prefab == null)
{
return null;
--
Gitblit v1.8.0