Пример #1
0
    /// <summary>
    /// 等待并获取UI实例,执行callback
    /// 源起Loadindg UI, 在加载过程中,进度条设置方法会失效
    ///
    /// 如果是DynamicWindow,,使用前务必先要Open!
    /// </summary>
    /// <param name="uiTemplateName"></param>
    /// <param name="callback"></param>
    /// <param name="args"></param>
    public void CallUI(string uiTemplateName, Action <CUIController, object[]> callback, params object[] args)
    {
        CDebug.Assert(callback);

        CUILoadState uiState;

        if (!UIWindows.TryGetValue(uiTemplateName, out uiState))
        {
            uiState = LoadWindow(uiTemplateName, false);  // 加载,这样就有UIState了, 但注意因为没参数,不要随意执行OnOpen
        }

        CUILoadState openState = UIWindows[uiTemplateName];

        openState.DoCallback(callback, args);
    }
Пример #2
0
    /// <summary>
    /// DynamicWindow专用, 不会自动加载,会提示报错
    /// </summary>
    /// <param name="uiName"></param>
    /// <param name="callback"></param>
    /// <param name="args"></param>
    public void CallDynamicUI(string uiName, Action <CUIController, object[]> callback, params object[] args)
    {
        CDebug.Assert(callback);

        CUILoadState uiState;

        if (!UIWindows.TryGetValue(uiName, out uiState))
        {
            CDebug.LogError("找不到UIState: {0}", uiName);
            return;
        }

        CUILoadState openState = UIWindows[uiName];

        openState.DoCallback(callback, args);
    }