public static void Init() { Scales = new List <ScaleDefinition>(); TextAsset mytxtData = Resources.Load <TextAsset>("GammeDefinition"); //string[] sep = { "\r", "\n" }; //string[] txt = mytxtData.text.Split(sep, StringSplitOptions.None); //string[] list1 = mytxtData.text.Split('\r'); string text = System.Text.Encoding.UTF8.GetString(mytxtData.bytes); string[] list1 = text.Split('\r'); if (list1.Length >= 1) { for (int i = 1; i < list1.Length; i++) { string[] c = list1[i].Split(';'); if (c.Length >= 15) { ScaleDefinition scale = new ScaleDefinition(); try { scale.Name = c[0]; if (scale.Name[0] == '\n') { scale.Name = scale.Name.Remove(0, 1); } scale.Short = c[1]; scale.Index = Convert.ToInt32(c[2]); scale.Main = (c[3].ToUpper() == "X") ? true : false; scale.Count = Convert.ToInt32(c[4]); scale.Position = new string[12]; for (int j = 5; j <= 16; j++) { scale.Position[j - 5] = c[j]; } } catch (Exception ex) { Debug.Log(list1[i] + " " + ex.Message); } Scales.Add(scale); scale.Build(); } } } Names = new List <string>(); foreach (ScaleDefinition sd in Scales) { Names.Add(sd.Name); } //Debug.Log("Loaded " + Scales.Count + " scales"); }
void Awake() { //Debug.Log("Awake InfinityMusic"); HelperNoteLabel.Init(); // Event set in Inspector //if (MidiPlayerGlobal.OnEventPresetLoaded != null) // MidiPlayerGlobal.OnEventPresetLoaded.AddListener(() => EndLoadingSF()); instance = this; LastDateTick = DateTime.Now; ScaleDefinition.Init(); HelperNoteLabel.Init(); HelperNoteRatio.Init(); }