Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BuilderNameTooltipDetail.c
Go to the documentation of this file.
1 
4 {
5  //------------------------------------------------------------------------------------------------
6  override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
7  {
8  TextWidget text = TextWidget.Cast(widget.FindAnyWidget("Text"));
9  if (!text)
10  return false;
11 
12  BaseGameMode gameMode = GetGame().GetGameMode();
13  if (!gameMode)
14  return false;
15 
16  SCR_CampaignBuildingCompositionComponent compositionComponent = SCR_CampaignBuildingCompositionComponent.Cast(entity.GetOwner().FindComponent(SCR_CampaignBuildingCompositionComponent));
17  if (!compositionComponent)
18  return false;
19 
20  string name = GetPlayerName(compositionComponent.GetBuilderId());
21  if (SCR_StringHelper.IsEmptyOrWhiteSpace(name))
22  return false;
23 
24  text.SetText(name);
25  return true;
26  }
27 
28  //------------------------------------------------------------------------------------------------
29  protected string GetPlayerName(int playerID)
30  {
31  PlayerManager playerManager = GetGame().GetPlayerManager();
32  if (!playerManager)
33  return string.Empty;
34 
35  string playerName = playerManager.GetPlayerName(playerID);
36 
37  //Player name not found
38  if (playerName.IsEmpty())
39  {
40  SCR_NotificationsComponent notificationsManager = SCR_NotificationsComponent.GetInstance();
41  if (notificationsManager)
42  playerName = notificationsManager.GetPlayerNameFromHistory(playerID);
43  }
44 
45  return playerName;
46  }
47 }
SCR_BuilderNameTooltipDetail
Definition: SCR_BuilderNameTooltipDetail.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_StringHelper
Definition: SCR_StringHelper.c:1
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
SCR_EntityTooltipDetail
Definition: SCR_EntityTooltipDetail.c:2
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
PlayerManager
Definition: PlayerManager.c:12
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468