Exemplo n.º 1
0
 private void ChoiceDone(ALOutput.SoundPlay reference)
 {
     lock (this._curLock)
     {
         if (reference != this._curChoice)
             return;
         this._curChoice = (ALOutput.SoundPlay)null;
         System.Diagnostics.Debug.WriteLine("Choice done, clearing");
     }
 }
Exemplo n.º 2
0
 public void Stop(ALOutput.SoundPlay sound)
 {
     lock (this._commands)
     {
         this._commands.Enqueue(new ALOutput.CommandInst()
         {
             Command = ALOutput.Command.Stop,
             Sound   = sound
         });
         this._event.Set();
     }
 }
Exemplo n.º 3
0
 private void DialogueDone(ALOutput.SoundPlay reference)
 {
     lock (this._curLock)
     {
         if (this._curDialogue != reference)
             return;
         this._curDialogue = (ALOutput.SoundPlay)null;
         System.Diagnostics.Debug.WriteLine("Dialogue done, clearing current [" + reference.File);
         if (this._curChoice != null)
         {
             System.Diagnostics.Debug.WriteLine("Dlg done, playing pending choice " + this._curChoice.File);
             this._output.Play(this._curChoice);
         }
     }
 }
Exemplo n.º 4
0
 private void TriggerChoice(ALOutput.SoundPlay choice)
 {
     lock (this._curLock)
     {
         if (this._curChoice != null)
             this._output.Stop(this._curChoice);
         this._curChoice = choice;
         this._curChoice.OnComplete = (Action)(() => this.ChoiceDone(choice));
         if (this._curDialogue == null)
         {
             System.Diagnostics.Debug.WriteLine("No dlg active, playing choice " + this._curChoice.File);
             this._output.Play(this._curChoice);
         }
         else
             System.Diagnostics.Debug.WriteLine("Dlg active, pending choice " + this._curChoice.File);
     }
 }
Exemplo n.º 5
0
 public void Play(Ambient a, fVoices form)
 {
     if (this.Playing != null && a.File.Equals(this.Playing.File, StringComparison.InvariantCultureIgnoreCase))
     {
         this.Sound.Pan = a.Pan;
         this.Sound.Volume = a.Volume;
         this.Sound.Loop = a.Loop;
     }
     else
     {
         if (this.Playing != null)
             form._output.Stop(this.Sound);
         this.Sound = form.CreateSound((Sound)a);
         this.Sound.Loop = a.Loop;
         form._output.Play(this.Sound);
     }
     this.Playing = a;
 }
Exemplo n.º 6
0
 private void bTest_Click(object sender, EventArgs e)
 {
     ALOutput.SoundPlay sound = this.CreateSound("ultrasound\\blip2.mp3");
     sound.Pan = 1f;
     this._output.Play(sound);
 }
Exemplo n.º 7
0
        private void NewDialogue(
            int fieldID,
            string text,
            int DID,
            int SID,
            int charsInParty,
            int dlgSel)
        {
            this.lbText.Items.Add((object)string.Format("{0}/{2}/{3} ({4:x}): {1}", (object)fieldID, (object)text, (object)DID, (object)SID, (object)charsInParty));
            if (fieldID != this._currentFID)
            {
                this._current = (VoiceList)null;
                string file = this._index.Lookup(fieldID);
                if (file != null)
                {
                    this._current = this.LoadVL(file);
                }
                this._currentFID = fieldID;
            }
            VoiceEntry voiceEntry1 = (VoiceEntry)null;

            if (dlgSel < 0)
            {
                if (this._current != null)
                {
                    voiceEntry1 = this._current.Entries.Find((Predicate <VoiceEntry>)(e => e.Matches(DID, SID, charsInParty) && string.IsNullOrEmpty(e.Choice)));
                }
                if (voiceEntry1 == null && this._global != null)
                {
                    voiceEntry1 = this._global.Entries.Find((Predicate <VoiceEntry>)(e => e.Matches(DID, SID, charsInParty) && string.IsNullOrEmpty(e.Choice)));
                }
                if (voiceEntry1 == null)
                {
                    return;
                }
                string logMsg = string.Format("[{0}] {1}", (object)voiceEntry1.File, (object)text);
                bool   flag   = this.cbLogging.SelectedIndex == 2;
                lock (this._curLock)
                {
                    if (this._curDialogue != null)
                    {
                        this._output.Stop(this._curDialogue);
                    }
                    if (this._curChoice != null)
                    {
                        this._output.Stop(this._curChoice);
                    }
                    System.Diagnostics.Debug.WriteLine("Clearing all current");
                    this._curChoice = this._curDialogue = (ALOutput.SoundPlay)null;
                    if (this._data.Exists(voiceEntry1.File))
                    {
                        this.lbText.Items.Add((object)(" --> playing " + voiceEntry1.File));
                        ALOutput.SoundPlay snd = this.CreateSound(voiceEntry1.File);
                        this._curDialogue            = snd;
                        this._curDialogue.OnComplete = (Action)(() => this.DialogueDone(snd));
                        this._output.Play(this._curDialogue);
                        System.Diagnostics.Debug.WriteLine("Playing " + this._curDialogue.File);
                        logMsg = "[PRESENT] " + logMsg;
                    }
                    else
                    {
                        logMsg = "[MISSING] " + logMsg;
                        flag   = this.cbLogging.SelectedIndex >= 1;
                    }
                }
                if (flag)
                {
                    this.DoLog(logMsg);
                }
            }
            else
            {
                VoiceEntry voiceEntry2 = (VoiceEntry)null;
                this.lbText.Items.Add((object)("Choice changed to " + dlgSel.ToString()));
                if (this._current != null)
                {
                    voiceEntry2 = this._current.Entries.Find((Predicate <VoiceEntry>)(e => e.Matches(DID, SID, charsInParty) && dlgSel.ToString().Equals(e.Choice)));
                }
                if (voiceEntry2 != null && this._data.Exists(voiceEntry2.File))
                {
                    this.TriggerChoice(this.CreateSound(voiceEntry2.File));
                }
            }
        }