using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class DialogManager
{
    public static DialogManager Instance { get; private set; }
    static DialogManager() { Instance = new DialogManager(); }

    public Dialog GetDialog(System.Type dialogType)
    {
        Util.AssertTrue(mDialogsNovo.ContainsKey(dialogType), "Dialog not found: " + dialogType);
        return mDialogsNovo[dialogType];
    }

    private readonly Dictionary<System.Type, Dialog> mDialogsNovo = new Dictionary<System.Type,Dialog>();

    public DialogManager()
    {
        Util.GetSubclasses<Dialog>(true).ForEach(dialogType => mDialogsNovo[dialogType] = dialogType.GetConstructor(new System.Type[] { }).Invoke(new object[] { }) as Dialog);        
    }
}