private void chatter_gui()
{
GUIContent _content = new GUIContent();
//Chatter frequency
chatter_freq = Convert.ToInt32(Math.Round(chatter_freq_slider));
string chatter_freq_str = "";
if (chatter_freq == 0) chatter_freq_str = "No chatter";
else
{
if (chatter_freq == 1) chatter_freq_str = "180-300s";
else if (chatter_freq == 2) chatter_freq_str = "90-180s";
else if (chatter_freq == 3) chatter_freq_str = "60-90s";
else if (chatter_freq == 4) chatter_freq_str = "30-60s";
else if (chatter_freq == 5) chatter_freq_str = "10-30s";
}
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
_content.text = "Chatter frequency: " + chatter_freq_str;
_content.tooltip = "How often chatter will play";
GUILayout.Label(_content, label_txt_left, GUILayout.ExpandWidth(true));
chatter_freq_slider = GUILayout.HorizontalSlider(chatter_freq_slider, 0, 5f, GUILayout.Width(100f));
GUILayout.EndHorizontal();
if (chatter_freq != prev_chatter_freq)
{
if (debugging) Debug.Log("[CHATR] chatter_freq has changed, setting new delay between exchanges...");
if (chatter_freq == 0)
{
exchange_playing = false;
secs_since_initial_chatter = 0;
}
secs_since_last_exchange = 0;
set_new_delay_between_exchanges();
prev_chatter_freq = chatter_freq;
}
//Chatter volume
_content.text = "Chatter volume: " + (chatter_vol_slider * 100).ToString("F0") + "%";
_content.tooltip = "Volume of chatter audio";
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label(_content, label_txt_left, GUILayout.ExpandWidth(true));
chatter_vol_slider = GUILayout.HorizontalSlider(chatter_vol_slider, 0, 1f, GUILayout.Width(130f));
GUILayout.EndHorizontal();
if (chatter_vol_slider != prev_chatter_vol_slider)
{
if (debugging) Debug.Log("[CHATR] Changing chatter AudioSource volume...");
initial_chatter.volume = chatter_vol_slider;
response_chatter.volume = chatter_vol_slider;
prev_chatter_vol_slider = chatter_vol_slider;
}
//Quindar
_content.text = "Quindar volume: " + (quindar_vol_slider * 100).ToString("F0") + "%";
_content.tooltip = "Volume of beeps before and after chatter";
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label(_content, label_txt_left, GUILayout.ExpandWidth(true));
quindar_vol_slider = GUILayout.HorizontalSlider(quindar_vol_slider, 0, 1f, GUILayout.Width(130f));
GUILayout.EndHorizontal();
if (quindar_vol_slider != prev_quindar_vol_slider)
{
if (debugging) Debug.Log("[CHATR] Quindar volume has been changed...");
quindar1.volume = quindar_vol_slider;
quindar2.volume = quindar_vol_slider;
prev_quindar_vol_slider = quindar_vol_slider;
}
if (show_advanced_options)
{
//Chatter sets
_content.text = "ChatterSets";
_content.tooltip = "Show currently loaded chatter audio";
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) show_chatter_sets = !show_chatter_sets;
GUILayout.Label("", GUILayout.ExpandWidth(true)); //spacer
_content.text = "Filters";
_content.tooltip = "Adjust filters for chatter audio";
if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
{
show_chatter_filter_settings = !show_chatter_filter_settings;
}
GUILayout.EndHorizontal();
if (show_chatter_sets)
{
int i;
for (i = 0; i < chatter_array.Count; i++)
{
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
bool temp = chatter_array[i].is_active;
_content.text = chatter_array[i].directory + " (" + (chatter_array[i].capcom.Count + chatter_array[i].capsule.Count).ToString() + " clips)";
_content.tooltip = "Toggle this chatter set on/off";
chatter_array[i].is_active = GUILayout.Toggle(chatter_array[i].is_active, _content, GUILayout.ExpandWidth(true));
_content.text = "Remove";
_content.tooltip = "Remove this chatter set from the list";
if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
{
//Remove this set
chatter_array.RemoveAt(i);
load_chatter_audio();
break;
}
if (temp != chatter_array[i].is_active) load_toggled_chatter_sets(); //reload toggled audio clips if any set is toggled on/off
GUILayout.EndHorizontal();
}
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
custom_dir_name = GUILayout.TextField(custom_dir_name, GUILayout.Width(150f));
GUILayout.Label("", GUILayout.ExpandWidth(true)); //spacer
_content.text = "Load";
_content.tooltip = "Try to load chatter set with this name";
if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
{
bool already_loaded = false;
foreach (ChatterAudioList r in chatter_array)
{
//check if this set is already loaded
if (custom_dir_name == r.directory) already_loaded = true;
}
if (custom_dir_name.Trim() != "" && custom_dir_name != "directory name" && already_loaded == false)
{
//set name isn't blank, "directory name", or already loaded. load it.
chatter_array.Add(new ChatterAudioList());
chatter_array[chatter_array.Count - 1].directory = custom_dir_name.Trim();
chatter_array[chatter_array.Count - 1].is_active = true;
//reset custom_dir_name
custom_dir_name = "directory name";
//reload audio
load_chatter_audio();
}
}
GUILayout.EndHorizontal();
}
}
}