Enfusion Script API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ScriptCallQueue Interface Reference

ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but later during frame update (used mainly in UI)
usage: More...

Public Member Functions

proto native void Tick (float timeslice)
 executes calls on queue if their time is already elapsed, if 'repeat = false' call is removed from queue
 
proto void Call (func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
 adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)
 
proto void CallByName (Managed obj, string fnName, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
 adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)
 
proto void CallLater (func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
 adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)
 
proto void CallLaterByName (Managed obj, string fnName, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
 adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)
 
proto void Remove (func fn)
 remove specific call from queue
 
proto int GetRemainingTime (func fn)
 return Remaining time to the call execution (in miliseconds)
 
proto void RemoveByName (Managed obj, string fnName)
 remove specific call from queue
 
proto int GetRemainingTimeByName (Managed obj, string fnName)
 return Remaining time to the call execution (in miliseconds)
 
proto native void Clear ()
 remove all calls from queue
 
proto native void Dump ()
 dump all callbacks into log
 

Detailed Description

ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but later during frame update (used mainly in UI)
usage:

class MyGame extends Game
{
ref ScriptCallQueue m_CallQueue = new ScriptCallQueue();
ScriptCallQueue GetCallqueue() {
return m_CallQueue;
}
override void OnUpdate(float timeslice)
{
m_CallQueue.Tick(timeslice);
...
}
...
}
class MyObject
{
int m_cnt = 0;
void Hello(int p1, string p2)
{
Print("Hello( " + p1 + " , " + p2 + ")");
}
void Test()
{
Print(m_cnt);
m_cnt++;
if (m_cnt > 10)
{
ScriptCallQueue queue = g_Game.GetCallqueue();
queue.Remove(Test);
}
}
}
void Test(MyObject obj)
{
ScriptCallQueue queue = g_Game.GetCallqueue();
queue.CallLater(obj.Hello, 5000, false, 65, "world"); // adds call 'obj.Hello(65, "world")' into queue, and it will be executed once after 5s
queue.CallLater(obj.Test, 3000, true); // adds call 'obj.Test()' into queue, and it will be executed each 3s
queue.Call(obj.Hello, 72, "world 2"); // adds call 'obj.Hello(72, "world 2")' into queue, and it will be executed next frame (on next call of ScriptCallQueue.Tick)
}
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
Definition: Game.c:8
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Definition: tools.c:53
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are holded in memory until th...
proto native void Tick(float timeslice)
executes calls on queue if their time is already elapsed, if 'repeat = false' call is removed from qu...
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are holded in memory until th...
proto void Remove(func fn)
remove specific call from queue
Attribute used for tests annotation and assignment to Suites.
Definition: TestingFramework.c:97

Member Function Documentation

◆ Call()

proto void ScriptCallQueue.Call ( func  fn,
void  param1 = NULL,
void  param2 = NULL,
void  param3 = NULL,
void  param4 = NULL,
void  param5 = NULL,
void  param6 = NULL,
void  param7 = NULL,
void  param8 = NULL,
void  param9 = NULL 
)

adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)

◆ CallByName()

proto void ScriptCallQueue.CallByName ( Managed  obj,
string  fnName,
void  param1 = NULL,
void  param2 = NULL,
void  param3 = NULL,
void  param4 = NULL,
void  param5 = NULL,
void  param6 = NULL,
void  param7 = NULL,
void  param8 = NULL,
void  param9 = NULL 
)

adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)

◆ CallLater()

proto void ScriptCallQueue.CallLater ( func  fn,
int  delay = 0,
bool  repeat = false,
void  param1 = NULL,
void  param2 = NULL,
void  param3 = NULL,
void  param4 = NULL,
void  param5 = NULL,
void  param6 = NULL,
void  param7 = NULL,
void  param8 = NULL,
void  param9 = NULL 
)

adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)

◆ CallLaterByName()

proto void ScriptCallQueue.CallLaterByName ( Managed  obj,
string  fnName,
int  delay = 0,
bool  repeat = false,
void  param1 = NULL,
void  param2 = NULL,
void  param3 = NULL,
void  param4 = NULL,
void  param5 = NULL,
void  param6 = NULL,
void  param7 = NULL,
void  param8 = NULL,
void  param9 = NULL 
)

adds call into the queue with given parameters and arguments (arguments are holded in memory until the call is executed/removed or ScriptCallQueue is destroyed)

◆ Clear()

proto native void ScriptCallQueue.Clear ( )

remove all calls from queue

◆ Dump()

proto native void ScriptCallQueue.Dump ( )

dump all callbacks into log

◆ GetRemainingTime()

proto int ScriptCallQueue.GetRemainingTime ( func  fn)

return Remaining time to the call execution (in miliseconds)

◆ GetRemainingTimeByName()

proto int ScriptCallQueue.GetRemainingTimeByName ( Managed  obj,
string  fnName 
)

return Remaining time to the call execution (in miliseconds)

◆ Remove()

proto void ScriptCallQueue.Remove ( func  fn)

remove specific call from queue

◆ RemoveByName()

proto void ScriptCallQueue.RemoveByName ( Managed  obj,
string  fnName 
)

remove specific call from queue

◆ Tick()

proto native void ScriptCallQueue.Tick ( float  timeslice)

executes calls on queue if their time is already elapsed, if 'repeat = false' call is removed from queue


The documentation for this interface was generated from the following file: