DayZ 1.24
Loading...
Searching...
No Matches
array< ref CallQueueContext > Class Reference

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

Collaboration diagram for array< ref CallQueueContext >:
[legend]

Private Member Functions

void CallQueue ()
 
void Tick ()
 System function, don't call it.
 
void Call (Class obj, string fn_name, Param params=NULL)
 Creates new call request, add it on queue and execute during frame update (depends on call category)
 
void RemoveCalls (Class obj)
 Removes all queued calls for object (call this function when object is going to be deleted)
 

Private Attributes

bool m_processing
 

Detailed Description

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

GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(this, "Refresh"); // calls "Refresh" function on "this" with no arguments
GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(this, "Show", new Param1<bool>(true)); // calls "Show" function on "this" with one bool argument
GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(this, "SetPos", new Param2<float, float>(0.2, 0.5)); // calls "SetPos" function on "this" with two float arguments
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9

Definition at line 64 of file tools.c.

Member Function Documentation

◆ Call()

void array< ref CallQueueContext >::Call ( Class obj,
string fn_name,
Param params = NULL )
inlineprivate

Creates new call request, add it on queue and execute during frame update (depends on call category)

Parameters
objtarget object on which function will be executed
fn_namename of function (on object "obj") which will be executed
paramsfunction arguments see Param for usage, default NULL (no arguments)
Warning
When object "obj" is deleted prior call execution, don't forget to remove calls for this object with RemoveCalls

Definition at line 104 of file tools.c.

105 {
106 Insert(new CallQueueContext(obj, fn_name, params));
107 }

◆ CallQueue()

void array< ref CallQueueContext >::CallQueue ( )
inlineprivate

Definition at line 68 of file tools.c.

69 {
70 m_processing = false;
71 }

◆ RemoveCalls()

void array< ref CallQueueContext >::RemoveCalls ( Class obj)
inlineprivate

Removes all queued calls for object (call this function when object is going to be deleted)

Parameters
objobject for which you want remove all "lazy" calls

Definition at line 114 of file tools.c.

115 {
116 if (Count())
117 {
118 for (int i = Count() - 1; i >= 0; i--)
119 {
121 if (ctx.m_target == obj)
122 ctx.Invalidate();
123 }
124 }
125 }
array< ref PlayerStatBase > Get()

References Count, Get(), CallQueueContext::Invalidate(), and CallQueueContext::m_target.

◆ Tick()

void array< ref CallQueueContext >::Tick ( )
inlineprivate

System function, don't call it.

Definition at line 76 of file tools.c.

77 {
78 if (m_processing) return;
79
80 m_processing = true;
81
82 while (Count() > 0)
83 {
85 if (!ctx.IsValid())
86 Remove(0);
87 else
88 {
89 Remove(0);
90 ctx.Call();
91 }
92 }
93
94 m_processing = false;
95 }
void Remove(Object object)

References CallQueueContext::Call(), Count, Get(), CallQueueContext::IsValid(), and Remove().

Member Data Documentation

◆ m_processing

bool array< ref CallQueueContext >::m_processing
private

Definition at line 66 of file tools.c.


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