private void Awake() { m_Rhythms = GetComponent <Rhythms>(); m_Bpm = 120.0f; m_NextWait = 1; m_CurrentMusicSequence = new MusicSequence { m_Bpm = m_Bpm, m_Scale = m_Scale, m_DefaultVolume = m_DefaultVolume, m_TimeMultiplier = m_TimeMultiplier, m_BeatsPerBar = m_BeatsPerBar, m_MusicUnits = new Queue <MusicUnit>(), }; }
public async Task <IActionResult> OnGetAsync() { if (string.IsNullOrEmpty(Request.Cookies["Token"])) { return(Redirect("/")); } LastMessage = ""; var rhythmResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/rhythms?sortOnVerseCount=true"); if (!rhythmResponse.IsSuccessStatusCode) { LastMessage = JsonConvert.DeserializeObject <string>(await rhythmResponse.Content.ReadAsStringAsync()); return(Page()); } Rhythms = JsonConvert.DeserializeObject <List <GanjoorMetre> >(await rhythmResponse.Content.ReadAsStringAsync()); var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/probablemetre/next"); if (!response.IsSuccessStatusCode) { LastMessage = JsonConvert.DeserializeObject <string>(await response.Content.ReadAsStringAsync()); } else { Poem = JsonConvert.DeserializeObject <GanjoorPoemCompleteViewModel>(await response.Content.ReadAsStringAsync()); if (string.IsNullOrEmpty(Poem.GanjoorMetre.Rhythm)) { Rhythms.Add ( new GanjoorMetre() { Id = 0, Rhythm = "" } ); } } return(Page()); }