Enfusion Script API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ScriptInvokerBase< Class T > Interface Template Reference

ScriptInvoker Class provide list of callbacks
usage: More...

Inheritance diagram for ScriptInvokerBase< Class T >:
[legend]

Public Member Functions

proto void Invoke (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)
 invoke call on all inserted methods with given arguments
 
proto void Insert (T fn)
 insert method to list

 
proto void Remove (T fn)
 remove specific call from list
 
proto native void Clear ()
 remove all calls from list
 
proto native void Dump ()
 dump all callbacks into log
 
- Public Member Functions inherited from Managed
proto external ref Managed Clone ()
 Return shallow copy of object, or null if it is not allowed (not public constructor)
 

Detailed Description

ScriptInvoker Class provide list of callbacks
usage:

class Player
{
ref ScriptInvoker m_DeathInvoker = new ScriptInvoker();
void OnKilled()
{
m_DeathInvoker.Invoke(this);
}
}
void LogPlayerDeath(p)
{
Print("RIP " + p);
}
class Game
{
void RemovePlayer(Player p)
{
}
void GameOver()
{
}
}
void OnPlayerSpaned(Player p)
{
Game game = g_Game;
p.m_DeathInvoker.Insert(LogPlayerDeath);
p.m_DeathInvoker.Insert(game.RemovePlayer);
p.m_DeathInvoker.Insert(game.GameOver);
}
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
Definition: Game.c:8

Member Function Documentation

◆ Clear()

proto native void ScriptInvokerBase< Class T >.Clear ( )

remove all calls from list

◆ Dump()

proto native void ScriptInvokerBase< Class T >.Dump ( )

dump all callbacks into log

◆ Insert()

proto void ScriptInvokerBase< Class T >.Insert ( fn)

insert method to list

◆ Invoke()

proto void ScriptInvokerBase< Class T >.Invoke ( 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 
)

invoke call on all inserted methods with given arguments

◆ Remove()

proto void ScriptInvokerBase< Class T >.Remove ( fn)

remove specific call from list


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