Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AdvancedActionRowComponent.c
Go to the documentation of this file.
2{
3 [Attribute(UIColors.GetColorAttribute(UIColors.NEUTRAL_ACTIVE_STANDBY))]
4 protected ref Color m_ActionColor;
5
6 [Attribute("1")]
7 protected bool m_bShowConflictsList;
8
9 [Attribute(UIConstants.ACTION_DISPLAY_ICON_SCALE_BIG)]
10 protected float m_fActionIconScale;
11
12 [Attribute("0", UIWidgets.ComboBox, "Determines the colors of the rich text action icons", "", ParamEnumArray.FromEnum(SCR_EActionDisplayState))]
13 protected SCR_EActionDisplayState m_eActionIconState;
14
15 protected int m_iKeybindIndex;
16
21
22 protected SCR_HorizontalScrollAnimationComponent m_HorizontalScrollComponent;
23
24 protected const string ROOT_NAME = "AdvancedKeybindActionDisplay";
25
26 //------------------------------------------------------------------------------------------------
27 override void HandlerAttached(Widget w)
28 {
29 super.HandlerAttached(w);
30
31 m_wActionBindRichText = RichTextWidget.Cast(m_wRoot.FindAnyWidget("ActionRichText"));
32 m_wIndexRichText = RichTextWidget.Cast(m_wRoot.FindAnyWidget("IndexRichText"));
33 m_wWarningRichText = RichTextWidget.Cast(m_wRoot.FindAnyWidget("WarningText"));
34 m_wActionsRichText = RichTextWidget.Cast(m_wRoot.FindAnyWidget("WarningActions"));
35
36 Widget frame = m_wRoot.FindAnyWidget("HorizontalScrollFrame");
37 if (frame)
38 m_HorizontalScrollComponent = SCR_HorizontalScrollAnimationComponent.FindComponent(frame);
39
42 }
43
44 //------------------------------------------------------------------------------------------------
45 // Displays the action's specified bind for the chosen device and conflicting occurrances
46 void Init(string actionName, string actionPreset, int index, SCR_SettingsManagerKeybindModule settingsKeybindModule, EInputDeviceType device)
47 {
49
50 string deviceString = UIConstants.DEVICE_KEYBOARD;
51 if (device == EInputDeviceType.GAMEPAD)
52 deviceString = UIConstants.DEVICE_GAMEPAD;
53
55 m_wActionBindRichText.SetText(string.Format(
56 "<action name='%1' preset='%2' index='%3' device='%4' scale='%5' state ='%6'/>",
57 actionName,
58 actionPreset,
59 index,
60 deviceString,
61 m_fActionIconScale.ToString(),
62 UIConstants.GetActionDisplayStateAttribute(m_eActionIconState)
63 ));
64
66 return;
67
68 //offset index by 1 so it's comfortable for humans
69 int order = m_iKeybindIndex + 1;
70
71 //todo: check how localization deals with the dot: Updated with Wlib - removing "."
73 m_wIndexRichText.SetText(order.ToString() + ".");
74
75 //check for conflicts and deal with them if they exist
76 array<SCR_KeyBindingEntry> conflictedActions = {};
77 bool conflicted = m_bShowConflictsList && settingsKeybindModule.IsActionConflicted(actionName, conflictedActions, m_iKeybindIndex, actionPreset);
78
80 m_wWarningRichText.SetVisible(conflicted);
81
83 m_wActionsRichText.SetVisible(conflicted);
84
85 if (!conflicted || !m_wActionsRichText)
86 return;
87
88 string actionNames = conflictedActions.Get(0).m_sDisplayName;
89
90 for (int i = 1, count = conflictedActions.Count(); i < count; i++)
91 {
92 actionNames = actionNames + ", " + conflictedActions.Get(i).m_sDisplayName;
93 }
94
95 m_wActionsRichText.SetText(actionNames);
96 }
97
98 //------------------------------------------------------------------------------------------------
100 {
101 return m_iKeybindIndex;
102 }
103
104 //------------------------------------------------------------------------------------------------
106 {
108 return;
109
110 m_HorizontalScrollComponent.AnimationStart();
111 }
112
113 //------------------------------------------------------------------------------------------------
115 {
117 return;
118
119 m_HorizontalScrollComponent.AnimationStop();
120 m_HorizontalScrollComponent.ResetPosition();
121 }
122
123 //------------------------------------------------------------------------------------------------
128
129 //------------------------------------------------------------------------------------------------
131 {
132 Widget actionRoot = w.FindAnyWidget(ROOT_NAME);
133 if (!actionRoot)
134 return null;
135
137 }
138}
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition Color.c:13
static SCR_AdvancedActionRowComponent FindComponentInHierarchy(notnull Widget w)
static SCR_AdvancedActionRowComponent FindComponent(notnull Widget w)
SCR_HorizontalScrollAnimationComponent m_HorizontalScrollComponent
void Init(string actionName, string actionPreset, int index, SCR_SettingsManagerKeybindModule settingsKeybindModule, EInputDeviceType device)
bool IsActionConflicted(string actionName, notnull out array< SCR_KeyBindingEntry > confirmedConflicts, int bindIndex, string preset=string.Empty)
returns false if the action has no conflicts (no other action in keybind settings with same bind),...
SCR_FieldOfViewSettings Attribute