/// <summary> /// Clones this named variable. The cloned named variable will be used at the specified <see cref="Scripting.ScriptingComponent"/>. /// </summary> /// <param name="scriptingComponent"><see cref="Scripting.ScriptingComponent"/> where the named variable will be used.</param> /// <returns>Cloned named variable.</returns> public NamedVariable Clone(ScriptingComponent scriptingComponent) { return(new NamedVariable(scriptingComponent, Value.Clone()) { Name = Name }); }
/// <summary> /// Deserialize object. /// </summary> /// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> to retrieve data.</param> /// <param name="ctxt">The source (see <see cref="System.Runtime.Serialization.StreamingContext"/>) for this deserialization.</param> private StateMachine(SerializationInfo info, StreamingContext ctxt) { _scriptingComponent = (ScriptingComponent)info.GetValue("ScriptingComponent", typeof(ScriptingComponent)); _name = info.GetString("Name"); _states = (ObservableIndexedList <State>)info.GetValue("States", typeof(ObservableIndexedList <State>)); _startingState = (State)info.GetValue("StartingState", typeof(State)); }
/// <summary> /// Initializes a new instance of the <see cref="ScriptingForm"/> class. /// </summary> /// <param name="scriptingComponent">The scripting component.</param> public ScriptingForm(ScriptingComponent scriptingComponent) { _scriptingComponent = scriptingComponent; InitializeComponent(); Icon = Properties.Resources._2DPGC_Logo; if (ScriptingComponent.Actor != null) { Text = String.Format("Visual Scripting Editor - Actor - {0}", ScriptingComponent.Actor.Name); ScriptingComponent.Actor.NameChanged += new EventHandler(Actor_NameChanged); } else { Text = "Visual Scripting Editor - Scene Scripting"; } messagesManager = new DefaultMessagesManager(toolStripStatusLabel); Messages.MessagesManager = messagesManager; // create scripting nodes tree CreateTreeOfScriptingNodes(nodesView.Nodes, ScriptingNodes.Root); CreateTreeOfVariablesNodes(nodesView.Nodes); nodesView.ExpandAll(); // create scripting screen scriptingScreen = new ScriptingScreen(); scriptingScreen.Dock = DockStyle.Fill; toolStripContainer2.ContentPanel.Controls.Add(scriptingScreen); scriptingScreen.SelectedNodesChanged += new EventHandler(scriptingScreen_SelectedNodesChanged); // create state machine screen stateMachineView = new StateMachineView(); stateMachineView.Dock = DockStyle.Fill; toolStripContainer3.ContentPanel.Controls.Add(stateMachineView); stateMachineView.SelectedStateChanged += new EventHandler(stateView_SelectedStateChanged); stateMachineView.StateDoubleClicked += new EventHandler(stateView_StateDoubleClicked); stateMachineView.AfterDeletingState += new EventHandler(stateMachineView_AfterDeletingState); // init actor variables namedVariablesView.ScriptingComponent = scriptingComponent; namedVariablesView.VariableToScene += new NamedVariablesView.AddVariableToScene(namedVariablesView_VariableToScene); // init actor events eventsInView.Events = scriptingComponent.EventsIn; eventsInView.OnEventRemoving += new EventsView.EventRemovingHandler(eventsInView_OnEventRemoved); eventsOutView.Events = scriptingComponent.EventsOut; // init state machines view stateMachinesView.StateMachines = ScriptingComponent.StateMachines; stateMachinesView.OpenStateMachine += new StateMachinesView.StateMachineHandler(stateMachinesView_OpenStateMachine); stateMachinesView.AfterDeletingStateMachine += new StateMachinesView.StateMachineHandler(stateMachinesView_AfterDeletingStateMachine); SelectedStateMachine = scriptingComponent.StateMachines[0]; }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { ScriptingComponent = null; } if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { SelectedStateMachine = null; if (ScriptingComponent.Actor != null) { ScriptingComponent.Actor.NameChanged -= new EventHandler(Actor_NameChanged); } _scriptingComponent = null; } if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
/// <summary> /// Deserialize object. /// </summary> /// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> to retrieve data.</param> /// <param name="ctxt">The source (see <see cref="System.Runtime.Serialization.StreamingContext"/>) for this deserialization.</param> private NamedVariable(SerializationInfo info, StreamingContext ctxt) { _scriptingComponent = (ScriptingComponent)info.GetValue("ScriptingComponent", typeof(ScriptingComponent)); _value = (IVariable)info.GetValue("Value", typeof(IVariable)); _name = info.GetString("Name"); }
/// <summary> /// Initializes a new instance of the <see cref="NamedVariable"/> class. /// </summary> /// <param name="scriptingComponent"><see cref="Scripting.ScriptingComponent"/> where the named variable will be used.</param> /// <param name="value">The default value.</param> public NamedVariable(ScriptingComponent scriptingComponent, IVariable value) { _scriptingComponent = scriptingComponent; _value = value; }
/// <summary> /// Initializes a new instance of the <see cref="NamedVariable"/> class. /// </summary> /// <param name="scriptingComponent"><see cref="Scripting.ScriptingComponent"/> where the named variable will be used.</param> /// <param name="variableType">Type of the variable.</param> public NamedVariable(ScriptingComponent scriptingComponent, VariableType variableType) { _scriptingComponent = scriptingComponent; _value = VarFactory.Create(variableType); }
/// <summary> /// Initializes a new instance of the <see cref="StateMachine"/> class. /// </summary> /// <param name="scriptingComponent">The <see cref="Scripting.ScriptingComponent"/> where the state machine will be used.</param> public StateMachine(ScriptingComponent scriptingComponent) { _scriptingComponent = scriptingComponent; _states = new ObservableIndexedList <State>(); }