Chatterer.chatterer.AAE_background_sample_selector_gui C# (CSharp) Method

AAE_background_sample_selector_gui() private method

private AAE_background_sample_selector_gui ( int window_id ) : void
window_id int
return void
        private void AAE_background_sample_selector_gui(int window_id)
        {
            GUIContent _content = new GUIContent();

            //BeepSource source = beepsource_list[(((sel_beep_page - 1) * 10) + sel_beep_src)];   //shortcut   0-9 only, but correspond to the correct beepsource

            BackgroundSource src = sel_background_src;

            AAE_background_sample_selector_scroll_pos = GUILayout.BeginScrollView(AAE_background_sample_selector_scroll_pos, false, true);

            //list each sample from Dict
            foreach (string key in dict_background_samples.Keys)
            {
                AudioClip _clip = new AudioClip();
                GUIStyle sample_gs = label_txt_left;

                if (dict_background_samples.TryGetValue(key, out _clip))
                {

                    //check if _clip is == source.clip
                    //if yes, bold it
                    if (_clip == src.audiosource.clip) sample_gs = label_txt_bold;
                    else sample_gs = label_txt_left;
                }

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

                _content.text = key;
                _content.tooltip = "Background sample file name";
                GUILayout.Label(_content, sample_gs, GUILayout.ExpandWidth(true));

                /*
                _content.text = "►";
                _content.tooltip = "Play this sample once";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    if ((exchange_playing && disable_beeps_during_chatter) || sstv.isPlaying) return;   //don't play during chatter or sstv
                    //if (debugging) Debug.Log("[CHATR] playing sample " + source.current_clip + " one time...");

                    OTP_source = source;
                    OTP_stored_clip = source.audiosource.clip;

                    //if (debugging) Debug.Log("[CHATR] OTP_stored_clip = " + OTP_stored_clip);
                    //source.current_clip = key;
                    //if (debugging) Debug.Log("[CHATR] set clip " + source.current_clip + " to play once");
                    //set_beep_clip(source);
                    //if (debugging) Debug.Log("[CHATR] source.audiosource.clip set");

                    //AudioClip _clip;
                    if (dict_probe_samples.TryGetValue(key, out _clip))
                    {
                        source.audiosource.clip = _clip;
                    }

                    OTP_playing = true;
                    source.audiosource.Play();

                    //problem may be right here when setting clip back right after playing
                    //reset clip in Update() after playing has finished

                    //if (debugging) Debug.Log("[CHATR] AudioSource has played");
                    //source.current_clip = stored_clip;
                    //if (debugging) Debug.Log("[CHATR] source.current_clip = " +  source.current_clip);
                    //set_beep_clip(source);

                    //AudioClip temp_clip;
                    //if (dict_probe_samples.TryGetValue(key, out temp_clip))
                    //{
                    //    if (debugging) Debug.Log("[CHATR] got temp_clip, key = " + key);
                    //    source.audiosource.clip = temp_clip;
                    //    if (debugging) Debug.Log("[CHATR] playing one time");
                    //    source.audiosource.Play();
                    //    source.current_clip = stored_clip;
                    //    set_beep_clip(source);
                    //    if (debugging) Debug.Log("[CHATR] stored clip replaced");
                    //}
                }
                */

                _content.text = "Set";
                _content.tooltip = "Set this sample to play from this backgroundsource";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    //sample was selected
                    src.current_clip = key;  //set current_clip
                    //set_beep_clip(source);  //then assign AudioClip

                    AudioClip temp_clip = new AudioClip();

                    if (dict_background_samples.TryGetValue(src.current_clip, out temp_clip))
                    {
                        src.audiosource.clip = temp_clip;
                        string s = "";
                        if (dict_background_samples2.TryGetValue(src.audiosource.clip, out s))
                        {
                            src.current_clip = s;
                            if (debugging) Debug.Log("[CHATR] background AudioClip set :: current_clip = " + s);
                        }
                    }
                    else
                    {
                        if (debugging) Debug.LogError("[CHATR] Could not find AudioClip for key " + src.current_clip + " :: setting AudioClip to \"First\"");
                        src.current_clip = "First";
                        set_background_clip(src);
                        //set_beep_clip(beepsource);
                    }

                    if (debugging) Debug.Log("[CHATR] sample selector clip set :: clip = " + key);

                    //set and play once when clicked
                    //if ((exchange_playing && disable_beeps_during_chatter) || sstv.isPlaying) return;   //don't play during chatter or sstv
                    //else
                    //{
                    //if (debugging) Debug.Log("[CHATR] playing sample " + source.current_clip + " one time...");
                    //source.audiosource.clip = all_beep_clips[bm.current_clip - 1];
                    //source.audiosource.Play();
                    //}

                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.Label(" ", GUILayout.ExpandWidth(true));
            if (GUILayout.Button("Close", GUILayout.ExpandWidth(false)))
            {
                show_AAE_background_sample_selector = false;
            }
            GUILayout.EndHorizontal();

            if (show_tooltips && GUI.tooltip != "") tooltips(probe_sample_selector_window_pos);

            GUI.DragWindow();
        }
chatterer