/** * Return current weather uxt translation key, eg. uiFair, uiRainy, uiThundery * * @return bool|string */ public function getLocalizedName() { $setup = $this->wf->getWeatherSetup($this->index); if ($setup !== false) { return $setup['localizedname']; } return false; }
public function testThreeSetup() { $setup = [['setup' => ['lighting' => 0.8, 'localizedname' => 'uiRainy1', 'setupname' => 'fair1'], 'weight' => 50], ['setup' => ['lighting' => 0.8, 'localizedname' => 'uiRainy2', 'setupname' => 'fair1'], 'weight' => 20], ['setup' => ['lighting' => 0.8, 'localizedname' => 'uiThundery', 'setupname' => 'storm'], 'weight' => 30]]; $wf = new CWeatherFunction($setup); $this->assertEquals(3, $wf->getNumWeatherSetups()); $this->assertEquals(100, $wf->getWeatherSetupsTotalWeight()); $this->assertEquals(50, $wf->getWeatherSetupWeight(0)); $this->assertEquals($setup[0]['setup'], $wf->getWeatherSetup(0)); $this->assertEquals(30, $wf->getWeatherSetupWeight(2)); $this->assertEquals($setup[2]['setup'], $wf->getWeatherSetup(2)); $this->assertEquals(false, $wf->getWeatherSetupWeight(3)); $this->assertEquals(false, $wf->getWeatherSetup(3)); }