public ScriptExecutionProcess() { _eventListener = new EventListener(ProcessEvent); EventManager.AttachListener(_eventListener); _priority = 1; // We always want to be executed before other processes. }
/// <summary> /// Initializes a new instance of this class with the given data. /// </summary> /// <param name="entity">Entity to attach this process to.</param> /// <param name="process">Script process that this entitys logic script is contained in.</param> public ScriptExecutionProcess(EntityNode entity, ScriptProcess process) { _entity = entity; Process = process; _eventListener = new EventListener(ProcessEvent); EventManager.AttachListener(_eventListener); _priority = 1; // We always want to be executed before other processes. }
/// <summary> /// Initializes a new instance of this control. /// </summary> /// <param name="file">Tileset file to display.</param> public TilesetWindow(string file) { InitializeComponent(); _canvas = new GraphicsCanvas(canvasPanel, 0, Render); _tileset = new Tileset(file); TilesetWindow_ResizeEnd(null, new EventArgs()); EventManager.AttachListener(_listener = new EventListener(EventCaptured)); }
/// <summary> /// Initializes a new instance of this class and sets up all the /// controls on this form. /// </summary> public AssetManagerWindow() { // Initialize the controls on this window. InitializeComponent(); // Create a new event listener to listen out for input events. _listener = new EventListener(new ProcessorDelegate(EventCaptured)); EventManager.AttachListener(_listener); // Fill the audio and object tree views. FillTreeViews(); // Sync all the page's data up. ;). SyncronizeData(); }
/// <summary> /// Removes the given event listener from the listener list so it no /// longer recieves event notifications. /// </summary> /// <param name="listener">Listener to dettach.</param> public static void DetachListener(EventListener listener) { _listenerList.Remove(listener); }
/// <summary> /// Attachs a given event listener to the listener list so that it /// recieves notification on all fired events. /// </summary> /// <param name="listener">Listener to attach.</param> public static void AttachListener(EventListener listener) { _listenerList.Add(listener); }
/// <summary> /// Initializes a new instance of this class with the given data. /// </summary> /// <param name="url">Url of script this process should run.</param> public ScriptExecutionProcess(object url) { Process = VirtualMachine.GlobalInstance.LoadScript(url); _eventListener = new EventListener(ProcessEvent); EventManager.AttachListener(_eventListener); _priority = 1; // We always want to be executed before other processes. }
/// <summary> /// Called when this process needs to be destroyed. /// </summary> public override void Dispose() { if (_eventListener != null) EventManager.DetachListener(_eventListener); if (_process != null) _process.Dispose(); _eventListener = null; _process = null; _entity = null; }
/// <summary> /// Initializes a new instance of this class, and sets up the form. /// </summary> public EditorWindow() { // Initialize the windows form controls. InitializeComponent(); // Refresh the recent file list. RefreshRecentFiles(); // Create the map canvas to render to. _mapCanvas = GraphicsManager.CreateCanvas(mapPanel, 0, new CanvasRenderHandler(Render)); // Grab the path marker image. _pathMarkerImage = new Graphics.Image(ReflectionMethods.GetEmbeddedResourceStream("path_marker.png"), 0); // Syncronize the window to the current data. SyncronizeWindow(); // Create a new event listener to listen out for input events. _listener = new EventListener(new ProcessorDelegate(EventCaptured)); EventManager.AttachListener(_listener); }
/// <summary> /// Disposes of this tileset window. /// </summary> /// <param name="sender">Object that caused this event to be triggered.</param> /// <param name="e">Arguments explaining why this event occured.</param> private void TilesetWindow_FormClosed(object sender, FormClosedEventArgs e) { EventManager.DetachListener(_listener); _listener = null; _tileset = null; GC.Collect(); }