private void ClearByTime(object sender, EventArgs e) { if (disposing) { return; } for (int i = 0; i < uis.Length; i++) { CGameUI ui = uis[i]; if (null == ui) { continue; } if (ui.dontDestoryOnLoad) { continue; } if (ui.IsShow() || GameTimer.Within(ui.showTime, DISPOS_TIME) || ui.Layer == CUILayer.Free) //|| ui.IsMainFace { continue; } Remove(ui); ui.Dispose(); } }
public void Remove(CGameUI ui) { if (!ui || ui.disposed) { return; } if (ui.index < 0) { return; } uis[ui.index] = null; ui.Close(); names.Remove(ui.Name); index_pool.Free(ui.index); ui.index = -1; if (loading.ContainsKey(ui.Name)) { CGameUIAsset asset = loading[ui.Name] as CGameUIAsset; CClientCommon.DestroyImmediate(ref asset); loading.Remove(ui.Name); } ui.Dispose(); ui = null; }