refactor: update file-graph package structure and integrate with game session management

This commit is contained in:
Justin Lin committed 2025-04-23 17:04:00 +08:00
1 parent 92173bb7e9
commit cfbc386c16
9 files changed
+44 -10

No files matched your search

+9 -2
View File
@@ -1,3 +1,4 @@
import { FileGraph, INode } from '@linux-odyssey/file-graph'
import { Quest } from './Quest'
import {
IQuest,
@@ -8,17 +9,19 @@ import {
ITask,
} from './schema'
export class GameSession implements ISession {
export class GameSession {
private completed: string[] = []
private quest: Quest
private graph: FileGraph
constructor(
{ completedEvents }: ISession,
{ completedEvents, graph }: ISession,
quest: IQuest,
checker: IFileExistenceChecker
) {
this.completed = completedEvents
this.quest = new Quest(quest, checker)
this.graph = new FileGraph(graph)
}
get completedEvents() {
@@ -48,4 +51,8 @@ export class GameSession implements ISession {
getTasks(): ITask[] {
return this.quest.getTasks(this.completed)
}
getGraph(): INode {
return this.graph
}
}
+3
View File
@@ -1,3 +1,5 @@
import { INode } from '@linux-odyssey/file-graph'
export * from './condition.js'
export * from './stage.js'
export * from './requirements.js'
@@ -14,6 +16,7 @@ export interface ICommand {
export interface ISession {
completedEvents: string[]
graph: INode
}
export interface ITask {