public static void Unselect()
    {
        if (Selected != null)
        {
            foreach (Rhythm_Loop_Border border in Selected.Borders)
            {
                border.GetComponent <Image>().color = color_not_selected;
            }
        }

        Selected = null;
    }
    public void Select()
    {
        Unselect();

        foreach (Rhythm_Loop_Border border in Borders)
        {
            border.GetComponent <Image>().color = color_selected;
        }

        Selected = this;
        Rhythm_Loop_Editor.Singleton.Show_In_Loop_Editor(this);
    }
 public void Show_In_Loop_Editor(Rhythm_Loop loop)
 {
     parent.SetActive(true);
     Repetitions.text = loop.Data.Repetitions.ToString();
 }
Example #4
0
 private void Awake()
 {
     loop           = transform.parent.GetComponent <Rhythm_Loop>();
     rect_Transform = GetComponent <RectTransform>();
 }
Example #5
0
    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;
    }