Reworks the open/close functions of the gui and world editors so they will properly toggle between and clean up when closed.

This commit is contained in:
Areloch 2017-01-21 17:11:54 -06:00
parent 0aea1d5c33
commit f8b650f7a1
16 changed files with 238 additions and 142 deletions

View file

@ -75,11 +75,26 @@ function toggleGuiEditor( %make )
if( EditorIsActive() && !GuiEditor.toggleIntoEditorGui )
toggleEditor( true );
GuiEdit();
if( !isObject( GuiEditCanvas ) )
new GuiControl( GuiEditCanvas, EditorGuiGroup );
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
if( GuiEditorIsActive() )
{
GuiEditor.close();
}
else
{
GuiEditor.open();
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
}
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
}
}
@ -98,6 +113,26 @@ package GuiEditor_BlockDialogs
//---------------------------------------------------------------------------------------------
function GuiEditor::open(%this)
{
GuiEditCanvas.onCreateMenu();
GuiEditContent(Canvas.getContent());
}
function GuiEditor::close(%this)
{
// prevent the mission editor from opening while the GuiEditor is open.
if(Canvas.getContent() != GuiEditorGui.getId())
return;
GuiGroup.add(GuiEditorGui);
Canvas.setContent(GuiEditor.lastContent);
GuiEditCanvas.onDestroyMenu();
}
function GuiEditor::openForEditing( %this, %content )
{
Canvas.setContent( GuiEditorGui );