Beispiel #1
0
        public void Notify(NotificationType type, string notification, string nickname, string phonetic, NotifyPriority priority)
        {
            if (Muted)
            {
                return;
            }

            lock (notifications)
            {
                IEnumerable <INotifier> notifiers;
                if (this.notifications.TryGetValues(type, out notifiers))
                {
                    foreach (var n in notifiers)
                    {
                        n.Notify(type, String.Format(notification, nickname), priority);
                    }
                }
            }

            if (SpeechReceiver != null)
            {
                lock (speechNotifiers)
                {
                    IEnumerable <ITextToSpeech> speakers;
                    if (this.speechNotifiers.TryGetValues(type, out speakers))
                    {
                        foreach (var n in speakers)
                        {
                            SpeechReceiver.Receive(n.AudioSource, n.GetSpeech(String.Format(notification, (!phonetic.IsNullOrWhitespace()) ? phonetic : nickname)));
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void Notify(NotificationType type, string notification, NotifyPriority priority)
        {
            if (Muted)
            {
                return;
            }

            lock (notifications)
            {
                IEnumerable <INotifier> notifiers;
                if (this.notifications.TryGetValues(type, out notifiers))
                {
                    foreach (var n in notifiers)
                    {
                        n.Notify(type, notification, priority);
                    }
                }
            }

            if (SpeechReceiver != null)
            {
                lock (speechNotifiers)
                {
                    IEnumerable <ITextToSpeech> speakers;
                    if (this.speechNotifiers.TryGetValues(type, out speakers))
                    {
                        foreach (var n in speakers)
                        {
                            SpeechReceiver.Receive(n.AudioSource, n.GetSpeech(notification));
                        }
                    }
                }
            }
        }
    //-------------------------------------------------------------------------
    void _initNativeMsgReceiverListener()
    {
        var native_receiver = NativeReceiver.instance();

        native_receiver.TakePhotoReceiverListener = this;
        native_receiver.AudioControlListener      = this;
        var speech_receiver = SpeechReceiver.instance();

        speech_receiver.SpeechListener = this;
        var pay_receiver = PayReceiver.instance();

        pay_receiver.PayReceiverListener = this;
    }
    //-------------------------------------------------------------------------
    public static SpeechReceiver instance()
    {
        mSpeechReceiverName = (typeof(SpeechReceiver)).Name;
        GameObject msg_receiver = GameObject.Find(mSpeechReceiverName);

        if (msg_receiver == null)
        {
            msg_receiver    = new GameObject(mSpeechReceiverName);
            mSpeechReceiver = msg_receiver.AddComponent <SpeechReceiver>();
            GameObject.DontDestroyOnLoad(msg_receiver);
        }
        else
        {
            mSpeechReceiver = msg_receiver.GetComponent <SpeechReceiver>();
        }

        return(mSpeechReceiver);
    }
 void Awake()
 {
     characterController = GetComponent <CharacterController>();
     speechReceiver      = GetComponent <SpeechReceiver>();
 }