Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл UiHintPanel.c

См. исходные тексты.

Структуры данных

class  ScriptedWidgetEventHandler
 map: item x vector(index, width, height) Подробнее...
 

Функции

class UiHintPanel extends ScriptedWidgetEventHandler Init (DayZGame game)
 
void UiHintPanel (Widget parent_widget)
 
void ~UiHintPanel ()
 
void LoadContentList ()
 
void BuildLayout (Widget parent_widget)
 
void PopulateLayout ()
 
void SetHintHeadline ()
 
void SetHintDescription ()
 
void SetHintImage ()
 
void SetHintPaging ()
 
void ShowRandomPage ()
 
void RandomizePageIndex ()
 
void ShowNextPage ()
 
void ShowPreviousPage ()
 
void StartSlideshow ()
 
void SlideshowThread ()
 
void StopSlideShow ()
 
void RestartSlideShow ()
 
override bool OnClick (Widget w, int x, int y, int button)
 
override bool OnMouseEnter (Widget w, int x, int y)
 
override bool OnMouseLeave (Widget w, Widget enterW, int x, int y)
 

Переменные

int m_SlideShowDelay = 25000
 
string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"
 
const string m_DataPath = "scripts/data/hints.json"
 
Widget m_RootFrame
 
Widget m_SpacerFrame
 
ButtonWidget m_UiLeftButton
 
ButtonWidget m_UiRightButton
 
RichTextWidget m_UiDescLabel
 
TextWidget m_UiHeadlineLabel
 
ImageWidget m_UiHintImage
 
TextWidget m_UiPageingLabel
 
ref array< ref HintPagem_ContentList
 
int m_PageIndex = int.MIN
 
DayZGame m_Game
 
bool m_Initialized
 
Widget m_ParentWidget
 
int m_PreviousRandomIndex = int.MIN
 

Функции

◆ BuildLayout()

void BuildLayout ( Widget parent_widget)
protected

◆ Init()

void Init ( DayZGame game)
296 {
297 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
298 super.Init(game);
299 }
string m_RootPath
Definition UiHintPanel.c:302
Definition EntityAI.c:95

◆ LoadContentList()

void LoadContentList ( )
protected
379{
380 #ifdef DIAG_DEVELOPER
381 static int m_ForcedIndex = -1;//only for debug purposes
382 #endif
383
384 // Const
385 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
386 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
387 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
388 // Widgets
389 protected Widget m_RootFrame;
390 protected Widget m_SpacerFrame;
395 protected ImageWidget m_UiHintImage;
397 // Data
399 protected int m_PageIndex = int.MIN;
400 protected DayZGame m_Game;
401 protected bool m_Initialized;
402 protected Widget m_ParentWidget;
403 protected int m_PreviousRandomIndex = int.MIN;
404
405 // ---------------------------------------------------------
406
407 // Constructor
409 {
410 DayZGame game = DayZGame.Cast(GetGame());
412 Init(game);
413 }
414 // Destructor
415 void ~UiHintPanel()
416 {
418
419 if(m_RootFrame)
420 m_RootFrame.Unlink();
421 }
422
423
424 void Init(DayZGame game)
425 {
426 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
427 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
428 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
429
430 if (m_Initialized)
431 return;
432 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
433 return;
434 m_Initialized = true;
435
436 m_Game = game;
437 // Load Json File
439 // If load successful
440 if (m_ContentList)
441 {
442 // Build the layout
444 // Get random page index
446 // Populate the layout with data
448 // Start the slideshow
450 }
451 else
452 ErrorEx("Could not create the hint panel. The data are missing!");
453 }
454
455 // ------------------------------------------------------
456
457 // Load content data from json file
458 protected void LoadContentList()
459 {
460 string errorMessage;
463 }
464
465 // Create and Build the layout
466 protected void BuildLayout(Widget parent_widget)
467 {
468 // Create the layout
469 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
470
471 if (m_RootFrame)
472 {
473 // Find Widgets
474 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
475 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
476 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
477 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
478 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
479 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
480 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
481 // Set handler
482 m_RootFrame.SetHandler(this);
483 }
484 }
485
486 // Populate the hint with content
487 protected void PopulateLayout()
488 {
489 if (m_RootFrame)
490 {
493 SetHintImage();
495 }
496 }
497
498 // -------------------------------------------
499 // Setters
500 protected void SetHintHeadline()
501 {
502 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
503 }
504 protected void SetHintDescription()
505 {
506 #ifdef DEVELOPER
507 //Print("showing contents for page "+m_PageIndex);
508 #endif
509 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
510 m_UiDescLabel.Update();
511 m_SpacerFrame.Update();
512 }
513 protected void SetHintImage()
514 {
515 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
516
517 // If there is an image
518 if (image_path)
519 {
520 // Show the widget
521 m_UiHintImage.Show(true);
522 // Set the image path
523 m_UiHintImage.LoadImageFile(0, image_path);
524 }
525 else
526 {
527 // Hide the widget
528 m_UiHintImage.Show(false);
529 }
530 }
531 protected void SetHintPaging()
532 {
534 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
535 }
536
537 void ShowRandomPage()
538 {
541 }
542
543 // Set a random page index
544 protected void RandomizePageIndex()
545 {
546 #ifdef DIAG_DEVELOPER
548 {
549 if (m_ForcedIndex != -1)
550 {
552 return;
553 }
554 }
555 #endif
556
557 Math.Randomize(m_Game.GetTime());
558 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
562
563 }
564 // Show next hint page by incrementing the page index.
565 protected void ShowNextPage()
566 {
567 // Update the page index
568 if ( m_PageIndex < m_ContentList.Count() - 1 )
569 {
570 m_PageIndex++;
571 }
572 else
573 {
574 m_PageIndex = 0;
575 }
576
577 //Update the hint page
579 }
580 // Show previous hint page by decreasing the page index.
581 protected void ShowPreviousPage()
582 {
583 // Update the page index
584 if ( m_PageIndex == 0 )
585 {
586 m_PageIndex = m_ContentList.Count() - 1;
587 }
588 else
589 {
590 m_PageIndex--;
591
592 }
593 //Update the hint page
595 }
596
597 // -------------------------------------------
598 // Slideshow
599
600 // Creates new slidshow thread
601 protected void StartSlideshow()
602 {
604 }
605 // Slidshow thread - run code
606 protected void SlideshowThread()
607 {
608 ShowNextPage();
609 }
610 // Stop the slide show
611 protected void StopSlideShow()
612 {
613 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
614 }
615 // Restart the slide show
616 protected void RestartSlideShow()
617 {
620 }
621
622 // ----------------------------------------
623 // Layout manipulation
624
625 override bool OnClick(Widget w, int x, int y, int button)
626 {
627 if (button == MouseState.LEFT)
628 {
629 switch (w)
630 {
631 case m_UiLeftButton:
632 {
634 return true;
635 }
636 case m_UiRightButton:
637 {
638 ShowNextPage();
639 return true;
640 }
641 }
642 }
643 return false;
644 }
645 override bool OnMouseEnter(Widget w, int x, int y)
646 {
647 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
648 {
650 return true;
651 }
652 return false;
653 }
654 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
655 {
656 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
657 {
659 return true;
660 }
661 return false;
662 }
663}
664
665// ---------------------------------------------------------------------------------------------------------
667{
668 override void Init(DayZGame game)
669 {
670 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
671 super.Init(game);
672 }
673}
override Widget Init()
Definition DayZGame.c:122
Icon x
Icon y
void RestartSlideShow()
Definition UiHintPanel.c:532
Widget m_RootFrame
Definition UiHintPanel.c:305
const string m_DataPath
Definition UiHintPanel.c:303
void BuildLayout(Widget parent_widget)
Definition UiHintPanel.c:382
void ShowNextPage()
Definition UiHintPanel.c:481
ImageWidget m_UiHintImage
Definition UiHintPanel.c:311
void PopulateLayout()
Definition UiHintPanel.c:403
int m_PageIndex
Definition UiHintPanel.c:315
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition UiHintPanel.c:570
ButtonWidget m_UiRightButton
Definition UiHintPanel.c:308
Widget m_ParentWidget
Definition UiHintPanel.c:318
bool m_Initialized
Definition UiHintPanel.c:317
void SetHintHeadline()
Definition UiHintPanel.c:416
void ShowRandomPage()
Definition UiHintPanel.c:453
ref array< ref HintPage > m_ContentList
Definition UiHintPanel.c:314
void LoadContentList()
Definition UiHintPanel.c:374
void RandomizePageIndex()
Definition UiHintPanel.c:460
void ~UiHintPanel()
Definition UiHintPanel.c:331
Widget m_SpacerFrame
Definition UiHintPanel.c:306
RichTextWidget m_UiDescLabel
Definition UiHintPanel.c:309
void ShowPreviousPage()
Definition UiHintPanel.c:497
void SetHintDescription()
Definition UiHintPanel.c:420
int m_SlideShowDelay
Definition UiHintPanel.c:301
TextWidget m_UiHeadlineLabel
Definition UiHintPanel.c:310
DayZGame m_Game
Definition UiHintPanel.c:316
void UiHintPanel(Widget parent_widget)
Definition UiHintPanel.c:324
TextWidget m_UiPageingLabel
Definition UiHintPanel.c:312
override bool OnMouseEnter(Widget w, int x, int y)
Definition UiHintPanel.c:561
ButtonWidget m_UiLeftButton
Definition UiHintPanel.c:307
void SetHintPaging()
Definition UiHintPanel.c:447
void StopSlideShow()
Definition UiHintPanel.c:527
void SetHintImage()
Definition UiHintPanel.c:429
override bool OnClick(Widget w, int x, int y, int button)
Definition UiHintPanel.c:541
void StartSlideshow()
Definition UiHintPanel.c:517
int m_PreviousRandomIndex
Definition UiHintPanel.c:319
void SlideshowThread()
Definition UiHintPanel.c:522
Definition EnDebug.c:233
Definition EnMath.c:7
Definition gameplay.c:316
Definition EnWidgets.c:220
Definition EnWidgets.c:190
proto native CGame GetGame()
enum ShapeType ErrorEx
static proto bool IsInitialized()
Checks if DiagMenu is initialized.
static proto int Randomize(int seed)
Sets the seed for the random number generator.
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 int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
MouseState
Definition EnSystem.c:311
const int CALL_CATEGORY_GUI
Definition tools.c:9

◆ OnClick()

override bool OnClick ( Widget w,
int x,
int y,
int button )
protected
546{
547 #ifdef DIAG_DEVELOPER
548 static int m_ForcedIndex = -1;//only for debug purposes
549 #endif
550
551 // Const
552 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
553 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
554 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
555 // Widgets
556 protected Widget m_RootFrame;
557 protected Widget m_SpacerFrame;
562 protected ImageWidget m_UiHintImage;
564 // Data
566 protected int m_PageIndex = int.MIN;
567 protected DayZGame m_Game;
568 protected bool m_Initialized;
569 protected Widget m_ParentWidget;
570 protected int m_PreviousRandomIndex = int.MIN;
571
572 // ---------------------------------------------------------
573
574 // Constructor
576 {
577 DayZGame game = DayZGame.Cast(GetGame());
579 Init(game);
580 }
581 // Destructor
582 void ~UiHintPanel()
583 {
585
586 if(m_RootFrame)
587 m_RootFrame.Unlink();
588 }
589
590
591 void Init(DayZGame game)
592 {
593 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
594 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
595 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
596
597 if (m_Initialized)
598 return;
599 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
600 return;
601 m_Initialized = true;
602
603 m_Game = game;
604 // Load Json File
606 // If load successful
607 if (m_ContentList)
608 {
609 // Build the layout
611 // Get random page index
613 // Populate the layout with data
615 // Start the slideshow
617 }
618 else
619 ErrorEx("Could not create the hint panel. The data are missing!");
620 }
621
622 // ------------------------------------------------------
623
624 // Load content data from json file
625 protected void LoadContentList()
626 {
627 string errorMessage;
630 }
631
632 // Create and Build the layout
633 protected void BuildLayout(Widget parent_widget)
634 {
635 // Create the layout
636 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
637
638 if (m_RootFrame)
639 {
640 // Find Widgets
641 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
642 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
643 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
644 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
645 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
646 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
647 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
648 // Set handler
649 m_RootFrame.SetHandler(this);
650 }
651 }
652
653 // Populate the hint with content
654 protected void PopulateLayout()
655 {
656 if (m_RootFrame)
657 {
660 SetHintImage();
662 }
663 }
664
665 // -------------------------------------------
666 // Setters
667 protected void SetHintHeadline()
668 {
669 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
670 }
671 protected void SetHintDescription()
672 {
673 #ifdef DEVELOPER
674 //Print("showing contents for page "+m_PageIndex);
675 #endif
676 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
677 m_UiDescLabel.Update();
678 m_SpacerFrame.Update();
679 }
680 protected void SetHintImage()
681 {
682 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
683
684 // If there is an image
685 if (image_path)
686 {
687 // Show the widget
688 m_UiHintImage.Show(true);
689 // Set the image path
690 m_UiHintImage.LoadImageFile(0, image_path);
691 }
692 else
693 {
694 // Hide the widget
695 m_UiHintImage.Show(false);
696 }
697 }
698 protected void SetHintPaging()
699 {
701 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
702 }
703
704 void ShowRandomPage()
705 {
708 }
709
710 // Set a random page index
711 protected void RandomizePageIndex()
712 {
713 #ifdef DIAG_DEVELOPER
715 {
716 if (m_ForcedIndex != -1)
717 {
719 return;
720 }
721 }
722 #endif
723
724 Math.Randomize(m_Game.GetTime());
725 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
729
730 }
731 // Show next hint page by incrementing the page index.
732 protected void ShowNextPage()
733 {
734 // Update the page index
735 if ( m_PageIndex < m_ContentList.Count() - 1 )
736 {
737 m_PageIndex++;
738 }
739 else
740 {
741 m_PageIndex = 0;
742 }
743
744 //Update the hint page
746 }
747 // Show previous hint page by decreasing the page index.
748 protected void ShowPreviousPage()
749 {
750 // Update the page index
751 if ( m_PageIndex == 0 )
752 {
753 m_PageIndex = m_ContentList.Count() - 1;
754 }
755 else
756 {
757 m_PageIndex--;
758
759 }
760 //Update the hint page
762 }
763
764 // -------------------------------------------
765 // Slideshow
766
767 // Creates new slidshow thread
768 protected void StartSlideshow()
769 {
771 }
772 // Slidshow thread - run code
773 protected void SlideshowThread()
774 {
775 ShowNextPage();
776 }
777 // Stop the slide show
778 protected void StopSlideShow()
779 {
780 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
781 }
782 // Restart the slide show
783 protected void RestartSlideShow()
784 {
787 }
788
789 // ----------------------------------------
790 // Layout manipulation
791
792 override bool OnClick(Widget w, int x, int y, int button)
793 {
794 if (button == MouseState.LEFT)
795 {
796 switch (w)
797 {
798 case m_UiLeftButton:
799 {
801 return true;
802 }
803 case m_UiRightButton:
804 {
805 ShowNextPage();
806 return true;
807 }
808 }
809 }
810 return false;
811 }
812 override bool OnMouseEnter(Widget w, int x, int y)
813 {
814 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
815 {
817 return true;
818 }
819 return false;
820 }
821 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
822 {
823 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
824 {
826 return true;
827 }
828 return false;
829 }
830}
831
832// ---------------------------------------------------------------------------------------------------------
834{
835 override void Init(DayZGame game)
836 {
837 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
838 super.Init(game);
839 }
840}

