d30b064f49fcd135b78857e67c56b6619d71c2a67039e92c931d77a82543f016.json 5.1 KB

1
  1. {"ast":null,"code":"import { FlowGraphExecutionBlock } from \"../../../flowGraphExecutionBlock.js\";\nimport { RichTypeAny } from \"../../../flowGraphRichTypes.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\n/**\n * @experimental\n * A block that executes a branch based on a selection.\n */\nexport class FlowGraphSwitchBlock extends FlowGraphExecutionBlock {\n constructor(\n /**\n * the configuration of the block\n */\n config) {\n super(config);\n this.config = config;\n this.selection = this.registerDataInput(\"selection\", RichTypeAny);\n this.outputFlows = [];\n for (let i = 0; i <= this.config.cases.length; i++) {\n this.outputFlows.push(this._registerSignalOutput(`out${i}`));\n }\n }\n _execute(context, _callingSignal) {\n const selectionValue = this.selection.getValue(context);\n for (let i = 0; i < this.config.cases.length; i++) {\n if (selectionValue === this.config.cases[i]) {\n this.outputFlows[i]._activateSignal(context);\n return;\n }\n }\n // default case\n this.outputFlows[this.outputFlows.length - 1]._activateSignal(context);\n }\n /**\n * @returns class name of the block.\n */\n getClassName() {\n return \"FGSwitchBlock\";\n }\n /**\n * Serialize the block to a JSON representation.\n * @param serializationObject the object to serialize to.\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.cases = this.config.cases;\n }\n}\nRegisterClass(\"FGSwitchBlock\", FlowGraphSwitchBlock);","map":{"version":3,"names":["FlowGraphExecutionBlock","RichTypeAny","RegisterClass","FlowGraphSwitchBlock","constructor","config","selection","registerDataInput","outputFlows","i","cases","length","push","_registerSignalOutput","_execute","context","_callingSignal","selectionValue","getValue","_activateSignal","getClassName","serialize","serializationObject"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js"],"sourcesContent":["import { FlowGraphExecutionBlock } from \"../../../flowGraphExecutionBlock.js\";\nimport { RichTypeAny } from \"../../../flowGraphRichTypes.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\n/**\n * @experimental\n * A block that executes a branch based on a selection.\n */\nexport class FlowGraphSwitchBlock extends FlowGraphExecutionBlock {\n constructor(\n /**\n * the configuration of the block\n */\n config) {\n super(config);\n this.config = config;\n this.selection = this.registerDataInput(\"selection\", RichTypeAny);\n this.outputFlows = [];\n for (let i = 0; i <= this.config.cases.length; i++) {\n this.outputFlows.push(this._registerSignalOutput(`out${i}`));\n }\n }\n _execute(context, _callingSignal) {\n const selectionValue = this.selection.getValue(context);\n for (let i = 0; i < this.config.cases.length; i++) {\n if (selectionValue === this.config.cases[i]) {\n this.outputFlows[i]._activateSignal(context);\n return;\n }\n }\n // default case\n this.outputFlows[this.outputFlows.length - 1]._activateSignal(context);\n }\n /**\n * @returns class name of the block.\n */\n getClassName() {\n return \"FGSwitchBlock\";\n }\n /**\n * Serialize the block to a JSON representation.\n * @param serializationObject the object to serialize to.\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.cases = this.config.cases;\n }\n}\nRegisterClass(\"FGSwitchBlock\", FlowGraphSwitchBlock);\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,qCAAqC;AAC7E,SAASC,WAAW,QAAQ,gCAAgC;AAC5D,SAASC,aAAa,QAAQ,+BAA+B;AAC7D;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,SAASH,uBAAuB,CAAC;EAC9DI,WAAWA;EACX;AACJ;AACA;EACIC,MAAM,EAAE;IACJ,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACC,iBAAiB,CAAC,WAAW,EAAEN,WAAW,CAAC;IACjE,IAAI,CAACO,WAAW,GAAG,EAAE;IACrB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAI,IAAI,CAACJ,MAAM,CAACK,KAAK,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;MAChD,IAAI,CAACD,WAAW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