using System;
using System.Collections;
using Nuro.Processes;
using UnityEngine;
using UnityEngine.UIElements;
using WorldBuilder.Plugins;
using WorldBuilder.UI;

public class XR4EDWizardDemoProcess : Process
{
    private IReferenceProvider m_ReferenceProvider = null;
    private VisualElement m_Parent = null;
    private Action m_OnCancel;

    public XR4EDWizardDemoProcess(IReferenceProvider referenceProvider, VisualElement parent, Action onCancel) : base()
    {
        m_ReferenceProvider = referenceProvider;
        m_Parent = parent;
        m_OnCancel = onCancel;
    }

    protected override IEnumerator ProcessFunc()
    {
        UIWindow window = new XR4EDWizardDemoWindow(m_ReferenceProvider, m_Parent);
        window.Open();

        yield return new WaitWhile(() => window.IsOpen);

        m_OnCancel?.Invoke();
    }
}