◆ OnMouseEnter()

override bool OnMouseEnter ( Widget w,
int x,
int y )
protected
566{
567 #ifdef DIAG_DEVELOPER
568 static int m_ForcedIndex = -1;//only for debug purposes
569 #endif
570
571 // Const
572 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
573 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
574 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
575 // Widgets
576 protected Widget m_RootFrame;
577 protected Widget m_SpacerFrame;
582 protected ImageWidget m_UiHintImage;
584 // Data
586 protected int m_PageIndex = int.MIN;
587 protected DayZGame m_Game;
588 protected bool m_Initialized;
589 protected Widget m_ParentWidget;
590 protected int m_PreviousRandomIndex = int.MIN;
591
592 // ---------------------------------------------------------
593
594 // Constructor
596 {
597 DayZGame game = DayZGame.Cast(GetGame());
599 Init(game);
600 }
601 // Destructor
602 void ~UiHintPanel()
603 {
605
606 if(m_RootFrame)
607 m_RootFrame.Unlink();
608 }
609
610
611 void Init(DayZGame game)
612 {
613 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
614 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
615 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
616
617 if (m_Initialized)
618 return;
619 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
620 return;
621 m_Initialized = true;
622
623 m_Game = game;
624 // Load Json File
626 // If load successful
627 if (m_ContentList)
628 {
629 // Build the layout
631 // Get random page index
633 // Populate the layout with data
635 // Start the slideshow
637 }
638 else
639 ErrorEx("Could not create the hint panel. The data are missing!");
640 }
641
642 // ------------------------------------------------------
643
644 // Load content data from json file
645 protected void LoadContentList()
646 {
647 string errorMessage;
650 }
651
652 // Create and Build the layout
653 protected void BuildLayout(Widget parent_widget)
654 {
655 // Create the layout
656 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
657
658 if (m_RootFrame)
659 {
660 // Find Widgets
661 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
662 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
663 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
664 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
665 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
666 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
667 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
668 // Set handler
669 m_RootFrame.SetHandler(this);
670 }
671 }
672
673 // Populate the hint with content
674 protected void PopulateLayout()
675 {
676 if (m_RootFrame)
677 {
680 SetHintImage();
682 }
683 }
684
685 // -------------------------------------------
686 // Setters
687 protected void SetHintHeadline()
688 {
689 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
690 }
691 protected void SetHintDescription()
692 {
693 #ifdef DEVELOPER
694 //Print("showing contents for page "+m_PageIndex);
695 #endif
696 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
697 m_UiDescLabel.Update();
698 m_SpacerFrame.Update();
699 }
700 protected void SetHintImage()
701 {
702 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
703
704 // If there is an image
705 if (image_path)
706 {
707 // Show the widget
708 m_UiHintImage.Show(true);
709 // Set the image path
710 m_UiHintImage.LoadImageFile(0, image_path);
711 }
712 else
713 {
714 // Hide the widget
715 m_UiHintImage.Show(false);
716 }
717 }
718 protected void SetHintPaging()
719 {
721 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
722 }
723
724 void ShowRandomPage()
725 {
728 }
729
730 // Set a random page index
731 protected void RandomizePageIndex()
732 {
733 #ifdef DIAG_DEVELOPER
735 {
736 if (m_ForcedIndex != -1)
737 {
739 return;
740 }
741 }
742 #endif
743
744 Math.Randomize(m_Game.GetTime());
745 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
749
750 }
751 // Show next hint page by incrementing the page index.
752 protected void ShowNextPage()
753 {
754 // Update the page index
755 if ( m_PageIndex < m_ContentList.Count() - 1 )
756 {
757 m_PageIndex++;
758 }
759 else
760 {
761 m_PageIndex = 0;
762 }
763
764 //Update the hint page
766 }
767 // Show previous hint page by decreasing the page index.
768 protected void ShowPreviousPage()
769 {
770 // Update the page index
771 if ( m_PageIndex == 0 )
772 {
773 m_PageIndex = m_ContentList.Count() - 1;
774 }
775 else
776 {
777 m_PageIndex--;
778
779 }
780 //Update the hint page
782 }
783
784 // -------------------------------------------
785 // Slideshow
786
787 // Creates new slidshow thread
788 protected void StartSlideshow()
789 {
791 }
792 // Slidshow thread - run code
793 protected void SlideshowThread()
794 {
795 ShowNextPage();
796 }
797 // Stop the slide show
798 protected void StopSlideShow()
799 {
800 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
801 }
802 // Restart the slide show
803 protected void RestartSlideShow()
804 {
807 }
808
809 // ----------------------------------------
810 // Layout manipulation
811
812 override bool OnClick(Widget w, int x, int y, int button)
813 {
814 if (button == MouseState.LEFT)
815 {
816 switch (w)
817 {
818 case m_UiLeftButton:
819 {
821 return true;
822 }
823 case m_UiRightButton:
824 {
825 ShowNextPage();
826 return true;
827 }
828 }
829 }
830 return false;
831 }
832 override bool OnMouseEnter(Widget w, int x, int y)
833 {
834 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
835 {
837 return true;
838 }
839 return false;
840 }
841 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
842 {
843 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
844 {
846 return true;
847 }
848 return false;
849 }
850}
851
852// ---------------------------------------------------------------------------------------------------------
854{
855 override void Init(DayZGame game)
856 {
857 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
858 super.Init(game);
859 }
860}

◆ OnMouseLeave()

override bool OnMouseLeave ( Widget w,
Widget enterW,
int x,
int y )
protected
575{
576 #ifdef DIAG_DEVELOPER
577 static int m_ForcedIndex = -1;//only for debug purposes
578 #endif
579
580 // Const
581 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
582 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
583 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
584 // Widgets
585 protected Widget m_RootFrame;
586 protected Widget m_SpacerFrame;
591 protected ImageWidget m_UiHintImage;
593 // Data
595 protected int m_PageIndex = int.MIN;
596 protected DayZGame m_Game;
597 protected bool m_Initialized;
598 protected Widget m_ParentWidget;
599 protected int m_PreviousRandomIndex = int.MIN;
600
601 // ---------------------------------------------------------
602
603 // Constructor
605 {
606 DayZGame game = DayZGame.Cast(GetGame());
608 Init(game);
609 }
610 // Destructor
611 void ~UiHintPanel()
612 {
614
615 if(m_RootFrame)
616 m_RootFrame.Unlink();
617 }
618
619
620 void Init(DayZGame game)
621 {
622 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
623 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
624 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
625
626 if (m_Initialized)
627 return;
628 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
629 return;
630 m_Initialized = true;
631
632 m_Game = game;
633 // Load Json File
635 // If load successful
636 if (m_ContentList)
637 {
638 // Build the layout
640 // Get random page index
642 // Populate the layout with data
644 // Start the slideshow
646 }
647 else
648 ErrorEx("Could not create the hint panel. The data are missing!");
649 }
650
651 // ------------------------------------------------------
652
653 // Load content data from json file
654 protected void LoadContentList()
655 {
656 string errorMessage;
659 }
660
661 // Create and Build the layout
662 protected void BuildLayout(Widget parent_widget)
663 {
664 // Create the layout
665 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
666
667 if (m_RootFrame)
668 {
669 // Find Widgets
670 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
671 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
672 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
673 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
674 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
675 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
676 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
677 // Set handler
678 m_RootFrame.SetHandler(this);
679 }
680 }
681
682 // Populate the hint with content
683 protected void PopulateLayout()
684 {
685 if (m_RootFrame)
686 {
689 SetHintImage();
691 }
692 }
693
694 // -------------------------------------------
695 // Setters
696 protected void SetHintHeadline()
697 {
698 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
699 }
700 protected void SetHintDescription()
701 {
702 #ifdef DEVELOPER
703 //Print("showing contents for page "+m_PageIndex);
704 #endif
705 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
706 m_UiDescLabel.Update();
707 m_SpacerFrame.Update();
708 }
709 protected void SetHintImage()
710 {
711 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
712
713 // If there is an image
714 if (image_path)
715 {
716 // Show the widget
717 m_UiHintImage.Show(true);
718 // Set the image path
719 m_UiHintImage.LoadImageFile(0, image_path);
720 }
721 else
722 {
723 // Hide the widget
724 m_UiHintImage.Show(false);
725 }
726 }
727 protected void SetHintPaging()
728 {
730 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
731 }
732
733 void ShowRandomPage()
734 {
737 }
738
739 // Set a random page index
740 protected void RandomizePageIndex()
741 {
742 #ifdef DIAG_DEVELOPER
744 {
745 if (m_ForcedIndex != -1)
746 {
748 return;
749 }
750 }
751 #endif
752
753 Math.Randomize(m_Game.GetTime());
754 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
758
759 }
760 // Show next hint page by incrementing the page index.
761 protected void ShowNextPage()
762 {
763 // Update the page index
764 if ( m_PageIndex < m_ContentList.Count() - 1 )
765 {
766 m_PageIndex++;
767 }
768 else
769 {
770 m_PageIndex = 0;
771 }
772
773 //Update the hint page
775 }
776 // Show previous hint page by decreasing the page index.
777 protected void ShowPreviousPage()
778 {
779 // Update the page index
780 if ( m_PageIndex == 0 )
781 {
782 m_PageIndex = m_ContentList.Count() - 1;
783 }
784 else
785 {
786 m_PageIndex--;
787
788 }
789 //Update the hint page
791 }
792
793 // -------------------------------------------
794 // Slideshow
795
796 // Creates new slidshow thread
797 protected void StartSlideshow()
798 {
800 }
801 // Slidshow thread - run code
802 protected void SlideshowThread()
803 {
804 ShowNextPage();
805 }
806 // Stop the slide show
807 protected void StopSlideShow()
808 {
809 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
810 }
811 // Restart the slide show
812 protected void RestartSlideShow()
813 {
816 }
817
818 // ----------------------------------------
819 // Layout manipulation
820
821 override bool OnClick(Widget w, int x, int y, int button)
822 {
823 if (button == MouseState.LEFT)
824 {
825 switch (w)
826 {
827 case m_UiLeftButton:
828 {
830 return true;
831 }
832 case m_UiRightButton:
833 {
834 ShowNextPage();
835 return true;
836 }
837 }
838 }
839 return false;
840 }
841 override bool OnMouseEnter(Widget w, int x, int y)
842 {
843 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
844 {
846 return true;
847 }
848 return false;
849 }
850 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
851 {
852 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
853 {
855 return true;
856 }
857 return false;
858 }
859}
860
861// ---------------------------------------------------------------------------------------------------------
863{
864 override void Init(DayZGame game)
865 {
866 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
867 super.Init(game);
868 }
869}

◆ PopulateLayout()

