22 void CallQueueContext(
Class target,
string fn,
Param params)
35 void CallParams(
Param params)
39 g_Game.GameScript.CallFunctionParams(m_target, m_function, NULL, params);
43 g_Game.GameScript.CallFunction(m_target, m_function, NULL, 0);
66class CallQueue
extends array<ref CallQueueContext>
68 private bool m_processing;
80 if (m_processing)
return;
108 void Call(
Class obj,
string fn_name,
Param params = NULL)
118 void RemoveCalls(
Class obj)
122 for (
int i =
Count() - 1; i >= 0; i--)
125 if (ctx.m_target == obj)
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);
199 ctx.CallParams(m_mouse_params);
211 m_processing =
false;
337 ErrorEx(
"Attempting to Init a timer when the game does not exist (g_Game == null)");
340 protected void OnStart(
float duration,
bool loop)
382class TimerQueue
extends array<TimerBase>
384 private bool m_processing;
389 m_processing =
false;
397 for (
int i =
Count() - 1; i >= 0; i--)
399 Get(i).OnTimerQueueDestoryed();
407 void Tick(
float timeslice)
409 if (m_processing)
return;
414 for (
int i = count - 1; i >= 0; i--)
416 Get(i).Tick(timeslice);
419 m_processing =
false;
429 private Widget m_widget;
433 void WidgetFadeTimer()
445 void FadeIn(Widget w,
float time,
bool continue_ =
false)
447 m_alpha = w.GetAlpha();
449 if (continue_ && m_alpha > 0.95)
463 m_alpha = m_widget.GetAlpha();
464 m_widget.SetAlpha(0);
480 void FadeOut(Widget w,
float time,
bool continue_ =
false)
482 m_alpha = w.GetAlpha();
484 if (continue_ && m_alpha < 0.05)
496 if (m_widget && !continue_)
499 m_widget.SetAlpha(m_alpha);
505 m_time = (1.0 - m_alpha) * time;
509 override private void OnTimer()
515 m_widget.SetAlpha(1);
519 m_widget.SetAlpha(0);
520 m_widget.Show(
false);
537 progress =
Math.Lerp(m_alpha,0,timeDiff);
538 progress =
Math.Clamp(progress,0,1);
541 m_widget.SetAlpha(progress);
595 void Run(
float duration,
Managed obj,
string fn_name,
Param params = NULL,
bool loop =
false)
652 private bool m_Active;
653 private float m_TargetValue;
654 private float m_TargetValueOriginal;
655 private float m_Value;
671 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)
677 m_TargetValueOriginal = targetVal;
678 m_TargetValue = targetVal;
683 m_Value = startingVal;
700 override void Tick(
float timeslice)
706 float diff =
Math.AbsFloat(m_TargetValue - m_Value);
707 float step =
m_time * timeslice;
711 m_Value = m_TargetValue;
718 if (m_TargetValue == m_TargetValueOriginal)
724 m_TargetValue = m_TargetValueOriginal;
732 if (m_TargetValue > m_Value)
748 private bool m_active =
false;
749 private bool m_loop =
false;
750 private float m_target_value = 0;
751 private float m_value = 0;
752 private float m_time = 0;
759 void Animate(
float val,
float speed = 1.0)
761 m_target_value = val;
771 void AnimateLoop(
float speed = 1.0)
790 float GetTargetValue() {
791 return m_target_value;
797 void SetValue(
float val) {
799 m_target_value = val;
809 void Tick(
float timeslice)
811 if ( !m_active )
return;
815 m_target_value += m_time *
Math.PI2 * timeslice;
816 while (m_target_value >
Math.PI2) m_target_value -=
Math.PI2;
818 m_value =
Math.Sin(m_target_value);
822 float diff =
Math.AbsFloat(m_target_value - m_value);
823 float step = m_time * timeslice;
827 m_value = m_target_value;
832 if (m_target_value > m_value)
875 index = m_keys.Find(key);
891 index = m_keys.Find(key);
896 return m_values.Get(index);
904 return m_values.Get(index);
907 K GetKeyByIndex(
int index)
909 return m_keys.Get(index);
912 void Insert(K key, V value)
923 index = m_keys.Find(key);
929 value_array.Insert(value);
932 m_values.Insert(value_array);
937 m_values.Get(index).Insert(value);
941 void RemoveByIndex(
int index)
943 m_keys.Remove(index);
944 m_values.Remove(index);
952 index = m_keys.Find(key);
957 RemoveByIndex(index);
965 return m_keys.Count();
973 if ( m_keys && m_values)
997 if (temperature <
GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT)
999 temperature = temperature - 20;
1000 temperature =
Math.Clamp( temperature, -50, 50);
1001 temperature =
Math.AbsInt(temperature);
1003 red =
Math.Clamp ( red - ((red/50 )*temperature), 0, 255);
1004 green =
Math.Clamp ( green - ((green/50 )*temperature), 0, 255);
1005 blue =
Math.Clamp ( blue+((blue/50)*temperature), 0, 255);
1007 else if (temperature >
GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1009 temperature =
Math.Clamp(temperature, -100, 100);
1010 blue =
Math.Clamp (blue - ((blue / 100) * temperature), 0, 255);
1011 green =
Math.Clamp (green - ((green / 100) * temperature), 0, 255);
1012 red =
Math.Clamp (red + ((red / 100) * temperature), 0, 255);
1015 return ARGB(alpha, red, green, blue);
1024 if (value ==
"true" || value ==
"1")
1055 return Math.GetNumberOfSetBits(i);
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
void AnimationTimer(int category=CALL_CATEGORY_SYSTEM)
override void Tick(float timeslice)
Ticks the timer, is called by timer subsystem.
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)
override bool IsRunning()
string m_FinishedFunction
float GetValue()
Returns actual animated value.
DragQueue Class provide callbacks while mouse is dragging. Callback function must have exact argument...
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 Timer(int category=CALL_CATEGORY_SYSTEM)
void Run(float duration, Managed obj, string fn_name, Param params=NULL, bool loop=false)
Starts timer.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native int GetMouseState(MouseState index)
proto void GetMousePos(out int x, out int y)
void OnInit()
Callback for user defined initialization. Called for all suites during TestHarness....
int ARGB(int a, int r, int g, int b)
void Clear(bool clearFile=false)