@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
63 lines (62 loc) • 2.1 kB
TypeScript
import type { FlowGraphContext } from "../../../flowGraphContext.js";
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection.js";
import { FlowGraphExecutionBlock } from "../../../flowGraphExecutionBlock.js";
import type { FlowGraphSignalConnection } from "../../../flowGraphSignalConnection.js";
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
import type { FlowGraphNumber } from "../../../utils.js";
/**
* Configuration for a switch block.
*/
export interface IFlowGraphSwitchBlockConfiguration<T> extends IFlowGraphBlockConfiguration {
/**
* The possible values for the selection.
*/
cases: T[];
}
/**
* A block that executes a branch based on a selection.
*/
export declare class FlowGraphSwitchBlock<T extends FlowGraphNumber> extends FlowGraphExecutionBlock {
/**
* the configuration of the block
*/
config: IFlowGraphSwitchBlockConfiguration<T>;
/**
* Input connection: The value of the selection.
*/
readonly case: FlowGraphDataConnection<T>;
/**
* The default case to execute if no other case is found.
*/
readonly default: FlowGraphSignalConnection;
private _caseToOutputFlow;
constructor(
/**
* the configuration of the block
*/
config: IFlowGraphSwitchBlockConfiguration<T>);
_execute(context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void;
/**
* Adds a new case to the switch block.
* @param newCase the new case to add.
*/
addCase(newCase: T): void;
/**
* Removes a case from the switch block.
* @param caseToRemove the case to remove.
*/
removeCase(caseToRemove: T): void;
/**
* @internal
*/
_getOutputFlowForCase(caseValue: T): FlowGraphSignalConnection | undefined;
/**
* @returns class name of the block.
*/
getClassName(): string;
/**
* Serialize the block to a JSON representation.
* @param serializationObject the object to serialize to.
*/
serialize(serializationObject?: any): void;
}