// Create actor from toolbar public void createActorFromToolbar(string buttonName) { // Create actor controller based on button name EditorActor actor = null; switch (buttonName) { case "boxButton": actor = new EditorBoxActor(_level); break; case "circleButton": actor = new EditorCircleActor(_level); break; case "terrainButton": actor = new EditorTerrainActor(_level); break; case "ropeButton": actor = new EditorRopeActor(_level); break; case "fluidButton": actor = new EditorFluidActor(_level); break; case "playerSpawnButton": // Remove existing player spawns before adding a new one List <EditorPlayerSpawnActor> results = _level.getActors <EditorPlayerSpawnActor>(ActorType.PlayerSpawn); if (results.Count > 0) { _level.removeActor(results[0]); } actor = new EditorPlayerSpawnActor(_level); break; case "plantsButton": PlantSelectBox plantSelectBox = new PlantSelectBox(); if (plantSelectBox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // Adjust mouse position since movement isn't tracked when a form is open _mouse = _levelView.PointToClient(System.Windows.Forms.Cursor.Position); _oldMouse = _mouse; PlantType selectedPlantType = plantSelectBox.selectedPlantType; switch (selectedPlantType) { case PlantType.Tree: actor = new EditorTreeActor(_level); break; } } break; case "itemsButton": SelectItem selectItemForm = new SelectItem(_editorController); if (selectItemForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { actor = new EditorItemActor(_level, selectItemForm.uid); } break; case "circuitsButton": SelectCircuit selectCircuitForm = new SelectCircuit(_editorController.circuitController); if (selectCircuitForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { actor = new EditorCircuitActor(_level, selectCircuitForm.circuitUID); } break; case "revoluteButton": actor = new EditorRevoluteActor(_level); break; case "prismaticButton": actor = new EditorPrismaticActor(_level); break; case "collisionFilterButton": actor = new EditorCollisionFilterActor(_level); break; case "regionButton": actor = new EditorRegionActor(_level); break; case "decalsButton": actor = new EditorDecalActor(_level); break; case "levelTransitionButton": actor = new EditorLevelTransitionActor(_level); break; case "tooltipButton": actor = new EditorTooltipActor(_level); break; case "waypointButton": actor = new EditorWaypointActor(_level); break; case "edgeBoundaryButton": actor = new EditorEdgeBoundaryActor(_level); break; } if (actor != null) { _editorController.view.selectLevelTab(); _level.addActor(actor); _selectedActor = actor; } }
// Create actor from toolbar public void createActorFromToolbar(string buttonName) { // Create actor controller based on button name EditorActor actor = null; switch (buttonName) { case "boxButton": actor = new EditorBoxActor(_level); break; case "circleButton": actor = new EditorCircleActor(_level); break; case "terrainButton": actor = new EditorTerrainActor(_level); break; case "ropeButton": actor = new EditorRopeActor(_level); break; case "fluidButton": actor = new EditorFluidActor(_level); break; case "playerSpawnButton": // Remove existing player spawns before adding a new one List<EditorPlayerSpawnActor> results = _level.getActors<EditorPlayerSpawnActor>(ActorType.PlayerSpawn); if (results.Count > 0) { _level.removeActor(results[0]); } actor = new EditorPlayerSpawnActor(_level); break; case "plantsButton": PlantSelectBox plantSelectBox = new PlantSelectBox(); if (plantSelectBox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // Adjust mouse position since movement isn't tracked when a form is open _mouse = _levelView.PointToClient(System.Windows.Forms.Cursor.Position); _oldMouse = _mouse; PlantType selectedPlantType = plantSelectBox.selectedPlantType; switch (selectedPlantType) { case PlantType.Tree: actor = new EditorTreeActor(_level); break; } } break; case "itemsButton": SelectItem selectItemForm = new SelectItem(_editorController); if (selectItemForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { actor = new EditorItemActor(_level, selectItemForm.uid); } break; case "circuitsButton": SelectCircuit selectCircuitForm = new SelectCircuit(_editorController.circuitController); if (selectCircuitForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { actor = new EditorCircuitActor(_level, selectCircuitForm.circuitUID); } break; case "revoluteButton": actor = new EditorRevoluteActor(_level); break; case "prismaticButton": actor = new EditorPrismaticActor(_level); break; case "collisionFilterButton": actor = new EditorCollisionFilterActor(_level); break; case "regionButton": actor = new EditorRegionActor(_level); break; case "decalsButton": actor = new EditorDecalActor(_level); break; case "levelTransitionButton": actor = new EditorLevelTransitionActor(_level); break; case "tooltipButton": actor = new EditorTooltipActor(_level); break; case "waypointButton": actor = new EditorWaypointActor(_level); break; case "edgeBoundaryButton": actor = new EditorEdgeBoundaryActor(_level); break; } if (actor != null) { _editorController.view.selectLevelTab(); _level.addActor(actor); _selectedActor = actor; } }