Ferreteria/v2/trait/ftExecutableTwig: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v2
Jump to navigation Jump to search
(Created page with "{{page/code/class}} * '''file''': {{l/ferreteria/file|page/page.php}} * '''uses''': ''nothing'' * '''used by''': ** {{l/version|class|fcNavBase}} <source lang=php> // PURPOSE:...")
 
m (1 revision imported: moving this project here)
 
(No difference)

Latest revision as of 16:45, 22 May 2022

Template:Page/code/class

// PURPOSE: So a node can respond to events (does not pass them down to subnodes)
trait ftExecutableTwig {
    public function DoEvent($nEvent) {
	$this->OnEventDispatch($nEvent);
    }
    protected function OnEventDispatch($nEvent) {
	switch ($nEvent) {
	  case KI_NODE_EVENT_DO_BUILDING:
	    $this->OnCreateElements();
	    break;
	  case KI_NODE_EVENT_DO_FIGURING:
	    $this->OnRunCalculations();
	    break;
	}
    }
    abstract protected function OnCreateElements();
    abstract protected function OnRunCalculations();
}