*/ private array $list = []; private string $before = ''; protected function loaded(array $params = []): void { $this->before = $this->wz->skin->dir; $this->onRefreshClick($this->refresh); } public function onRefreshClick(Button $sender): void { $this->list = $this->wz->skins(); $this->skins->items = array_map(fn (Skin $s) => $s->name, $this->list); $current = -1; foreach ($this->list as $i => $skin) { if (realpath($skin->dir) === realpath($this->wz->skin->dir)) { $current = $i; } } $this->skins->selected = $current; $this->info->text = count($this->list) . ' skin(s). Les vĂ´tres : un dossier avec INFO.txt dans ' . $this->wz->storagePath('skins'); } /** List1_Click: the skin is tried at once. */ public function onSkinsChange(ListBox $sender, int $index, string $item): void { if (isset($this->list[$index])) { $this->wz->useSkin($this->list[$index]->dir); } } public function onSkinsActivate(ListBox $sender, int $index, string $item): void { $this->onSkinsChange($sender, $index, $item); $this->close(); } public function onChooseClick(Button $sender): void { $this->onSkinsChange($this->skins, (int)$this->skins->selected, ''); $this->wz->save(); $this->close(); } public function onMarketClick(Button $sender): void { $this->scenes()->pop(); $this->scenes()->push(MarketForm::class, ['kind' => 'skin']); } /** EDT, from the skin chosen in the list. */ public function onEditorClick(Button $sender): void { $skin = $this->list[(int)$this->skins->selected] ?? null; $this->wz->save(); $this->scenes()->switchTo(SkinEditorForm::class, $skin !== null ? ['skin' => $skin->dir] : [], false); } public function onQuitClick(Button $sender): void { $this->wz->useSkin($this->before); $this->close(); } }