コード例 #1
0
        public static ParticlesSettings GetParticlesSettings(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            ParticlesSettings particlesSettingsCache = null;
            var store = GetSettingsStore(serviceProvider);

            particlesSettingsCache = new ParticlesSettings();
            var particlesColorType = GetStringOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.ParticlesColorType));

            particlesSettingsCache.ParticlesColorType        = string.IsNullOrWhiteSpace(particlesColorType) ? particlesSettingsCache.ParticlesColorType : (ParticlesColorType)Enum.Parse(typeof(ParticlesColorType), particlesColorType);
            particlesSettingsCache.FixedColor                = GetColorOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.FixedColor)).GetValueOrDefault(particlesSettingsCache.FixedColor);
            particlesSettingsCache.MaxParticlesCount         = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MaxParticlesCount)).GetValueOrDefault(particlesSettingsCache.MaxParticlesCount);
            particlesSettingsCache.MinSpawnedParticles       = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MinSpawnedParticles)).GetValueOrDefault(particlesSettingsCache.MinSpawnedParticles);
            particlesSettingsCache.MaxSpawnedParticles       = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MaxSpawnedParticles)).GetValueOrDefault(particlesSettingsCache.MaxSpawnedParticles);
            particlesSettingsCache.MinParticlesSize          = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MinParticlesSize)).GetValueOrDefault(particlesSettingsCache.MinParticlesSize);
            particlesSettingsCache.MaxParticlesSize          = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MaxParticlesSize)).GetValueOrDefault(particlesSettingsCache.MaxParticlesSize);
            particlesSettingsCache.IsEnabledPartyMode        = GetBoolOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.IsEnabledPartyMode)).GetValueOrDefault(particlesSettingsCache.IsEnabledPartyMode);
            particlesSettingsCache.PartyModeThreshold        = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.PartyModeThreshold)).GetValueOrDefault(particlesSettingsCache.PartyModeThreshold);
            particlesSettingsCache.PartyModeSpawnedParticles = GetIntegerOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.PartyModeSpawnedParticles)).GetValueOrDefault(particlesSettingsCache.PartyModeSpawnedParticles);

            return(particlesSettingsCache);
        }
コード例 #2
0
 public void CloneFrom(ParticlesSettings other)
 {
     this.ParticlesColorType  = other.ParticlesColorType;
     this.FixedColor          = other.FixedColor;
     this.MaxParticlesCount   = other.MaxParticlesCount;
     this.MinSpawnedParticles = other.MinSpawnedParticles;
     this.MaxSpawnedParticles = other.MaxSpawnedParticles;
     this.MinParticlesSize    = other.MinParticlesSize;
     this.MaxParticlesSize    = other.MaxParticlesSize;
 }
コード例 #3
0
 public void CloneFrom(ParticlesSettings other)
 {
     this.ParticlesColorType        = other.ParticlesColorType;
     this.FixedColor                = other.FixedColor;
     this.MaxParticlesCount         = other.MaxParticlesCount;
     this.MinSpawnedParticles       = other.MinSpawnedParticles;
     this.MaxSpawnedParticles       = other.MaxSpawnedParticles;
     this.MinParticlesSize          = other.MinParticlesSize;
     this.MaxParticlesSize          = other.MaxParticlesSize;
     this.IsEnabledPartyMode        = other.IsEnabledPartyMode;
     this.PartyModeThreshold        = other.PartyModeThreshold;
     this.PartyModeSpawnedParticles = other.PartyModeSpawnedParticles;
 }
コード例 #4
0
        public static void SaveToStorage(ParticlesSettings settings, IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            var store = GetSettingsStore(serviceProvider);

            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.ParticlesColorType), settings.ParticlesColorType.ToString());
            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.FixedColor), settings.FixedColor);
            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MaxParticlesCount), settings.MaxParticlesCount);
            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MinSpawnedParticles), settings.MinSpawnedParticles);
            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MaxSpawnedParticles), settings.MaxSpawnedParticles);
            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MinParticlesSize), settings.MinParticlesSize);
            SetOption(store, PARTICLES_SETTINGS_CATELOG, nameof(ParticlesSettings.MaxParticlesSize), settings.MaxParticlesSize);
        }