4 protected ref Color m_ActionColor;
7 protected bool m_bShowConflictsList;
10 protected float m_fActionIconScale;
12 [
Attribute(
"0", UIWidgets.ComboBox,
"Determines the colors of the rich text action icons",
"", ParamEnumArray.FromEnum(SCR_EActionDisplayState))]
13 protected SCR_EActionDisplayState m_eActionIconState;
15 protected int m_iKeybindIndex;
17 protected RichTextWidget m_wActionBindRichText;
18 protected RichTextWidget m_wIndexRichText;
19 protected RichTextWidget m_wWarningRichText;
20 protected RichTextWidget m_wActionsRichText;
24 protected const string ROOT_NAME =
"AdvancedKeybindActionDisplay";
27 override void HandlerAttached(Widget w)
29 super.HandlerAttached(w);
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"));
36 Widget frame =
m_wRoot.FindAnyWidget(
"HorizontalScrollFrame");
40 if (m_HorizontalScrollComponent)
48 m_iKeybindIndex =
index;
50 string deviceString = settingsKeybindModule.GetKeyboardDeviceString();
51 if (device == EInputDeviceType.GAMEPAD)
52 deviceString = settingsKeybindModule.GetGamepadDeviceString();
54 if (m_wActionBindRichText)
55 m_wActionBindRichText.SetText(
string.Format(
56 "<action name='%1' preset='%2' index='%3' device='%4' scale='%5' state ='%6'/>",
61 m_fActionIconScale.ToString(),
62 UIConstants.GetActionDisplayStateAttribute(m_eActionIconState)
65 if (!m_wIndexRichText)
69 int order = m_iKeybindIndex + 1;
73 m_wIndexRichText.SetText(order.ToString() +
".");
76 array<SCR_KeyBindingEntry> conflictedActions = {};
77 bool conflicted = m_bShowConflictsList && settingsKeybindModule.IsActionConflicted(actionName, conflictedActions, m_iKeybindIndex, actionPreset);
79 if (m_wWarningRichText)
80 m_wWarningRichText.SetVisible(conflicted);
82 if (m_wActionsRichText)
83 m_wActionsRichText.SetVisible(conflicted);
85 if (!conflicted || !m_wActionsRichText)
88 string actionNames = conflictedActions.Get(0).m_sDisplayName;
90 for (
int i = 1, count = conflictedActions.Count(); i < count; i++)
92 actionNames = actionNames +
", " + conflictedActions.Get(i).m_sDisplayName;
95 m_wActionsRichText.SetText(actionNames);
101 return m_iKeybindIndex;
105 void StartScrolling()
107 if (!m_HorizontalScrollComponent)
110 m_HorizontalScrollComponent.AnimationStart();
116 if (!m_HorizontalScrollComponent)
119 m_HorizontalScrollComponent.AnimationStop();
120 m_HorizontalScrollComponent.ResetPosition();
132 Widget actionRoot = w.FindAnyWidget(ROOT_NAME);