Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
creditsdepartmentelement.c
Go to the documentation of this file.
1 class CreditsDepartmentElement extends CreditsElement
2 {
3  protected TextWidget m_DepartmentTitle;
4  protected GridSpacerWidget m_DepartmentSections;
5  protected ref array<ref CreditsDepartmentSection> m_DepartmentSectionEntries = new array<ref CreditsDepartmentSection>;
6 
7  void CreditsDepartmentElement( int index, Widget parent, JsonDataCreditsDepartment department_data )
8  {
9  m_Root = GetGame().GetWorkspace().CreateWidgets( "gui/layouts/new_ui/credits/department_element/department_element.layout", parent );
10  m_DepartmentTitle = TextWidget.Cast( m_Root.FindAnyWidget( "department_title" ) );
11  m_DepartmentSections = GridSpacerWidget.Cast( m_Root.FindAnyWidget( "department_sections" ) );
12 
13  if( department_data.DepartmentName != "" )
14  {
15  m_DepartmentTitle.SetText( department_data.DepartmentName );
16  }
17  else
18  {
19  m_DepartmentTitle.Show( false );
20  m_Root.FindAnyWidget( "SeparatorPanel" ).Show( false );
21  }
22 
23  m_Root.SetSort( index );
24  LoadDataAsync( department_data.Sections );
25  }
26 
27  void LoadDataAsync( array<ref JsonDataCreditsSection> department_data )
28  {
29  for( int i = 1; i <= department_data.Count(); i++ )
30  {
31  ref CreditsDepartmentSection e = new CreditsDepartmentSection( i, m_DepartmentSections, department_data.Get( i - 1 ) );
32  m_DepartmentSectionEntries.Insert( e );
33  }
34 
35  m_DepartmentSections.Update();
36  }
37 }
38 
40 {
41  protected TextWidget m_SectionTitle;
42  protected WrapSpacerWidget m_SectionSections;
44 
45  void CreditsDepartmentSection( int index, Widget parent, JsonDataCreditsSection section_data )
46  {
47  m_Root = GetGame().GetWorkspace().CreateWidgets( "gui/layouts/new_ui/credits/department_element/department_section.layout", parent );
48  m_SectionTitle = TextWidget.Cast( m_Root.FindAnyWidget( "section_title" ) );
49  m_SectionSections = WrapSpacerWidget.Cast( m_Root.FindAnyWidget( "section_elements" ) );
50 
51  if( section_data.SectionName != "" )
52  {
53  m_SectionTitle.SetText( section_data.SectionName );
54  }
55  else
56  {
57  m_SectionTitle.Show( false );
58  m_Root.FindAnyWidget( "SeparatorPanel" ).Show( false );
59  }
60 
61  LoadDataAsync( section_data.SectionLines );
62  m_Root.SetSort( index );
63  }
64 
65  void LoadDataAsync( array<string> section_data )
66  {
67  for( int i = 1; i <= section_data.Count(); i++ )
68  {
69  TextWidget w = TextWidget.Cast( GetGame().GetWorkspace().CreateWidgets( "gui/layouts/new_ui/credits/department_element/department_section_element.layout", m_SectionSections ) );
70  w.SetText( section_data.Get( i - 1 ) + " \n" );
71  w.Update();
72  m_Root.SetSort( i );
73  m_SectionEntries.Insert( w );
74  }
75 
76  m_SectionSections.Update();
77  }
78 }
GetGame
proto native CGame GetGame()
CreditsDepartmentSection
void CreditsDepartmentSection(int index, Widget parent, JsonDataCreditsSection section_data)
Definition: creditsdepartmentelement.c:45
JsonDataCreditsDepartment
Definition: jsondatacreditsdepartment.c:1
m_SectionTitle
class CreditsDepartmentElement extends CreditsElement m_SectionTitle
TextWidget
Definition: enwidgets.c:219
m_SectionEntries
protected ref array< Widget > m_SectionEntries
Definition: creditsdepartmentelement.c:43
m_SectionSections
protected WrapSpacerWidget m_SectionSections
Definition: creditsdepartmentelement.c:42
LoadDataAsync
void LoadDataAsync(array< string > section_data)
Definition: creditsdepartmentelement.c:65
CreditsElement
Definition: creditsdepartmentelement.c:1
array< ref CreditsDepartmentSection >
JsonDataCreditsSection
Definition: jsondatacreditssection.c:1
Widget
Definition: enwidgets.c:189
m_Root
protected Widget m_Root
Definition: sizetochild.c:91