DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс TimerBase

Simple class for fading Widgets. Подробнее...

+ Граф наследования:TimerBase:

Защищенные члены

void Timer (int category=CALL_CATEGORY_SYSTEM)
 
void Run (float duration, Managed obj, string fn_name, Param params=NULL, bool loop=false)
 Starts timer.
 
void OnTimer ()
 
override void Stop ()
 

Защищенные данные

Managed m_target
 
string m_function
 
ref Param m_params
 

Закрытые члены

void WidgetFadeTimer ()
 
void FadeIn (Widget w, float time, bool continue_=false)
 Make "fade in" effect on Widget (transparency goes from 0.0 to 1.0)
 
void FadeOut (Widget w, float time, bool continue_=false)
 Make "fade out" effect on Widget (transparency goes from 1.0 to 0.0)
 
void OnTimer ()
 
void OnUpdate ()
 

Закрытые данные

Widget m_widget
 
bool m_fadeIn
 
float m_alpha
 

Подробное описание

Simple class for fading Widgets.

Timer class. Use when you want call function after some time, or repeatedly in time intervals. Call is not executed after the Timer object is deleted.
usage:

class MyObject
{
void MyObject()
{
myTimer1 = new Timer();
myTimer1.Run(10, this, "Refresh"); // calls "Refresh" on "this" after 10 seconds
myTimer2 = new Timer();
myTimer2.Run(10, this, "Refresh", NULL, true); // calls "Refresh" on "this" every 10 seconds, until Pause or Stop is called
myTimer3 = new Timer();
myTimer3.Run(15, this, "Show", new Param1<bool>(false)); // calls "Show" on "this" with one bool argument after 15 seconds
}
void Refresh();
void Show(bool visible);
}
void Show()
Definition DayZGame.c:157
ref Timer myTimer1
Definition PluginItemDiagnostic.c:46
void Refresh()
Definition SizeToChild.c:108
Definition EntityAI.c:95
Definition DayZPlayerImplement.c:63

Методы

◆ FadeIn()

void FadeIn ( Widget w,
float time,
bool continue_ = false )
inlineprivate

Make "fade in" effect on Widget (transparency goes from 0.0 to 1.0)

Аргументы
wwidget which will be faded
timeduration of effect
continue- if True continue from current alpha value, otherwise always begin from 0.0 alpha
448 {
449 m_alpha = w.GetAlpha();
450
451 if (continue_ && m_alpha > 0.95)
452 {
453 w.SetAlpha(1.0);
454 w.Show(true);
455 return;
456 }
457
458 m_widget = w;
459 m_fadeIn = true;
460
461 OnStart(time, false);
462
463 if (m_widget)
464 {
465 m_alpha = m_widget.GetAlpha();
466 m_widget.SetAlpha(0);
467 m_widget.Show(true);
468 }
469
470 if (continue_)
471 {
472 m_time = m_alpha * time;
473 }
474 }
Widget m_widget
Definition tools.c:431
float m_alpha
Definition tools.c:433
bool m_fadeIn
Definition tools.c:432
float m_time
Definition tools.c:224
void OnStart(float duration, bool loop)
Definition tools.c:340

Перекрестные ссылки m_time и OnStart().

◆ FadeOut()

void FadeOut ( Widget w,
float time,
bool continue_ = false )
inlineprivate

Make "fade out" effect on Widget (transparency goes from 1.0 to 0.0)

Аргументы
wwidget which will be faded
timeduration of effect
continue- if True continue from current alpha value, otherwise always begin from 1.0 alpha
483 {
484 m_alpha = w.GetAlpha();
485
486 if (continue_ && m_alpha < 0.05)
487 {
488 w.SetAlpha(0);
489 w.Show(false);
490 return;
491 }
492
493 m_widget = w;
494 m_fadeIn = false;
495
496 OnStart(time, false);
497
498 if (m_widget && !continue_)
499 {
500 m_alpha = 1.0;
501 m_widget.SetAlpha(m_alpha);
502 m_widget.Show(true);
503 }
504
505 if (continue_)
506 {
507 m_time = (1.0 - m_alpha) * time;
508 }
509 }

Перекрестные ссылки m_alpha, m_time и OnStart().

◆ OnTimer() [1/2]

void OnTimer ( )
inlineprivate
512 {
513 if (m_widget)
514 {
515 if (m_fadeIn)
516 {
517 m_widget.SetAlpha(1);
518 }
519 else
520 {
521 m_widget.SetAlpha(0);
522 m_widget.Show(false);
523 }
524 }
525 }

Используется в Tick().

◆ OnTimer() [2/2]

void OnTimer ( )
inlineprotected
607 {
608 if (m_params)
609 {
610 GetGame().GameScript.CallFunctionParams(m_target, m_function, NULL, m_params);
611 m_params = NULL;
612 }
613 else
614 {
615 GetGame().GameScript.CallFunction(m_target, m_function, NULL, 0);
616 }
617 }
Managed m_target
Definition tools.c:580
ref Param m_params
Definition tools.c:582
string m_function
Definition tools.c:581
proto native CGame GetGame()

Перекрестные ссылки GetGame().

◆ OnUpdate()

void OnUpdate ( )
inlineprivate
528 {
529 float timeDiff = m_time / m_duration;
530 float progress;
531 if (m_widget)
532 {
533 if (m_fadeIn)
534 {
536 }
537 else
538 {
541 }
542
543 m_widget.SetAlpha(progress);
544 }
545 }
Definition EnMath.c:7
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 Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
float m_duration
Definition tools.c:223

Перекрестные ссылки Math::Clamp(), Math::Lerp(), m_duration и m_time.

Используется в Tick().

◆ Run()

void Run ( float duration,
Managed obj,
string fn_name,
Param params = NULL,
bool loop = false )
inlineprotected

Starts timer.

Аргументы
durationfunction is executed after this time (in seconds).
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)
loopwhen true, timer is looped endlessly and function is executed after every loop.
598 {
599 m_target = obj;
601
604 }

Перекрестные ссылки OnStart().

◆ Stop()

override void Stop ( )
inlineprotected
620 {
621 super.Stop();
622 m_params = NULL;
623 }

◆ Timer()

void Timer ( int category = CALL_CATEGORY_SYSTEM)
inlineprotected
585 {
587 }
void OnInit()
Definition AIBehaviour.c:49

Перекрестные ссылки OnInit().

◆ WidgetFadeTimer()

void WidgetFadeTimer ( )
inlineprivate
436 {
438 m_fadeIn = true;
439 }
const int CALL_CATEGORY_GUI
Definition tools.c:9

Перекрестные ссылки CALL_CATEGORY_GUI и OnInit().

Поля

◆ m_alpha

float m_alpha
private

Используется в FadeOut().

◆ m_fadeIn

bool m_fadeIn
private

◆ m_function

string m_function
protected

◆ m_params

ref Param m_params
protected

◆ m_target

Managed m_target
protected

◆ m_widget

Widget m_widget
private

Объявления и описания членов класса находятся в файле: