onRefreshClick($this->refresh); } public function onRefreshClick(Button $sender): void { $this->plugins->items = array_map(fn (array $p) => $p[0], array_values(WinZik::PLUGINS)); $current = array_search($this->wz->plugin(), array_keys(WinZik::PLUGINS), true); $this->plugins->selected = $current === false ? 0 : (int)$current; $this->onPluginsChange($this->plugins, (int)$this->plugins->selected, ''); } protected function tick(float $dt): void { parent::tick($dt); // Timer1: the caption says if a plug-in runs $on = $this->wz->plugin() !== ''; $this->state->text = $on ? 'PLUGINS : ACTIVE (' . WinZik::PLUGINS[$this->wz->plugin()][0] . ')' : 'PLUGINS : DESACTIVE'; $this->stop->enabled = $on; } public function onPluginsChange(ListBox $sender, int $index, string $item): void { $key = array_keys(WinZik::PLUGINS)[$index] ?? null; $this->about->text = $key === null ? '' : WinZik::PLUGINS[$key][1]; } public function onPluginsActivate(ListBox $sender, int $index, string $item): void { $this->onStartClick($this->start); } public function onStartClick(Button $sender): void { $key = array_keys(WinZik::PLUGINS)[(int)$this->plugins->selected] ?? ''; $this->wz->usePlugin($key); $this->wz->save(); } public function onStopClick(Button $sender): void { $this->wz->usePlugin(''); $this->wz->save(); } public function onQuitClick(Button $sender): void { $this->close(); } }