Files
core/twe/sammo/Event/EventHandler.php
T
Hide_D 31d9bac59c Scenario 세팅 과정에 문제 해결
SetNationFront 함수도 수정
2018-03-31 16:06:24 +09:00

32 lines
731 B
PHP

<?php
namespace sammo\Event;
class EventHandler{
private $condition = null;
private $actions = [];
public function __construct($rawCondition, $rawActions){
$this->condition = Condition::build($rawCondition);
foreach($rawActions as $rawAction){
$this->actions[] = Action::build($rawAction);
}
}
public function tryRunEvent(array $env=null){
$result = $this->condition->eval($env);
if(!$result['value']){
return $result;
}
$resultAction = [];
foreach($this->actions as $action){
$resultAction[] = $action->run();
}
$result['action'] = $resultAction;
return $result;
}
}