DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл VONManager.c

См. исходные тексты.

Структуры данных

class  VONManagerBase
 
class  VONManager
 Manager class which handles Voice-over-network functionality while player is connected to a server. Подробнее...
 

Функции

VONManagerBase Managed VONManagerImplementation ()
 
void VONManagerBase ()
 
void HideVoiceNotification ()
 Hides the VON notification completely and immediately.
 
void ShowVoiceNotification (int level, bool fading)
 Shows the voice notification.
 
void HandleInput (Input inp)
 Handles some VON related input.
 
void OnVOIPThresholdChanged ()
 Fires every time VOIP threshold value changes.
 
void OnEvent (EventType eventTypeId, Param params)
 Handles VON-related events.
 
bool IsVonToggled ()
 
void ~VONManagerImplementation ()
 
void UpdateVoiceIcon ()
 

Переменные

bool m_VoNToggled
 
ref ScriptInvoker m_OnVonStateEvent
 
ref ScriptInvoker m_OnPartyChatChangedEvent
 

Функции

◆ HandleInput()

override void HandleInput ( Input inp)
protected

Handles some VON related input.

Аргументы
inpinput to handle
114 {
115#ifdef PLATFORM_XBOX
116 // ignore VON-related input if user is in an xbox party
117 if (GetGame().IsInPartyChat())
118 {
119 return;
120 }
121#endif
122 int oldLevel = GetGame().GetVoiceLevel();
123 if (oldLevel == -1) //VoN system not initialized!
124 return;
125
126 int newLevel = -1;
127
128 if (inp.LocalPress_ID(UAVoiceDistanceUp,false))
129 {
130 newLevel = ( oldLevel + 1 ) % ( VoiceLevelShout + 1 );
131 }
132
133 if (inp.LocalPress_ID(UAVoiceDistanceDown,false))
134 {
135 newLevel = oldLevel - 1;
136 if (newLevel < VoiceLevelWhisper) //nah...
137 {
139 }
140 }
141
142 if (newLevel > -1)
143 {
144 CGame game = GetGame();
145 game.SetVoiceLevel(newLevel);
146 if (game.GetMission().IsVoNActive()) // icon is already visible, just update the range
147 {
149 }
150 else // Show the icon and let it fade out
151 {
152 int level = GetGame().GetVoiceLevel();
154 }
155 }
156 }
void ShowVoiceNotification(int level, bool fading)
Shows the voice notification.
Definition VONManager.c:58
void UpdateVoiceIcon()
Definition VONManager.c:158
Definition DayZGame.c:885
Definition EntityAI.c:95
proto native CGame GetGame()

Перекрестные ссылки GetGame(), VONManagerBase::ShowVoiceNotification() и UpdateVoiceIcon().

◆ HideVoiceNotification()

override void HideVoiceNotification ( )
protected

Hides the VON notification completely and immediately.

42 {
43 if (GetGame().IsMissionMainMenu())
44 {
45 return;
46 }
47
48 Mission mission = GetGame().GetMission();
49 mission.GetMicrophoneIcon().Show(false);
51 }
Mission mission
Definition DisplayStatus.c:28
Mission class.
Definition gameplay.c:681
ImageWidget GetMicrophoneIcon()
Definition gameplay.c:834
void HideVoiceLevelWidgets()
Definition gameplay.c:809

◆ IsVonToggled()

