4 protected Widget m_wRootWidget;
8 protected ref array<ResourceName> m_aBackgroundImages;
11 protected ref array<ResourceName> m_aRankImages;
13 protected ImageWidget m_RankImageWidget;
14 protected RichTextWidget m_RankLevel;
15 protected RichTextWidget m_LevelProgress, m_PlayerLevel;
16 protected ImageWidget m_BackgroundUserPictureImageWidget;
19 [
Attribute(
"0",
"auto",
"Min progress bar value")]
20 protected int m_iMinBarValue;
22 [
Attribute(
"100",
"auto",
"Value to display when progress is 0")]
23 protected int m_iMinRepresentativeValue;
25 [
Attribute(
"10000",
"auto",
"Max progress bar value")]
26 protected int m_iMaxBarValue;
28 [
Attribute(
"{9F18C476AB860F3B}Prefabs/World/Game/ItemPreviewManager.et")]
29 protected ResourceName previewManagerResource;
31 [
Attribute(
"{5B1996C05B1E51A4}Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_AR.et")]
32 protected ResourceName loadoutResource;
35 protected override void HandlerAttached(Widget w)
41 void PrepareHUD(
string rankImageName,
string rankLevelName,
string backgroundUserPictureName,
string CharacterLoadoutName,
string LevelProgressName,
string PlayerLevelName,
string ProgressBarName,
string EditAppearanceButtonName)
46 if (rankImageName.IsEmpty())
47 m_RankImageWidget = ImageWidget.Cast(m_wRootWidget.FindAnyWidget(rankImageName));
49 if (rankLevelName !=
"")
50 m_RankLevel = RichTextWidget.Cast(m_wRootWidget.FindAnyWidget(rankLevelName));
52 if (backgroundUserPictureName !=
"")
53 m_BackgroundUserPictureImageWidget = ImageWidget.Cast(m_wRootWidget.FindAnyWidget(backgroundUserPictureName));
55 if (CharacterLoadoutName !=
"")
57 Widget characterLoadout = m_wRootWidget.FindAnyWidget(CharacterLoadoutName);
61 if (characterLoadoutHandler)
63 ItemPreviewManagerEntity previewManager = characterLoadoutHandler.GetPreviewManagerEntity();
66 if (previewManager && previewWidget)
68 characterLoadoutHandler.SetPreviewManagerEntity(previewManager);
69 characterLoadoutHandler.SetItemPreviewWidget(previewWidget);
71 previewManager.SetPreviewItemFromPrefab(previewWidget, loadoutResource);
72 characterLoadoutHandler.SetReloadLoadout(
false);
78 if (ProgressBarName !=
"")
85 m_ProgressBar.SetMin(m_iMinBarValue);
86 m_ProgressBar.SetMax(m_iMaxBarValue);
88 if (LevelProgressName !=
"")
89 m_LevelProgress = RichTextWidget.Cast(m_wRootWidget.FindAnyWidget(LevelProgressName));
91 if (PlayerLevelName !=
"")
92 m_PlayerLevel = RichTextWidget.Cast(m_wRootWidget.FindAnyWidget(PlayerLevelName));
95 if (EditAppearanceButtonName !=
"")
98 if (!m_EditAppearance)
101 m_EditAppearance.m_OnClicked.Insert(OnEditAppearance);
106 void OnEditAppearance()
112 void SetLevelProgressGain(
float f)
114 RichTextWidget levelProgressGain = RichTextWidget.Cast(m_wRootWidget.FindAnyWidget(
"LevelGained"));
115 if (!levelProgressGain)
120 levelProgressGain.SetText(
"+"+f);
121 levelProgressGain.SetEnabled(
true);
122 levelProgressGain.SetVisible(
true);
126 levelProgressGain.SetText(
"");
127 levelProgressGain.SetEnabled(
false);
128 levelProgressGain.SetVisible(
false);
132 void SetPlayerRank(
int rank)
140 m_RankLevel.SetTextFormat(
"#AR-CareerProfile_RankTitle",rank);
142 if (m_RankImageWidget && m_aRankImages && m_aRankImages.Count() >= rank)
147 void SetRandomBackgroundPicture()
149 if (m_BackgroundUserPictureImageWidget && m_aBackgroundImages.Count()>0)
151 m_BackgroundUserPictureImageWidget.SetColor(Color.FromSRGBA(255,255,255,204));
152 SCR_WLibComponentBase.SetTexture(m_BackgroundUserPictureImageWidget, m_aBackgroundImages[Math.RandomInt(0,m_aBackgroundImages.Count())],
string.Empty);
158 void SetPlayerLevel(
int n)
161 m_PlayerLevel.SetTextFormat(
"#AR-CareerProfile_PlayerLv",n);
165 void SetProgressBarValue(
int n)
167 if (n < m_iMinBarValue || n > m_iMaxBarValue)
171 m_LevelProgress.SetText (
"" + n +
"/" + m_iMaxBarValue);
175 if (n > m_iMinRepresentativeValue)
176 m_ProgressBar.SetValue(n);
178 m_ProgressBar.SetValue(m_iMinRepresentativeValue);