예제 #1
0
        private void PlaySound(
            string skillName)
        {
            if (this.Config.WaveSoundEnabled)
            {
                if (Settings.Instance.UseNAudio)
                {
                    BufferedWavePlayer.Instance.Play(
                        this.Config.WaveFile,
                        Settings.Instance.WaveVolume / 100f);
                }
                else
                {
                    ActGlobals.oFormActMain?.PlaySoundMethod(
                        this.Config.WaveFile,
                        (int)Settings.Instance.WaveVolume);
                }
            }

            if (this.Config.TTSEnabled)
            {
                // スキル名を辞書で置換する
                skillName = TTSDictionary.Instance.ReplaceTTS(skillName);

                if (!string.IsNullOrEmpty(skillName))
                {
                    if (skillName.Contains("UNKNOWN", StringComparison.InvariantCultureIgnoreCase))
                    {
                        skillName = "アンノウン";
                    }

                    TTSWrapper.Speak(skillName);
                }
            }
        }
예제 #2
0
        private void PlaySound(
            string skillName)
        {
            if (this.Config.WaveSoundEnabled)
            {
                var vol = Settings.Instance.WaveVolume / 100f;
                switch (Settings.Instance.TTSDevice)
                {
                case TTSDevices.Normal:
                    ActGlobals.oFormActMain?.PlaySound(this.Config.WaveFile);
                    break;

                case TTSDevices.OnlyMain:
                    PlayBridge.Instance.PlayMain(this.Config.WaveFile, vol);
                    break;

                case TTSDevices.OnlySub:
                    PlayBridge.Instance.PlaySub(this.Config.WaveFile, vol);
                    break;
                }
            }

            if (this.Config.TTSEnabled)
            {
                // スキル名を辞書で置換する
                skillName = TTSDictionary.Instance.ReplaceTTS(skillName);

                if (!string.IsNullOrEmpty(skillName))
                {
                    if (skillName.Contains("UNKNOWN", StringComparison.InvariantCultureIgnoreCase))
                    {
                        skillName = "アンノウン";
                    }

                    TTSWrapper.Speak(skillName);
                }
            }
        }
예제 #3
0
        public void UpdateTargets(
            IEnumerable <CombatantEx> combatants)
        {
            if (this.Config.IsDesignMode ||
                WPFHelper.IsDesignMode)
            {
                combatants = DesignTimeCombatantList;
            }

            // ゴミを除去しておく
            combatants = combatants.Where(x =>
                                          !string.IsNullOrEmpty(x.Name) &&
                                          !x.Name.ContainsIgnoreCase("typeid"));

            using (this.TacticalTargetListSource.DeferRefresh())
            {
                foreach (var combatant in combatants)
                {
                    var clone = combatant.Clone();

                    var exists = this.TacticalTargetList.FirstOrDefault(x => x.ID == clone.UUID);
                    if (exists != null)
                    {
                        exists.TargetActor = clone;
                    }
                    else
                    {
                        var config = this.Config.TacticalItems.FirstOrDefault(x =>
                                                                              x.TargetName.ToLower() == clone.Name.ToLower());

                        exists = new TacticalTarget()
                        {
                            TargetActor  = clone,
                            TargetConfig = config,
                        };

                        this.TacticalTargetList.Add(exists);

                        if (exists.TargetConfig != null &&
                            exists.TargetConfig.IsNoticeEnabled &&
                            !string.IsNullOrEmpty(exists.TargetConfig.TTS))
                        {
                            TTSWrapper.Speak(exists.TargetConfig.TTS);
                        }
                    }

                    exists.UpdateTargetInfo();
                    Thread.Yield();
                }

                var toRemoveTargets = this.TacticalTargetList
                                      .Where(x => !combatants.Any(y => y.UUID == x.ID))
                                      .ToArray();

                foreach (var item in toRemoveTargets)
                {
                    this.TacticalTargetList.Remove(item);
                    Thread.Yield();
                }

                var ordered = (
                    from x in this.TacticalTargetList
                    orderby
                    x.TargetActor.Type descending,
                    x.Distance ascending,
                    x.ID ascending
                    select
                    x).ToArray();

                var order = 1;
                foreach (var target in ordered)
                {
                    target.Order = order++;
                }
            }

            this.RaisePropertyChanged(nameof(this.IsExistsTargets));
        }