Ejemplo n.º 1
0
        private static ComponentData[] GetMultipleData <T>(GenesisSettings settings = null)
        {
            var provider = new ComponentDataProvider(
                new Type[]
            {
                typeof(T)
            });

            if (settings == null)
            {
                settings = ScriptableObject.CreateInstance <GenesisSettings>();
                var contextConfig = settings.CreateAndConfigure <ContextSettingsConfig>();
                contextConfig.ContextNames = new[]
                {
                    "Game",
                    "GameState"
                };

                var assembliesConfig = settings.CreateAndConfigure <AssembliesConfig>();
                assembliesConfig.DoUseWhitelistOfAssemblies = true;
                assembliesConfig.WhiteListedAssemblies      = new[]
                {
                    "EntitasRedux.Tests"
                };
            }

            provider.Configure(settings);

            return((ComponentData[])provider.GetData());
        }
Ejemplo n.º 2
0
        public override void Configure(GenesisSettings settings)
        {
            base.Configure(settings);

            settings.SetIfNotPresent(DEFAULT_INSTANCE_CREATOR_FOLDER_PATH_KEY, DEFAULT_CREATOR_FOLDER_PATH);
            settings.SetIfNotPresent(TYPE_DRAWER_FOLDER_PATH_KEY, DEFAULT_DRAWER_FOLDER_PATH);
        }
Ejemplo n.º 3
0
        /// <summary>Configures preferences</summary>
        /// <param name="settings"></param>
        public override void Configure(GenesisSettings settings)
        {
            base.Configure(settings);

            settings.SetIfNotPresent(DO_USE_WHITE_LIST_KEY, DEFAULT_DO_USE_WHITE_LIST_VALUE);
            settings.SetIfNotPresent(WHITE_LIST_ASSEMBLIES_KEY, DEFAULT_ASSEMBLIES_VALUE);
        }
        /// <summary>
        /// Creates a new instance of <typeparamref name="T"/> and configures it with <see cref="GenesisSettings"/>
        /// <paramref name="settings"/>.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static T CreateAndConfigure <T>(this GenesisSettings settings)
            where T : IConfigurable, new()
        {
            var obj = new T();

            obj.Configure(settings);
            return(obj);
        }
