コード例 #1
0
    private bool InitWindow <T>(WindowType type, T data1, T data2 = default, string message = null,
                                Action noCallBack = null, Action yesCallBack = null)
    {
        // UpdateContainer();
        BaseWindow windowPrefab =
            Resources.Load <BaseWindow>(string.Format(PathUtils.windowPath, type.ToString()).ToLower());

        if (windowPrefab == null)
        {
            return(false);
        }
        BaseWindow window = Instantiate(windowPrefab, uiMainCanvas);

        windowList.Add(window.type, window);
        if (window != null)
        {
            BaseWindowGeneric <T> _window = window as BaseWindowGeneric <T>;
            _window.SetupData(data1, data2, message, noCallBack, yesCallBack);
            _window.transform.SetAsLastSibling();
            _window.OnShow();
            return(true);
        }

        return(false);
    }
コード例 #2
0
    public bool ShowWindowWithManyData <T>(WindowType type, T data1 = default, T data2         = default, string message = null,
                                           Action noCallBack        = null, Action yesCallBack = null)
    {
        if (windowList.ContainsKey(type))
        {
            BaseWindow window = windowList[type];
            if (window != null)
            {
                BaseWindowGeneric <T> _window = window as BaseWindowGeneric <T>;
                _window.SetupData(data1, data2, message, noCallBack, yesCallBack);
                _window.transform.SetAsLastSibling();
                _window.OnShow();
                return(true);
            }

            return(false);
        }

        bool check = InitWindow(type, data1, data2, message, noCallBack, yesCallBack);

        return(check);
    }