void PopulateLayout ( )
protected
408{
409 #ifdef DIAG_DEVELOPER
410 static int m_ForcedIndex = -1;//only for debug purposes
411 #endif
412
413 // Const
414 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
415 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
416 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
417 // Widgets
418 protected Widget m_RootFrame;
419 protected Widget m_SpacerFrame;
424 protected ImageWidget m_UiHintImage;
426 // Data
428 protected int m_PageIndex = int.MIN;
429 protected DayZGame m_Game;
430 protected bool m_Initialized;
431 protected Widget m_ParentWidget;
432 protected int m_PreviousRandomIndex = int.MIN;
433
434 // ---------------------------------------------------------
435
436 // Constructor
438 {
439 DayZGame game = DayZGame.Cast(GetGame());
441 Init(game);
442 }
443 // Destructor
444 void ~UiHintPanel()
445 {
447
448 if(m_RootFrame)
449 m_RootFrame.Unlink();
450 }
451
452
453 void Init(DayZGame game)
454 {
455 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
456 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
457 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
458
459 if (m_Initialized)
460 return;
461 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
462 return;
463 m_Initialized = true;
464
465 m_Game = game;
466 // Load Json File
468 // If load successful
469 if (m_ContentList)
470 {
471 // Build the layout
473 // Get random page index
475 // Populate the layout with data
477 // Start the slideshow
479 }
480 else
481 ErrorEx("Could not create the hint panel. The data are missing!");
482 }
483
484 // ------------------------------------------------------
485
486 // Load content data from json file
487 protected void LoadContentList()
488 {
489 string errorMessage;
492 }
493
494 // Create and Build the layout
495 protected void BuildLayout(Widget parent_widget)
496 {
497 // Create the layout
498 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
499
500 if (m_RootFrame)
501 {
502 // Find Widgets
503 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
504 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
505 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
506 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
507 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
508 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
509 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
510 // Set handler
511 m_RootFrame.SetHandler(this);
512 }
513 }
514
515 // Populate the hint with content
516 protected void PopulateLayout()
517 {
518 if (m_RootFrame)
519 {
522 SetHintImage();
524 }
525 }
526
527 // -------------------------------------------
528 // Setters
529 protected void SetHintHeadline()
530 {
531 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
532 }
533 protected void SetHintDescription()
534 {
535 #ifdef DEVELOPER
536 //Print("showing contents for page "+m_PageIndex);
537 #endif
538 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
539 m_UiDescLabel.Update();
540 m_SpacerFrame.Update();
541 }
542 protected void SetHintImage()
543 {
544 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
545
546 // If there is an image
547 if (image_path)
548 {
549 // Show the widget
550 m_UiHintImage.Show(true);
551 // Set the image path
552 m_UiHintImage.LoadImageFile(0, image_path);
553 }
554 else
555 {
556 // Hide the widget
557 m_UiHintImage.Show(false);
558 }
559 }
560 protected void SetHintPaging()
561 {
563 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
564 }
565
566 void ShowRandomPage()
567 {
570 }
571
572 // Set a random page index
573 protected void RandomizePageIndex()
574 {
575 #ifdef DIAG_DEVELOPER
577 {
578 if (m_ForcedIndex != -1)
579 {
581 return;
582 }
583 }
584 #endif
585
586 Math.Randomize(m_Game.GetTime());
587 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
591
592 }
593 // Show next hint page by incrementing the page index.
594 protected void ShowNextPage()
595 {
596 // Update the page index
597 if ( m_PageIndex < m_ContentList.Count() - 1 )
598 {
599 m_PageIndex++;
600 }
601 else
602 {
603 m_PageIndex = 0;
604 }
605
606 //Update the hint page
608 }
609 // Show previous hint page by decreasing the page index.
610 protected void ShowPreviousPage()
611 {
612 // Update the page index
613 if ( m_PageIndex == 0 )
614 {
615 m_PageIndex = m_ContentList.Count() - 1;
616 }
617 else
618 {
619 m_PageIndex--;
620
621 }
622 //Update the hint page
624 }
625
626 // -------------------------------------------
627 // Slideshow
628
629 // Creates new slidshow thread
630 protected void StartSlideshow()
631 {
633 }
634 // Slidshow thread - run code
635 protected void SlideshowThread()
636 {
637 ShowNextPage();
638 }
639 // Stop the slide show
640 protected void StopSlideShow()
641 {
642 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
643 }
644 // Restart the slide show
645 protected void RestartSlideShow()
646 {
649 }
650
651 // ----------------------------------------
652 // Layout manipulation
653
654 override bool OnClick(Widget w, int x, int y, int button)
655 {
656 if (button == MouseState.LEFT)
657 {
658 switch (w)
659 {
660 case m_UiLeftButton:
661 {
663 return true;
664 }
665 case m_UiRightButton:
666 {
667 ShowNextPage();
668 return true;
669 }
670 }
671 }
672 return false;
673 }
674 override bool OnMouseEnter(Widget w, int x, int y)
675 {
676 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
677 {
679 return true;
680 }
681 return false;
682 }
683 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
684 {
685 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
686 {
688 return true;
689 }
690 return false;
691 }
692}
693
694// ---------------------------------------------------------------------------------------------------------
696{
697 override void Init(DayZGame game)
698 {
699 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
700 super.Init(game);
701 }
702}

◆ RandomizePageIndex()

void RandomizePageIndex ( )
protected
465{
466 #ifdef DIAG_DEVELOPER
467 static int m_ForcedIndex = -1;//only for debug purposes
468 #endif
469
470 // Const
471 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
472 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
473 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
474 // Widgets
475 protected Widget m_RootFrame;
476 protected Widget m_SpacerFrame;
481 protected ImageWidget m_UiHintImage;
483 // Data
485 protected int m_PageIndex = int.MIN;
486 protected DayZGame m_Game;
487 protected bool m_Initialized;
488 protected Widget m_ParentWidget;
489 protected int m_PreviousRandomIndex = int.MIN;
490
491 // ---------------------------------------------------------
492
493 // Constructor
495 {
496 DayZGame game = DayZGame.Cast(GetGame());
498 Init(game);
499 }
500 // Destructor
501 void ~UiHintPanel()
502 {
504
505 if(m_RootFrame)
506 m_RootFrame.Unlink();
507 }
508
509
510 void Init(DayZGame game)
511 {
512 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
513 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
514 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
515
516 if (m_Initialized)
517 return;
518 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
519 return;
520 m_Initialized = true;
521
522 m_Game = game;
523 // Load Json File
525 // If load successful
526 if (m_ContentList)
527 {
528 // Build the layout
530 // Get random page index
532 // Populate the layout with data
534 // Start the slideshow
536 }
537 else
538 ErrorEx("Could not create the hint panel. The data are missing!");
539 }
540
541 // ------------------------------------------------------
542
543 // Load content data from json file
544 protected void LoadContentList()
545 {
546 string errorMessage;
549 }
550
551 // Create and Build the layout
552 protected void BuildLayout(Widget parent_widget)
553 {
554 // Create the layout
555 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
556
557 if (m_RootFrame)
558 {
559 // Find Widgets
560 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
561 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
562 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
563 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
564 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
565 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
566 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
567 // Set handler
568 m_RootFrame.SetHandler(this);
569 }
570 }
571
572 // Populate the hint with content
573 protected void PopulateLayout()
574 {
575 if (m_RootFrame)
576 {
579 SetHintImage();
581 }
582 }
583
584 // -------------------------------------------
585 // Setters
586 protected void SetHintHeadline()
587 {
588 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
589 }
590 protected void SetHintDescription()
591 {
592 #ifdef DEVELOPER
593 //Print("showing contents for page "+m_PageIndex);
594 #endif
595 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
596 m_UiDescLabel.Update();
597 m_SpacerFrame.Update();
598 }
599 protected void SetHintImage()
600 {
601 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
602
603 // If there is an image
604 if (image_path)
605 {
606 // Show the widget
607 m_UiHintImage.Show(true);
608 // Set the image path
609 m_UiHintImage.LoadImageFile(0, image_path);
610 }
611 else
612 {
613 // Hide the widget
614 m_UiHintImage.Show(false);
615 }
616 }
617 protected void SetHintPaging()
618 {
620 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
621 }
622
623 void ShowRandomPage()
624 {
627 }
628
629 // Set a random page index
630 protected void RandomizePageIndex()
631 {
632 #ifdef DIAG_DEVELOPER
634 {
635 if (m_ForcedIndex != -1)
636 {
638 return;
639 }
640 }
641 #endif
642
643 Math.Randomize(m_Game.GetTime());
644 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
648
649 }
650 // Show next hint page by incrementing the page index.
651 protected void ShowNextPage()
652 {
653 // Update the page index
654 if ( m_PageIndex < m_ContentList.Count() - 1 )
655 {
656 m_PageIndex++;
657 }
658 else
659 {
660 m_PageIndex = 0;
661 }
662
663 //Update the hint page
665 }
666 // Show previous hint page by decreasing the page index.
667 protected void ShowPreviousPage()
668 {
669 // Update the page index
670 if ( m_PageIndex == 0 )
671 {
672 m_PageIndex = m_ContentList.Count() - 1;
673 }
674 else
675 {
676 m_PageIndex--;
677
678 }
679 //Update the hint page
681 }
682
683 // -------------------------------------------
684 // Slideshow
685
686 // Creates new slidshow thread
687 protected void StartSlideshow()
688 {
690 }
691 // Slidshow thread - run code
692 protected void SlideshowThread()
693 {
694 ShowNextPage();
695 }
696 // Stop the slide show
697 protected void StopSlideShow()
698 {
699 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
700 }
701 // Restart the slide show
702 protected void RestartSlideShow()
703 {
706 }
707
708 // ----------------------------------------
709 // Layout manipulation
710
711 override bool OnClick(Widget w, int x, int y, int button)
712 {
713 if (button == MouseState.LEFT)
714 {
715 switch (w)
716 {
717 case m_UiLeftButton:
718 {
720 return true;
721 }
722 case m_UiRightButton:
723 {
724 ShowNextPage();
725 return true;
726 }
727 }
728 }
729 return false;
730 }
731 override bool OnMouseEnter(Widget w, int x, int y)
732 {
733 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
734 {
736 return true;
737 }
738 return false;
739 }
740 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
741 {
742 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
743 {
745 return true;
746 }
747 return false;
748 }
749}
750
751// ---------------------------------------------------------------------------------------------------------
753{
754 override void Init(DayZGame game)
755 {
756 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
757 super.Init(game);
758 }
759}

◆ RestartSlideShow()

void RestartSlideShow ( )
protected
537{
538 #ifdef DIAG_DEVELOPER
539 static int m_ForcedIndex = -1;//only for debug purposes
540 #endif
541
542 // Const
543 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
544 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
545 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
546 // Widgets
547 protected Widget m_RootFrame;
548 protected Widget m_SpacerFrame;
553 protected ImageWidget m_UiHintImage;
555 // Data
557 protected int m_PageIndex = int.MIN;
558 protected DayZGame m_Game;
559 protected bool m_Initialized;
560 protected Widget m_ParentWidget;
561 protected int m_PreviousRandomIndex = int.MIN;
562
563 // ---------------------------------------------------------
564
565 // Constructor
567 {
568 DayZGame game = DayZGame.Cast(GetGame());
570 Init(game);
571 }
572 // Destructor
573 void ~UiHintPanel()
574 {
576
577 if(m_RootFrame)
578 m_RootFrame.Unlink();
579 }
580
581
582 void Init(DayZGame game)
583 {
584 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
585 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
586 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
587
588 if (m_Initialized)
589 return;
590 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
591 return;
592 m_Initialized = true;
593
594 m_Game = game;
595 // Load Json File
597 // If load successful
598 if (m_ContentList)
599 {
600 // Build the layout
602 // Get random page index
604 // Populate the layout with data
606 // Start the slideshow
608 }
609 else
610 ErrorEx("Could not create the hint panel. The data are missing!");
611 }
612
613 // ------------------------------------------------------
614
615 // Load content data from json file
616 protected void LoadContentList()
617 {
618 string errorMessage;
621 }
622
623 // Create and Build the layout
624 protected void BuildLayout(Widget parent_widget)
625 {
626 // Create the layout
627 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
628
629 if (m_RootFrame)
630 {
631 // Find Widgets
632 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
633 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
634 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
635 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
636 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
637 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
638 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
639 // Set handler
640 m_RootFrame.SetHandler(this);
641 }
642 }
643
644 // Populate the hint with content
645 protected void PopulateLayout()
646 {
647 if (m_RootFrame)
648 {
651 SetHintImage();
653 }
654 }
655
656 // -------------------------------------------
657 // Setters
658 protected void SetHintHeadline()
659 {
660 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
661 }
662 protected void SetHintDescription()
663 {
664 #ifdef DEVELOPER
665 //Print("showing contents for page "+m_PageIndex);
666 #endif
667 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
668 m_UiDescLabel.Update();
669 m_SpacerFrame.Update();
670 }
671 protected void SetHintImage()
672 {
673 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
674
675 // If there is an image
676 if (image_path)
677 {
678 // Show the widget
679 m_UiHintImage.Show(true);
680 // Set the image path
681 m_UiHintImage.LoadImageFile(0, image_path);
682 }
683 else
684 {
685 // Hide the widget
686 m_UiHintImage.Show(false);
687 }
688 }
689 protected void SetHintPaging()
690 {
692 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
693 }
694
695 void ShowRandomPage()
696 {
699 }
700
701 // Set a random page index
702 protected void RandomizePageIndex()
703 {
704 #ifdef DIAG_DEVELOPER
706 {
707 if (m_ForcedIndex != -1)
708 {
710 return;
711 }
712 }
713 #endif
714
715 Math.Randomize(m_Game.GetTime());
716 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
720
721 }
722 // Show next hint page by incrementing the page index.
723 protected void ShowNextPage()
724 {
725 // Update the page index
726 if ( m_PageIndex < m_ContentList.Count() - 1 )
727 {
728 m_PageIndex++;
729 }
730 else
731 {
732 m_PageIndex = 0;
733 }
734
735 //Update the hint page
737 }
738 // Show previous hint page by decreasing the page index.
739 protected void ShowPreviousPage()
740 {
741 // Update the page index
742 if ( m_PageIndex == 0 )
743 {
744 m_PageIndex = m_ContentList.Count() - 1;
745 }
746 else
747 {
748 m_PageIndex--;
749
750 }
751 //Update the hint page
753 }
754
755 // -------------------------------------------
756 // Slideshow
757
758 // Creates new slidshow thread
759 protected void StartSlideshow()
760 {
762 }
763 // Slidshow thread - run code
764 protected void SlideshowThread()
765 {
766 ShowNextPage();
767 }
768 // Stop the slide show
769 protected void StopSlideShow()
770 {
771 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
772 }
773 // Restart the slide show
774 protected void RestartSlideShow()
775 {
778 }
779
780 // ----------------------------------------
781 // Layout manipulation
782
783 override bool OnClick(Widget w, int x, int y, int button)
784 {
785 if (button == MouseState.LEFT)
786 {
787 switch (w)
788 {
789 case m_UiLeftButton:
790 {
792 return true;
793 }
794 case m_UiRightButton:
795 {
796 ShowNextPage();
797 return true;
798 }
799 }
800 }
801 return false;
802 }
803 override bool OnMouseEnter(Widget w, int x, int y)
804 {
805 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
806 {
808 return true;
809 }
810 return false;
811 }
812 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
813 {
814 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
815 {
817 return true;
818 }
819 return false;
820 }
821}
822
823// ---------------------------------------------------------------------------------------------------------
825{
826 override void Init(DayZGame game)
827 {
828 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
829 super.Init(game);
830 }
831}