Ejemplo n.º 5
0
        public void Configure(GenesisSettings settings)
        {
            foreach (var dataProvider in _dataProviders.OfType <IConfigurable>())
            {
                dataProvider.Configure(settings);
            }

            _contextsComponentDataProvider.Configure(settings);
            _assembliesConfig.Configure(settings);
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            _settings = ScriptableObject.CreateInstance <GenesisSettings>();

            var contextConfig = _settings.CreateAndConfigure <ContextSettingsConfig>();

            contextConfig.ContextNames = new[]
            {
                "ConfiguredContext"
            };
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Draws the body GUI section
        /// </summary>
        /// <param name="settings"></param>
        public virtual void DrawContent(GenesisSettings settings)
        {
            // The default implementation for draw content enables its content to be collapsed via a foldout header bar.
            _drawContent = EditorGUILayoutTools.DrawSectionHeaderToggle(Title, _drawContent);
            if (!_drawContent)
            {
                return;
            }

            EditorGUILayoutTools.BeginSectionContent();
            DrawContentBody(settings);
            EditorGUILayoutTools.EndSectionContent();
        }
Ejemplo n.º 8
0
        public void Setup()
        {
            _settings = ScriptableObject.CreateInstance <GenesisSettings>();
            var contextNamesConfig = _settings.CreateAndConfigure <ContextSettingsConfig>();

            contextNamesConfig.ContextNames = new[]
            {
                "Game",
                "GameState"
            };

            var assembliesConfig = _settings.CreateAndConfigure <AssembliesConfig>();

            assembliesConfig.WhiteListedAssemblies = new[]
            {
                "EntitasRedux.Tests"
            };
        }
        protected override void DrawContentBody(GenesisSettings settings)
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(CONTEXT_NAMES_LABEL);

                using (var scope = new EditorGUI.ChangeCheckScope())
                {
                    var newValue = EditorGUILayout.TextField(_config.RawContextNames);

                    if (scope.changed)
                    {
                        _config.RawContextNames = newValue;

                        EditorUtility.SetDirty(settings);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private static EntityIndexData[] GetData <T1, T2>(GenesisSettings _settings = null)
        {
            var provider = new EntityIndexDataProvider(
                new Type[]
            {
                typeof(T1),
                typeof(T2)
            });

            if (_settings == null)
            {
                _settings = ScriptableObject.CreateInstance <GenesisSettings>();
                var contextConfig = _settings.CreateAndConfigure <ContextSettingsConfig>();
                contextConfig.ContextNames = new[]
                {
                    "Game",
                    "GameState"
                };
            }

            provider.Configure(_settings);

            return((EntityIndexData[])provider.GetData());
        }
        public override void Configure(GenesisSettings settings)
        {
            base.Configure(settings);

            settings.SetIfNotPresent(TEMPLATES_KEY, DEFAULT_VALUE);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Configures preferences
 /// </summary>
 /// <param name="settings"></param>
 public void Configure(GenesisSettings settings)
 {
     _assembliesConfig = settings.CreateAndConfigure <AssembliesConfig>();
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes any setup for the drawer prior to rendering any GUI.
 /// </summary>
 /// <param name="settings"></param>
 public virtual void Initialize(GenesisSettings settings)
 {
 }
Ejemplo n.º 14
0
 protected override void DrawContentBody(GenesisSettings settings)
 {
     _lineEndingConfig.LineEnding = (LineEndingMode)UnityEditor.EditorGUILayout.EnumPopup(
         typeof(LineEndingMode).Name,
         _lineEndingConfig.LineEnding);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Configures preferences
        /// </summary>
        /// <param name="settings"></param>
        public override void Configure(GenesisSettings settings)
        {
            base.Configure(settings);

            settings.SetIfNotPresent(LINE_ENDINGS_KEY, LineEndingMode.Unix.ToString());
        }
        public override void Initialize(GenesisSettings settings)
        {
            base.Initialize(settings);

            _config.Configure(settings);
        }
Ejemplo n.º 17
0
        /// <summary>Configures preferences</summary>
        /// <param name="settings"></param>
        public override void Configure(GenesisSettings settings)
        {
            base.Configure(settings);

            settings.SetIfNotPresent(TARGET_DIRECTORY_KEY, ASSETS_FOLDER);
        }
Ejemplo n.º 18
0
 public void Configure(GenesisSettings settings)
 {
     _targetDirectoryConfig.Configure(settings);
 }
Ejemplo n.º 19
0
        public override void Configure(GenesisSettings settings)
        {
            base.Configure(settings);

            settings.SetIfNotPresent(CONTEXTS_KEY, DEFAULT_CONTEXTS);
        }
 /// <summary>
 /// Initializes any setup for the drawer prior to rendering any GUI.
 /// </summary>
 /// <param name="settings"></param>
 public override void Initialize(GenesisSettings settings)
 {
     _directoryConfig.Configure(settings);
 }
 protected override void DrawContentBody(GenesisSettings settings)
 {
     _directoryConfig.TargetDirectory = UnityEditor.EditorGUILayout.TextField(_directoryConfig.TargetDirectory);
 }
Ejemplo n.º 22
0
 public void Configure(GenesisSettings settings)
 {
     _contextsComponentDataProvider.Configure(settings);
     _assembliesConfig.Configure(settings);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Initializes any setup for the drawer prior to rendering any GUI.
 /// </summary>
 /// <param name="settings"></param>
 public override void Initialize(GenesisSettings settings)
 {
     _lineEndingConfig.Configure(settings);
 }
 public void Configure(GenesisSettings settings)
 {
     _contextSettingsConfig.Configure(settings);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Draws the foldout content body
 /// </summary>
 /// <param name="settings"></param>
 protected abstract void DrawContentBody(GenesisSettings settings);
Ejemplo n.º 26
0
 protected override void DrawContentBody(GenesisSettings settings)
 {
     DrawDefaultInstanceCreator();
     DrawTypeDrawerFolder();
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Draws the header GUI section
 /// </summary>
 /// <param name="settings"></param>
 public virtual void DrawHeader(GenesisSettings settings)
 {
     // No-op
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Configures preferences
 /// </summary>
 /// <param name="settings"></param>
 public void Configure(GenesisSettings settings)
 {
     _lineEndingConfig.Configure(settings);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Configures preferences
 /// </summary>
 /// <param name="settings"></param>
 public void Configure(GenesisSettings settings)
 {
     _settings = settings;
 }
Ejemplo n.º 30
0
 private static ComponentData GetData <T>(GenesisSettings settings = null)
 {
     return(GetMultipleData <T>(settings)[0]);
 }