DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsole.c File Reference

Go to the source code of this file.

Classes

class  UIScriptedMenu
 
class  JsonHintsData
 

Functions

void OnWidgetScriptInit (Widget w)
 
override bool OnMouseEnter (Widget w, int x, int y)
 
override bool OnMouseLeave (Widget w, Widget enterW, int x, int y)
 
bool Tick ()
 
void DisplayHint (string message)
 
void HideHint ()
 
string GetMessage ()
 
void HoverSuccess ()
 
void HoverInterrupt ()
 

Variables

class ScriptConsole extends UIScriptedMenu HintMessage
 
Widget m_Root
 
float m_HoverTime
 
bool m_HoverSuccessTriggered
 
Widget m_CurrentHoverWidget
 
Widget m_HintWidgetRoot
 
ImageWidget m_HintWidgetBackground
 
RichTextWidget m_HintWidget
 
ref Timer m_Timer
 

Function Documentation

◆ DisplayHint()

void DisplayHint ( string message)
protected

Definition at line 493 of file ScriptConsole.c.

494 {
495 if (message)
496 {
497 m_HintWidgetRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console_hint.layout");
498 m_HintWidgetBackground = ImageWidget.Cast(m_HintWidgetRoot.FindAnyWidget("Background"));
499 m_HintWidget = RichTextWidget.Cast(m_HintWidgetRoot.FindAnyWidget("HintText"));
500
501 m_HintWidgetRoot.Show(true);
502 m_HintWidget.SetText(message);
503
504 int offsetX = 0;
505 int offsetY = 10;
506
507 int screenW, screenH;
509
510 int mouseX, mouseY;
512
513 float relativeX = mouseX / screenW;
514 float relativeY = mouseY / screenH;
515
516 int width, height;
517 m_HintWidget.GetTextSize(width, height);
518 if (relativeX > 0.8)
519 offsetX = -width - offsetX;
520 if (relativeY > 0.8)
522
524 m_HintWidgetBackground.SetScreenSize(width + 5, height + 5);
525
526 }
527 }
ImageWidget m_HintWidgetBackground
RichTextWidget m_HintWidget
Widget m_HintWidgetRoot
proto native CGame GetGame()
proto void GetScreenSize(out int x, out int y)
proto void GetMousePos(out int x, out int y)

References GetGame(), GetMousePos(), GetScreenSize(), m_HintWidget, m_HintWidgetBackground, and m_HintWidgetRoot.

Referenced by HoverSuccess().

◆ GetMessage()

string GetMessage ( )
protected

Definition at line 536 of file ScriptConsole.c.

537 {
538 return HintMessage;
539 }
class ScriptConsole extends UIScriptedMenu HintMessage

References HintMessage.

Referenced by HoverSuccess().

◆ HideHint()

void HideHint ( )
protected

Definition at line 529 of file ScriptConsole.c.

530 {
532 m_HintWidgetRoot.Show(false);
533 }

References m_HintWidgetRoot.

Referenced by HoverInterrupt().

◆ HoverInterrupt()

void HoverInterrupt ( )
protected

Definition at line 547 of file ScriptConsole.c.

548 {
549 m_Timer = null;
552 m_HoverTime = 0;
553 HideHint();
554 }
Widget m_CurrentHoverWidget
float m_HoverTime
bool m_HoverSuccessTriggered
ref Timer m_Timer
void HideHint()

References HideHint(), m_CurrentHoverWidget, m_HoverSuccessTriggered, m_HoverTime, and m_Timer.

Referenced by OnMouseLeave(), and Tick().

◆ HoverSuccess()

void HoverSuccess ( )
protected

Definition at line 541 of file ScriptConsole.c.

542 {
545 }
string GetMessage()
void DisplayHint(string message)

References DisplayHint(), GetMessage(), and m_HoverSuccessTriggered.

Referenced by Tick().

◆ OnMouseEnter()

override bool OnMouseEnter ( Widget w,
int x,
int y )
protected

Definition at line 465 of file ScriptConsole.c.

466 {
467 m_Timer = new Timer();
468 m_Timer.Run(0.1, this, "Tick", NULL, true);
469
471 return true;
472 }

References m_CurrentHoverWidget, and m_Timer.

◆ OnMouseLeave()

override bool OnMouseLeave ( Widget w,
Widget enterW,
int x,
int y )
protected

Definition at line 474 of file ScriptConsole.c.

475 {
477 return true;
478 }
void HoverInterrupt()

References HoverInterrupt().

◆ OnWidgetScriptInit()

void OnWidgetScriptInit ( Widget w)
protected

Definition at line 458 of file ScriptConsole.c.

459 {
460 m_Root = w;
461 m_Root.SetHandler(this);
462 m_Root.SetFlags(WidgetFlags.VEXACTPOS);
463 }
Widget m_Root
WidgetFlags
Definition EnWidgets.c:58

References m_Root.

◆ Tick()

bool Tick ( )
protected

Definition at line 480 of file ScriptConsole.c.

481 {
482 if (!m_Root.IsVisibleHierarchy())
485 {
486 m_HoverTime += 0.1;
487 if (m_HoverTime > 1)
488 HoverSuccess();
489 }
490 return true;
491 }
void HoverSuccess()

References HoverInterrupt(), HoverSuccess(), m_CurrentHoverWidget, m_HoverSuccessTriggered, m_HoverTime, and m_Root.

Variable Documentation

◆ HintMessage

class ScriptConsole extends UIScriptedMenu HintMessage

Referenced by GetMessage().

◆ m_CurrentHoverWidget

◆ m_HintWidget

RichTextWidget m_HintWidget
protected

Definition at line 454 of file ScriptConsole.c.

Referenced by UIScriptedMenu::DisplayHint(), and DisplayHint().

◆ m_HintWidgetBackground

ImageWidget m_HintWidgetBackground
protected

Definition at line 453 of file ScriptConsole.c.

Referenced by UIScriptedMenu::DisplayHint(), and DisplayHint().

◆ m_HintWidgetRoot

◆ m_HoverSuccessTriggered

bool m_HoverSuccessTriggered
protected

◆ m_HoverTime

float m_HoverTime
protected

◆ m_Root

Widget m_Root
protected

Definition at line 446 of file ScriptConsole.c.

◆ m_Timer

ref Timer m_Timer
protected

Definition at line 456 of file ScriptConsole.c.