private void AssetPressed(BaseAssetButton _asset) { var CheckVisualClass = _asset as ClassAssetButton; if (CheckVisualClass != null) //Class selected { ClassAssetButton button = (ClassAssetButton)CheckVisualClass; int existingClassManagerIndex = ClassNavigationPanelExists(button.visualClass); if (existingClassManagerIndex == -1) //new editor { form.projectManager.AddNewShowingEditor(button.visualClass); form.projectManager.ChangeSelectedEditorIndex(form.projectManager.showingEditors.Count - 1); } else //Editor already opened { form.projectManager.ChangeSelectedEditorIndex(existingClassManagerIndex); } } }
public override void DisplayAllOnMainPanel() { form.MainScriptingPanel.BackColor = Color.Silver; VisualProject visualProject = form.projectManager.visualProject; int amountOfPanelsInRow = (int)Math.Floor((double)form.MainScriptingPanel.Size.Width / (double)100); int amountOfRows = (int)Math.Ceiling((double)visualProject.visualClasses.Count / (double)amountOfPanelsInRow); for (int y = 0; y < amountOfRows; y++) { for (int x = 0; x < amountOfPanelsInRow; x++) { if (!(visualProject.visualClasses.Count <= y * amountOfPanelsInRow + x)) { ClassAssetButton newPanel = new ClassAssetButton(visualProject.visualClasses[y * amountOfPanelsInRow + x]); form.MainScriptingPanel.Controls.Add(newPanel); newPanel.Location = new Point(x * 100, y * 100); newPanel.assetPressed += AssetPressed; } } } }