Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MusicEditorComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Sound", description: "Music component", color: "0 0 255 255")]
3 {
4 };
6 {
7  SCR_EditorManagerEntity m_EditorManager;
8  protected bool m_bMusicWasMutedByEditor;
9  protected MusicManager m_MusicManager;
10 
11  protected void OnEditorOpened()
12  {
13  //Add a short delay to make sure any ambient music that started to play is terminated correctly
14  GetGame().GetCallqueue().CallLater(OpenedEditorDelay, 500);
15  }
16 
17  protected void OpenedEditorDelay()
18  {
19  if (!m_EditorManager.IsOpened() || m_EditorManager.IsLimited())
20  return;
21 
22  m_bMusicWasMutedByEditor = true;
23  m_MusicManager.MuteCategory(MusicCategory.Ambient, true, true);
24  m_MusicManager.MuteCategory(MusicCategory.Menu, true, true);
25  m_MusicManager.MuteCategory(MusicCategory.Misc, true, true);
26  }
27 
28  protected void OnEditorClosed()
29  {
30  //Checks this in cause the limited mode changed
31  if (m_bMusicWasMutedByEditor)
32  {
33  m_MusicManager.MuteCategory(MusicCategory.Ambient, false, false);
34  m_MusicManager.MuteCategory(MusicCategory.Menu, false, false);
35  m_MusicManager.MuteCategory(MusicCategory.Misc, false, false);
36  }
37 
38 
39  m_bMusicWasMutedByEditor = false;
40  }
41 
42  override void EOnEditorInit()
43  {
44  if (SCR_Global.IsEditMode())
45  return;
46 
47  super.EOnEditorInit();
48 
49  ChimeraWorld world = GetGame().GetWorld();
50 
51  if (!world)
52  return;
53 
54  m_MusicManager = world.GetMusicManager();
55  if (!m_MusicManager)
56  return;
57 
59  if (m_EditorManager)
60  {
61  m_EditorManager.GetOnOpened().Insert(OnEditorOpened);
62  m_EditorManager.GetOnClosed().Insert(OnEditorClosed);
63 
64  if (m_EditorManager.IsOpened())
65  OnEditorOpened();
66  }
67  }
68 
69  override void OnDelete(IEntity owner)
70  {
71  super.OnDelete(owner);
72 
73  if (m_EditorManager)
74  {
75  m_EditorManager.GetOnOpened().Remove(OnEditorOpened);
76  m_EditorManager.GetOnClosed().Remove(OnEditorClosed);
77  }
78  }
79 };
ChimeraWorld
Definition: ChimeraWorld.c:12
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
MusicCategory
MusicCategory
Definition: MusicCategory.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_MusicEditorComponent
Definition: SCR_MusicEditorComponent.c:5
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
m_EditorManager
protected SCR_EditorManagerEntity m_EditorManager
Definition: SCR_VotingEditor.c:5
SCR_BaseEditorComponentClass
Definition: SCR_BaseEditorComponent.c:2
SCR_Global
Definition: Functions.c:6
SCR_MusicEditorComponentClass
Definition: SCR_MusicEditorComponent.c:2
m_MusicManager
protected MusicManager m_MusicManager
Definition: SCR_CharacterTriggerEntity.c:70
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26