public void Toggle_Edit() { if (Selected_Sound != this) { if (Selected_Sound != null) { foreach (Sound_Instance_Mono instance in Selected_Sound.Instances.Values.ToList()) { RectTransform rect_transform = instance.sound.title.transform.parent.GetComponent <RectTransform>(); rect_transform.sizeDelta = new Vector2(rect_transform.sizeDelta.x, 45); rect_transform = instance.sound.GetComponent <RectTransform>(); rect_transform.sizeDelta = new Vector2(rect_transform.sizeDelta.x, 45); instance.Button.interactable = false; Utils.InvokeNextFrame(() => instance.Update_Volume()); } Selected_Sound.Update_Loop_Borders(); } Selected_Sound = this; foreach (Sound_Instance_Mono instance in Instances.Values.ToList()) { instance.Button.interactable = true; Set_Height(instance, 60); Utils.InvokeNextFrame(() => instance.Update_Volume()); } } else { foreach (Sound_Instance_Mono instance in Selected_Sound.Instances.Values.ToList()) { instance.Button.interactable = false; Selected_Sound = null; Set_Height(instance, 45); Utils.InvokeNextFrame(() => instance.Update_Volume()); } } Update_Loop_Borders(); Utils.Update_UI = true; }
void Handle_Data_Response(string response, Handler_Type type) { string data = Utils.Split(response, '~')[1]; foreach (string rhythm in Utils.Split(data, "%")) { Rhythm_Data new_rhythm = new Rhythm_Data(); string[] rhythm_data = Utils.Split(rhythm, '#'); new_rhythm.Id = uint.Parse(rhythm_data[0]); new_rhythm.Name = rhythm_data[1]; new_rhythm.Description = rhythm_data[2]; new_rhythm.PPM = uint.Parse(rhythm_data[3]); new_rhythm.Time_Signature = (Rhythm_Data.Time_Signature_Type)Enum.Parse(typeof(Rhythm_Data.Time_Signature_Type), rhythm_data[4]); new_rhythm.Creation = Utils.Get_DateTime(rhythm_data[5]); new_rhythm.Last_Update = Utils.Get_DateTime(rhythm_data[6]); new_rhythm.Author_id = uint.Parse(rhythm_data[7]); foreach (Sound_Data.Sound_Type sound_type in (Sound_Data.Sound_Type[])Enum.GetValues(typeof(Sound_Data.Sound_Type))) { if (sound_type == Sound_Data.Sound_Type.None) { continue; } Sound_Data new_sound = Parse_Sound(sound_type, rhythm_data[8]); new_rhythm.Sounds_Data.Add(new_sound); if (!Sound_Type_Mono.Sounds.Exists(a => a.Sound_Type == new_sound.Type)) { continue; } Sound_Type_Mono sound_mono = Sound_Type_Mono.Sounds.Find(a => a.Sound_Type == new_sound.Type); foreach (Sound_Data.Instance instance in new_sound.Instances) { sound_mono.Instances[instance.Fire_Time].Set_Enabled(true); sound_mono.Instances[instance.Fire_Time].Instance = instance; } foreach (Sound_Data.Loop loop in new_sound.Loops) { int sibling_index = sound_mono.Instances[loop.Start_Time].transform.GetSiblingIndex(); Rhythm_Loop rhythm_loop = Instantiate(loop_prefab, sound_mono.transform).GetComponent <Rhythm_Loop>(); rhythm_loop.Data = loop; rhythm_loop.Sound = sound_mono; rhythm_loop.Sound.Loops.Add(rhythm_loop); rhythm_loop.Update_Core(); rhythm_loop.Update_Periphery(); } } Rhythms.Add(new_rhythm); } rhythm_title.text = Rhythms[0].Name.ToString(); PPM = Rhythms[0].PPM; rhythm_speed.text = PPM.ToString(); rhythm_length.text = Song_Length.ToString(); time_signature.value = (int)Rhythms[0].Time_Signature; time_signature.onValueChanged.AddListener((int value) => { Rhythms[0].Time_Signature = (Rhythm_Data.Time_Signature_Type)value; Update_Separators(); }); Update_Numerators(); Update_Separators(); Reset_Events(); Utils.Update_UI = true; }