Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MapWatchUI.c
Go to the documentation of this file.
2{
3 protected static const string ICON_NAME = "watch";
4
5 protected SCR_WristwatchComponent m_WristwatchComp;
6 protected string m_sPrefabResource;
7
8 //------------------------------------------------------------------------------------------------
9 override void SetWidgetNames()
10 {
11 WIDGET_NAME = "WatchFrame";
12 RT_WIDGET_NAME = "WatchRTW";
13 WORLD_NAME = "WatchUIWorld";
14 }
15
16 //------------------------------------------------------------------------------------------------
17 override void InitPositionVectors()
18 {
19 m_WristwatchComp = SCR_WristwatchComponent.Cast( m_RTEntity.FindComponent(SCR_WristwatchComponent) );
20
21 m_vPrefabPos = "0 0 0";
22 m_vCameraPos = "0 0.14 0";
23 m_vCameraAngle = "0 -90 0";
24 }
25
26 //------------------------------------------------------------------------------------------------
28 protected void UpdatePreviewEntity()
29 {
31 {
32 // activate, apply proc anims
33 if (m_WristwatchComp.GetMode() != EGadgetMode.IN_HAND)
34 m_WristwatchComp.SetMapMode();
35
36 // tick the frame
37 m_WristwatchComp.UpdateTime();
38 }
39
40 // update
41 BaseWorld previewWorld = m_RTWorld.GetRef();
42 previewWorld.UpdateEntities();
43 }
44
45 //------------------------------------------------------------------------------------------------
46 protected void OnInputQuickBind(float value, EActionTrigger reason)
47 {
48 if (!GetGame().GetInputManager().IsUsingMouseAndKeyboard() && IsToolMenuFocused())
49 return;
51 }
52
53 //------------------------------------------------------------------------------------------------
54 protected override string GetPrefabResource()
55 {
56 return m_sPrefabResource;
57 }
58
59 //------------------------------------------------------------------------------------------------
62 override void SetVisible(bool visible)
63 {
64 if (visible)
65 {
66 IEntity wristwatch = FindRelatedGadget();
67 if (!wristwatch)
68 {
69 super.SetVisible(false);
70 return;
71 }
72
73 SCR_WristwatchComponent watchComp = SCR_WristwatchComponent.Cast(wristwatch.FindComponent(SCR_WristwatchComponent));
74 if (!watchComp)
75 return;
76
77 m_sPrefabResource = watchComp.GetMapPrefabResource();
78
79 super.SetVisible(visible);
80 if (!m_RTWorld || !m_RTEntity)
81 return;
82
83 // Start anim
84 ScriptCallQueue queue = GetGame().GetCallqueue();
85 if (queue)
86 queue.CallLater(UpdatePreviewEntity, 0, true);
87 }
88 else
89 {
90 ScriptCallQueue queue = GetGame().GetCallqueue();
91 if (queue)
92 queue.Remove(UpdatePreviewEntity);
93
94 super.SetVisible(visible);
95 }
96 }
97
98 //------------------------------------------------------------------------------------------------
99 override void Init()
100 {
101 SCR_MapToolMenuUI toolMenu = SCR_MapToolMenuUI.Cast(m_MapEntity.GetMapUIComponent(SCR_MapToolMenuUI));
102 if (toolMenu)
103 {
104 m_ToolMenuEntry = toolMenu.RegisterToolMenuEntry(SCR_MapToolMenuUI.s_sToolMenuIcons, ICON_NAME, 12, m_bIsExclusive); // add to menu
105 m_ToolMenuEntry.m_OnClick.Insert(ToggleVisible);
106
107 GetGame().GetInputManager().AddActionListener("MapToolWatch", EActionTrigger.DOWN, OnInputQuickBind);
108 }
109 }
110
111 //------------------------------------------------------------------------------------------------
112 override void Update(float timeSlice)
113 {
114 // Drag watch
116 {
117 // save position for map reopen
118 WorkspaceWidget workspace = g_Game.GetWorkspace();
119 m_wFrame.GetScreenPos(m_fPosX, m_fPosY);
120 m_fPosX = workspace.DPIUnscale(m_fPosX);
121 m_fPosY = workspace.DPIUnscale(m_fPosY);
122 }
123 }
124
125 //------------------------------------------------------------------------------------------------
126 // constructor
128 {
129 m_eGadgetType = EGadgetType.WRISTWATCH;
130 }
131}
ArmaReforgerScripted GetGame()
Definition game.c:1398
InputManager GetInputManager()
SCR_MapToolEntry m_ToolMenuEntry
SCR_MapEntity m_MapEntity
string RT_WIDGET_NAME
IEntity FindRelatedGadget()
vector m_vCameraAngle
bool m_bIsVisible
vector m_vPrefabPos
void ToggleVisible()
Visibility toggle.
vector m_vCameraPos
string WORLD_NAME
GenericEntity m_RTEntity
float m_fPosY
void SCR_MapRTWBaseUI()
float m_fPosX
string WIDGET_NAME
bool m_bIsDragged
Widget m_wFrame
ref SharedItemRef m_RTWorld
EGadgetType m_eGadgetType
void SCR_MapToolMenuUI()
proto external Managed FindComponent(typename typeName)
override string GetPrefabResource()
override void InitPositionVectors()
void OnInputQuickBind(float value, EActionTrigger reason)
override void SetVisible(bool visible)
SCR_WristwatchComponent m_WristwatchComp
static const string ICON_NAME
override void Update(float timeSlice)
override void Init()
override void SetWidgetNames()
void UpdatePreviewEntity()
Update for the wristwatch entity within preview world.
string m_sPrefabResource
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Definition tools.c:53
Game g_Game
Game singleton instance.
Definition gameLib.c:13
EActionTrigger