RTB Code:
//- GuiControl::shift (moves a gui in the X or Y)
function GuiControl::shift(%this,%x,%y)
{
%this.position = vectorAdd(%this.position,%x SPC %y);
}
//- GuiControl::conditionalShiftY (shifts all controls >= %position by %amount in the Y)
function GuiControl::conditionalShiftY(%this,%position,%amount)
{
for(%i=0;%i<%this.getCount();%i++)
{
%control = %this.getObject(%i);
if(getWord(%control.position,1) >= %position)
%control.shift(0,%amount);
}
}
//- RTBCC_Notification::step (plays a step through the animation)
function RTBCC_Notification::step(%this)
{
if(%this.state $= "left")
{
if(getWord(%this.window.position,0) <= 0)
{
if(%this.holdTime < 0)
{
%this.window.position = "0 0";
%this.state = "done";
return;
}
%this.window.position = "0 0";
%this.state = "wait";
%this.moveAnim = %this.schedule(%this.holdTime,"step");
return;
}
%this.window.position = vectorSub(%this.window.position,"10 0");
%this.moveAnim = %this.schedule(10,"step");
}
else if(%this.state $= "wait")
{
%this.state = "right";
%this.step();
}
else if(%this.state $= "right")
{
if(getWord(%this.window.position,0) >= getWord(%this.canvas.extent,0))
{
%this.window.position = getWord(%this.canvas.extent,0) SPC "0";
%this.state = "done";
%this.step();
return;
}
%this.window.position = vectorAdd(%this.window.position,"10 0");
%this.moveAnim = %this.schedule(10,"step");
}
else if(%this.state $= "done")
{
%y = getWord(%this.canvas.position,1);
%this.canvas.delete();
for(%i=0;%i<RTBCC_NotificationManager.getCount();%i++)
{
%notification = RTBCC_NotificationManager.getObject(%i);
if(!isObject(%notification.canvas))
continue;
if(getWord(%notification.canvas.position,1) < %y)
%notification.canvas.shift(0,50);
}
%this.delete();
}
}