示例#1
0
 /// <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);
     }
 }
示例#2
0
 /// <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);
     }
 }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
            });
        }
示例#5
0
 /// <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;
 }
示例#6
0
 /// <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);
 }
示例#7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public SimSubSceneBinding(SimSubSceneDefinition subScene)
 {
     this.subScene = subScene;
 }
示例#8
0
 /// <summary>
 /// Helper function to create an edit interface.
 /// </summary>
 /// <param name="def"></param>
 private void createEditInterface(SimSubSceneDefinition def)
 {
     subScenes.addSubInterface(def, def.getEditInterface());
 }