File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929// Official Documentation: https://gameframex.doc.alianblank.com/
3030// ==========================================================================================
3131
32+ using System ;
3233using System . Collections . Generic ;
3334using GameFrameX . Runtime ;
3435
@@ -115,6 +116,25 @@ public List<T> GetLoadedList<T>() where T : class, IUIForm
115116 return results ;
116117 }
117118
119+ /// <summary>
120+ /// 获取已加载且正在显示的UI。
121+ /// </summary>
122+ /// <param name="type">UI的具体类型。</param>
123+ /// <returns>返回已加载且正在显示的UI实例,如果未找到则返回null。</returns>
124+ public IUIForm GetLoadedAndShowing ( Type type )
125+ {
126+ var fullName = type . FullName ;
127+ var uiForms = m_UIManager . GetAllLoadedUIForms ( ) ;
128+ foreach ( var uiForm in uiForms )
129+ {
130+ if ( uiForm . FullName == fullName && uiForm . Visible && uiForm . Available )
131+ {
132+ return uiForm ;
133+ }
134+ }
135+
136+ return null ;
137+ }
118138
119139 /// <summary>
120140 /// 获取已加载且正在显示的UI。
@@ -155,6 +175,26 @@ public bool HasLoadedAndShowing(string uiFormAssetName)
155175 return false ;
156176 }
157177
178+ /// <summary>
179+ /// 根据界面逻辑类型获取界面。只要找到任意的一个即返回
180+ /// </summary>
181+ /// <param name="type">逻辑界面类型</param>
182+ /// <returns>返回已加载的UI实例,如果未找到则返回null。</returns>
183+ public IUIForm GetLoaded ( Type type )
184+ {
185+ var fullName = type . FullName ;
186+ var uiForms = m_UIManager . GetAllLoadedUIForms ( ) ;
187+ foreach ( var uiForm in uiForms )
188+ {
189+ if ( uiForm . FullName == fullName )
190+ {
191+ return uiForm ;
192+ }
193+ }
194+
195+ return null ;
196+ }
197+
158198 /// <summary>
159199 /// 根据界面逻辑类型获取界面。只要找到任意的一个即返回
160200 /// </summary>
You can’t perform that action at this time.
0 commit comments