◆ SetHintDescription()

void SetHintDescription ( )
protected
425{
426 #ifdef DIAG_DEVELOPER
427 static int m_ForcedIndex = -1;//only for debug purposes
428 #endif
429
430 // Const
431 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
432 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
433 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
434 // Widgets
435 protected Widget m_RootFrame;
436 protected Widget m_SpacerFrame;
441 protected ImageWidget m_UiHintImage;
443 // Data
445 protected int m_PageIndex = int.MIN;
446 protected DayZGame m_Game;
447 protected bool m_Initialized;
448 protected Widget m_ParentWidget;
449 protected int m_PreviousRandomIndex = int.MIN;
450
451 // ---------------------------------------------------------
452
453 // Constructor
455 {
456 DayZGame game = DayZGame.Cast(GetGame());
458 Init(game);
459 }
460 // Destructor
461 void ~UiHintPanel()
462 {
464
465 if(m_RootFrame)
466 m_RootFrame.Unlink();
467 }
468
469
470 void Init(DayZGame game)
471 {
472 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
473 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
474 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
475
476 if (m_Initialized)
477 return;
478 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
479 return;
480 m_Initialized = true;
481
482 m_Game = game;
483 // Load Json File
485 // If load successful
486 if (m_ContentList)
487 {
488 // Build the layout
490 // Get random page index
492 // Populate the layout with data
494 // Start the slideshow
496 }
497 else
498 ErrorEx("Could not create the hint panel. The data are missing!");
499 }
500
501 // ------------------------------------------------------
502
503 // Load content data from json file
504 protected void LoadContentList()
505 {
506 string errorMessage;
509 }
510
511 // Create and Build the layout
512 protected void BuildLayout(Widget parent_widget)
513 {
514 // Create the layout
515 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
516
517 if (m_RootFrame)
518 {
519 // Find Widgets
520 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
521 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
522 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
523 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
524 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
525 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
526 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
527 // Set handler
528 m_RootFrame.SetHandler(this);
529 }
530 }
531
532 // Populate the hint with content
533 protected void PopulateLayout()
534 {
535 if (m_RootFrame)
536 {
539 SetHintImage();
541 }
542 }
543
544 // -------------------------------------------
545 // Setters
546 protected void SetHintHeadline()
547 {
548 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
549 }
550 protected void SetHintDescription()
551 {
552 #ifdef DEVELOPER
553 //Print("showing contents for page "+m_PageIndex);
554 #endif
555 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
556 m_UiDescLabel.Update();
557 m_SpacerFrame.Update();
558 }
559 protected void SetHintImage()
560 {
561 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
562
563 // If there is an image
564 if (image_path)
565 {
566 // Show the widget
567 m_UiHintImage.Show(true);
568 // Set the image path
569 m_UiHintImage.LoadImageFile(0, image_path);
570 }
571 else
572 {
573 // Hide the widget
574 m_UiHintImage.Show(false);
575 }
576 }
577 protected void SetHintPaging()
578 {
580 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
581 }
582
583 void ShowRandomPage()
584 {
587 }
588
589 // Set a random page index
590 protected void RandomizePageIndex()
591 {
592 #ifdef DIAG_DEVELOPER
594 {
595 if (m_ForcedIndex != -1)
596 {
598 return;
599 }
600 }
601 #endif
602
603 Math.Randomize(m_Game.GetTime());
604 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
608
609 }
610 // Show next hint page by incrementing the page index.
611 protected void ShowNextPage()
612 {
613 // Update the page index
614 if ( m_PageIndex < m_ContentList.Count() - 1 )
615 {
616 m_PageIndex++;
617 }
618 else
619 {
620 m_PageIndex = 0;
621 }
622
623 //Update the hint page
625 }
626 // Show previous hint page by decreasing the page index.
627 protected void ShowPreviousPage()
628 {
629 // Update the page index
630 if ( m_PageIndex == 0 )
631 {
632 m_PageIndex = m_ContentList.Count() - 1;
633 }
634 else
635 {
636 m_PageIndex--;
637
638 }
639 //Update the hint page
641 }
642
643 // -------------------------------------------
644 // Slideshow
645
646 // Creates new slidshow thread
647 protected void StartSlideshow()
648 {
650 }
651 // Slidshow thread - run code
652 protected void SlideshowThread()
653 {
654 ShowNextPage();
655 }
656 // Stop the slide show
657 protected void StopSlideShow()
658 {
659 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
660 }
661 // Restart the slide show
662 protected void RestartSlideShow()
663 {
666 }
667
668 // ----------------------------------------
669 // Layout manipulation
670
671 override bool OnClick(Widget w, int x, int y, int button)
672 {
673 if (button == MouseState.LEFT)
674 {
675 switch (w)
676 {
677 case m_UiLeftButton:
678 {
680 return true;
681 }
682 case m_UiRightButton:
683 {
684 ShowNextPage();
685 return true;
686 }
687 }
688 }
689 return false;
690 }
691 override bool OnMouseEnter(Widget w, int x, int y)
692 {
693 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
694 {
696 return true;
697 }
698 return false;
699 }
700 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
701 {
702 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
703 {
705 return true;
706 }
707 return false;
708 }
709}
710
711// ---------------------------------------------------------------------------------------------------------
713{
714 override void Init(DayZGame game)
715 {
716 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
717 super.Init(game);
718 }
719}

◆ SetHintHeadline()

void SetHintHeadline ( )
protected
421{
422 #ifdef DIAG_DEVELOPER
423 static int m_ForcedIndex = -1;//only for debug purposes
424 #endif
425
426 // Const
427 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
428 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
429 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
430 // Widgets
431 protected Widget m_RootFrame;
432 protected Widget m_SpacerFrame;
437 protected ImageWidget m_UiHintImage;
439 // Data
441 protected int m_PageIndex = int.MIN;
442 protected DayZGame m_Game;
443 protected bool m_Initialized;
444 protected Widget m_ParentWidget;
445 protected int m_PreviousRandomIndex = int.MIN;
446
447 // ---------------------------------------------------------
448
449 // Constructor
451 {
452 DayZGame game = DayZGame.Cast(GetGame());
454 Init(game);
455 }
456 // Destructor
457 void ~UiHintPanel()
458 {
460
461 if(m_RootFrame)
462 m_RootFrame.Unlink();
463 }
464
465
466 void Init(DayZGame game)
467 {
468 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
469 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
470 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
471
472 if (m_Initialized)
473 return;
474 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
475 return;
476 m_Initialized = true;
477
478 m_Game = game;
479 // Load Json File
481 // If load successful
482 if (m_ContentList)
483 {
484 // Build the layout
486 // Get random page index
488 // Populate the layout with data
490 // Start the slideshow
492 }
493 else
494 ErrorEx("Could not create the hint panel. The data are missing!");
495 }
496
497 // ------------------------------------------------------
498
499 // Load content data from json file
500 protected void LoadContentList()
501 {
502 string errorMessage;
505 }
506
507 // Create and Build the layout
508 protected void BuildLayout(Widget parent_widget)
509 {
510 // Create the layout
511 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
512
513 if (m_RootFrame)
514 {
515 // Find Widgets
516 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
517 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
518 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
519 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
520 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
521 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
522 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
523 // Set handler
524 m_RootFrame.SetHandler(this);
525 }
526 }
527
528 // Populate the hint with content
529 protected void PopulateLayout()
530 {
531 if (m_RootFrame)
532 {
535 SetHintImage();
537 }
538 }
539
540 // -------------------------------------------
541 // Setters
542 protected void SetHintHeadline()
543 {
544 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
545 }
546 protected void SetHintDescription()
547 {
548 #ifdef DEVELOPER
549 //Print("showing contents for page "+m_PageIndex);
550 #endif
551 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
552 m_UiDescLabel.Update();
553 m_SpacerFrame.Update();
554 }
555 protected void SetHintImage()
556 {
557 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
558
559 // If there is an image
560 if (image_path)
561 {
562 // Show the widget
563 m_UiHintImage.Show(true);
564 // Set the image path
565 m_UiHintImage.LoadImageFile(0, image_path);
566 }
567 else
568 {
569 // Hide the widget
570 m_UiHintImage.Show(false);
571 }
572 }
573 protected void SetHintPaging()
574 {
576 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
577 }
578
579 void ShowRandomPage()
580 {
583 }
584
585 // Set a random page index
586 protected void RandomizePageIndex()
587 {
588 #ifdef DIAG_DEVELOPER
590 {
591 if (m_ForcedIndex != -1)
592 {
594 return;
595 }
596 }
597 #endif
598
599 Math.Randomize(m_Game.GetTime());
600 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
604
605 }
606 // Show next hint page by incrementing the page index.
607 protected void ShowNextPage()
608 {
609 // Update the page index
610 if ( m_PageIndex < m_ContentList.Count() - 1 )
611 {
612 m_PageIndex++;
613 }
614 else
615 {
616 m_PageIndex = 0;
617 }
618
619 //Update the hint page
621 }
622 // Show previous hint page by decreasing the page index.
623 protected void ShowPreviousPage()
624 {
625 // Update the page index
626 if ( m_PageIndex == 0 )
627 {
628 m_PageIndex = m_ContentList.Count() - 1;
629 }
630 else
631 {
632 m_PageIndex--;
633
634 }
635 //Update the hint page
637 }
638
639 // -------------------------------------------
640 // Slideshow
641
642 // Creates new slidshow thread
643 protected void StartSlideshow()
644 {
646 }
647 // Slidshow thread - run code
648 protected void SlideshowThread()
649 {
650 ShowNextPage();
651 }
652 // Stop the slide show
653 protected void StopSlideShow()
654 {
655 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
656 }
657 // Restart the slide show
658 protected void RestartSlideShow()
659 {
662 }
663
664 // ----------------------------------------
665 // Layout manipulation
666
667 override bool OnClick(Widget w, int x, int y, int button)
668 {
669 if (button == MouseState.LEFT)
670 {
671 switch (w)
672 {
673 case m_UiLeftButton:
674 {
676 return true;
677 }
678 case m_UiRightButton:
679 {
680 ShowNextPage();
681 return true;
682 }
683 }
684 }
685 return false;
686 }
687 override bool OnMouseEnter(Widget w, int x, int y)
688 {
689 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
690 {
692 return true;
693 }
694 return false;
695 }
696 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
697 {
698 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
699 {
701 return true;
702 }
703 return false;
704 }
705}
706
707// ---------------------------------------------------------------------------------------------------------
709{
710 override void Init(DayZGame game)
711 {
712 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
713 super.Init(game);
714 }
715}

◆ SetHintImage()

