Beispiel #1
0
    public void OpenPanel(string panelName)
    {
        Type viewType = viewTypeDict[panelName];

        if (viewType == null)
        {
            Debug.LogError("未找到输入字符串对应的UI面板");
            return;
        }
        string     path = UIConst.UIPrefabPathPrefix + panelName;
        GameObject UIGameObjetPrefab = (GameObject)Resources.Load(path);
        GameObject UIGameObjet       = GameObject.Instantiate(UIGameObjetPrefab);

        UIGameObjet.transform.parent = rootCanv.transform;
        UIView  view  = (UIView)Activator.CreateInstance(viewType, true);
        UICtrl  ctrl  = ctrlManager.GetCtrl(panelName);
        UIModel model = modelManager.GetModel(panelName);

        view.Init(ctrl, UIGameObjet);
        ctrl.View  = view;
        ctrl.Model = model;
        ctrl.Create();
        ctrl.Show();
        //ctrlManager.GetT<UICtrl>(ctrlName).Model().InitModel(GameObject.Find(name), name);
        //ctrlManager.GetT<UICtrl>(ctrlName).OnCreat(t, name);



        // panelDict = ctrlManager.GetT<UICtrl>(ctrlName).Model().modelDict();
    }