Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CameraLimitedEditorComponent.c
Go to the documentation of this file.
1 #ifdef WORKBENCH
2  #define SHOW_DISCLAIMER
3 #endif
4 
5 [ComponentEditorProps(category: "GameScripted/Editor", description: "Limited camera for in-game editor. Works only with SCR_EditorBaseEntity!", icon: "WBData/ComponentEditorProps/componentEditor.png")]
7 {
8 };
9 
18 {
19  [Attribute("", UIWidgets.ResourceNamePicker, "Prefab of class SCR_ManualCamera", "et", category: "Camera")]
20  private ResourceName m_LimitedCameraPrefab;
21 
22 #ifdef SHOW_DISCLAIMER
23  private ref DebugTextScreenSpace m_Disclaimer;
24  private float m_fDisclaimerCountdown;
25 #endif
26 
27  override protected ResourceName GetCameraPrefab()
28  {
29  SCR_EditorManagerEntity manager = SCR_EditorManagerEntity.GetInstance();
30  if (!manager) return ResourceName.Empty;
31 
32 
33  bool isLimited = manager.IsLimited() && !DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_UNLIMITED);
34 
35 #ifdef SHOW_DISCLAIMER
36  if (isLimited)
37  {
38  m_Disclaimer = DebugTextScreenSpace.Create(GetGame().GetWorld(), "", 0, 50, 50, 10, ARGBF(1, 1, 1, 1), ARGBF(1, 0, 0, 0));
39  m_fDisclaimerCountdown = 15;
40  }
41 #endif
42 
43  if (isLimited)
44  return m_LimitedCameraPrefab;
45  else
46  return super.GetCameraPrefab();
47  }
48 #ifdef SHOW_DISCLAIMER
49  override void EOnFrame(IEntity owner, float timeSlice)
50  {
51  super.EOnFrame(owner, timeSlice);
52 
53  if (m_Disclaimer)
54  {
55  m_fDisclaimerCountdown -= timeSlice;
56  m_Disclaimer.SetText(string.Format("Armavision camera is restricted around player when no other editor modes are available.\n\nTo unlock it for testing, activate: Debug Menu > Manual Camera > Unlimited Movement\nRestart the editor afterwards.\n\nThis message will disappear in %1 s.", Math.Ceil(m_fDisclaimerCountdown)));
57  if (m_fDisclaimerCountdown < 0) delete m_Disclaimer;
58  }
59  }
60 #endif
61  override protected void EOnEditorActivate()
62  {
63  super.EOnEditorActivate();
64 
65  SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
66  if (editorManager) editorManager.GetOnLimitedChange().Insert(ReplaceCamera);
67 
68  DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_UNLIMITED, "", "Unlimited Movement", "Manual Camera");
69  }
70  override protected void EOnEditorDeactivate()
71  {
72  super.EOnEditorDeactivate();
73 
74  SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
75  if (editorManager) editorManager.GetOnLimitedChange().Remove(ReplaceCamera);
76 
77  //DiagMenu.Unregister(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_UNLIMITED);
78 
79 #ifdef SHOW_DISCLAIMER
80  delete m_Disclaimer;
81 #endif
82  }
83 };
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
SCR_CameraLimitedEditorComponentClass
Definition: SCR_CameraLimitedEditorComponent.c:6
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_CameraEditorComponent
Definition: SCR_CameraEditorComponent.c:13
EOnFrame
override void EOnFrame(IEntity owner, float timeSlice)
Definition: SCR_PlayerProfileManagerComponent.c:199
SCR_CameraLimitedEditorComponent
Definition: SCR_CameraLimitedEditorComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3
SCR_CameraEditorComponentClass
Definition: SCR_CameraEditorComponent.c:2
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26