Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_UISoundEntity.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/UI", description: "Handles sounds played by UI", color: "0 0 255 255")]
2class SCR_UISoundEntityClass: GenericEntityClass
3{
4
5};
6
7class SCR_UISoundEntity : GenericEntity
8{
9 static private SimpleSoundComponent m_SoundComponent;
10 static private SCR_UISoundEntity m_Instance;
11
12 static SCR_UISoundEntity GetInstance()
13 {
14 return m_Instance;
15 }
16
17 //------------------------------------------------------------------------------------------------
18 static AudioHandle SoundEvent(string eventName, bool force = false)
19 {
20 if (!m_SoundComponent)
21 {
22 if (!m_Instance)
23 return AudioHandle.Invalid;
24
25 m_SoundComponent = SimpleSoundComponent.Cast(m_Instance.FindComponent(SimpleSoundComponent));
26 if (!m_SoundComponent)
27 return AudioHandle.Invalid;
28 }
29
30 if (force)
31 m_SoundComponent.TerminateAll();
32
33 return m_SoundComponent.PlayStr(eventName);
34 }
35
36 //------------------------------------------------------------------------------------------------
37 static void SetSignalValueStr(string signal, float value)
38 {
39 if (!m_SoundComponent)
40 {
41 if (!m_Instance)
42 return;
43
44 m_SoundComponent = SimpleSoundComponent.Cast(m_Instance.FindComponent(SimpleSoundComponent));
45 if (!m_SoundComponent)
46 return;
47 }
48
49 m_SoundComponent.SetSignalValueStr(signal, value);
50 }
51
52 //------------------------------------------------------------------------------------------------
53 override void EOnInit(IEntity owner)
54 {
56
57 // Insert radio protocol subtitles settings change event
58 GetGame().OnUserSettingsChangedInvoker().Insert(SCR_CommunicationSoundComponent.SetSubtitiles);
60 }
61
62 //------------------------------------------------------------------------------------------------
63 void SCR_UISoundEntity(IEntitySource src, IEntity parent)
64 {
66 m_Instance = this;
67 }
68
69 //------------------------------------------------------------------------------------------------
70 void ~SCR_UISoundEntity(IEntitySource src, IEntity parent)
71 {
72 // Remove radio protocol subtitles settings change event
73 GetGame().OnUserSettingsChangedInvoker().Remove(SCR_CommunicationSoundComponent.SetSubtitiles);
74 }
75};
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external Managed FindComponent(typename typeName)
EntityEvent
Various entity events.
Definition EntityEvent.c:14