private void NavigationPanelPartClose(object sender, EventArgs e) { Control ctr = sender as Control; BaseNavigationPanelPart panel = ctr.Parent as BaseNavigationPanelPart; showingEditors.RemoveAt(panel.navigationPanelPartIndex); currentEditorIndex = 0; UpdateNavigationPanel(); }
private void NavigationPanelPartPressed(BaseNavigationPanelPart panelPressed) { var checkClass = panelPressed as VisualClassNavigationPanelPart; var checkFunction = panelPressed as VisualFunctionNavigationPanelPart; var checkAsset = panelPressed as AssetsManagerNavigationPanelPart;; if (checkClass != null) //Class { ChangeSelectedEditorIndex(checkClass.navigationPanelPartIndex); } else if (checkFunction != null) //Function { ChangeSelectedEditorIndex(checkFunction.navigationPanelPartIndex); } else if (checkAsset != null) { ChangeSelectedEditorIndex(checkAsset.navigationPanelPartIndex); } }
void UpdateNavigationPanel() { int amountOfChildren = navigationPanel.Controls.Count; for (int i = 0; i < amountOfChildren; i++) { navigationPanel.Controls[0].Dispose(); } int assetEditorMinus = 0; for (int i = 0; i < showingEditors.Count; i++) { BaseNavigationPanelPart newPanel = null; var checkAsset = showingEditors[i] as AssetsEditorManager; var checkClass = showingEditors[i] as VisualClassScriptEditorManager; var checkFunction = showingEditors[i] as VisualFunctionScriptEditorManager; if (checkAsset != null) //Asset editor { newPanel = new AssetsManagerNavigationPanelPart(i); assetEditorMinus = 1; } else if (checkClass != null)// Class editor { newPanel = new VisualClassNavigationPanelPart(i, visualProject.visualClasses[i - assetEditorMinus]); } else if (checkFunction != null) //Function editor { newPanel = new VisualFunctionNavigationPanelPart(i, visualProject.visualClasses[0].visualFunctions[0]); /////////////Only supports 1 function in FIRST class FIX THIS } navigationPanel.Controls.Add(newPanel); newPanel.Location = new Point(i * 105 + 2, 2); newPanel.navigationPanelPressed += NavigationPanelPartPressed; newPanel.closeButton.Click += NavigationPanelPartClose; if (i == currentEditorIndex) { newPanel.BackColor = Color.LightYellow; } } }