public bool ToggleRingerUI(RingerComponent ringer, IPlayerSession session)
        {
            var ui = ringer.Owner.GetUIOrNull(RingerUiKey.Key);

            ui?.Toggle(session);
            return(true);
        }
        //Non Event Functions

        private bool UpdateRingerRingtone(RingerComponent ringer, Note[] ringtone)
        {
            // Assume validation has already happened.
            ringer.Ringtone = ringtone;
            UpdateRingerUserInterface(ringer);

            return(true);
        }
        private void OnSetRingtone(EntityUid uid, RingerComponent ringer, RingerSetRingtoneMessage args)
        {
            // Client sent us an updated ringtone so set it to that.
            if (args.Ringtone.Length != RingtoneLength)
            {
                return;
            }

            UpdateRingerRingtone(ringer, args.Ringtone);
        }
        public void RandomizeRingtone(EntityUid uid, RingerComponent ringer, ComponentInit args)
        {
            // Default to using C pentatonic so it at least sounds not terrible.
            var notes = new[]
            {
                Note.C,
                Note.D,
                Note.E,
                Note.G,
                Note.A,
            };

            var ringtone = new Note[RingtoneLength];

            for (var i = 0; i < 4; i++)
            {
                ringtone[i] = _random.Pick(notes);
            }

            UpdateRingerRingtone(ringer, ringtone);
        }
        private void UpdateRingerUserInterface(RingerComponent ringer)
        {
            var ui = ringer.Owner.GetUIOrNull(RingerUiKey.Key);

            ui?.SetState(new RingerUpdateState(HasComp <ActiveRingerComponent>(ringer.Owner), ringer.Ringtone));
        }
 private void UpdateRingerUserInterfaceDriver(EntityUid uid, RingerComponent ringer, RingerRequestUpdateInterfaceMessage args)
 {
     UpdateRingerUserInterface(ringer);
 }
        //Event Functions

        private void RingerPlayRingtone(EntityUid uid, RingerComponent ringer, RingerPlayRingtoneMessage args)
        {
            EnsureComp <ActiveRingerComponent>(uid);
            UpdateRingerUserInterface(ringer);
        }
Example #8
0
        //Event Functions

        private void RingerPlayRingtone(EntityUid uid, RingerComponent ringer, RingerPlayRingtoneMessage args)
        {
            ringer.IsPlaying = true;
            UpdateRingerUserInterface(ringer);
        }