4 protected Widget m_wFirstColumnWidget;
5 protected Widget m_wCareerSpecializationsWidget;
6 protected Widget m_wProfileNotFound;
8 protected Widget m_wHud;
17 protected ResourceName m_StatsLayout;
20 protected ResourceName m_HeaderStatsLayout;
23 protected ResourceName m_ProgressionStatsLayout;
28 override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout,
int index)
30 super.OnTabCreate(menuRoot, buttonsLayout,
index);
32 m_wFirstColumnWidget =
GetRootWidget().FindAnyWidget(
"FirstColumn");
33 m_wCareerSpecializationsWidget =
GetRootWidget().FindAnyWidget(
"CareerSpecializations0");
34 m_wProfileNotFound =
GetRootWidget().FindAnyWidget(
"ProfileNotFound");
36 if (!m_wFirstColumnWidget || !m_wCareerSpecializationsWidget || !m_wProfileNotFound)
39 m_wHud = m_wFirstColumnWidget.FindAnyWidget(
"CareerProfileHUD0");
46 m_HudHandler.PrepareHUD(
"",
"RankTitleText",
"BackgroundUserPicture",
"CharacterLoadout",
"LevelProgress",
"PlayerLevel",
"ProgressBar0",
"");
48 Widget m_wCharacterLoadout = m_wHud.FindAnyWidget(
"CharacterLoadout");
49 if (!m_wCharacterLoadout)
52 m_LoadoutPreviewHandler.SetPreviewedLoadout(m_PlayerLoadout);
55 if (!m_CareerSpecializationsHandler)
61 if (m_PlayerData.IsDataReady())
64 m_PlayerData.GetDataReadyInvoker().Insert(FillFields);
68 override void OnMenuUpdate(
float tDelta)
70 super.OnMenuUpdate(tDelta);
72 GetGame().GetInputManager().ActivateContext(
"CareerProfileContext");
76 protected void FillFields()
78 if (!m_PlayerData || !m_PlayerData.IsDataReady())
80 Print(
"SCR_CareerEndScreenUI: Array of EarntPoints from player's PlayerData object is empty.", LogLevel.ERROR);
84 #ifdef DEBUG_PLAYERPROFILE
85 m_PlayerData.DebugCalculateStats();
88 FillScreen(!m_PlayerData.IsEmptyProfile());
92 void FillScreen(
bool profileDataFound)
96 m_wFirstColumnWidget.SetVisible(
true);
97 m_wCareerSpecializationsWidget.SetVisible(
true);
98 m_wProfileNotFound.SetVisible(
false);
100 FillSpecializationsFrame();
104 m_wFirstColumnWidget.SetVisible(
false);
105 m_wCareerSpecializationsWidget.SetVisible(
false);
106 m_wProfileNotFound.SetVisible(
true);
111 protected void FillHudAndStats()
113 #ifdef DEBUG_PLAYERPROFILE
114 Print(
"SCR_CareerProfileOverviewUI: Debugging FillHudAndStats!", LogLevel.DEBUG);
117 int Level = m_PlayerData.GetStat(
SCR_EDataStats.LEVEL_EXPERIENCE);
121 m_HudHandler.SetPlayerRank(m_PlayerData.GetStat(
SCR_EDataStats.RANK));
122 m_HudHandler.SetRandomBackgroundPicture();
124 Widget RankStatsWidget = m_wFirstColumnWidget.FindAnyWidget(
"RankStatEntries");
125 if (!RankStatsWidget)
128 #ifdef DEBUG_PLAYERPROFILE
129 array<float> EarntPoints = m_PlayerData.GetArrayEarntPoints();
131 m_HudHandler.SetLevelProgressGain(EarntPoints[
SCR_EDataStats.LEVELEXPERIENCE]);
134 int minutes = (m_PlayerData.GetSessionDuration() - m_PlayerData.GetSessionDuration(
false)) / 60;
135 SCR_CareerUI.CreateProgressionStatEntry(RankStatsWidget, m_ProgressionStatsLayout,
"#AR-CareerProfile_TimePlayed", Math.Floor(EarntPoints[
SCR_EDataStats.SESSIONDURATION] * warCrimes), Math.Floor(EarntPoints[
SCR_EDataStats.SESSIONDURATION]),
"#AR-CareerProfile_Minutes",
""+Math.Floor(minutes));
137 int days, hours, minutes, seconds;
140 SCR_CareerUI.CreateStatEntry(RankStatsWidget, m_StatsLayout,
"#AR-CareerProfile_TimePlayed",
"#AR-CareerProfile_TimePlayed_TotalValue",
""+days,
""+hours,
""+minutes);
141 SCR_CareerUI.CreateStatEntry(RankStatsWidget, m_StatsLayout,
"#AR-CareerProfile_Deaths",
"#AR-CareerProfile_Times",
""+Math.Floor(m_PlayerData.GetStat(
SCR_EDataStats.DEATHS)));
142 SCR_CareerUI.CreateHeaderStatEntry(RankStatsWidget, m_HeaderStatsLayout,
"#AR-CareerProfile_Distance");
143 SCR_CareerUI.CreateStatEntry(RankStatsWidget, m_StatsLayout,
"#AR-CareerProfile_DistanceTravelled_ByFoot",
"#AR-CareerProfile_KMs",
""+Math.Floor(m_PlayerData.GetStat(
SCR_EDataStats.DISTANCE_WALKED)/1000));
144 SCR_CareerUI.CreateStatEntry(RankStatsWidget, m_StatsLayout,
"#AR-CareerProfile_DistanceTravelled_AsDriver",
"#AR-CareerProfile_KMs",
""+Math.Floor(m_PlayerData.GetStat(
SCR_EDataStats.DISTANCE_DRIVEN)/1000));
145 SCR_CareerUI.CreateStatEntry(RankStatsWidget, m_StatsLayout,
"#AR-CareerProfile_DistanceTravelled_AsPassenger",
"#AR-CareerProfile_KMs",
""+Math.Floor(m_PlayerData.GetStat(
SCR_EDataStats.DISTANCE_AS_OCCUPANT)/1000));
150 protected void FillSpecializationsFrame()
152 #ifdef DEBUG_PLAYERPROFILE
153 Print(
"SCR_CareerProfileOverviewUI: Debugging FillSpecializationsFrame!", LogLevel.DEBUG);
154 m_CareerSpecializationsHandler.SetShowProgression(
true);
156 m_CareerSpecializationsHandler.SetShowProgression(
false);
159 m_CareerSpecializationsHandler.FillSpecializations(m_PlayerData, m_StatsLayout, m_HeaderStatsLayout, m_ProgressionStatsLayout);
160 m_CareerSpecializationsHandler.FillWarCrimes();
171 protected void ControllerActive(EInputDeviceType oldDevice, EInputDeviceType newDevice)
173 if (newDevice == EInputDeviceType.GAMEPAD || newDevice == EInputDeviceType.JOYSTICK)
175 Print(
"Device is gamepad or joystick now", LogLevel.DEBUG);
180 if (oldDevice != EInputDeviceType.GAMEPAD || newDevice != EInputDeviceType.JOYSTICK)
182 Print(
"Device is mouse or keyboard now", LogLevel.DEBUG);