예제 #1
0
        internal NotifyFlashMessage DefaultNotifyAction(string titleText, string bodyText, EventType evType)
        {
            var ev = BasicTeraData.Instance.EventsData.AFK;

            if (!(ev?.Item1 is CommonAFKEvent))
            {
                return(null);
            }
            foreach (var action in ev.Item2)
            {
                var action1 = action as NotifyAction;
                if (action1 == null)
                {
                    continue;
                }
                var notifyAction = action1.Clone();
                notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{afk_body}", bodyText);
                notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{afk_title}", titleText);
                notifyAction.Balloon.EventType = evType;

                if (notifyAction.Sound == null || notifyAction.Sound.GetType() != typeof(TextToSpeech))
                {
                    return(new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, ev.Item1.Priority));
                }

                var tts = (TextToSpeech)notifyAction.Sound;
                tts.Text = tts.Text.Replace("{afk_title}", titleText);
                if (!BasicTeraData.Instance.WindowData.TTSSizeExceededTruncate && bodyText.Length > BasicTeraData.Instance.WindowData.MaxTTSSize)
                {
                    tts.Text = tts.Text.Replace("{afk_body}", "");
                }
                else
                {
                    tts.Text = tts.Text.Replace("{afk_body}", bodyText.Substring(0, Math.Min(bodyText.Length, BasicTeraData.Instance.WindowData.MaxTTSSize)));
                }

                return(new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, ev.Item1.Priority));
            }

            return(null);
        }
예제 #2
0
        internal NotifyFlashMessage DefaultNotifyAction(string titleText, string bodyText, EventType evType)
        {
            var ev = BasicTeraData.Instance.EventsData.AFK;

            if (!(ev?.Item1 is CommonAFKEvent))
            {
                return(null);
            }
            foreach (var action in ev.Item2)
            {
                var action1 = action as NotifyAction;
                if (action1 == null)
                {
                    continue;
                }
                var notifyAction = action1.Clone();
                notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{afk_body}", bodyText);
                notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{afk_title}", titleText);
                notifyAction.Balloon.EventType = evType;

                if (notifyAction.Sound == null || notifyAction.Sound.GetType() != typeof(TextToSpeech))
                {
                    return(new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, ev.Item1.Priority));
                }

                var tts = (TextToSpeech)notifyAction.Sound;
                tts.Text = tts.Text.Replace("{afk_body}", bodyText);
                tts.Text = tts.Text.Replace("{afk_title}", titleText);

                return(new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, ev.Item1.Priority));
            }

            return(null);
        }