67 lines
1.5 KiB
Ucode
67 lines
1.5 KiB
Ucode
class ICCME_EventBase extends RelationalClasses
|
|
abstract;
|
|
|
|
// time the event was created (relative to game start)
|
|
var float createdTime;
|
|
|
|
// Is this event reliable ? Setted for some emulated event that might not be accurates
|
|
var bool bReliable;
|
|
|
|
// Tell the engine this event must be treated in the current Tick() context and not the next one
|
|
var bool bUrgent;
|
|
|
|
var array<ICCME_EventListenerBase> _ar_AttachedEventListener;
|
|
var bool _bBroadcast;
|
|
|
|
|
|
// print Event relevent informations in the main UT log file
|
|
function doLog()
|
|
{
|
|
log("");
|
|
log("===== Event:"@Self.Class@"["$createdTime$"]"@"=====");
|
|
log("Self:"@Self);
|
|
log("bReliable:"@bReliable);
|
|
log("bUrgent:"@bUrgent);
|
|
}
|
|
|
|
static function attach(ICCME_EventListenerBase EventListener)
|
|
{
|
|
local int i;
|
|
local bool bAlreadyRegistered;
|
|
|
|
if(EventListener.bMonitor) return;
|
|
|
|
for(i=0;i<default._ar_AttachedEventListener.Length;i++)
|
|
{
|
|
if(default._ar_AttachedEventListener[i] == EventListener)
|
|
{
|
|
bAlreadyRegistered=True;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(!bAlreadyRegistered)
|
|
{
|
|
default._ar_AttachedEventListener.Length = default._ar_AttachedEventListener.Length + 1;
|
|
default._ar_AttachedEventListener[default._ar_AttachedEventListener.Length-1] = EventListener;
|
|
}
|
|
|
|
for(i=0;i<default.Tchilds.length;i++)
|
|
{
|
|
class<ICCME_EventBase>(default.Tchilds[i]).static.attach(EventListener);
|
|
}
|
|
}
|
|
|
|
function RunAttached()
|
|
{
|
|
local int i;
|
|
for(i=0;i<default._ar_AttachedEventListener.Length;i++)
|
|
{
|
|
default._ar_AttachedEventListener[i].ProcessEvent(Self);
|
|
}
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
bReliable=True
|
|
} |