public void Construct(DiContainer diContainer, ConfigsService configsService)
        {
            _diContainer    = diContainer;
            _configsService = configsService;

            _configsService.ConfigModel.Subscribe(model =>
            {
                if (model == null)
                {
                    return;
                }

                this.gameObject.transform.DestroyAllChildren();

                var propertyInfos = model.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
                foreach (var propertyInfo in propertyInfos)
                {
                    var propertyInfoComponentInstance = _diContainer.InstantiatePrefab(
                        _propertyInfoComponentPrefab,
                        this.gameObject.transform).GetComponent <PropertyInfoComponent>();
                    propertyInfoComponentInstance.Object       = model;
                    propertyInfoComponentInstance.PropertyInfo = propertyInfo;
                }
            });
        }
Esempio n. 2
0
        public void Construct(ConfigsService configsService)
        {
            _configsService = configsService;

            _configsService.ConfigModel.Subscribe(configModel =>
            {
                this.gameObject.SetActive(configModel != null);
            });
        }