void SetHintImage ( )
protected
434{
435 #ifdef DIAG_DEVELOPER
436 static int m_ForcedIndex = -1;//only for debug purposes
437 #endif
438
439 // Const
440 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
441 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
442 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
443 // Widgets
444 protected Widget m_RootFrame;
445 protected Widget m_SpacerFrame;
450 protected ImageWidget m_UiHintImage;
452 // Data
454 protected int m_PageIndex = int.MIN;
455 protected DayZGame m_Game;
456 protected bool m_Initialized;
457 protected Widget m_ParentWidget;
458 protected int m_PreviousRandomIndex = int.MIN;
459
460 // ---------------------------------------------------------
461
462 // Constructor
464 {
465 DayZGame game = DayZGame.Cast(GetGame());
467 Init(game);
468 }
469 // Destructor
470 void ~UiHintPanel()
471 {
473
474 if(m_RootFrame)
475 m_RootFrame.Unlink();
476 }
477
478
479 void Init(DayZGame game)
480 {
481 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
482 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
483 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
484
485 if (m_Initialized)
486 return;
487 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
488 return;
489 m_Initialized = true;
490
491 m_Game = game;
492 // Load Json File
494 // If load successful
495 if (m_ContentList)
496 {
497 // Build the layout
499 // Get random page index
501 // Populate the layout with data
503 // Start the slideshow
505 }
506 else
507 ErrorEx("Could not create the hint panel. The data are missing!");
508 }
509
510 // ------------------------------------------------------
511
512 // Load content data from json file
513 protected void LoadContentList()
514 {
515 string errorMessage;
518 }
519
520 // Create and Build the layout
521 protected void BuildLayout(Widget parent_widget)
522 {
523 // Create the layout
524 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
525
526 if (m_RootFrame)
527 {
528 // Find Widgets
529 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
530 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
531 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
532 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
533 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
534 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
535 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
536 // Set handler
537 m_RootFrame.SetHandler(this);
538 }
539 }
540
541 // Populate the hint with content
542 protected void PopulateLayout()
543 {
544 if (m_RootFrame)
545 {
548 SetHintImage();
550 }
551 }
552
553 // -------------------------------------------
554 // Setters
555 protected void SetHintHeadline()
556 {
557 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
558 }
559 protected void SetHintDescription()
560 {
561 #ifdef DEVELOPER
562 //Print("showing contents for page "+m_PageIndex);
563 #endif
564 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
565 m_UiDescLabel.Update();
566 m_SpacerFrame.Update();
567 }
568 protected void SetHintImage()
569 {
570 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
571
572 // If there is an image
573 if (image_path)
574 {
575 // Show the widget
576 m_UiHintImage.Show(true);
577 // Set the image path
578 m_UiHintImage.LoadImageFile(0, image_path);
579 }
580 else
581 {
582 // Hide the widget
583 m_UiHintImage.Show(false);
584 }
585 }
586 protected void SetHintPaging()
587 {
589 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
590 }
591
592 void ShowRandomPage()
593 {
596 }
597
598 // Set a random page index
599 protected void RandomizePageIndex()
600 {
601 #ifdef DIAG_DEVELOPER
603 {
604 if (m_ForcedIndex != -1)
605 {
607 return;
608 }
609 }
610 #endif
611
612 Math.Randomize(m_Game.GetTime());
613 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
617
618 }
619 // Show next hint page by incrementing the page index.
620 protected void ShowNextPage()
621 {
622 // Update the page index
623 if ( m_PageIndex < m_ContentList.Count() - 1 )
624 {
625 m_PageIndex++;
626 }
627 else
628 {
629 m_PageIndex = 0;
630 }
631
632 //Update the hint page
634 }
635 // Show previous hint page by decreasing the page index.
636 protected void ShowPreviousPage()
637 {
638 // Update the page index
639 if ( m_PageIndex == 0 )
640 {
641 m_PageIndex = m_ContentList.Count() - 1;
642 }
643 else
644 {
645 m_PageIndex--;
646
647 }
648 //Update the hint page
650 }
651
652 // -------------------------------------------
653 // Slideshow
654
655 // Creates new slidshow thread
656 protected void StartSlideshow()
657 {
659 }
660 // Slidshow thread - run code
661 protected void SlideshowThread()
662 {
663 ShowNextPage();
664 }
665 // Stop the slide show
666 protected void StopSlideShow()
667 {
668 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
669 }
670 // Restart the slide show
671 protected void RestartSlideShow()
672 {
675 }
676
677 // ----------------------------------------
678 // Layout manipulation
679
680 override bool OnClick(Widget w, int x, int y, int button)
681 {
682 if (button == MouseState.LEFT)
683 {
684 switch (w)
685 {
686 case m_UiLeftButton:
687 {
689 return true;
690 }
691 case m_UiRightButton:
692 {
693 ShowNextPage();
694 return true;
695 }
696 }
697 }
698 return false;
699 }
700 override bool OnMouseEnter(Widget w, int x, int y)
701 {
702 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
703 {
705 return true;
706 }
707 return false;
708 }
709 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
710 {
711 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
712 {
714 return true;
715 }
716 return false;
717 }
718}
719
720// ---------------------------------------------------------------------------------------------------------
722{
723 override void Init(DayZGame game)
724 {
725 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
726 super.Init(game);
727 }
728}

◆ SetHintPaging()

void SetHintPaging ( )
protected
452{
453 #ifdef DIAG_DEVELOPER
454 static int m_ForcedIndex = -1;//only for debug purposes
455 #endif
456
457 // Const
458 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
459 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
460 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
461 // Widgets
462 protected Widget m_RootFrame;
463 protected Widget m_SpacerFrame;
468 protected ImageWidget m_UiHintImage;
470 // Data
472 protected int m_PageIndex = int.MIN;
473 protected DayZGame m_Game;
474 protected bool m_Initialized;
475 protected Widget m_ParentWidget;
476 protected int m_PreviousRandomIndex = int.MIN;
477
478 // ---------------------------------------------------------
479
480 // Constructor
482 {
483 DayZGame game = DayZGame.Cast(GetGame());
485 Init(game);
486 }
487 // Destructor
488 void ~UiHintPanel()
489 {
491
492 if(m_RootFrame)
493 m_RootFrame.Unlink();
494 }
495
496
497 void Init(DayZGame game)
498 {
499 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
500 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
501 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
502
503 if (m_Initialized)
504 return;
505 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
506 return;
507 m_Initialized = true;
508
509 m_Game = game;
510 // Load Json File
512 // If load successful
513 if (m_ContentList)
514 {
515 // Build the layout
517 // Get random page index
519 // Populate the layout with data
521 // Start the slideshow
523 }
524 else
525 ErrorEx("Could not create the hint panel. The data are missing!");
526 }
527
528 // ------------------------------------------------------
529
530 // Load content data from json file
531 protected void LoadContentList()
532 {
533 string errorMessage;
536 }
537
538 // Create and Build the layout
539 protected void BuildLayout(Widget parent_widget)
540 {
541 // Create the layout
542 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
543
544 if (m_RootFrame)
545 {
546 // Find Widgets
547 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
548 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
549 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
550 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
551 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
552 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
553 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
554 // Set handler
555 m_RootFrame.SetHandler(this);
556 }
557 }
558
559 // Populate the hint with content
560 protected void PopulateLayout()
561 {
562 if (m_RootFrame)
563 {
566 SetHintImage();
568 }
569 }
570
571 // -------------------------------------------
572 // Setters
573 protected void SetHintHeadline()
574 {
575 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
576 }
577 protected void SetHintDescription()
578 {
579 #ifdef DEVELOPER
580 //Print("showing contents for page "+m_PageIndex);
581 #endif
582 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
583 m_UiDescLabel.Update();
584 m_SpacerFrame.Update();
585 }
586 protected void SetHintImage()
587 {
588 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
589
590 // If there is an image
591 if (image_path)
592 {
593 // Show the widget
594 m_UiHintImage.Show(true);
595 // Set the image path
596 m_UiHintImage.LoadImageFile(0, image_path);
597 }
598 else
599 {
600 // Hide the widget
601 m_UiHintImage.Show(false);
602 }
603 }
604 protected void SetHintPaging()
605 {
607 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
608 }
609
610 void ShowRandomPage()
611 {
614 }
615
616 // Set a random page index
617 protected void RandomizePageIndex()
618 {
619 #ifdef DIAG_DEVELOPER
621 {
622 if (m_ForcedIndex != -1)
623 {
625 return;
626 }
627 }
628 #endif
629
630 Math.Randomize(m_Game.GetTime());
631 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
635
636 }
637 // Show next hint page by incrementing the page index.
638 protected void ShowNextPage()
639 {
640 // Update the page index
641 if ( m_PageIndex < m_ContentList.Count() - 1 )
642 {
643 m_PageIndex++;
644 }
645 else
646 {
647 m_PageIndex = 0;
648 }
649
650 //Update the hint page
652 }
653 // Show previous hint page by decreasing the page index.
654 protected void ShowPreviousPage()
655 {
656 // Update the page index
657 if ( m_PageIndex == 0 )
658 {
659 m_PageIndex = m_ContentList.Count() - 1;
660 }
661 else
662 {
663 m_PageIndex--;
664
665 }
666 //Update the hint page
668 }
669
670 // -------------------------------------------
671 // Slideshow
672
673 // Creates new slidshow thread
674 protected void StartSlideshow()
675 {
677 }
678 // Slidshow thread - run code
679 protected void SlideshowThread()
680 {
681 ShowNextPage();
682 }
683 // Stop the slide show
684 protected void StopSlideShow()
685 {
686 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
687 }
688 // Restart the slide show
689 protected void RestartSlideShow()
690 {
693 }
694
695 // ----------------------------------------
696 // Layout manipulation
697
698 override bool OnClick(Widget w, int x, int y, int button)
699 {
700 if (button == MouseState.LEFT)
701 {
702 switch (w)
703 {
704 case m_UiLeftButton:
705 {
707 return true;
708 }
709 case m_UiRightButton:
710 {
711 ShowNextPage();
712 return true;
713 }
714 }
715 }
716 return false;
717 }
718 override bool OnMouseEnter(Widget w, int x, int y)
719 {
720 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
721 {
723 return true;
724 }
725 return false;
726 }
727 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
728 {
729 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
730 {
732 return true;
733 }
734 return false;
735 }
736}
737
738// ---------------------------------------------------------------------------------------------------------
740{
741 override void Init(DayZGame game)
742 {
743 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
744 super.Init(game);
745 }
746}

◆ ShowNextPage()

void ShowNextPage ( )
protected
486{
487 #ifdef DIAG_DEVELOPER
488 static int m_ForcedIndex = -1;//only for debug purposes
489 #endif
490
491 // Const
492 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
493 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
494 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
495 // Widgets
496 protected Widget m_RootFrame;
497 protected Widget m_SpacerFrame;
502 protected ImageWidget m_UiHintImage;
504 // Data
506 protected int m_PageIndex = int.MIN;
507 protected DayZGame m_Game;
508 protected bool m_Initialized;
509 protected Widget m_ParentWidget;
510 protected int m_PreviousRandomIndex = int.MIN;
511
512 // ---------------------------------------------------------
513
514 // Constructor
516 {
517 DayZGame game = DayZGame.Cast(GetGame());
519 Init(game);
520 }
521 // Destructor
522 void ~UiHintPanel()
523 {
525
526 if(m_RootFrame)
527 m_RootFrame.Unlink();
528 }
529
530
531 void Init(DayZGame game)
532 {
533 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
534 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
535 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
536
537 if (m_Initialized)
538 return;
539 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
540 return;
541 m_Initialized = true;
542
543 m_Game = game;
544 // Load Json File
546 // If load successful
547 if (m_ContentList)
548 {
549 // Build the layout
551 // Get random page index
553 // Populate the layout with data
555 // Start the slideshow
557 }
558 else
559 ErrorEx("Could not create the hint panel. The data are missing!");
560 }
561
562 // ------------------------------------------------------
563
564 // Load content data from json file
565 protected void LoadContentList()
566 {
567 string errorMessage;
570 }
571
572 // Create and Build the layout
573 protected void BuildLayout(Widget parent_widget)
574 {
575 // Create the layout
576 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
577
578 if (m_RootFrame)
579 {
580 // Find Widgets
581 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
582 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
583 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
584 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
585 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
586 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
587 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
588 // Set handler
589 m_RootFrame.SetHandler(this);
590 }
591 }
592
593 // Populate the hint with content
594 protected void PopulateLayout()
595 {
596 if (m_RootFrame)
597 {
600 SetHintImage();
602 }
603 }
604
605 // -------------------------------------------
606 // Setters
607 protected void SetHintHeadline()
608 {
609 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
610 }
611 protected void SetHintDescription()
612 {
613 #ifdef DEVELOPER
614 //Print("showing contents for page "+m_PageIndex);
615 #endif
616 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
617 m_UiDescLabel.Update();
618 m_SpacerFrame.Update();
619 }
620 protected void SetHintImage()
621 {
622 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
623
624 // If there is an image
625 if (image_path)
626 {
627 // Show the widget
628 m_UiHintImage.Show(true);
629 // Set the image path
630 m_UiHintImage.LoadImageFile(0, image_path);
631 }
632 else
633 {
634 // Hide the widget
635 m_UiHintImage.Show(false);
636 }
637 }
638 protected void SetHintPaging()
639 {
641 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
642 }
643
644 void ShowRandomPage()
645 {
648 }
649
650 // Set a random page index
651 protected void RandomizePageIndex()
652 {
653 #ifdef DIAG_DEVELOPER
655 {
656 if (m_ForcedIndex != -1)
657 {
659 return;
660 }
661 }
662 #endif
663
664 Math.Randomize(m_Game.GetTime());
665 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
669
670 }
671 // Show next hint page by incrementing the page index.
672 protected void ShowNextPage()
673 {
674 // Update the page index
675 if ( m_PageIndex < m_ContentList.Count() - 1 )
676 {
677 m_PageIndex++;
678 }
679 else
680 {
681 m_PageIndex = 0;
682 }
683
684 //Update the hint page
686 }
687 // Show previous hint page by decreasing the page index.
688 protected void ShowPreviousPage()
689 {
690 // Update the page index
691 if ( m_PageIndex == 0 )
692 {
693 m_PageIndex = m_ContentList.Count() - 1;
694 }
695 else
696 {
697 m_PageIndex--;
698
699 }
700 //Update the hint page
702 }
703
704 // -------------------------------------------
705 // Slideshow
706
707 // Creates new slidshow thread
708 protected void StartSlideshow()
709 {
711 }
712 // Slidshow thread - run code
713 protected void SlideshowThread()
714 {
715 ShowNextPage();
716 }
717 // Stop the slide show
718 protected void StopSlideShow()
719 {
720 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
721 }
722 // Restart the slide show
723 protected void RestartSlideShow()
724 {
727 }
728
729 // ----------------------------------------
730 // Layout manipulation
731
732 override bool OnClick(Widget w, int x, int y, int button)
733 {
734 if (button == MouseState.LEFT)
735 {
736 switch (w)
737 {
738 case m_UiLeftButton:
739 {
741 return true;
742 }
743 case m_UiRightButton:
744 {
745 ShowNextPage();
746 return true;
747 }
748 }
749 }
750 return false;
751 }
752 override bool OnMouseEnter(Widget w, int x, int y)
753 {
754 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
755 {
757 return true;
758 }
759 return false;
760 }
761 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
762 {
763 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
764 {
766 return true;
767 }
768 return false;
769 }
770}
771
772// ---------------------------------------------------------------------------------------------------------
774{
775 override void Init(DayZGame game)
776 {
777 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
778 super.Init(game);
779 }
780}

