Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_KeybindActionDisplayComponent.c
Go to the documentation of this file.
1/*
2Component that takes care of displaying action bindings
3Additional text will display the number of extra bindings associated with the action
4*/
5
7{
8 [Attribute(UIConstants.ACTION_DISPLAY_ICON_SCALE_BIG)]
9 float m_fActionIconScale;
10
12
13 //TODO: cleanup: move the separator to the ActionDisplayRow
16
17 //------------------------------------------------------------------------------------------------
18 override void HandlerAttached(Widget w)
19 {
20 super.HandlerAttached(w);
21
22 m_wText = RichTextWidget.Cast(m_wRoot.FindAnyWidget("Text"));
23 m_wSeparator = m_wRoot.FindAnyWidget("Separator");
24 }
25
26 //------------------------------------------------------------------------------------------------
28 {
29 if (!data || !data.m_Entry || !data.m_SettingsKeybindModule)
30 return;
31
32 SCR_KeyBindingEntry entry = data.m_Entry;
33
34 string finalPreset;
35 string deviceString;
36 string actionName;
37 string preset;
38
39 // Devices
40 if (data.m_eDevice == EInputDeviceType.GAMEPAD) // Gamepad setup
41 {
42 if (!entry.m_sActionNameGamepadOptional.IsEmpty())
43 actionName = entry.m_sActionNameGamepadOptional;
44 else
45 actionName = entry.m_sActionName;
46
47 if (!entry.m_sPresetGamepadOptional.IsEmpty())
48 preset = entry.m_sPresetGamepadOptional;
49 else
50 preset = entry.m_sPreset;
51
52 deviceString = UIConstants.DEVICE_GAMEPAD;
53
54 if (!preset.IsEmpty())
55 finalPreset = data.m_SettingsKeybindModule.GetGamepadPresetPrefix() + preset;
56 }
57 else if (data.m_eDevice == EInputDeviceType.KEYBOARD) // Keyboard & mouse setup
58 {
59 actionName = entry.m_sActionName;
60 preset = entry.m_sPreset;
61 deviceString = UIConstants.DEVICE_KEYBOARD;
62
63 if (!preset.IsEmpty())
64 finalPreset = data.m_SettingsKeybindModule.GetPrimaryPresetPrefix() + preset;
65 }
66
67 // Set Action text
68 if (m_wText)
69 {
70 string binding = string.Format(
71 "<action name='%1' preset='%2' device='%3' scale='%4' index='%5' state='%6'/>",
72 actionName,
73 finalPreset,
74 deviceString,
75 m_fActionIconScale.ToString(),
76 data.m_iIndex.ToString(),
77 UIConstants.GetActionDisplayStateAttribute(data.m_eState)
78 );
79
80 m_wText.SetText(binding);
81 }
82
83 // Store data, should we need to modify only one of them
85
86 if (m_wSeparator)
87 m_wSeparator.SetVisible(data.m_iIndex < data.m_iLastIndex);
88 }
89
90 //------------------------------------------------------------------------------------------------
95
96 //------------------------------------------------------------------------------------------------
101}
102
104{
105 SCR_KeyBindingEntry m_Entry;
107 EInputDeviceType m_eDevice;
108 SCR_EActionDisplayState m_eState;
109 int m_iIndex;
111
112 //------------------------------------------------------------------------------------------------
113 void SCR_KeybindActionDisplayData(SCR_KeyBindingEntry entry, SCR_SettingsManagerKeybindModule settingsKeybindModule, EInputDeviceType device, SCR_EActionDisplayState state, int index = 0, int lastIndex = 0)
114 {
115 m_Entry = entry;
116 m_SettingsKeybindModule = settingsKeybindModule;
117 m_eDevice = device;
118 m_eState = state;
119 m_iIndex = index;
120 m_iLastIndex = lastIndex;
121 }
122}
EAITargetClusterState m_eState
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Get all prefabs that have the spawner data
void SCR_KeybindActionDisplayData(SCR_KeyBindingEntry entry, SCR_SettingsManagerKeybindModule settingsKeybindModule, EInputDeviceType device, SCR_EActionDisplayState state, int index=0, int lastIndex=0)
EInputDeviceType m_eDevice
SCR_SettingsManagerKeybindModule m_SettingsKeybindModule
class SCR_KeybindDialogs m_Entry
static SCR_KeybindActionDisplayComponent FindComponent(Widget w)
ref SCR_KeybindActionDisplayData m_ActionDisplayData
SCR_KeybindActionDisplayData GetActionDisplayData()
void UpdateActionDisplay(SCR_KeybindActionDisplayData data)
SCR_FieldOfViewSettings Attribute