public function createFromFragmentType(TES5FragmentType $fragmentType) { $localScope = new TES5LocalScope(); switch ($fragmentType) { case TES5FragmentType::T_TIF(): $localScope->addVariable(new TES5LocalVariable("akSpeakerRef", TES5BasicType::T_OBJECTREFERENCE(), [TES5LocalVariableParameterMeaning::ACTIVATOR()])); break; case TES5FragmentType::T_PF(): $localScope->addVariable(new TES5LocalVariable("akActor", TES5BasicType::T_ACTOR(), [TES5LocalVariableParameterMeaning::ACTIVATOR()])); break; case TES5FragmentType::T_QF(): break; } return $localScope; }
/** * @param string $scriptName * @param TES4VariableDeclarationList $variableList * @param TES4CodeChunks $script * @return TES5Script * @throws ConversionException */ public function convert($scriptName, TES4VariableDeclarationList $variableList, TES4CodeChunks $script) { //Create the header. $scriptHeader = new TES5ScriptHeader($this->nameTransformer->transform($scriptName, ''), $scriptName, TES5BasicType::T_TOPICINFO(), '', true); $globalScope = new TES5GlobalScope($scriptHeader); foreach ($this->esmAnalyzer->getGlobalVariables() as $globalVariable) { $globalScope->addGlobalVariable($globalVariable); } if ($variableList !== null) { //Converting the variables to the properties. $this->propertiesFactory->createProperties($variableList, $globalScope); } $fragment = $this->fragmentFactory->createFragment(TES5FragmentType::T_TIF(), "Fragment_0", $globalScope, new TES5MultipleScriptsScope([$globalScope]), $script); $blockList = new TES5BlockList(); $blockList->add($fragment); return new TES5Script($scriptHeader, $globalScope, $blockList); }