/// <summary> /// Remove a SimSubSceneDefinition. /// </summary> /// <param name="def">The definition to remove.</param> public void removeSimSubSceneDefinition(SimSubSceneDefinition def) { subSceneDefinitions.Remove(def.Name); def.setScene(null); if (editInterface != null) { subScenes.removeSubInterface(def); } }
/// <summary> /// Add a SimSubSceneDefinition. /// </summary> /// <param name="def">The definition to add.</param> public void addSimSubSceneDefinition(SimSubSceneDefinition def) { subSceneDefinitions.Add(def.Name, def); def.setScene(this); if (editInterface != null) { createEditInterface(def); } }
/// <summary> /// Create a definition. /// </summary> /// <returns>A new defintion.</returns> public SimSubSceneDefinition createDefinition(SimSceneDefinition scene) { SimSubSceneDefinition definition = new SimSubSceneDefinition(name); definition.setScene(scene); foreach (SimElementManager manager in simElements.Values) { definition.addBinding(scene.getSimElementManagerDefinition(manager.getName())); } return(definition); }
/// <summary> /// Callback to create a SimSubSceneDefinition. /// </summary> /// <param name="callback">The EditUICallback to get more info from the user.</param> /// <param name="caller">The command that initiated this funciton call.</param> private void createSimSubSceneDefinition(EditUICallback callback) { callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt) { if (input == null || input == "") { errorPrompt = "Please enter a non empty name."; return(false); } if (this.hasSimSubSceneDefinition(input)) { errorPrompt = "That name is already in use. Please provide another."; return(false); } SimSubSceneDefinition def = new SimSubSceneDefinition(input); this.addSimSubSceneDefinition(def); return(true); }); }
/// <summary> /// Constructor takes a SubScene and a SimElementManagerDefinition. /// </summary> /// <param name="subScene">The SubSceneDefinition.</param> /// <param name="simElementManager">The SimElementManagerDefinition.</param> public SimSubSceneBinding(SimSubSceneDefinition subScene, SimElementManagerDefinition simElementManager) { this.subScene = subScene; this.simElementManager = simElementManager; }
/// <summary> /// Constructor takes a name and a subScene. /// </summary> /// <param name="subScene">The SubScene to add bindings to.</param> /// <param name="managerName">The name of the SimElementManager.</param> public SimSubSceneBinding(SimSubSceneDefinition subScene, String managerName) { this.subScene = subScene; simElementManager = subScene.getSimElementManager(managerName); }
/// <summary> /// Constructor /// </summary> public SimSubSceneBinding(SimSubSceneDefinition subScene) { this.subScene = subScene; }
/// <summary> /// Helper function to create an edit interface. /// </summary> /// <param name="def"></param> private void createEditInterface(SimSubSceneDefinition def) { subScenes.addSubInterface(def, def.getEditInterface()); }