Beispiel #1
0
 public UI Create(string type)
 {
     try
     {
         UI         ui;
         IUIFactory uiFactory = uiMvcVessel.GetUIMvcVessel(UIMvcVesselType.Factory, type) as IUIFactory;
         if (uiFactory != null)
         {
             ui = uiFactory.Create(this.GetParent <Scene>(), type, Root);
         }
         else
         {
             UIView uiCommpoentView = uiMvcVessel.GetUIMvcVessel(UIMvcVesselType.Componet, type) as UIView;
             ui = DefaultUIFactory.Create(this.GetParent <Scene>(), type, Root, uiCommpoentView);
         }
         UIView uiView = ui.GetComponent <UIView>();
         uiView.pViewState = ViewState.CreateIn;//状态改为正在创建中
         Type t = uiView.GetType();
         ui.GameObject.transform.SetParent(this.Root.Get <GameObject>(uiView.pCavasName).transform, false);
         uiView.OnCrete(ui.GameObject);
         uis.Add(type, ui);
         uiViews.Add(uiView);
         return(ui);
     }
     catch (Exception e)
     {
         throw new Exception($"{type} UI 错误: {e}");
     }
 }