ironsphererpg/scripts/gameCanvas.cs
Jusctsch5 a5143b67f7 T2RPG: Initial commit of ironsphererpg directory
Taking everything obtained from http://ironsphererpg2.webs.com/ and dumping it in a git repo
2015-01-18 21:06:06 -06:00

47 lines
1,015 B
C#

function SimSet::removeStable(%this, %object)
{
if(%this.getCount() < 2)
{
%this.remove(%object);
return;
}
%last = %this.getObject(%this.getCount() - 1);
%this.remove(%object);
%this.pushToBack(%last);
}
if(!isObject(GameDialogSet))
{
new SimSet(GameDialogSet);
RootGroup.add(GameDialogSet);
}
function GuiCanvas::setGameMode(%this, %on)
{
if(%this.gameMode == %on)
return;
%this.gameMode = %on;
if(%this.gameMode)
{
%this.setContent(%this.gameContent);
for(%i = 0; %i < GameDialogSet.getCount(); %i++)
%this.pushDialog(GameDialogSet.getObject(%i));
}
else
Canvas.setContent(LobbyGui);
}
function GuiCanvas::pushGameDialog(%this, %dialog)
{
GameDialogSet.add(%dialog);
if(%this.gameMode)
%this.pushDialog(%dialog);
}
function GuiCanvas::popGameDialog(%this, %dialog)
{
GameDialogSet.removeStable(%dialog);
if(%this.gameMode)
%this.popDialog(%dialog);
}