protected bool Deactivate(T control, out bool destroyed) { destroyed = false; if (control == null) { return(false); } var configuration = DeviceController.GetConfiguration(control); var layer = UILayerController.GetLayerView(configuration.appLayerId); var view = layer.transform.Find(control.name); if (!view || !view.gameObject.activeSelf) { return(false); } if (control.ToDestroyOnDeactivation) { Object.Destroy(view.gameObject); destroyed = true; } else { view.gameObject.SetActive(false); } return(true); }
protected bool CheckControlIsActive(T control) { if (control == null) { return(false); } var configuration = DeviceController.GetConfiguration(control); var layer = UILayerController.GetLayerView(configuration.appLayerId); var view = layer.transform.Find(control.name); return(view != null && view.gameObject.activeSelf); }
protected GameObject GetInstance(T control, UIControlOptions options, out bool isNewInstance) { isNewInstance = false; if (control == null) { return(null); } var configuration = DeviceController.GetConfiguration(control); if (!CheckConfigInstalled(configuration)) { InstallConfiguration(configuration); } var activate = (options & UIControlOptions.Activate) == UIControlOptions.Activate; var layer = UILayerController.GetLayerView <Transform>(configuration.appLayerId); if (control.IsSingleInstance) { var instanceTransform = layer.Find(control.name); if (instanceTransform) { if (activate) { instanceTransform.gameObject.SetActive(true); } return(instanceTransform.gameObject); } } var instantiate = (options & UIControlOptions.Instantiate) == UIControlOptions.Instantiate; if (!instantiate) { return(null); } isNewInstance = true; return(Instantiate(control, configuration, layer, activate)); }
/* * Public. */ public void Initialize(IEnumerable <T> controls) { foreach (var control in controls) { var configuration = DeviceController.GetConfiguration(control); if (CheckConfigInstalled(configuration)) { continue; } InstallConfiguration(configuration); if (!control.ToPreInstantiate) { continue; } var layerView = UILayerController.GetLayerView <Transform>(configuration.appLayerId); Instantiate(control, configuration, layerView, false); } }
void OnDestroy() { instance = null; }