Exemplo n.º 1
0
    public async Task <UIGenericWindow> CloseWindow(string windowName, bool loadIfNotExist = false)
    {
        UIGenericWindow window = await GetWindow(windowName, loadIfNotExist);

        if (window != null)
        {
            await window.Show(false, false);
        }

        return(window);
    }
Exemplo n.º 2
0
    public async Task <UIGenericWindow> GetWindow(string windowName, bool loadIfNotExist = true)
    {
        for (int i = 0; i < _loadedWindow.Count; i++)
        {
            if (_loadedWindow[i].WindowName == windowName)
            {
                return(_loadedWindow[i]);
            }
        }

        UIGenericWindow window = await LoadWindow(windowName);

        return(window);
    }
Exemplo n.º 3
0
    private void AddWindow(UIGenericWindow window)
    {
        if (window == null)
        {
            return;
        }

        for (int i = 0; i < _loadedWindow.Count; i++)
        {
            if (_loadedWindow[i].WindowName == window.name)
            {
                break;
            }
        }

        _loadedWindow.Add(window);
    }
Exemplo n.º 4
0
    private async Task <UIGenericWindow> LoadWindow(string windowName)
    {
        string          path    = string.Format("Prefabs/Windows/{0}", windowName);
        ResourceRequest request = Resources.LoadAsync <UIGenericWindow>(path);

        while (!request.isDone)
        {
            await Task.Delay(1);
        }

        UIGenericWindow window      = null;
        UIGenericWindow windowAsset = request.asset as UIGenericWindow;

        if (windowAsset != null)
        {
            window = Instantiate(windowAsset, _tfWindowRoot);

            AddWindow(window);
        }

        return(window);
    }