bool IsVonToggled ( )
protected
42 {
43 if (GetGame().IsMissionMainMenu())
44 {
45 return;

Перекрестные ссылки GetGame(), Mission::GetMicrophoneIcon(), Mission::HideVoiceLevelWidgets() и mission.

◆ OnEvent()

void OnEvent ( EventType eventTypeId,
Param params )
protected

Handles VON-related events.

Аргументы
eventTypeIdevent that fired
paramsevent-specific parameters
201 {
202 Mission mission = GetGame().GetMission();
203 switch (eventTypeId)
204 {
206 {
207 // only handle this if we are in Voice Activation mode, so ignore if in PTT mode
208 if (m_VoNToggled)
209 {
211 {
212 ShowVoiceNotification(GetGame().GetVoiceLevel(), false);
213 }
214 }
215 break;
216 }
217
219 {
220 // only handle this if we are in Voice Activation mode, so ignore if in PTT mode
221 if (m_VoNToggled)
222 {
224 {
226 }
227 }
228 break;
229 }
230
232 {
233 if (!mission)
234 {
235 break;
236 }
237
241
243
244 m_OnVonStateEvent.Invoke();
245 break;
246 }
247
249 {
251 break;
252 }
253
255 {
258 {
259 GetDayZGame().AddVoiceNotification(vonStartParams);
260 }
261 break;
262 }
263
265 {
268 {
269 GetDayZGame().RemoveVoiceNotification(vonStopParams);
270 }
271 break;
272 }
273
275 {
277 break;
278 }
279 }
280 }
DayZGame GetDayZGame()
Definition DayZGame.c:3817
bool m_VoNToggled
Definition VONManager.c:27
ref ScriptInvoker m_OnPartyChatChangedEvent
Definition VONManager.c:29
void HideVoiceNotification()
Hides the VON notification completely and immediately.
Definition VONManager.c:41
ref ScriptInvoker m_OnVonStateEvent
Definition VONManager.c:28
Super root of all classes in Enforce script.
Definition EnScript.c:11
void SetVoNActive(bool active)
Definition gameplay.c:811
Manager class which handles Voice-over-network functionality while player is connected to a server.
Definition VONManager.c:285
static bool IsVoiceThresholdMinimum()
Specifies whether user's voice activation threshold value is equal to the minimum voice activation th...
Definition VONManager.c:328
const EventType PartyChatStatusChangedEventTypeID
no params
Definition gameplay.c:558
const EventType VONStartSpeakingEventTypeID
params: VONStartSpeakingEventParams
Definition gameplay.c:548
const EventType VONStateEventTypeID
params: VONStateEventParams
Definition gameplay.c:546
const EventType VONUserStoppedTransmittingAudioEventTypeID
no params
Definition gameplay.c:554
const EventType VONUserStartedTransmittingAudioEventTypeID
no params
Definition gameplay.c:552
const EventType VONStopSpeakingEventTypeID
params: VONStopSpeakingEventParams
Definition gameplay.c:550
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition gameplay.c:478
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo(), GetDayZGame(), GetGame(), VONManagerBase::HideVoiceNotification(), VONManager::IsVoiceThresholdMinimum(), m_OnPartyChatChangedEvent, m_OnVonStateEvent, m_VoNToggled, mission, MPSessionPlayerReadyEventTypeID, PartyChatStatusChangedEventTypeID, Mission::SetVoNActive(), VONManagerBase::ShowVoiceNotification(), UpdateVoiceIcon(), VONStartSpeakingEventTypeID, VONStateEventTypeID, VONStopSpeakingEventTypeID, VONUserStartedTransmittingAudioEventTypeID и VONUserStoppedTransmittingAudioEventTypeID.

◆ OnVOIPThresholdChanged()

override void OnVOIPThresholdChanged ( )
protected

Fires every time VOIP threshold value changes.

191 {
193 }

Перекрестные ссылки UpdateVoiceIcon().

◆ ShowVoiceNotification()

override void ShowVoiceNotification ( int level,
bool fading )
protected

Shows the voice notification.

Аргументы
levelthe loudness of the player voice. 0 = whisper, 1 = normal, 2 = shout
fadingspecifies whether icon should slowly fade to invisibility after being displayed
59 {
60 if (GetGame().IsMissionMainMenu())
61 {
62 return;
63 }
64
65 Mission mission = GetGame().GetMission();
67 WidgetFadeTimer micTimer = mission.GetMicWidgetFadeTimer();
70
71 // microphone icon
72 micTimer.Stop();
73 micIcon.SetAlpha(1.0);
74 micIcon.Show(true);
75
76 if (fading)
77 {
78 micTimer.FadeOut(micIcon, 3.0);
79 }
80
81 // range icons
82 for( int n = 0; n < voiceLeveWidgets.Count(); n++ )
83 {
84 int voiceKey = voiceLeveWidgets.GetKey(n);
86
87 // stop fade timer since it will be refreshed
88 WidgetFadeTimer timer = voiceLevelTimers.Get(n);
89 timer.Stop();
90
91 // show widgets according to the level
92 if ( voiceKey <= level )
93 {
94 voiceWidget.SetAlpha(1.0); // reset from possible previous fade out
95 voiceWidget.Show(true);
96
97 if (fading)
98 {
99 timer.FadeOut(voiceWidget, 3.0);
100 }
101 }
102 else
103 {
104 voiceWidget.Show(false);
105 }
106 }
107 }
map< int, ref WidgetFadeTimer > GetVoiceLevelTimers()
map< int, ImageWidget > GetVoiceLevelWidgets()
WidgetFadeTimer GetMicWidgetFadeTimer()

Перекрестные ссылки GetGame(), Mission::GetMicrophoneIcon(), Mission::GetMicWidgetFadeTimer(), Mission::GetVoiceLevelTimers(), Mission::GetVoiceLevelWidgets() и mission.

◆ UpdateVoiceIcon()

void UpdateVoiceIcon ( )
private
159 {
160 Mission mission = GetGame().GetMission();
161 int rangeLevel = GetGame().GetVoiceLevel();
162
163 if (mission.IsVoNActive())
164 {
165 if (m_VoNToggled)
166 {
168 {
170 }
171 else
172 {
174 }
175 }
176 else
177 {
179 }
180 }
181 else
182 {
184 }
185 }
bool IsVoNActive()
Definition gameplay.c:810

Перекрестные ссылки GetGame(), VONManagerBase::HideVoiceNotification(), VONManager::IsVoiceThresholdMinimum(), Mission::IsVoNActive(), m_VoNToggled, mission и VONManagerBase::ShowVoiceNotification().

Используется в HandleInput(), OnEvent() и OnVOIPThresholdChanged().

◆ VONManagerBase()

void VONManagerBase ( )
protected
33 {
34 m_OnVonStateEvent.Clear();

Используется в VONManager::CleanupInstance().

◆ VONManagerImplementation()

VONManagerBase Managed VONManagerImplementation ( )
27 {
30 }
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116

Используется в VONManager::Init().

◆ ~VONManagerImplementation()

33 {
34 m_OnVonStateEvent.Clear();
36 }

Перекрестные ссылки m_OnPartyChatChangedEvent и m_OnVonStateEvent.

Переменные

◆ m_OnPartyChatChangedEvent

ref ScriptInvoker m_OnPartyChatChangedEvent
protected

Используется в OnEvent() и ~VONManagerImplementation().

◆ m_OnVonStateEvent

ref ScriptInvoker m_OnVonStateEvent
protected

Используется в OnEvent() и ~VONManagerImplementation().

◆ m_VoNToggled

bool m_VoNToggled
protected

Используется в OnEvent() и UpdateVoiceIcon().