◆ ShowPreviousPage()

void ShowPreviousPage ( )
protected
502{
503 #ifdef DIAG_DEVELOPER
504 static int m_ForcedIndex = -1;//only for debug purposes
505 #endif
506
507 // Const
508 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
509 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
510 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
511 // Widgets
512 protected Widget m_RootFrame;
513 protected Widget m_SpacerFrame;
518 protected ImageWidget m_UiHintImage;
520 // Data
522 protected int m_PageIndex = int.MIN;
523 protected DayZGame m_Game;
524 protected bool m_Initialized;
525 protected Widget m_ParentWidget;
526 protected int m_PreviousRandomIndex = int.MIN;
527
528 // ---------------------------------------------------------
529
530 // Constructor
532 {
533 DayZGame game = DayZGame.Cast(GetGame());
535 Init(game);
536 }
537 // Destructor
538 void ~UiHintPanel()
539 {
541
542 if(m_RootFrame)
543 m_RootFrame.Unlink();
544 }
545
546
547 void Init(DayZGame game)
548 {
549 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
550 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
551 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
552
553 if (m_Initialized)
554 return;
555 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
556 return;
557 m_Initialized = true;
558
559 m_Game = game;
560 // Load Json File
562 // If load successful
563 if (m_ContentList)
564 {
565 // Build the layout
567 // Get random page index
569 // Populate the layout with data
571 // Start the slideshow
573 }
574 else
575 ErrorEx("Could not create the hint panel. The data are missing!");
576 }
577
578 // ------------------------------------------------------
579
580 // Load content data from json file
581 protected void LoadContentList()
582 {
583 string errorMessage;
586 }
587
588 // Create and Build the layout
589 protected void BuildLayout(Widget parent_widget)
590 {
591 // Create the layout
592 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
593
594 if (m_RootFrame)
595 {
596 // Find Widgets
597 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
598 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
599 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
600 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
601 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
602 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
603 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
604 // Set handler
605 m_RootFrame.SetHandler(this);
606 }
607 }
608
609 // Populate the hint with content
610 protected void PopulateLayout()
611 {
612 if (m_RootFrame)
613 {
616 SetHintImage();
618 }
619 }
620
621 // -------------------------------------------
622 // Setters
623 protected void SetHintHeadline()
624 {
625 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
626 }
627 protected void SetHintDescription()
628 {
629 #ifdef DEVELOPER
630 //Print("showing contents for page "+m_PageIndex);
631 #endif
632 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
633 m_UiDescLabel.Update();
634 m_SpacerFrame.Update();
635 }
636 protected void SetHintImage()
637 {
638 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
639
640 // If there is an image
641 if (image_path)
642 {
643 // Show the widget
644 m_UiHintImage.Show(true);
645 // Set the image path
646 m_UiHintImage.LoadImageFile(0, image_path);
647 }
648 else
649 {
650 // Hide the widget
651 m_UiHintImage.Show(false);
652 }
653 }
654 protected void SetHintPaging()
655 {
657 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
658 }
659
660 void ShowRandomPage()
661 {
664 }
665
666 // Set a random page index
667 protected void RandomizePageIndex()
668 {
669 #ifdef DIAG_DEVELOPER
671 {
672 if (m_ForcedIndex != -1)
673 {
675 return;
676 }
677 }
678 #endif
679
680 Math.Randomize(m_Game.GetTime());
681 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
685
686 }
687 // Show next hint page by incrementing the page index.
688 protected void ShowNextPage()
689 {
690 // Update the page index
691 if ( m_PageIndex < m_ContentList.Count() - 1 )
692 {
693 m_PageIndex++;
694 }
695 else
696 {
697 m_PageIndex = 0;
698 }
699
700 //Update the hint page
702 }
703 // Show previous hint page by decreasing the page index.
704 protected void ShowPreviousPage()
705 {
706 // Update the page index
707 if ( m_PageIndex == 0 )
708 {
709 m_PageIndex = m_ContentList.Count() - 1;
710 }
711 else
712 {
713 m_PageIndex--;
714
715 }
716 //Update the hint page
718 }
719
720 // -------------------------------------------
721 // Slideshow
722
723 // Creates new slidshow thread
724 protected void StartSlideshow()
725 {
727 }
728 // Slidshow thread - run code
729 protected void SlideshowThread()
730 {
731 ShowNextPage();
732 }
733 // Stop the slide show
734 protected void StopSlideShow()
735 {
736 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
737 }
738 // Restart the slide show
739 protected void RestartSlideShow()
740 {
743 }
744
745 // ----------------------------------------
746 // Layout manipulation
747
748 override bool OnClick(Widget w, int x, int y, int button)
749 {
750 if (button == MouseState.LEFT)
751 {
752 switch (w)
753 {
754 case m_UiLeftButton:
755 {
757 return true;
758 }
759 case m_UiRightButton:
760 {
761 ShowNextPage();
762 return true;
763 }
764 }
765 }
766 return false;
767 }
768 override bool OnMouseEnter(Widget w, int x, int y)
769 {
770 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
771 {
773 return true;
774 }
775 return false;
776 }
777 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
778 {
779 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
780 {
782 return true;
783 }
784 return false;
785 }
786}
787
788// ---------------------------------------------------------------------------------------------------------
790{
791 override void Init(DayZGame game)
792 {
793 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
794 super.Init(game);
795 }
796}

◆ ShowRandomPage()

void ShowRandomPage ( )
protected
458{
459 #ifdef DIAG_DEVELOPER
460 static int m_ForcedIndex = -1;//only for debug purposes
461 #endif
462
463 // Const
464 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
465 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
466 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
467 // Widgets
468 protected Widget m_RootFrame;
469 protected Widget m_SpacerFrame;
474 protected ImageWidget m_UiHintImage;
476 // Data
478 protected int m_PageIndex = int.MIN;
479 protected DayZGame m_Game;
480 protected bool m_Initialized;
481 protected Widget m_ParentWidget;
482 protected int m_PreviousRandomIndex = int.MIN;
483
484 // ---------------------------------------------------------
485
486 // Constructor
488 {
489 DayZGame game = DayZGame.Cast(GetGame());
491 Init(game);
492 }
493 // Destructor
494 void ~UiHintPanel()
495 {
497
498 if(m_RootFrame)
499 m_RootFrame.Unlink();
500 }
501
502
503 void Init(DayZGame game)
504 {
505 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
506 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
507 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
508
509 if (m_Initialized)
510 return;
511 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
512 return;
513 m_Initialized = true;
514
515 m_Game = game;
516 // Load Json File
518 // If load successful
519 if (m_ContentList)
520 {
521 // Build the layout
523 // Get random page index
525 // Populate the layout with data
527 // Start the slideshow
529 }
530 else
531 ErrorEx("Could not create the hint panel. The data are missing!");
532 }
533
534 // ------------------------------------------------------
535
536 // Load content data from json file
537 protected void LoadContentList()
538 {
539 string errorMessage;
542 }
543
544 // Create and Build the layout
545 protected void BuildLayout(Widget parent_widget)
546 {
547 // Create the layout
548 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
549
550 if (m_RootFrame)
551 {
552 // Find Widgets
553 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
554 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
555 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
556 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
557 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
558 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
559 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
560 // Set handler
561 m_RootFrame.SetHandler(this);
562 }
563 }
564
565 // Populate the hint with content
566 protected void PopulateLayout()
567 {
568 if (m_RootFrame)
569 {
572 SetHintImage();
574 }
575 }
576
577 // -------------------------------------------
578 // Setters
579 protected void SetHintHeadline()
580 {
581 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
582 }
583 protected void SetHintDescription()
584 {
585 #ifdef DEVELOPER
586 //Print("showing contents for page "+m_PageIndex);
587 #endif
588 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
589 m_UiDescLabel.Update();
590 m_SpacerFrame.Update();
591 }
592 protected void SetHintImage()
593 {
594 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
595
596 // If there is an image
597 if (image_path)
598 {
599 // Show the widget
600 m_UiHintImage.Show(true);
601 // Set the image path
602 m_UiHintImage.LoadImageFile(0, image_path);
603 }
604 else
605 {
606 // Hide the widget
607 m_UiHintImage.Show(false);
608 }
609 }
610 protected void SetHintPaging()
611 {
613 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
614 }
615
616 void ShowRandomPage()
617 {
620 }
621
622 // Set a random page index
623 protected void RandomizePageIndex()
624 {
625 #ifdef DIAG_DEVELOPER
627 {
628 if (m_ForcedIndex != -1)
629 {
631 return;
632 }
633 }
634 #endif
635
636 Math.Randomize(m_Game.GetTime());
637 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
641
642 }
643 // Show next hint page by incrementing the page index.
644 protected void ShowNextPage()
645 {
646 // Update the page index
647 if ( m_PageIndex < m_ContentList.Count() - 1 )
648 {
649 m_PageIndex++;
650 }
651 else
652 {
653 m_PageIndex = 0;
654 }
655
656 //Update the hint page
658 }
659 // Show previous hint page by decreasing the page index.
660 protected void ShowPreviousPage()
661 {
662 // Update the page index
663 if ( m_PageIndex == 0 )
664 {
665 m_PageIndex = m_ContentList.Count() - 1;
666 }
667 else
668 {
669 m_PageIndex--;
670
671 }
672 //Update the hint page
674 }
675
676 // -------------------------------------------
677 // Slideshow
678
679 // Creates new slidshow thread
680 protected void StartSlideshow()
681 {
683 }
684 // Slidshow thread - run code
685 protected void SlideshowThread()
686 {
687 ShowNextPage();
688 }
689 // Stop the slide show
690 protected void StopSlideShow()
691 {
692 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
693 }
694 // Restart the slide show
695 protected void RestartSlideShow()
696 {
699 }
700
701 // ----------------------------------------
702 // Layout manipulation
703
704 override bool OnClick(Widget w, int x, int y, int button)
705 {
706 if (button == MouseState.LEFT)
707 {
708 switch (w)
709 {
710 case m_UiLeftButton:
711 {
713 return true;
714 }
715 case m_UiRightButton:
716 {
717 ShowNextPage();
718 return true;
719 }
720 }
721 }
722 return false;
723 }
724 override bool OnMouseEnter(Widget w, int x, int y)
725 {
726 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
727 {
729 return true;
730 }
731 return false;
732 }
733 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
734 {
735 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
736 {
738 return true;
739 }
740 return false;
741 }
742}
743
744// ---------------------------------------------------------------------------------------------------------
746{
747 override void Init(DayZGame game)
748 {
749 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
750 super.Init(game);
751 }
752}

◆ SlideshowThread()

