Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_QuickslotBaseContainer.c
Go to the documentation of this file.
1
2
4{
5 protected static const string COMMAND_OUTLINE_WIDGET_NAME = "CommandOutline";
6
7 //------------------------------------------------------------------------------------------------
10
11 //------------------------------------------------------------------------------------------------
14 void HandleVisualization(ImageWidget iconImage, RenderTargetWidget renderTarget, RichTextWidget text, TextWidget quickslotNumber);
15
16 //------------------------------------------------------------------------------------------------
19}
20
22{
23 protected IEntity m_Entity;
24
25 //------------------------------------------------------------------------------------------------
27 void SetEntity(IEntity entity)
28 {
29 m_Entity = entity;
30 }
31
32 //------------------------------------------------------------------------------------------------
35 {
36 return m_Entity;
37 }
38
39 //------------------------------------------------------------------------------------------------
42 {
43 m_Entity = entity;
44 }
45
46 //------------------------------------------------------------------------------------------------
49 {
50 slotUI.UseItem(playerCharacter, SCR_EUseContext.FROM_QUICKSLOT);
51 }
52
53 //------------------------------------------------------------------------------------------------
55 override void HandleVisualization(ImageWidget iconImage, RenderTargetWidget renderTarget, RichTextWidget text, TextWidget quickslotNumber)
56 {
57 iconImage.SetVisible(false);
58 renderTarget.SetVisible(true);
59 text.SetVisible(false);
60 quickslotNumber.SetVisible(false);
61
62 Widget commandOutline = iconImage.GetParent().FindAnyWidget(COMMAND_OUTLINE_WIDGET_NAME);
63 if (commandOutline)
64 commandOutline.SetVisible(false);
65 }
66
67 //------------------------------------------------------------------------------------------------
69 {
70 if (!m_Entity)
71 return false;
72
73 return true;
74 }
75}
76
78{
79 protected string m_sCommandName;
80
81 //------------------------------------------------------------------------------------------------
83 void SetCommandName(string name)
84 {
85 m_sCommandName = name;
86 }
87
88 //------------------------------------------------------------------------------------------------
91 {
92 return m_sCommandName;
93 }
94
95 //------------------------------------------------------------------------------------------------
97 override void ActivateContainer()
98 {
99 PlayerController playerController = GetGame().GetPlayerController();
100 if (!playerController)
101 return;
102
103 SCR_PlayerControllerCommandingComponent commandingComp = SCR_PlayerControllerCommandingComponent.Cast(playerController.FindComponent(SCR_PlayerControllerCommandingComponent));
104 if (!commandingComp)
105 return;
106
107 commandingComp.PrepareExecuteCommand(m_sCommandName);
108 }
109
110 //------------------------------------------------------------------------------------------------
112 override void HandleVisualization(ImageWidget iconImage, RenderTargetWidget renderTarget, RichTextWidget text, TextWidget quickslotNumber)
113 {
114 //hide unused widgets which we do not want to use for command quickslot visualization
115 iconImage.SetVisible(true);
116 iconImage.SetColor(GUIColors.ENABLED);
117 renderTarget.SetVisible(false);
118 quickslotNumber.SetOpacity(0);
119
120 Widget commandOutline = iconImage.GetParent().FindAnyWidget(COMMAND_OUTLINE_WIDGET_NAME);
121 if (commandOutline)
122 commandOutline.SetVisible(true);
123
124 SCR_CommandingManagerComponent commandingManager = SCR_CommandingManagerComponent.GetInstance();
125 if (!commandingManager)
126 return;
127
128 SCR_BaseRadialCommand command = commandingManager.FindCommand(m_sCommandName);
129 if (!command)
130 return;
131
132 iconImage.LoadImageFromSet(0, command.GetIconImageset(), command.GetIconName());
133 }
134
135 //------------------------------------------------------------------------------------------------
138 {
139 m_sCommandName = name;
140 }
141
142 //------------------------------------------------------------------------------------------------
144 {
145 return !m_sCommandName.IsEmpty();
146 }
147}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAITargetInfoCategory m_Entity
void SCR_CommandingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_EUseContext
void SCR_QuickslotEntityContainer(IEntity entity)
void SetEntity(IEntity entity)
void UseItem(IEntity player, SCR_EUseContext context)
SCR_QuickslotBaseContainer is intended to be used for quickslots, to allow quickslotting of non-item ...
void ActivateContainer()
Gets called when the quickslot with this container is activated.
void HandleVisualization(ImageWidget iconImage, RenderTargetWidget renderTarget, RichTextWidget text, TextWidget quickslotNumber)
static const string COMMAND_OUTLINE_WIDGET_NAME
bool IsQuickslotActionAvailable()
returns true if the containers action can be performed
override void HandleVisualization(ImageWidget iconImage, RenderTargetWidget renderTarget, RichTextWidget text, TextWidget quickslotNumber)
IEntity GetEntity()