closeIn = -1; $this->download = $this->wz->startDownload(); $tag = $this->wz->tag; $this->artist->text = "Nom de l'artiste : " . ($tag->artist !== '' ? $tag->artist : 'N/A'); $this->song->text = 'Nom de la chanson : ' . ($tag->title !== '' ? $tag->title : 'N/A'); if ($this->download === null) { $this->action->text = 'Action en cours : pas de morceau'; } $this->where->text = 'winster.free.fr/LYR/ (archive.org)'; } protected function tick(float $dt): void { parent::tick($dt); $d = $this->download; if ($d === null) { return; } $this->attempt->text = 'Essai n° : ' . $d->attempt; $this->action->text = 'Action en cours : ' . $d->action; $this->progress->value = (int)round($d->progress * 100); if ($d->finished()) { $this->cancel->text = 'Fermer'; if ($d->ok && $this->closeIn < 0) { $this->closeIn = 1.2; // "Telechargement terminer", then the lyrics play } } if ($this->closeIn > 0) { $this->closeIn -= $dt; if ($this->closeIn <= 0) { $this->wz->ui['lyrics']['visible'] = true; $this->close(); } } } public function onCancelClick(Button $sender): void { if ($this->download !== null && !$this->download->finished()) { $this->download->cancel(); // quitte = True } $this->close(); } }