using NEG.UI.Area;
using NEG.UI.Popup;
using NEG.UI.UnityUi.Buttons.Reaction;
using NEG.UI.UnityUi.Buttons.Settings;
using NEG.UI.UnityUi.Popup;
using NEG.UI.UnityUi.Window;
using NEG.Utils;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;
namespace NEG.UI.UnityUi
{
///
/// Implements ui using UnityUI and Unity Event System with New Input System.
/// You have to provide prefabs within resources:
/// - UI/PopupCanvas - prefab with canvas to create popups (will be created on every scene)
/// - UI/DefaultPopupPrefab - prefab of default popup with 2 options (has to have component)
/// NEG_UI_DISABLE_WARNING_DEFAULT_SELECTION
///
public class MonoUiManager : UiManager, IDisposable
{
//TODO: use default unity selection
//TODO: window snaping to slots
public static new MonoUiManager Instance { get; private set; }
public ButtonSettings DefaultUiSettings { get; }
public KeyBasedFactory BehavioursFactory { get; private set; }
//TODO: editor to auto add slots, buttons
private readonly MonoDefaultPopup defaultPopupPrefab;
private readonly GameObject canvasPrefab;
private UiInputModule inputModule;
public MonoUiManager(IArea startArea, Type inputModuleType, ButtonSettings defaultUiSettings) : base(startArea)
{
Instance = this;
var popupCanvas = Resources.Load("UI/PopupCanvas");
var defaultPopup = Resources.Load("UI/DefaultPopupPrefab");
Assert.IsNotNull(popupCanvas,"No canvas prefab was provided. Please check MonoUiManager class documentation");
Assert.IsNotNull(defaultPopup,"No popup prefab was provided. Please check MonoUiManager class documentation");
Assert.IsNotNull(popupCanvas.GetComponent