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 UIControlAttribute(UIControlType type, // string sourceEnumerable = "", // string displayProperty = "", // string storageProperty = "", // UIControlOptions options = UIControlOptions.None) //{ // SourceEnumerable = sourceEnumerable; // DisplayProperty = displayProperty; // StorageProperty = storageProperty; // Type = type; // Options = options; //} public UIControlAttribute(UIControlType type, UIControlOptions options = UIControlOptions.None) { Type = type; Options = options; }
/* * Protected. */ protected GameObject GetInstance(T control, UIControlOptions options) { return(GetInstance(control, options, out var isNewInstance)); }