void SlideshowThread ( )
protected
527{
528 #ifdef DIAG_DEVELOPER
529 static int m_ForcedIndex = -1;//only for debug purposes
530 #endif
531
532 // Const
533 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
534 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
535 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
536 // Widgets
537 protected Widget m_RootFrame;
538 protected Widget m_SpacerFrame;
543 protected ImageWidget m_UiHintImage;
545 // Data
547 protected int m_PageIndex = int.MIN;
548 protected DayZGame m_Game;
549 protected bool m_Initialized;
550 protected Widget m_ParentWidget;
551 protected int m_PreviousRandomIndex = int.MIN;
552
553 // ---------------------------------------------------------
554
555 // Constructor
557 {
558 DayZGame game = DayZGame.Cast(GetGame());
560 Init(game);
561 }
562 // Destructor
563 void ~UiHintPanel()
564 {
566
567 if(m_RootFrame)
568 m_RootFrame.Unlink();
569 }
570
571
572 void Init(DayZGame game)
573 {
574 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
575 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
576 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
577
578 if (m_Initialized)
579 return;
580 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
581 return;
582 m_Initialized = true;
583
584 m_Game = game;
585 // Load Json File
587 // If load successful
588 if (m_ContentList)
589 {
590 // Build the layout
592 // Get random page index
594 // Populate the layout with data
596 // Start the slideshow
598 }
599 else
600 ErrorEx("Could not create the hint panel. The data are missing!");
601 }
602
603 // ------------------------------------------------------
604
605 // Load content data from json file
606 protected void LoadContentList()
607 {
608 string errorMessage;
611 }
612
613 // Create and Build the layout
614 protected void BuildLayout(Widget parent_widget)
615 {
616 // Create the layout
617 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
618
619 if (m_RootFrame)
620 {
621 // Find Widgets
622 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
623 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
624 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
625 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
626 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
627 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
628 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
629 // Set handler
630 m_RootFrame.SetHandler(this);
631 }
632 }
633
634 // Populate the hint with content
635 protected void PopulateLayout()
636 {
637 if (m_RootFrame)
638 {
641 SetHintImage();
643 }
644 }
645
646 // -------------------------------------------
647 // Setters
648 protected void SetHintHeadline()
649 {
650 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
651 }
652 protected void SetHintDescription()
653 {
654 #ifdef DEVELOPER
655 //Print("showing contents for page "+m_PageIndex);
656 #endif
657 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
658 m_UiDescLabel.Update();
659 m_SpacerFrame.Update();
660 }
661 protected void SetHintImage()
662 {
663 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
664
665 // If there is an image
666 if (image_path)
667 {
668 // Show the widget
669 m_UiHintImage.Show(true);
670 // Set the image path
671 m_UiHintImage.LoadImageFile(0, image_path);
672 }
673 else
674 {
675 // Hide the widget
676 m_UiHintImage.Show(false);
677 }
678 }
679 protected void SetHintPaging()
680 {
682 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
683 }
684
685 void ShowRandomPage()
686 {
689 }
690
691 // Set a random page index
692 protected void RandomizePageIndex()
693 {
694 #ifdef DIAG_DEVELOPER
696 {
697 if (m_ForcedIndex != -1)
698 {
700 return;
701 }
702 }
703 #endif
704
705 Math.Randomize(m_Game.GetTime());
706 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
710
711 }
712 // Show next hint page by incrementing the page index.
713 protected void ShowNextPage()
714 {
715 // Update the page index
716 if ( m_PageIndex < m_ContentList.Count() - 1 )
717 {
718 m_PageIndex++;
719 }
720 else
721 {
722 m_PageIndex = 0;
723 }
724
725 //Update the hint page
727 }
728 // Show previous hint page by decreasing the page index.
729 protected void ShowPreviousPage()
730 {
731 // Update the page index
732 if ( m_PageIndex == 0 )
733 {
734 m_PageIndex = m_ContentList.Count() - 1;
735 }
736 else
737 {
738 m_PageIndex--;
739
740 }
741 //Update the hint page
743 }
744
745 // -------------------------------------------
746 // Slideshow
747
748 // Creates new slidshow thread
749 protected void StartSlideshow()
750 {
752 }
753 // Slidshow thread - run code
754 protected void SlideshowThread()
755 {
756 ShowNextPage();
757 }
758 // Stop the slide show
759 protected void StopSlideShow()
760 {
761 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
762 }
763 // Restart the slide show
764 protected void RestartSlideShow()
765 {
768 }
769
770 // ----------------------------------------
771 // Layout manipulation
772
773 override bool OnClick(Widget w, int x, int y, int button)
774 {
775 if (button == MouseState.LEFT)
776 {
777 switch (w)
778 {
779 case m_UiLeftButton:
780 {
782 return true;
783 }
784 case m_UiRightButton:
785 {
786 ShowNextPage();
787 return true;
788 }
789 }
790 }
791 return false;
792 }
793 override bool OnMouseEnter(Widget w, int x, int y)
794 {
795 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
796 {
798 return true;
799 }
800 return false;
801 }
802 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
803 {
804 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
805 {
807 return true;
808 }
809 return false;
810 }
811}
812
813// ---------------------------------------------------------------------------------------------------------
815{
816 override void Init(DayZGame game)
817 {
818 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
819 super.Init(game);
820 }
821}

Используется в ScriptedWidgetEventHandler::StartSlideshow() и ScriptedWidgetEventHandler::StopSlideShow().

◆ StartSlideshow()

void StartSlideshow ( )
protected
522{
523 #ifdef DIAG_DEVELOPER
524 static int m_ForcedIndex = -1;//only for debug purposes
525 #endif
526
527 // Const
528 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
529 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
530 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
531 // Widgets
532 protected Widget m_RootFrame;
533 protected Widget m_SpacerFrame;
538 protected ImageWidget m_UiHintImage;
540 // Data
542 protected int m_PageIndex = int.MIN;
543 protected DayZGame m_Game;
544 protected bool m_Initialized;
545 protected Widget m_ParentWidget;
546 protected int m_PreviousRandomIndex = int.MIN;
547
548 // ---------------------------------------------------------
549
550 // Constructor
552 {
553 DayZGame game = DayZGame.Cast(GetGame());
555 Init(game);
556 }
557 // Destructor
558 void ~UiHintPanel()
559 {
561
562 if(m_RootFrame)
563 m_RootFrame.Unlink();
564 }
565
566
567 void Init(DayZGame game)
568 {
569 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
570 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
571 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
572
573 if (m_Initialized)
574 return;
575 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
576 return;
577 m_Initialized = true;
578
579 m_Game = game;
580 // Load Json File
582 // If load successful
583 if (m_ContentList)
584 {
585 // Build the layout
587 // Get random page index
589 // Populate the layout with data
591 // Start the slideshow
593 }
594 else
595 ErrorEx("Could not create the hint panel. The data are missing!");
596 }
597
598 // ------------------------------------------------------
599
600 // Load content data from json file
601 protected void LoadContentList()
602 {
603 string errorMessage;
606 }
607
608 // Create and Build the layout
609 protected void BuildLayout(Widget parent_widget)
610 {
611 // Create the layout
612 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
613
614 if (m_RootFrame)
615 {
616 // Find Widgets
617 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
618 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
619 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
620 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
621 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
622 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
623 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
624 // Set handler
625 m_RootFrame.SetHandler(this);
626 }
627 }
628
629 // Populate the hint with content
630 protected void PopulateLayout()
631 {
632 if (m_RootFrame)
633 {
636 SetHintImage();
638 }
639 }
640
641 // -------------------------------------------
642 // Setters
643 protected void SetHintHeadline()
644 {
645 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
646 }
647 protected void SetHintDescription()
648 {
649 #ifdef DEVELOPER
650 //Print("showing contents for page "+m_PageIndex);
651 #endif
652 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
653 m_UiDescLabel.Update();
654 m_SpacerFrame.Update();
655 }
656 protected void SetHintImage()
657 {
658 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
659
660 // If there is an image
661 if (image_path)
662 {
663 // Show the widget
664 m_UiHintImage.Show(true);
665 // Set the image path
666 m_UiHintImage.LoadImageFile(0, image_path);
667 }
668 else
669 {
670 // Hide the widget
671 m_UiHintImage.Show(false);
672 }
673 }
674 protected void SetHintPaging()
675 {
677 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
678 }
679
680 void ShowRandomPage()
681 {
684 }
685
686 // Set a random page index
687 protected void RandomizePageIndex()
688 {
689 #ifdef DIAG_DEVELOPER
691 {
692 if (m_ForcedIndex != -1)
693 {
695 return;
696 }
697 }
698 #endif
699
700 Math.Randomize(m_Game.GetTime());
701 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
705
706 }
707 // Show next hint page by incrementing the page index.
708 protected void ShowNextPage()
709 {
710 // Update the page index
711 if ( m_PageIndex < m_ContentList.Count() - 1 )
712 {
713 m_PageIndex++;
714 }
715 else
716 {
717 m_PageIndex = 0;
718 }
719
720 //Update the hint page
722 }
723 // Show previous hint page by decreasing the page index.
724 protected void ShowPreviousPage()
725 {
726 // Update the page index
727 if ( m_PageIndex == 0 )
728 {
729 m_PageIndex = m_ContentList.Count() - 1;
730 }
731 else
732 {
733 m_PageIndex--;
734
735 }
736 //Update the hint page
738 }
739
740 // -------------------------------------------
741 // Slideshow
742
743 // Creates new slidshow thread
744 protected void StartSlideshow()
745 {
747 }
748 // Slidshow thread - run code
749 protected void SlideshowThread()
750 {
751 ShowNextPage();
752 }
753 // Stop the slide show
754 protected void StopSlideShow()
755 {
756 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
757 }
758 // Restart the slide show
759 protected void RestartSlideShow()
760 {
763 }
764
765 // ----------------------------------------
766 // Layout manipulation
767
768 override bool OnClick(Widget w, int x, int y, int button)
769 {
770 if (button == MouseState.LEFT)
771 {
772 switch (w)
773 {
774 case m_UiLeftButton:
775 {
777 return true;
778 }
779 case m_UiRightButton:
780 {
781 ShowNextPage();
782 return true;
783 }
784 }
785 }
786 return false;
787 }
788 override bool OnMouseEnter(Widget w, int x, int y)
789 {
790 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
791 {
793 return true;
794 }
795 return false;
796 }
797 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
798 {
799 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
800 {
802 return true;
803 }
804 return false;
805 }
806}
807
808// ---------------------------------------------------------------------------------------------------------
810{
811 override void Init(DayZGame game)
812 {
813 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
814 super.Init(game);
815 }
816}

◆ StopSlideShow()

void StopSlideShow ( )
protected
532{
533 #ifdef DIAG_DEVELOPER
534 static int m_ForcedIndex = -1;//only for debug purposes
535 #endif
536
537 // Const
538 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
539 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
540 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
541 // Widgets
542 protected Widget m_RootFrame;
543 protected Widget m_SpacerFrame;
548 protected ImageWidget m_UiHintImage;
550 // Data
552 protected int m_PageIndex = int.MIN;
553 protected DayZGame m_Game;
554 protected bool m_Initialized;
555 protected Widget m_ParentWidget;
556 protected int m_PreviousRandomIndex = int.MIN;
557
558 // ---------------------------------------------------------
559
560 // Constructor
562 {
563 DayZGame game = DayZGame.Cast(GetGame());
565 Init(game);
566 }
567 // Destructor
568 void ~UiHintPanel()
569 {
571
572 if(m_RootFrame)
573 m_RootFrame.Unlink();
574 }
575
576
577 void Init(DayZGame game)
578 {
579 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
580 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
581 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
582
583 if (m_Initialized)
584 return;
585 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
586 return;
587 m_Initialized = true;
588
589 m_Game = game;
590 // Load Json File
592 // If load successful
593 if (m_ContentList)
594 {
595 // Build the layout
597 // Get random page index
599 // Populate the layout with data
601 // Start the slideshow
603 }
604 else
605 ErrorEx("Could not create the hint panel. The data are missing!");
606 }
607
608 // ------------------------------------------------------
609
610 // Load content data from json file
611 protected void LoadContentList()
612 {
613 string errorMessage;
616 }
617
618 // Create and Build the layout
619 protected void BuildLayout(Widget parent_widget)
620 {
621 // Create the layout
622 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
623
624 if (m_RootFrame)
625 {
626 // Find Widgets
627 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
628 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
629 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
630 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
631 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
632 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
633 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
634 // Set handler
635 m_RootFrame.SetHandler(this);
636 }
637 }
638
639 // Populate the hint with content
640 protected void PopulateLayout()
641 {
642 if (m_RootFrame)
643 {
646 SetHintImage();
648 }
649 }
650
651 // -------------------------------------------
652 // Setters
653 protected void SetHintHeadline()
654 {
655 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
656 }
657 protected void SetHintDescription()
658 {
659 #ifdef DEVELOPER
660 //Print("showing contents for page "+m_PageIndex);
661 #endif
662 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
663 m_UiDescLabel.Update();
664 m_SpacerFrame.Update();
665 }
666 protected void SetHintImage()
667 {
668 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
669
670 // If there is an image
671 if (image_path)
672 {
673 // Show the widget
674 m_UiHintImage.Show(true);
675 // Set the image path
676 m_UiHintImage.LoadImageFile(0, image_path);
677 }
678 else
679 {
680 // Hide the widget
681 m_UiHintImage.Show(false);
682 }
683 }
684 protected void SetHintPaging()
685 {
687 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
688 }
689
690 void ShowRandomPage()
691 {
694 }
695
696 // Set a random page index
697 protected void RandomizePageIndex()
698 {
699 #ifdef DIAG_DEVELOPER
701 {
702 if (m_ForcedIndex != -1)
703 {
705 return;
706 }
707 }
708 #endif
709
710 Math.Randomize(m_Game.GetTime());
711 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
715
716 }
717 // Show next hint page by incrementing the page index.
718 protected void ShowNextPage()
719 {
720 // Update the page index
721 if ( m_PageIndex < m_ContentList.Count() - 1 )
722 {
723 m_PageIndex++;
724 }
725 else
726 {
727 m_PageIndex = 0;
728 }
729
730 //Update the hint page
732 }
733 // Show previous hint page by decreasing the page index.
734 protected void ShowPreviousPage()
735 {
736 // Update the page index
737 if ( m_PageIndex == 0 )
738 {
739 m_PageIndex = m_ContentList.Count() - 1;
740 }
741 else
742 {
743 m_PageIndex--;
744
745 }
746 //Update the hint page
748 }
749
750 // -------------------------------------------
751 // Slideshow
752
753 // Creates new slidshow thread
754 protected void StartSlideshow()
755 {
757 }
758 // Slidshow thread - run code
759 protected void SlideshowThread()
760 {
761 ShowNextPage();
762 }
763 // Stop the slide show
764 protected void StopSlideShow()
765 {
766 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
767 }
768 // Restart the slide show
769 protected void RestartSlideShow()
770 {
773 }
774
775 // ----------------------------------------
776 // Layout manipulation
777
778 override bool OnClick(Widget w, int x, int y, int button)
779 {
780 if (button == MouseState.LEFT)
781 {
782 switch (w)
783 {
784 case m_UiLeftButton:
785 {
787 return true;
788 }
789 case m_UiRightButton:
790 {
791 ShowNextPage();
792 return true;
793 }
794 }
795 }
796 return false;
797 }
798 override bool OnMouseEnter(Widget w, int x, int y)
799 {
800 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
801 {
803 return true;
804 }
805 return false;
806 }
807 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
808 {
809 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
810 {
812 return true;
813 }
814 return false;
815 }
816}
817
818// ---------------------------------------------------------------------------------------------------------
820{
821 override void Init(DayZGame game)
822 {
823 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
824 super.Init(game);
825 }
826}

◆ UiHintPanel()

