예제 #1
0
        private void set_background_clip(BackgroundSource src)
        {
            //
            //FIX background audio clip assignment.  i think it will f**k up if there are less than 2 clips found
            //

            if (src.current_clip == "Default")
            {
                //build a list of all background clips
                List<AudioClip> val_list = new List<AudioClip>();
                foreach (AudioClip val in dict_background_samples.Values)
                {
                    val_list.Add(val);
                }

                //set current source clip from above list (first source gets first clip, second gets second, etc)
                src.audiosource.clip = val_list[backgroundsource_list.Count - 1];

                //get the file name for the clip
                string s = "";
                if (dict_background_samples2.TryGetValue(src.audiosource.clip, out s))
                {
                    src.current_clip = s;
                    if (debugging) Debug.Log("[CHATR] \"Default\" AudioClip set :: current_clip = " + s);
                }
            }
        }
예제 #2
0
        private void AAE_gui()
        {
            GUIContent _content = new GUIContent();
            string truncated;   //truncate file names because some are stupid long

            if (aae_backgrounds_exist)
            {
                int i = 1;
                foreach (BackgroundSource src in backgroundsource_list)
                {
                    _content.text = "Background " + i + " volume: " + (src.audiosource.volume * 100).ToString("F0") + "%";
                    _content.tooltip = "Volume level for this Background audio";
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                    src.audiosource.volume = GUILayout.HorizontalSlider(src.audiosource.volume, 0, 1f, GUILayout.Width(100f));
                    GUILayout.EndHorizontal();

                    if (src.current_clip.Length > 30) truncated = src.current_clip.Substring(0, 27) + "...";
                    else truncated = src.current_clip;
                    _content.text = truncated;
                    _content.tooltip = "Click to change the selected sample";
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    GUILayout.Label("Sample:");
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        sel_background_src = src;
                        //show_sample_selector = !show_sample_selector;
                        show_AAE_background_sample_selector = !show_AAE_background_sample_selector;
                    }
                    GUILayout.EndHorizontal();
                    i++;
                }

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Background sounds only in IVA";
                _content.tooltip = "Play only when in internal view";
                aae_backgrounds_onlyinIVA = GUILayout.Toggle(aae_backgrounds_onlyinIVA, _content);
                GUILayout.EndHorizontal();
            }

            //line to separate
            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
            GUILayout.Label(line_512x4, GUILayout.ExpandWidth(false), GUILayout.Width(275f), GUILayout.Height(10f));
            GUILayout.EndHorizontal();

            //EVA breathing
            if (aae_breathing_exist)
            {
                _content.text = "Breath volume: " + (aae_breathing.volume * 100).ToString("F0") + "%";
                _content.tooltip = "Volume level for EVA breathing";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aae_breathing.volume = GUILayout.HorizontalSlider(aae_breathing.volume, 0, 1f, GUILayout.Width(100f));
                GUILayout.EndHorizontal();
            }

            //Airlock
            if (aae_airlock_exist)
            {
                _content.text = "Airlock volume: " + (aae_airlock.volume * 100).ToString("F0") + "%";
                _content.tooltip = "Volume level for Airlock";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aae_airlock.volume = GUILayout.HorizontalSlider(aae_airlock.volume, 0, 1f, GUILayout.Width(100f));
                GUILayout.EndHorizontal();
            }

            //Wind
            if (aae_wind_exist)
            {
                _content.text = "Wind volume: " + (aae_wind_vol_slider * 100).ToString("F0") + "%";
                _content.tooltip = "Volume level for surface wind";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aae_wind_vol_slider = GUILayout.HorizontalSlider(aae_wind_vol_slider, 0, 1f, GUILayout.Width(100f));
                GUILayout.EndHorizontal();
            }

            //Soundscape
            if (aae_soundscapes_exist)
            {
                _content.text = "Soundscape volume: " + (aae_soundscape.volume * 100).ToString("F0") + "%";
                _content.tooltip = "Volume level for Soundscapes";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aae_soundscape.volume = GUILayout.HorizontalSlider(aae_soundscape.volume, 0, 1f, GUILayout.Width(100f));
                GUILayout.EndHorizontal();

                aae_soundscape_freq = Convert.ToInt32(Math.Round(aae_soundscape_freq_slider));
                string soundscape_freq_str = "";
                if (aae_soundscape_freq == 0) soundscape_freq_str = "Disabled";
                else
                {
                    if (aae_soundscape_freq == 1) soundscape_freq_str = "5-10 min";
                    else if (aae_soundscape_freq == 2) soundscape_freq_str = "2-5 min";
                    else if (aae_soundscape_freq == 3) soundscape_freq_str = "1-2 min";
                    else if (aae_soundscape_freq == 4) soundscape_freq_str = "Continuous";
                }

                _content.text = "Soundscape frequency: " + soundscape_freq_str;
                _content.tooltip = "How often soundscapes will play";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, label_txt_left, GUILayout.ExpandWidth(true));
                aae_soundscape_freq_slider = GUILayout.HorizontalSlider(aae_soundscape_freq_slider, 0, 4f, GUILayout.Width(60f));
                GUILayout.EndHorizontal();

                if (aae_soundscape_freq != aae_prev_soundscape_freq)
                {
                    if (aae_soundscape_freq == 0)
                    {
                        //soundscape turned off
                        aae_soundscape.Stop();
                    }
                    if (aae_soundscape_freq == 4)
                    {
                        //if freq = 4, continuous play of soundscape

                    }
                    else
                    {
                        if (debugging) Debug.Log("[CHATR] setting new soundscape1 timer limit...");
                        new_soundscape_loose_timer_limit();
                        aae_soundscape_timer = 0;
                    }

                    aae_prev_soundscape_freq = aae_soundscape_freq;
                }

                //Curently playing soundscape
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label("Sample: ");
                if (aae_soundscape_current_clip.Length > 30) truncated = aae_soundscape_current_clip.Substring(0, 27) + "...";
                else truncated = aae_soundscape_current_clip;
                _content.text = truncated;
                _content.tooltip = "Click to skip to a new random soundscape";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    set_soundscape_clip();
                }
                GUILayout.EndHorizontal();
            }
        }