Ejemplo n.º 1
0
    public T Load <T>(UISet TargetUI) where T : UISetting
    {
        T Target = Get <T>(TargetUI);

        if (Target != null)
        {
            return(Target);
        }

        string Path = "Prefabs/UI/" + TargetUI.ToString();

        Debug.Log(Path);

        T Temp = Resources.Load(Path, typeof(T)) as T;

        Target = GameObject.Instantiate <T>(Temp, Vector3.zero, Quaternion.identity);

        if (Target != null)
        {
            Target.Init();
            UIDictionary.Add(TargetUI, Target);
        }

        return(Temp);
    }
Ejemplo n.º 2
0
 public void DestroyUI(UISet TargetUI)
 {
     if (UIDictionary.ContainsKey(TargetUI))
     {
         Destroy(UIDictionary[TargetUI].gameObject);
         UIDictionary.Remove(TargetUI);
     }
 }
Ejemplo n.º 3
0
    public T Get <T>(UISet TargetUI) where T : UISetting
    {
        if (UIDictionary.ContainsKey(TargetUI))
        {
            return(UIDictionary[TargetUI].GetComponent <T>());
        }

        return(null);
    }