private void EditorEventRaised(IEditorEvent obj) { if (obj is Editor.LevelChangedEvent) { _lastTexturePalette = null; lightPalette.LoadPalette(((Editor.LevelChangedEvent)obj).Current.Settings.Palette); } if (obj is Editor.ResetPaletteEvent) { if (!butSampleFromTextures.Checked) { lightPalette.LoadPalette(LevelSettings.LoadPalette()); _editor.Level.Settings.Palette = lightPalette.Palette; } } if (obj is Editor.SelectedLevelTextureChangedSetEvent) { var o = (Editor.SelectedLevelTextureChangedSetEvent)obj; _lastTexturePalette = new List <ColorC>(o.Texture.Image.Palette); UpdateControls(); } if (obj is Editor.ConfigurationChangedEvent) { var o = (Editor.ConfigurationChangedEvent)obj; if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts) { CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true); } UpdateControls(); } }
public Palette() { InitializeComponent(); CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip); _editor = Editor.Instance; _editor.EditorEventRaised += EditorEventRaised; // Reset palette to default and prepare controls lightPalette.LoadPalette(LevelSettings.LoadPalette()); UpdateControls(false); }