2class SCR_AvailableActionsWidget
22 void SetText(
string text,
string name, EInputDeviceType currentInputDevice = EInputDeviceType.KEYBOARD)
56 float left, top, right, bottom;
73 if (
layout ==
string.Empty)
79 SCR_AvailableActionsWidget instance =
new SCR_AvailableActionsWidget();
116 override bool _WB_GetCustomTitle(
BaseContainer source, out
string title)
119 int index = source.GetVarIndex(
"m_sAction");
125 source.Get(
"m_sTag", tag);
127 source.Get(
"m_sAction", title);
131 source.Get(
"m_bEnabled", enabled);
133 string enabledStr =
"x";
138 title =
"(" + title +
") " + tag +
" - " + enabledStr;
151 [
Attribute(
"0",
UIWidgets.EditBox,
"Amount of milliseconds to hide this hint after it was shown, 0 means no hiding",
params:
"0 inf")]
154 [
Attribute(
"0",
UIWidgets.EditBox,
"Amount of milliseconds that have to pass while conditions are met in oder for this hint to be shown",
params:
"0 inf")]
160 [
Attribute(
"DefaultTag",
UIWidgets.EditBox,
"Tag for quick search and recongnition. Change default tag to allow easier search.")]
183 return string.Format(
"%1", text);
212 if (!cond.IsEnabled())
215 if (!cond.IsAvailable(
data))
267class SCR_AvailableActionsDisplay : SCR_InfoDisplayExtended
270 [
Attribute(
"", UIWidgets.Object,
"List of all actions to process at any given moment, these are filtered and available ones are displayed")]
271 protected ref array<ref SCR_AvailableActionContext>
m_aActions;
273 [
Attribute(
"", UIWidgets.ResourceNamePicker,
"Layout used for individual action widgets",
params:
"layout")]
283 protected ref array<ref AvailableActionLayoutBehaviorBase>
m_aBehaviors;
285 [
Attribute(
"40",
desc:
"Size of the small button which will be used when there are too many bigger buttons. (Height in px)")]
288 [
Attribute(
"44",
desc:
"Size of the medium button which will be used when there are too many bigger buttons. (Height in px)")]
291 [
Attribute(
"48",
desc:
"Size of the large button. This is the maximum size of the shown button. If there are too many one of the above will be used instead. (Height in px)")]
298 protected ref array<ref SCR_AvailableActionsWidget>
m_aWidgets =
new array<ref SCR_AvailableActionsWidget>();
356 string actionName = action.GetActionName();
358 if (actionName ==
string.Empty)
361 if (!inputManager.IsActionActive(actionName))
363 if (action.IsDelayed())
364 action.ResetTimers();
369 if (!action.IsAvailable(
data, timeSlice))
372 outActions.Insert(action);
389 CharacterControllerComponent controller = character.GetCharacterController();
456 private void DisplayWidgetsUpdate(
float timeSlice)
458 array<SCR_AvailableActionContext> availableActions =
new array<SCR_AvailableActionContext>();
462 bool shouldBeVisible;
463 SCR_AvailableActionContext availableAction;
464 foreach (
int i, SCR_AvailableActionsWidget widget :
m_aWidgets)
466 if (i >= updateCount)
472 shouldBeVisible = i < actionsCount;
473 if (widget.IsVisible() != shouldBeVisible)
476 DisplayHint(widget.GetRootWidget(), UIConstants.FADE_RATE_SUPER_FAST, UIConstants.FADE_RATE_SUPER_FAST);
478 HintFadeOut(widget.GetRootWidget(), UIConstants.FADE_RATE_DEFAULT, UIConstants.FADE_RATE_FAST);
488 if (!shouldBeVisible)
492 widget.SetForcedUpdate();
494 if (!availableActions.IsIndexValid(i))
497 availableAction = availableActions[i];
513 widget.SetOpacity(0);
515 widget.SetVisible(
true);
522 float padding[4] = {0, 0, 0, 0};
535 GetGame().GetCallqueue().CallLater(
HintShrink, 1000 / delayFade,
false, widget, delayShrink);
545 GetGame().GetCallqueue().CallLater(
HintHide, 1000 / delayShrink,
false, widget);
552 widget.SetVisible(
false);
599 for (
int i = 0; i < toGenerate; i++)
636 PlayerController playerController = PlayerController.Cast(owner);
637 if (!playerController)
639 Print(
"SCR_AvailableActionsDisplay is not an object in HUDManagerComponent attached onto a PlayerController entity! May result in undefined behaviour.",
LogLevel.WARNING);
700 if (beh.ConditionsChecked(
this))
703 if (!selectedBehavior)
705 selectedBehavior = beh;
710 if (selectedBehavior.m_iPriority < beh.m_iPriority)
711 selectedBehavior = beh;
715 if (selectedBehavior)
716 selectedBehavior.ApplyBehavior(
this);
733 bool ConditionsChecked(SCR_AvailableActionsDisplay display)
739 void ApplyBehavior(notnull SCR_AvailableActionsDisplay display)
741 display.SetOffsetY(m_fOffsetY);
792 super.ApplyBehavior(display);
809 override bool ConditionsChecked(SCR_AvailableActionsDisplay display)
811 return (
GetGame().GetMenuManager().FindMenuByPreset(m_ActiveMenu) != null);
822 [
Attribute(
"0",
desc:
"Additional offset applied when editor is no legal in given scenario.")]
829 if (!editorManagerEntity)
832 EEditorMode mode = editorManagerEntity.GetCurrentMode();
838 float offset = m_fOffsetY;
851 display.SetOffsetY(offset);
ArmaReforgerScripted GetGame()
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override event void DisplayStartDraw(IEntity owner)
void OnSettingsMenuClosed(ChimeraMenuBase menu)
void SetAdditionalOffsetY(float offset)
override event void DisplayInit(IEntity owner)
int GetAvailableActions(notnull SCR_AvailableActionsConditionData data, array< ref SCR_AvailableActionContext > inActions, out array< SCR_AvailableActionContext > outActions, float timeSlice)
void OnGamepadDeviceChanged(bool isUsingGamepad)
ref SCR_AvailableActionsConditionData m_data
const int HEIGHT_DIVIDER_BIG
This values are used to determine how many actions fit in the available space. (Space / devider = Max...
SCR_HUDSlotUIComponent m_HUDSlotComponent
const int DEFAULT_FONT_SIZE
override event void DisplayUpdate(IEntity owner, float timeSlice)
void SetOffsetY(float offset=-1)
Set available actions layout y position.
void HintShrink(Widget widget, float delayShrink)
Hide hint with fadeout.
void HintHide(Widget widget)
Hide hint with fadeout.
int m_iLastCount
Amount of previously shown widgets.
float m_fAdditionalOffsetY
bool m_bForceUpdate
If user changed keybing then it should force update of hints.
void HintFadeOut(Widget widget, float delayFade, float delayShrink)
Hide hint with fadeout.
class AvailableActionLayoutBehaviorBase Attribute
float m_fDataFetchTimer
Timer for fetching data limitation.
override event void DisplayStopDraw(IEntity owner)
ResourceName m_sChildLayout
void ApplyLayoutBehavior()
bool m_bIsEnabledSettings
Game settings.
SCR_InfoDisplaySlotHandler m_slotHandler
Widget m_wLayoutWidget
Layout widget in root or null if new.
int m_iMaxActionsBig
Default values for how many large / medium buttons will be displayed before they switch to a smaller ...
EInputDeviceType m_eCurrentInputDevice
void DisplayHint(Widget widget, float delayFade, float delayShrink)
ref array< ref SCR_AvailableActionsWidget > m_aWidgets
List of available action widget containers.
const int HEIGHT_DIVIDER_MEDIUM
const int PRELOADED_WIDGETS_COUNT
Count of maximum elements that will be pre-cached.
ref array< ref AvailableActionLayoutBehaviorBase > m_aBehaviors
ref SCR_SortedArray< SCR_BaseEditorAction > m_aActions
bool CanBeShown(notnull SCR_EditorContentBrowserSaveStateDataUI tab)
Check if the given tab can be shown.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
Get all prefabs that have the spawner data
UI layouts Menus CleanSweep CleanSweepAreaSelection layout
SCR_HelicopterControllerComponentClass gameplaySettings
SCR_InfoDisplayHandler GetHandler(typename handlerType)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
override void ApplyBehavior(notnull SCR_AvailableActionsDisplay display)
override bool ConditionsChecked(SCR_AvailableActionsDisplay display)
float m_fIllegalEditorOffset
Variables that should be applied on available actions layout whenever given HUD is active.
override void ApplyBehavior(notnull SCR_AvailableActionsDisplay display)
bool m_bOffsetFromDisplay
override bool ConditionsChecked(SCR_AvailableActionsDisplay display)
A single available action condition representation.
void ResetTimers()
Reset fade in and fade out timers to their default values.
const string MARKUP_FORMAT
bool IsAvailable(notnull SCR_AvailableActionsConditionData data, float timeSlice)
bool IsDelayed()
returns true if action display is currently counting down twords its delayed fade in or out
string ToString(bool forceText=true)
ref array< ref SCR_AvailableActionCondition > m_aConditions
Core component to manage SCR_EditorManagerEntity.
SCR_EditorSettingsEntity GetSettingsEntity()
bool IsUnlimitedEditorLegal()
SCR_InfoDisplay FindInfoDisplayByResourceName(ResourceName path)
Find layout by resorce name.
static SCR_HUDManagerComponent GetHUDManager()
Widget FindLayoutByResourceName(ResourceName path)
Find layout by resorce name.
static IEntity GetLocalControlledEntity()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EEditorMode
Editor mode that defines overall functionality.