コード例 #1
0
        public void Put([NotNull] VoicePlayback playback)
        {
            if (playback == null)
            {
                throw new ArgumentNullException("playback");
            }

            playback.gameObject.SetActive(false);
            playback.gameObject.name = "Spare voice comms";
            playback.PlayerName      = null;

            _pool.Put(playback);
        }
コード例 #2
0
 private void LateUpdate()
 {
     if (base.isLocalPlayer)
     {
         foreach (GameObject gameObject in this.pm.players)
         {
             if (gameObject != base.gameObject)
             {
                 RadioInitializator component = gameObject.GetComponent <RadioInitializator>();
                 component.radio.SetRelationship();
                 string playerId = component.hlapiPlayer.PlayerId;
                 if (component.radio.mySource != null)
                 {
                     VoicePlayback component2 = component.radio.mySource.GetComponent <VoicePlayback>();
                     bool          flag       = component.radio.mySource.spatialBlend == 0f && component2.Priority != ChannelPriority.None && (component.radio.ShouldBeVisible(base.gameObject) || Intercom.host.speaker == gameObject);
                     if (RadioInitializator.names.Contains(playerId))
                     {
                         int index = RadioInitializator.names.IndexOf(playerId);
                         if (!flag)
                         {
                             UnityEngine.Object.Destroy(RadioInitializator.spawns[index]);
                             RadioInitializator.spawns.RemoveAt(index);
                             RadioInitializator.names.RemoveAt(index);
                             return;
                         }
                         RadioInitializator.spawns[index].GetComponent <Image>().color         = component.serverRoles.GetGradient()[0].Evaluate(component2.Amplitude * 3f);
                         RadioInitializator.spawns[index].GetComponent <Outline>().effectColor = component.serverRoles.GetGradient()[1].Evaluate(component2.Amplitude * 3f);
                     }
                     else if (flag)
                     {
                         GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.prefab, this.parent);
                         gameObject2.transform.localScale = Vector3.one;
                         gameObject2.GetComponentInChildren <Text>().text = component.nicknameSync.myNick;
                         RadioInitializator.spawns.Add(gameObject2);
                         RadioInitializator.names.Add(playerId);
                         return;
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
        private static void PlaybackPrefabGui([NotNull] DissonanceComms comm)
        {
            using (new EditorGUI.DisabledScope(Application.isPlaying))
            {
                var prefab = EditorGUILayout.ObjectField("Playback Prefab", comm.PlaybackPrefab, typeof(VoicePlayback), false);
                if (!Application.isPlaying)
                {
                    VoicePlayback newPrefab = null;
                    if (prefab != null && PrefabUtility.GetPrefabType(prefab) == PrefabType.Prefab)
                    {
                        newPrefab = (VoicePlayback)prefab;
                    }

                    comm.ChangeWithUndo(
                        "Changed Dissonance Playback Prefab",
                        newPrefab,
                        comm.PlaybackPrefab,
                        a => comm.PlaybackPrefab = a
                        );
                }
            }
        }
コード例 #4
0
 internal RemoteVoicePlayerState(VoicePlayback playback)
     : base(playback.PlayerName)
 {
     _playback = playback;
 }
コード例 #5
0
 public void Start(VoicePlayback playbackPrefab, Transform transform)
 {
     _prefab = playbackPrefab;
     _parent = transform;
 }
コード例 #6
0
 internal RemoteVoicePlayerState([NotNull] VoicePlayback playback)
     : base(playback.PlayerName)
 {
     _playback = playback;
     _playback.Reset();
 }