80 if (m_processing)
return;
122 for (
int i =
Count() - 1; i >= 0; i--)
159 m_mouse_params =
new Param3<int, int, bool>(0,0,
true);
167 if (m_processing)
return;
174 bool is_holding =
false;
184 if (!is_holding || mouse_x != m_mouse_params.param1 || mouse_y != m_mouse_params.param2)
186 m_mouse_params.param1 = mouse_x;
187 m_mouse_params.param2 = mouse_y;
188 m_mouse_params.param3 = is_holding;
190 while (
Count() > last_index)
192 ctx =
Get(last_index);
211 m_processing =
false;
327 ErrorEx(
"Attempting to Init a timer when the game does not exist (GetGame() == null)");
330 protected void OnStart(
float duration,
bool loop)
371class TimerQueue
extends array<TimerBase>
378 m_processing =
false;
386 for (
int i =
Count() - 1; i >= 0; i--)
388 Get(i).OnTimerQueueDestoryed();
398 if (m_processing)
return;
404 for (
int i =
Count() - 1; i >= 0; i--)
406 Get(i).Tick(timeslice);
410 m_processing =
false;
438 float alpha = w.GetAlpha();
440 if (continue_ && alpha > 0.95)
454 alpha = m_widget.GetAlpha();
455 m_widget.SetAlpha(0);
473 m_alpha = w.GetAlpha();
475 if (continue_ && m_alpha < 0.05)
487 if (m_widget && !continue_)
490 m_widget.SetAlpha(m_alpha);
506 m_widget.SetAlpha(1);
510 m_widget.SetAlpha(0);
511 m_widget.Show(
false);
519 float progress =
Math.
Max( 0.0, timeDiff );
525 m_widget.SetAlpha( timeDiff );
529 m_widget.SetAlpha( m_alpha - timeDiff );
584 void Run(
float duration,
Managed obj,
string fn_name,
Param params = NULL,
bool loop =
false)
587 m_function = fn_name;
660 void Run(
float targetVal,
Managed obj,
string updateFunc,
string finishedFunc,
float startingVal = 0,
bool loop =
false,
float speed = 1.0,
Param params = null,
int category =
CALL_CATEGORY_SYSTEM)
689 override void Tick(
float timeslice)
696 float step =
m_time * timeslice;
812 float step =
m_time * timeslice;
864 index = m_keys.Find(key);
880 index = m_keys.Find(key);
885 return m_values.Get(index);
893 return m_values.Get(index);
898 return m_keys.Get(index);
912 index = m_keys.Find(key);
918 value_array.Insert(value);
921 m_values.Insert(value_array);
926 m_values.Get(index).Insert(value);
932 m_keys.Remove(index);
933 m_values.Remove(index);
941 index = m_keys.Find(key);
946 RemoveByIndex(index);
954 return m_keys.Count();
962 if ( m_keys && m_values)
985 if ( temperature < 20 )
987 temperature = temperature - 20;
988 temperature =
Math.
Clamp( temperature, -50, 50);
991 red =
Math.
Clamp ( red - ((red/50 )*temperature), 0, 255 );
992 green =
Math.
Clamp ( green - ((green/50 )*temperature), 0, 255 );
993 blue =
Math.
Clamp ( blue+((blue/50)*temperature), 0, 255 );
995 else if ( temperature > 20 )
997 temperature =
Math.
Clamp( temperature, -100, 100);
998 blue =
Math.
Clamp ( blue - ((blue/100 )*temperature), 0, 255 );
999 green =
Math.
Clamp ( green - ((green/100 )*temperature), 0, 255 );
1000 red =
Math.
Clamp ( red+((red/100)*temperature), 0, 255 );
1003 int color =
ARGB( alpha, red, green, blue );
1013 if (value ==
"true" || value ==
"1")
void Remove(Object object)
array< ref PlayerStatBase > Get()
AnimationTimer class. This timer is for animating float value. usage:
protected string m_UpdateFunction
private float m_TargetValue
protected Managed m_TargetObject
void Run(float targetVal, Managed obj, string updateFunc, string finishedFunc, float startingVal=0, bool loop=false, float speed=1.0, Param params=null, int category=CALL_CATEGORY_SYSTEM)
protected string m_FinishedFunction
float GetValue()
Returns actual animated value.
protected ref Param m_Params
override void Tick(float timeslice)
Ticks the timer, is called by timer subsystem.
private float m_TargetValueOriginal
void AnimationTimer(int category=CALL_CATEGORY_SYSTEM)
override bool IsRunning()
float GetValue()
Returns actual animated value.
private float m_target_value
void AnimateLoop(float speed=1.0)
Starts infinite animation loop <-1,1>. Based on sinus transition.
float GetTargetValue()
Returns target value. While AnimateLoop returns angle of cycle in radians.
void Animate(float val, float speed=1.0)
Starts animate value until value reaches target value.
void SetValue(float val)
Sets both value and target value.
void Tick(float timeslice)
Ticks the timer, is called by timer subsystem.
override TimerQueue GetTimerQueue(int call_category)
proto native void SetProfileString(string name, string value)
Sets string to profile variable.
void CallParams(Param params)
void CallQueueContext(Class target, string fn, Param params)
DragQueue Class provide callbacks while mouse is dragging. Callback function must have exact argument...
private ref Param3< int, int, bool > m_mouse_params
override void Tick()
System function, don't call it.
Super root of all classes in Enforce script.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Simple class for fading Widgets.
void Run(float duration, Managed obj, string fn_name, Param params=NULL, bool loop=false)
Starts timer.
override protected void OnTimer()
override private void OnTimer()
override private void OnUpdate()
void FadeOut(Widget w, float time, bool continue_=false)
Make "fade out" effect on Widget (transparency goes from 1.0 to 0.0)
void FadeIn(Widget w, float time, bool continue_=false)
Make "fade in" effect on Widget (transparency goes from 0.0 to 1.0)
protected ref Param m_params
protected Managed m_target
void Timer(int category=CALL_CATEGORY_SYSTEM)
protected string m_function
private bool m_processing
void Tick(float timeslice)
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)
private bool m_processing
void RemoveCalls(Class obj)
Removes all queued calls for object (call this function when object is going to be deleted)
void Tick()
System function, don't call it.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
array< V > GetByIndex(int index)
K GetKeyByIndex(int index)
private ref array< ref array< V > > m_values
void Insert(K key, V value)
void RemoveByIndex(int index)
private ref array< K > m_keys
proto native CGame GetGame()
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)
proto volatile int CallFunctionParams(Class inst, string function, out void returnVal, Class parms)
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float AbsFloat(float f)
Returns absolute value.
static proto int GetNumberOfSetBits(int i)
returns the number of bits set in a bitmask i
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto int AbsInt(int i)
Returns absolute value.
proto native int GetMouseState(MouseState index)
proto void GetMousePos(out int x, out int y)
int ARGB(int a, int r, int g, int b)