mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
修正动态添加/异步添加ui组件的脏数据问题
修正动态添加/异步添加ui组件的脏数据问题
This commit is contained in:
@@ -175,7 +175,15 @@ namespace TEngine
|
||||
protected virtual void OnSetVisible(bool visible)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
internal void SetUpdateDirty()
|
||||
{
|
||||
m_updateListValid = false;
|
||||
if (Parent != null)
|
||||
{
|
||||
Parent.SetUpdateDirty();
|
||||
}
|
||||
}
|
||||
|
||||
#region FindChildComponent
|
||||
|
||||
|
@@ -102,6 +102,11 @@ namespace TEngine
|
||||
for (int i = 0; i < listChild.Count; i++)
|
||||
{
|
||||
var uiWidget = listChild[i];
|
||||
|
||||
if (uiWidget == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TProfiler.BeginSample(uiWidget.name);
|
||||
var needValid = uiWidget.InternalUpdate();
|
||||
@@ -208,6 +213,7 @@ namespace TEngine
|
||||
RestChildCanvas(parentUI);
|
||||
parent = parentUI;
|
||||
Parent.ListChild.Add(this);
|
||||
Parent.SetUpdateDirty();
|
||||
ScriptGenerator();
|
||||
BindMemberProperty();
|
||||
RegisterEvent();
|
||||
@@ -279,6 +285,8 @@ namespace TEngine
|
||||
/// </summary>
|
||||
internal void OnDestroyWidget()
|
||||
{
|
||||
Parent?.SetUpdateDirty();
|
||||
|
||||
RemoveAllUIEvent();
|
||||
|
||||
foreach (var uiChild in ListChild)
|
||||
|
@@ -318,6 +318,11 @@ namespace TEngine
|
||||
{
|
||||
var uiWidget = listChild[i];
|
||||
|
||||
if (uiWidget == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TProfiler.BeginSample(uiWidget.name);
|
||||
var needValid = uiWidget.InternalUpdate();
|
||||
TProfiler.EndSample();
|
||||
|
Reference in New Issue
Block a user