public static ParticlesSettings GetParticlesSettings() { if (particlesSettingsCache == null) { particlesSettingsCache = SettingsRepository.GetParticlesSettings(ServiceProvider.GlobalProvider); } return(particlesSettingsCache); }
public static void SaveToStorage(ParticlesSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } SettingsRepository.SaveToStorage(settings, ServiceProvider.GlobalProvider); particlesSettingsCache.CloneFrom(settings); }
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); } }
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); } }