/// <summary> /// /// </summary> public void Init() { if (_inited || _loading) { return; } if (_uiSources.Count > 0) { _loading = false; int cnt = _uiSources.Count; for (int i = 0; i < cnt; i++) { IUISource lib = _uiSources[i]; if (!lib.loaded) { lib.Load(__uiLoadComplete); _loading = true; } } if (!_loading) { _init(); } } else { _init(); } }
void __uiLoadComplete() { int cnt = _uiSources.Count; for (int i = 0; i < cnt; i++) { IUISource lib = _uiSources[i]; if (!lib.loaded) { return; } } _loading = false; _init(); }
/// <summary> /// Set a UISource to this window. It must call before the window is shown. When the window is first time to show, /// UISource.Load is called. Only after all UISource is loaded, the window will continue to init. /// 为窗口添加一个源。这个方法建议在构造函数调用。当窗口第一次显示前,UISource的Load方法将被调用,然后只有所有的UISource /// 都ready后,窗口才会继续初始化和显示。 /// </summary> /// <param name="source"></param> public void AddUISource(IUISource source) { _uiSources.Add(source); }