Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit fa25f6b

Browse files
committed
修改热更新的UI模块的IUpdate的接口
1 parent 41797b7 commit fa25f6b

File tree

11 files changed

+3508
-3241
lines changed

11 files changed

+3508
-3241
lines changed

.idea/.idea.UnityGameFramework/.idea/contentModel.xml

Lines changed: 60 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.UnityGameFramework/.idea/workspace.xml

Lines changed: 354 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Game/HotFix/HotFix.dll.bytes

0 Bytes
Binary file not shown.

Assets/HotFix/GameFramework/UI/UIManager.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ public sealed class UIManager : GameFrameworkModule,IUpdate
2828
private readonly Dictionary<int, AssetConfig> _uiAssetPath = new Dictionary<int, AssetConfig>();
2929
//所有的uiAsset
3030
private readonly Dictionary<int, AssetConfig> _allUiAssets = new Dictionary<int, AssetConfig>();
31+
//带Update的UIView
32+
private List<IUpdate> _allUpdates;
3133
#region 构造函数
3234
public UIManager()
3335
{
3436
//获取资源模块
3537
_resource = GameFramework.Taurus.GameFrameworkMode.GetModule<GameFramework.Taurus.ResourceManager>();
38+
_allUpdates=new List<IUpdate>();
3639
}
3740
#endregion
3841

@@ -68,7 +71,12 @@ public void Push<T>(bool allowMulti = false, params object[] parameters) where T
6871
_stackUiAsset.Push(newAssetConfig);
6972
UIView newUiView = GetUiView<T>(newAssetConfig);
7073
newUiView.OnEnter(parameters);
71-
74+
//更新函数 -- 添加
75+
IUpdate update = newUiView as IUpdate;
76+
if (update!=null)
77+
{
78+
_allUpdates.Add(update);
79+
}
7280
////触发打开事件
7381
//_uiEnterArgs.UIView = newUiView;
7482
//_event.Trigger(this, _uiEnterArgs);
@@ -84,6 +92,12 @@ public void Pop(bool isDestory = false)
8492
UIView lastUiView;
8593
if (_allUiViews.TryGetValue(lastAssetConfig, out lastUiView))
8694
{
95+
//更新函数 -- 移除
96+
IUpdate update = lastUiView as IUpdate;
97+
if (update!=null&&_allUpdates.Contains(update))
98+
{
99+
_allUpdates.Remove(update);
100+
}
87101
////触发关闭事件
88102
//_uiExitArgs.UIView = lastUiView;
89103
//_event.Trigger(this, _uiExitArgs);
@@ -122,8 +136,12 @@ public void OnUpdate()
122136
{
123137
if (_allUiViews != null)
124138
{
125-
foreach (var item in _allUiViews.Values)
126-
item.OnUpdate();
139+
for (int i = 0; i < _allUpdates.Count; i++)
140+
{
141+
_allUpdates[i].OnUpdate();
142+
}
143+
// foreach (var item in _allUiViews.Values)
144+
// item.OnUpdate();
127145
}
128146
}
129147

Assets/HotFix/GameFramework/UI/UIView.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ protected UIView(GameObject uiView)
3636
/// 恢复界面
3737
/// </summary>
3838
public abstract void OnResume();
39-
/// <summary>
40-
/// 更新函数
41-
/// </summary>
42-
public abstract void OnUpdate();
39+
4340
}
4441
}

0 commit comments

Comments
 (0)