feat: [US-054] - Character and Variable TypeScript types
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
e02d736f2e
commit
d9c42f4cf7
+35
-9
@@ -4,15 +4,35 @@ export type Position = {
|
||||
y: number;
|
||||
};
|
||||
|
||||
// Character type: represents a defined character in the project
|
||||
export type Character = {
|
||||
id: string;
|
||||
name: string;
|
||||
color: string; // hex color
|
||||
description?: string;
|
||||
};
|
||||
|
||||
// Variable type: represents a defined variable in the project
|
||||
export type Variable = {
|
||||
id: string;
|
||||
name: string;
|
||||
type: 'numeric' | 'string' | 'boolean';
|
||||
initialValue: number | string | boolean;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
// DialogueNode type: represents character speech/dialogue
|
||||
export type DialogueNodeData = {
|
||||
speaker?: string;
|
||||
characterId?: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export type DialogueNode = {
|
||||
id: string;
|
||||
type: 'dialogue';
|
||||
position: Position;
|
||||
data: {
|
||||
speaker?: string;
|
||||
text: string;
|
||||
};
|
||||
data: DialogueNodeData;
|
||||
};
|
||||
|
||||
// Choice option type for ChoiceNode
|
||||
@@ -33,15 +53,18 @@ export type ChoiceNode = {
|
||||
};
|
||||
|
||||
// VariableNode type: represents variable operations
|
||||
export type VariableNodeData = {
|
||||
variableName: string;
|
||||
variableId?: string;
|
||||
operation: 'set' | 'add' | 'subtract';
|
||||
value: number;
|
||||
};
|
||||
|
||||
export type VariableNode = {
|
||||
id: string;
|
||||
type: 'variable';
|
||||
position: Position;
|
||||
data: {
|
||||
variableName: string;
|
||||
operation: 'set' | 'add' | 'subtract';
|
||||
value: number;
|
||||
};
|
||||
data: VariableNodeData;
|
||||
};
|
||||
|
||||
// Union type for all node types
|
||||
@@ -50,6 +73,7 @@ export type FlowchartNode = DialogueNode | ChoiceNode | VariableNode;
|
||||
// Condition type for conditional edges
|
||||
export type Condition = {
|
||||
variableName: string;
|
||||
variableId?: string;
|
||||
operator: '>' | '<' | '==' | '>=' | '<=' | '!=';
|
||||
value: number;
|
||||
};
|
||||
@@ -70,4 +94,6 @@ export type FlowchartEdge = {
|
||||
export type FlowchartData = {
|
||||
nodes: FlowchartNode[];
|
||||
edges: FlowchartEdge[];
|
||||
characters: Character[];
|
||||
variables: Variable[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user