Example #1
0
        public static ParticlesSettings GetParticlesSettings()
        {
            if (particlesSettingsCache == null)
            {
                particlesSettingsCache = SettingsRepository.GetParticlesSettings(ServiceProvider.GlobalProvider);
            }

            return(particlesSettingsCache);
        }
Example #2
0
        public static void SaveToStorage(ParticlesSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            SettingsRepository.SaveToStorage(settings, ServiceProvider.GlobalProvider);
            particlesSettingsCache.CloneFrom(settings);
        }
Example #3
0
        public void OnTextBufferChanged(IAdornmentLayer adornmentLayer, IWpfTextView view, int streakCount)
        {
            settings = SettingsService.GetParticlesSettings();
            var isPartyMode = settings.IsEnabledPartyMode && settings.PartyModeThreshold <= streakCount;

            var spawnedSize = isPartyMode
                                ? settings.PartyModeSpawnedParticles
                                : RandomUtils.Random.Next(settings.MinSpawnedParticles, settings.MaxSpawnedParticles);

            spawnedSize = Math.Min(spawnedSize, settings.MaxParticlesCount - particlesList.Count);

            for (int i = 0; i < spawnedSize; i++)
            {
                NewParticleImage(adornmentLayer, view, isPartyMode);
            }
        }
Example #4
0
        public void OnTextBufferChanged(IAdornmentLayer adornmentLayer, IWpfTextView view, int streakCount)
        {
            settings = SettingsService.GetParticlesSettings();

            var spawnedSize = RandomUtils.Random.Next(settings.MinSpawnedParticles, settings.MaxSpawnedParticles);

            if (spawnedSize + particlesList.Count > settings.MaxParticlesCount)
            {
                spawnedSize = settings.MaxParticlesCount - particlesList.Count;
            }

            for (int i = 0; i < spawnedSize; i++)
            {
                NewParticlesImage(adornmentLayer, view);
            }
        }