SadConsoleEditor.Editors.SceneEditor.OnSelected C# (CSharp) Method

OnSelected() public method

public OnSelected ( ) : void
return void
        public void OnSelected()
        {
            if (selectedTool == null)
                SelectedTool = tools.First().Value;
            else
            {
                var oldTool = selectedTool;
                SelectedTool = null;
                SelectedTool = selectedTool;
            }

            foreach (var item in EditorConsoleManager.OpenEditors)
            {
                var editor = item as GameObjectEditor;

                if (editor != null && editor.LinkedEditor == this)
                {
                    // sync back up any entities.
                    foreach (var resizeObject in Objects)
                    {
                        var gameObject = resizeObject.GameObject;
                        var animationName = gameObject.Animation.Name;
                        gameObject.Animations.Clear();

                        gameObject.Name = LinkedGameObjects[gameObject].Name;

                        foreach (var animation in LinkedGameObjects[gameObject].Animations)
                            gameObject.Animations.Add(animation.Key, animation.Value);

                        if (animationName != null && gameObject.Animations.ContainsKey(animationName))
                            gameObject.Animation = gameObject.Animations[animationName];
                        else
                            gameObject.Animation = gameObject.Animations.First().Value;
                    }
                }
            }

            EditorConsoleManager.ToolsPane.PanelFiles.DocumentsListbox.IsDirty = true;

            GameObjectPanel.RebuildListBox();
        }