void UiHintPanel ( Widget parent_widget)
protected
329{
330 #ifdef DIAG_DEVELOPER
331 static int m_ForcedIndex = -1;//only for debug purposes
332 #endif
333
334 // Const
335 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
336 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
337 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
338 // Widgets
339 protected Widget m_RootFrame;
340 protected Widget m_SpacerFrame;
345 protected ImageWidget m_UiHintImage;
347 // Data
349 protected int m_PageIndex = int.MIN;
350 protected DayZGame m_Game;
351 protected bool m_Initialized;
352 protected Widget m_ParentWidget;
353 protected int m_PreviousRandomIndex = int.MIN;
354
355 // ---------------------------------------------------------
356
357 // Constructor
359 {
360 DayZGame game = DayZGame.Cast(GetGame());
362 Init(game);
363 }
364 // Destructor
365 void ~UiHintPanel()
366 {
368
369 if(m_RootFrame)
370 m_RootFrame.Unlink();
371 }
372
373
374 void Init(DayZGame game)
375 {
376 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
377 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
378 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
379
380 if (m_Initialized)
381 return;
382 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
383 return;
384 m_Initialized = true;
385
386 m_Game = game;
387 // Load Json File
389 // If load successful
390 if (m_ContentList)
391 {
392 // Build the layout
394 // Get random page index
396 // Populate the layout with data
398 // Start the slideshow
400 }
401 else
402 ErrorEx("Could not create the hint panel. The data are missing!");
403 }
404
405 // ------------------------------------------------------
406
407 // Load content data from json file
408 protected void LoadContentList()
409 {
410 string errorMessage;
413 }
414
415 // Create and Build the layout
416 protected void BuildLayout(Widget parent_widget)
417 {
418 // Create the layout
419 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
420
421 if (m_RootFrame)
422 {
423 // Find Widgets
424 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
425 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
426 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
427 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
428 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
429 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
430 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
431 // Set handler
432 m_RootFrame.SetHandler(this);
433 }
434 }
435
436 // Populate the hint with content
437 protected void PopulateLayout()
438 {
439 if (m_RootFrame)
440 {
443 SetHintImage();
445 }
446 }
447
448 // -------------------------------------------
449 // Setters
450 protected void SetHintHeadline()
451 {
452 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
453 }
454 protected void SetHintDescription()
455 {
456 #ifdef DEVELOPER
457 //Print("showing contents for page "+m_PageIndex);
458 #endif
459 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
460 m_UiDescLabel.Update();
461 m_SpacerFrame.Update();
462 }
463 protected void SetHintImage()
464 {
465 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
466
467 // If there is an image
468 if (image_path)
469 {
470 // Show the widget
471 m_UiHintImage.Show(true);
472 // Set the image path
473 m_UiHintImage.LoadImageFile(0, image_path);
474 }
475 else
476 {
477 // Hide the widget
478 m_UiHintImage.Show(false);
479 }
480 }
481 protected void SetHintPaging()
482 {
484 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
485 }
486
487 void ShowRandomPage()
488 {
491 }
492
493 // Set a random page index
494 protected void RandomizePageIndex()
495 {
496 #ifdef DIAG_DEVELOPER
498 {
499 if (m_ForcedIndex != -1)
500 {
502 return;
503 }
504 }
505 #endif
506
507 Math.Randomize(m_Game.GetTime());
508 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
512
513 }
514 // Show next hint page by incrementing the page index.
515 protected void ShowNextPage()
516 {
517 // Update the page index
518 if ( m_PageIndex < m_ContentList.Count() - 1 )
519 {
520 m_PageIndex++;
521 }
522 else
523 {
524 m_PageIndex = 0;
525 }
526
527 //Update the hint page
529 }
530 // Show previous hint page by decreasing the page index.
531 protected void ShowPreviousPage()
532 {
533 // Update the page index
534 if ( m_PageIndex == 0 )
535 {
536 m_PageIndex = m_ContentList.Count() - 1;
537 }
538 else
539 {
540 m_PageIndex--;
541
542 }
543 //Update the hint page
545 }
546
547 // -------------------------------------------
548 // Slideshow
549
550 // Creates new slidshow thread
551 protected void StartSlideshow()
552 {
554 }
555 // Slidshow thread - run code
556 protected void SlideshowThread()
557 {
558 ShowNextPage();
559 }
560 // Stop the slide show
561 protected void StopSlideShow()
562 {
563 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
564 }
565 // Restart the slide show
566 protected void RestartSlideShow()
567 {
570 }
571
572 // ----------------------------------------
573 // Layout manipulation
574
575 override bool OnClick(Widget w, int x, int y, int button)
576 {
577 if (button == MouseState.LEFT)
578 {
579 switch (w)
580 {
581 case m_UiLeftButton:
582 {
584 return true;
585 }
586 case m_UiRightButton:
587 {
588 ShowNextPage();
589 return true;
590 }
591 }
592 }
593 return false;
594 }
595 override bool OnMouseEnter(Widget w, int x, int y)
596 {
597 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
598 {
600 return true;
601 }
602 return false;
603 }
604 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
605 {
606 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
607 {
609 return true;
610 }
611 return false;
612 }
613}
614
615// ---------------------------------------------------------------------------------------------------------
617{
618 override void Init(DayZGame game)
619 {
620 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
621 super.Init(game);
622 }
623}

Используется в UIScriptedMenu::Init().

◆ ~UiHintPanel()

void ~UiHintPanel ( )
protected
336{
337 #ifdef DIAG_DEVELOPER
338 static int m_ForcedIndex = -1;//only for debug purposes
339 #endif
340
341 // Const
342 protected int m_SlideShowDelay = 25000; // The speed of the slideshow
343 protected string m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints.layout"; // Layout path
344 protected const string m_DataPath = "scripts/data/hints.json"; // Json path
345 // Widgets
346 protected Widget m_RootFrame;
347 protected Widget m_SpacerFrame;
352 protected ImageWidget m_UiHintImage;
354 // Data
356 protected int m_PageIndex = int.MIN;
357 protected DayZGame m_Game;
358 protected bool m_Initialized;
359 protected Widget m_ParentWidget;
360 protected int m_PreviousRandomIndex = int.MIN;
361
362 // ---------------------------------------------------------
363
364 // Constructor
366 {
367 DayZGame game = DayZGame.Cast(GetGame());
369 Init(game);
370 }
371 // Destructor
372 void ~UiHintPanel()
373 {
375
376 if(m_RootFrame)
377 m_RootFrame.Unlink();
378 }
379
380
381 void Init(DayZGame game)
382 {
383 //as this class is now also being instantiated from within the DayZGame CTOR, where GetGame() does not work yet, we need a way to pass the game instance from DayZGame CTOR
384 //however for modding legacy support purposes, this was done without modifying the CTOR signature with the addition of the Init method,
385 //in order to keep compatibility with existing MODs, there is still a way to instantiate this class properly even without calling Init from the outside
386
387 if (m_Initialized)
388 return;
389 if (!game)//is null when instantiated from DayZGame during loading before calling Init explicitly
390 return;
391 m_Initialized = true;
392
393 m_Game = game;
394 // Load Json File
396 // If load successful
397 if (m_ContentList)
398 {
399 // Build the layout
401 // Get random page index
403 // Populate the layout with data
405 // Start the slideshow
407 }
408 else
409 ErrorEx("Could not create the hint panel. The data are missing!");
410 }
411
412 // ------------------------------------------------------
413
414 // Load content data from json file
415 protected void LoadContentList()
416 {
417 string errorMessage;
420 }
421
422 // Create and Build the layout
423 protected void BuildLayout(Widget parent_widget)
424 {
425 // Create the layout
426 m_RootFrame = m_Game.GetWorkspace().CreateWidgets(m_RootPath, parent_widget);
427
428 if (m_RootFrame)
429 {
430 // Find Widgets
431 m_SpacerFrame = m_RootFrame.FindAnyWidget("GridSpacerWidget1");
432 m_UiLeftButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("LeftButton"));
433 m_UiRightButton = ButtonWidget.Cast(m_RootFrame.FindAnyWidget("RightButton"));
434 m_UiHeadlineLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("HeadlineLabel"));
435 m_UiDescLabel = RichTextWidget.Cast(m_RootFrame.FindAnyWidget("HintDescLabel"));
436 m_UiHintImage = ImageWidget.Cast(m_RootFrame.FindAnyWidget("HintImage"));
437 m_UiPageingLabel = TextWidget.Cast(m_RootFrame.FindAnyWidget("PageInfoLabel"));
438 // Set handler
439 m_RootFrame.SetHandler(this);
440 }
441 }
442
443 // Populate the hint with content
444 protected void PopulateLayout()
445 {
446 if (m_RootFrame)
447 {
450 SetHintImage();
452 }
453 }
454
455 // -------------------------------------------
456 // Setters
457 protected void SetHintHeadline()
458 {
459 m_UiHeadlineLabel.SetText(m_ContentList.Get(m_PageIndex).GetHeadlineText());
460 }
461 protected void SetHintDescription()
462 {
463 #ifdef DEVELOPER
464 //Print("showing contents for page "+m_PageIndex);
465 #endif
466 m_UiDescLabel.SetText(m_ContentList.Get(m_PageIndex).GetDescriptionText());
467 m_UiDescLabel.Update();
468 m_SpacerFrame.Update();
469 }
470 protected void SetHintImage()
471 {
472 string image_path = m_ContentList.Get(m_PageIndex).GetImagePath();
473
474 // If there is an image
475 if (image_path)
476 {
477 // Show the widget
478 m_UiHintImage.Show(true);
479 // Set the image path
480 m_UiHintImage.LoadImageFile(0, image_path);
481 }
482 else
483 {
484 // Hide the widget
485 m_UiHintImage.Show(false);
486 }
487 }
488 protected void SetHintPaging()
489 {
491 m_UiPageingLabel.SetText(string.Format("%1 / %2", m_PageIndex + 1, m_ContentList.Count()));
492 }
493
494 void ShowRandomPage()
495 {
498 }
499
500 // Set a random page index
501 protected void RandomizePageIndex()
502 {
503 #ifdef DIAG_DEVELOPER
505 {
506 if (m_ForcedIndex != -1)
507 {
509 return;
510 }
511 }
512 #endif
513
514 Math.Randomize(m_Game.GetTime());
515 Math.RandomFloat01();//throw-away value, without calling this, the next random number is always the same, calling Math.Randomize(-1) makes no difference
519
520 }
521 // Show next hint page by incrementing the page index.
522 protected void ShowNextPage()
523 {
524 // Update the page index
525 if ( m_PageIndex < m_ContentList.Count() - 1 )
526 {
527 m_PageIndex++;
528 }
529 else
530 {
531 m_PageIndex = 0;
532 }
533
534 //Update the hint page
536 }
537 // Show previous hint page by decreasing the page index.
538 protected void ShowPreviousPage()
539 {
540 // Update the page index
541 if ( m_PageIndex == 0 )
542 {
543 m_PageIndex = m_ContentList.Count() - 1;
544 }
545 else
546 {
547 m_PageIndex--;
548
549 }
550 //Update the hint page
552 }
553
554 // -------------------------------------------
555 // Slideshow
556
557 // Creates new slidshow thread
558 protected void StartSlideshow()
559 {
561 }
562 // Slidshow thread - run code
563 protected void SlideshowThread()
564 {
565 ShowNextPage();
566 }
567 // Stop the slide show
568 protected void StopSlideShow()
569 {
570 m_Game.GetCallQueue(CALL_CATEGORY_GUI).Remove(SlideshowThread);
571 }
572 // Restart the slide show
573 protected void RestartSlideShow()
574 {
577 }
578
579 // ----------------------------------------
580 // Layout manipulation
581
582 override bool OnClick(Widget w, int x, int y, int button)
583 {
584 if (button == MouseState.LEFT)
585 {
586 switch (w)
587 {
588 case m_UiLeftButton:
589 {
591 return true;
592 }
593 case m_UiRightButton:
594 {
595 ShowNextPage();
596 return true;
597 }
598 }
599 }
600 return false;
601 }
602 override bool OnMouseEnter(Widget w, int x, int y)
603 {
604 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
605 {
607 return true;
608 }
609 return false;
610 }
611 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
612 {
613 if (w == m_RootPath || w == m_UiLeftButton || w == m_UiRightButton)
614 {
616 return true;
617 }
618 return false;
619 }
620}
621
622// ---------------------------------------------------------------------------------------------------------
624{
625 override void Init(DayZGame game)
626 {
627 m_RootPath = "Gui/layouts/new_ui/hints/in_game_hints_load.layout";
628 super.Init(game);
629 }
630}

Переменные

◆ m_ContentList

◆ m_DataPath

const string m_DataPath = "scripts/data/hints.json"
protected

Используется в ScriptedWidgetEventHandler::LoadContentList().

◆ m_Game

◆ m_Initialized

◆ m_PageIndex

◆ m_ParentWidget

◆ m_PreviousRandomIndex

int m_PreviousRandomIndex = int.MIN
protected

◆ m_RootFrame

◆ m_RootPath

◆ m_SlideShowDelay

int m_SlideShowDelay = 25000
protected

Используется в ScriptedWidgetEventHandler::StartSlideshow().

◆ m_SpacerFrame

◆ m_UiDescLabel

◆ m_UiHeadlineLabel

TextWidget m_UiHeadlineLabel
protected

◆ m_UiHintImage

◆ m_UiLeftButton

◆ m_UiPageingLabel

TextWidget m_UiPageingLabel
protected

◆ m_UiRightButton