/// <summary> /// When the item chooser closes, if an item has been selected add it to the level. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event arguments.</param> private void OnItemChooserClose(object obj, EventArgs e) { //Get the item. Item item = _ItemChooser.LoadItem(); //Unsubscribe from the item chooser. _ItemChooser.Closed -= OnItemChooserClose; _ItemChooser = null; }
/// <summary> /// Launch an Item Chooser so that the user can add an item to the level. /// </summary> private void LaunchItemChooser() { //Create a new item chooser and add it to the GUI. _ItemChooser = new ItemChooser(_GUI, new Vector2(300, 100), 400, 500); _GUI.AddForegroundItem(_ItemChooser); //Subscribe to the chooser's close event. _ItemChooser.Closed += OnItemChooserClose; }