9 string m_aTextParams[4] = {
"",
"",
"",
""};
10 string m_aSubtitleParams[4] = {
"",
"",
"",
""};
35 static const string TASKS_KEY_IMAGE_FORMAT =
"<color rgba='226, 168, 79, 200'><shadow mode='image' color='0, 0, 0' size='1' offset='1, 1' opacity = '0.5'><action name='TasksOpen'/></shadow></color>";
37 protected ref array<ref SCR_PopupMessage>
m_aQueue = {};
105 PlayerController pc =
GetGame().GetPlayerController();
107 if (!pc || !pc.GetControlledEntity())
138 if (playerController)
150 Widget mapWidget = config.RootWidgetRef;
152 root.SetZOrder(mapWidget.GetZOrder() - 1);
165 if (!interfaceSettings)
190 SCR_InventoryStorageManagerComponent inventory;
194 inventory = SCR_InventoryStorageManagerComponent.Cast(previousPlayer.
FindComponent(SCR_InventoryStorageManagerComponent));
203 inventory = SCR_InventoryStorageManagerComponent.Cast(currentPlayer.
FindComponent(SCR_InventoryStorageManagerComponent));
255 for (
int i = 0, cnt =
m_aQueue.Count(); i < cnt; i++)
282 void PopupMsg(
string text,
float duration =
DEFAULT_DURATION,
string text2 =
"",
int prio = -1,
string param1 =
"",
string param2 =
"",
string param3 =
"",
string param4 =
"",
string text2param1 =
"",
string text2param2 =
"",
string text2param3 =
"",
string text2param4 =
"",
string sound =
"",
SCR_EPopupMsgFilter category =
SCR_EPopupMsgFilter.ALL,
288 if (
System.IsConsoleApp())
299 if ((text.IsEmpty() && text2.IsEmpty()) || duration == 0)
308 msg.m_sSubtitle = text2;
309 msg.m_fDuration = duration;
310 msg.m_iPriority = prio;
311 msg.m_sSound = sound;
313 msg.m_aSubtitleParams = {text2param1, text2param2, text2param3, text2param4};
315 msg.m_fProgressStart = progressStart;
316 msg.m_fProgressEnd = progressEnd;
334 m_ShownMsg.m_fHideTimestamp = world.GetServerTimestamp();
348 float elapsedTime = curTime.DiffMilliseconds(
m_ShownMsg.m_fProgressStart);
349 float curProgress = elapsedTime / totalTime;
352 if (curProgress == 1)
358 float newRemainingTime = progressEnd.DiffMilliseconds(curTime);
359 float newTotalTime = newRemainingTime / (1 - curProgress);
360 float newElapsedTime = newTotalTime * curProgress;
361 m_ShownMsg.m_fProgressStart = curTime.PlusMilliseconds(-newElapsedTime);
368 protected void FadeWidget(notnull
Widget widget,
bool fadeOut =
false,
bool instant =
false)
370 float alpha, targetAlpha;
385 widget.SetOpacity(targetAlpha);
389 widget.SetOpacity(alpha);
406 for (
int i = 0, cnt =
m_aQueue.Count(); i < cnt; i++)
411 if (msg.m_fDuration == -1)
413 if (checkedMsg.m_fDuration != -1 || checkedMsg.m_iPriority <= msg.m_iPriority)
416 else if (checkedMsg.m_fDuration != -1 && checkedMsg.m_iPriority < msg.m_iPriority)
461 if (msg.m_fDuration != -1)
464 msg.m_fHideTimestamp = world.GetServerTimestamp().PlusSeconds(msg.m_fDuration);
467 m_wPopupMsg.SetTextFormat(msg.m_sText, msg.m_aTextParams[0], msg.m_aTextParams[1], msg.m_aTextParams[2], msg.m_aTextParams[3]);
470 if (!msg.m_sSubtitle.IsEmpty())
472 m_wPopupMsgSmall.SetTextFormat(msg.m_sSubtitle, msg.m_aSubtitleParams[0], msg.m_aSubtitleParams[1], msg.m_aSubtitleParams[2], msg.m_aSubtitleParams[3]);
476 if (msg.m_fProgressStart != 0 && msg.m_fProgressEnd != 0)
479 m_wStatusProgress.SetMax(msg.m_fProgressEnd.DiffMilliseconds(msg.m_fProgressStart));
484 if (!msg.m_sSound.IsEmpty())
563 if (
m_ShownMsg.m_fProgressEnd.Greater(curTime))
586 if (
System.IsConsoleApp())
600 if (!interfaceSettings)
ArmaReforgerScripted GetGame()
SCR_HUDManagerComponent GetHUDManager()
IEntity SpawnEntity(ResourceName entityResourceName, notnull IEntity slotOwner)
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external Managed FindComponent(typename typeName)
proto external EntityEvent ClearEventMask(EntityEvent e)
proto external BaseWorld GetWorld()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
string GetInterfaceSettingsClass()
static SCR_HUDManagerComponent GetHUDManager()
MapConfiguration GetMapConfig()
Get map config.
static SCR_MapEntity GetMapInstance()
Get map entity instance.
ref OnControlledEntityChangedPlayerControllerInvoker m_OnControlledEntityChanged
bool IsPresentPopupWithHigherPriority(int priority)
ref array< ref SCR_PopupMessage > m_aQueue
void ClearMsg()
Clear and instant fade all popup messages.
void RefreshInventoryInvoker(IEntity previousPlayer, IEntity currentPlayer)
static const float FADE_DURATION
void ChangeProgressBarFinish(WorldTimestamp progressEnd)
static const ResourceName LAYOUT_NAME
static const int INVALID_ID
void ~SCR_PopUpNotification()
void RefreshQueue(SCR_PopupMessage msg=null)
static const int POPUP_OFFSET
override void EOnFrame(IEntity owner, float timeSlice)
static SCR_EPopupMsgFilter s_eFilter
void FadeWidget(notnull Widget widget, bool fadeOut=false, bool instant=false)
RichTextWidget m_wPopupMsgSmall
float m_fDefaultHorizontalOffset
void HideMsg(notnull SCR_PopupMessage msg)
void SCR_PopUpNotification(IEntitySource src, IEntity parent)
static void SetFilter(SCR_EPopupMsgFilter filter)
RichTextWidget m_wPopupMsg
void PopupMsg(string text, float duration=DEFAULT_DURATION, string text2="", int prio=-1, string param1="", string param2="", string param3="", string param4="", string text2param1="", string text2param2="", string text2param3="", string text2param4="", string sound="", SCR_EPopupMsgFilter category=SCR_EPopupMsgFilter.ALL, WorldTimestamp progressStart=null, WorldTimestamp progressEnd=null)
void OnInventoryToggle(bool open)
static const float DEFAULT_DURATION
static const string INTERFACE_SETTINGS_NAME
SCR_PopupMessage m_ShownMsg
ProgressBarWidget m_wStatusProgress
bool m_bIsEnabledInSettings
void OnEditorModeChanged(SCR_EditorModeEntity currentMode, SCR_EditorModeEntity prevMode)
void ShowMsg(notnull SCR_PopupMessage msg)
static SCR_PopUpNotification GetInstance()
void SetTitleText(string text)
void SetDefaultHorizontalPosition()
SCR_PopupMessage GetCurrentMsg()
static const string TASKS_KEY_IMAGE_FORMAT
static SCR_PopUpNotification s_Instance
@ NONE
When Shape is created and not initialized yet.
EEditorMode
Editor mode that defines overall functionality.
EntityEvent
Various entity events.
EntityFlags
Various entity flags.
@ ALL
Everything except general switch.
proto external PlayerController GetPlayerController()