예제 #1
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var dlg    = script.Dialogs[Dialog];
            var netdlg = new NetDlgLine[dlg.Lines.Count];

            for (int i = 0; i < dlg.Lines.Count; i++)
            {
                var    d     = dlg.Lines[i];
                string voice = "trent_voice";
                if (!d.Source.Equals("Player", StringComparison.OrdinalIgnoreCase))
                {
                    var src = script.Ships[d.Source];
                    var npc = script.NPCs[src.NPC];
                    voice = npc.Voice;
                }

                var hash = FLHash.CreateID(d.Line);
                runtime.EnqueueLine(hash, d.Line);
                netdlg[i] = new NetDlgLine()
                {
                    Voice = voice,
                    Hash  = hash
                };
            }
            runtime.Player.PlayDialog(netdlg);
        }
예제 #2
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var hash = FLHash.CreateID(Line);

            runtime.EnqueueLine(hash, Line);
            runtime.Player.PlayDialog(new NetDlgLine[] { new NetDlgLine()
                                                         {
                                                             Voice = Voice,
                                                             Hash  = hash
                                                         } });
        }
예제 #3
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var netdlg = new NetDlgLine[1];
            var src    = script.Ships[Source];
            var npc    = script.NPCs[src.NPC];
            var voice  = npc.Voice;
            var hash   = FLHash.CreateID(Line);

            runtime.EnqueueLine(hash, Line);
            netdlg[0] = new NetDlgLine()
            {
                Voice = voice,
                Hash  = hash
            };
            runtime.Player.PlayDialog(netdlg);
        }
예제 #4
0
        public IDTable(string fldir)
        {
            UtfNicknameTable = new Dictionary <uint, string>();
            var fs     = FileSystem.FromFolder(fldir, true);
            var flini  = new FreelancerIni(fs);
            var voices = new VoicesIni();

            foreach (var path in flini.VoicePaths)
            {
                voices.AddVoicesIni(path, fs);
            }
            foreach (var voice in voices.Voices.Values)
            {
                foreach (var msg in voice.Messages)
                {
                    UtfNicknameTable[FLHash.CreateID(msg.Message)] = msg.Message;
                }
            }
        }
예제 #5
0
 public VoiceUtf(string path)
 {
     foreach (var child in parseFile(path))
     {
         if (!(child is LeafNode))
         {
             FLLog.Error("Utf", "Invalid audio intermediate node in " + path);
             continue;
         }
         var  leaf = (LeafNode)child;
         uint hash;
         if (!child.Name.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
         {
             hash = FLHash.CreateID(child.Name);
         }
         else
         {
             hash = uint.Parse(child.Name.Substring(2), NumberStyles.HexNumber);
         }
         AudioFiles.Add(hash, leaf.ByteArrayData);
     }
 }
예제 #6
0
 public void PlayVoiceLine(string voice, string line)
 {
     Data.Sounds?.PlayVoiceLine(voice, FLHash.CreateID(line), null);
 }