public UIHandler <UI> Attach <UI>(Loader <UI> loader, int requiredSortOrders, ParamSet setupParams = null, CullSettings cullSettings = CullSettings.NoCullNoClear) where UI : UIView { CheckAndInitializeChildUIManagement(); UIID newId = UIID.Generate(cullSettings); _managedUIsSetupParams.Add(newId, setupParams); int minSort = GetMinSortForChildUI(); int maxSort = minSort + requiredSortOrders; UpdateMinSortForNextChildUI(maxSort); UIHandler <UI> handler = new UIHandler <UI>(loader, this, newId, minSort, maxSort, setupParams) .Exec(SetParent); _managedUIs.Add(newId, handler); return(handler); }
public UIHandler <UI> Attach <UI>(Loader <UI> loader, UISortingLayer.Layers uiLayer, int requiredSortOrders, ParamSet setupParams = null, CullSettings cullSettings = CullSettings.NoCullNoClear) where UI : UIView { if (_layers.ContainsKey(uiLayer)) { UIHandler <UI> handler = _layers[uiLayer].Attach <UI>(loader, requiredSortOrders, setupParams, cullSettings); _uiToLayerMap.Add(handler.id, uiLayer); UpdateCameraRenderSettings(handler.id); CheckAndCullLowerUIs(handler.id); if (IsOnTopActiveLayer(handler.id)) { _layers[_uiToLayerMap[handler.id]].ShowLayer(); } return(handler); } else { throw new UILayerNotFoundException(string.Format("UIManager: Couldn't find UI layer {0}", uiLayer)); } }