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

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

    public MultipleChoices GetMultipleChoice(System.Type multipleChoiceType)
    {
        Util.AssertTrue(mMultipleChoices.ContainsKey(multipleChoiceType), "Choice not found: " + multipleChoiceType);
        return mMultipleChoices[multipleChoiceType];
    }

    private readonly Dictionary<System.Type, MultipleChoices> mMultipleChoices = new Dictionary<System.Type, MultipleChoices>();

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