8 protected ResourceName m_LayoutSave;
11 protected ResourceName m_LayoutLoad;
14 protected float m_fFadeInSpeed;
16 private Widget m_WidgetSave;
17 private Widget m_WidgetLoad;
19 protected void SaveCamera1() { SaveCamera(1); }
20 protected void SaveCamera2() { SaveCamera(2); }
21 protected void SaveCamera3() { SaveCamera(3); }
22 protected void SaveCamera4() { SaveCamera(4); }
23 protected void SaveCamera5() { SaveCamera(5); }
24 protected void SaveCamera6() { SaveCamera(6); }
25 protected void SaveCamera7() { SaveCamera(7); }
26 protected void SaveCamera8() { SaveCamera(8); }
30 protected void SaveCamera(
int index)
33 ResourceName worldPath =
GetGame().GetWorldFile();
36 Print(
"Unable to save camera data, world path not found!", LogLevel.WARNING);
41 BaseContainer settingsContainer =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
42 BaseContainerTools.WriteToInstance(settings, settingsContainer);
44 if (!settings.m_aSavedData)
45 settings.m_aSavedData = {};
51 if (saveCandidate.m_iIndex ==
index && saveCandidate.m_sWorldPath == worldPath)
59 settings.m_aSavedData.Insert(save);
63 save.m_sWorldPath = worldPath;
64 save.m_iIndex =
index;
65 save.m_aComponentData = {};
66 camera.SaveComponents(save.m_aComponentData);
69 BaseContainerTools.ReadFromInstance(settings, settingsContainer);
70 GetGame().UserSettingsChanged();
72 PlayAnimation(m_WidgetSave);
74 SCR_NotificationsComponent.SendLocal(
ENotification.EDITOR_SAVED_CAMERA_POSITION,
index);
78 protected void LoadCamera1() { LoadCamera(1); }
79 protected void LoadCamera2() { LoadCamera(2); }
80 protected void LoadCamera3() { LoadCamera(3); }
81 protected void LoadCamera4() { LoadCamera(4); }
82 protected void LoadCamera5() { LoadCamera(5); }
83 protected void LoadCamera6() { LoadCamera(6); }
84 protected void LoadCamera7() { LoadCamera(7); }
85 protected void LoadCamera8() { LoadCamera(8); }
89 protected void LoadCamera(
int index)
91 ResourceName worldPath =
GetGame().GetWorldFile();
94 Print(
"Unable to save camera data, world path not found!", LogLevel.WARNING);
99 BaseContainer settingsContainer =
GetGame().GetGameUserSettings().GetModule(
"SCR_ManualCameraSettings");
100 BaseContainerTools.WriteToInstance(settings, settingsContainer);
102 if (!settings.m_aSavedData)
105 settings.m_aSavedData.Debug();
111 Print(
string.Format(
"%1 == %2 && %3 == %4", saveCandidate.m_iIndex,
index, saveCandidate.m_sWorldPath, worldPath), LogLevel.NORMAL);
112 if (saveCandidate.m_iIndex ==
index && saveCandidate.m_sWorldPath == worldPath)
114 camera.LoadComponents(saveCandidate.m_aComponentData);
117 m_Camera.GetCameraParam().velocityOriginal = vector.Zero;
119 PlayAnimation(m_WidgetLoad);
121 SCR_NotificationsComponent.SendLocal(
ENotification.EDITOR_LOADED_CAMERA_POSITION,
index);
128 override bool EOnCameraInit()
130 InputManager inputManager =
GetGame().GetInputManager();
134 inputManager.AddActionListener(
"ManualCameraSave1", EActionTrigger.DOWN, SaveCamera1);
135 inputManager.AddActionListener(
"ManualCameraSave2", EActionTrigger.DOWN, SaveCamera2);
136 inputManager.AddActionListener(
"ManualCameraSave3", EActionTrigger.DOWN, SaveCamera3);
137 inputManager.AddActionListener(
"ManualCameraSave4", EActionTrigger.DOWN, SaveCamera4);
138 inputManager.AddActionListener(
"ManualCameraSave5", EActionTrigger.DOWN, SaveCamera5);
139 inputManager.AddActionListener(
"ManualCameraSave6", EActionTrigger.DOWN, SaveCamera6);
140 inputManager.AddActionListener(
"ManualCameraSave7", EActionTrigger.DOWN, SaveCamera7);
141 inputManager.AddActionListener(
"ManualCameraSave8", EActionTrigger.DOWN, SaveCamera8);
144 inputManager.AddActionListener(
"ManualCameraLoad1", EActionTrigger.DOWN, LoadCamera1);
145 inputManager.AddActionListener(
"ManualCameraLoad2", EActionTrigger.DOWN, LoadCamera2);
146 inputManager.AddActionListener(
"ManualCameraLoad3", EActionTrigger.DOWN, LoadCamera3);
147 inputManager.AddActionListener(
"ManualCameraLoad4", EActionTrigger.DOWN, LoadCamera4);
148 inputManager.AddActionListener(
"ManualCameraLoad5", EActionTrigger.DOWN, LoadCamera5);
149 inputManager.AddActionListener(
"ManualCameraLoad6", EActionTrigger.DOWN, LoadCamera6);
150 inputManager.AddActionListener(
"ManualCameraLoad7", EActionTrigger.DOWN, LoadCamera7);
151 inputManager.AddActionListener(
"ManualCameraLoad8", EActionTrigger.DOWN, LoadCamera8);
157 m_WidgetSave.SetOpacity(0);
163 m_WidgetLoad.SetOpacity(0);
170 protected void PlayAnimation(Widget widget)
174 widget.SetOpacity(1);
180 override void EOnCameraExit()
182 InputManager inputManager =
GetGame().GetInputManager();
186 inputManager.RemoveActionListener(
"ManualCameraSave1", EActionTrigger.DOWN, SaveCamera1);
187 inputManager.RemoveActionListener(
"ManualCameraSave2", EActionTrigger.DOWN, SaveCamera2);
188 inputManager.RemoveActionListener(
"ManualCameraSave3", EActionTrigger.DOWN, SaveCamera3);
189 inputManager.RemoveActionListener(
"ManualCameraSave4", EActionTrigger.DOWN, SaveCamera4);
190 inputManager.RemoveActionListener(
"ManualCameraSave5", EActionTrigger.DOWN, SaveCamera5);
191 inputManager.RemoveActionListener(
"ManualCameraSave6", EActionTrigger.DOWN, SaveCamera6);
192 inputManager.RemoveActionListener(
"ManualCameraSave7", EActionTrigger.DOWN, SaveCamera7);
193 inputManager.RemoveActionListener(
"ManualCameraSave8", EActionTrigger.DOWN, SaveCamera8);
196 inputManager.RemoveActionListener(
"ManualCameraLoad1", EActionTrigger.DOWN, LoadCamera1);
197 inputManager.RemoveActionListener(
"ManualCameraLoad2", EActionTrigger.DOWN, LoadCamera2);
198 inputManager.RemoveActionListener(
"ManualCameraLoad3", EActionTrigger.DOWN, LoadCamera3);
199 inputManager.RemoveActionListener(
"ManualCameraLoad4", EActionTrigger.DOWN, LoadCamera4);
200 inputManager.RemoveActionListener(
"ManualCameraLoad5", EActionTrigger.DOWN, LoadCamera5);
201 inputManager.RemoveActionListener(
"ManualCameraLoad6", EActionTrigger.DOWN, LoadCamera6);
202 inputManager.RemoveActionListener(
"ManualCameraLoad7", EActionTrigger.DOWN, LoadCamera7);
203 inputManager.RemoveActionListener(
"ManualCameraLoad8", EActionTrigger.DOWN, LoadCamera8);
207 m_WidgetSave.RemoveFromHierarchy();
210 m_WidgetLoad.RemoveFromHierarchy();