feat: video player
This commit is contained in:
@@ -29,6 +29,7 @@ interface MissionFlowState {
|
||||
canMove: boolean;
|
||||
dialogMessage: string | null;
|
||||
playerName: string;
|
||||
currentVideo: string | null;
|
||||
}
|
||||
|
||||
interface GameState {
|
||||
@@ -78,6 +79,8 @@ interface GameActions {
|
||||
rewindGameState: () => void;
|
||||
resetGame: () => void;
|
||||
showDialog: (dialogMessage: string) => void;
|
||||
playVideo: (videoSrc: string) => void;
|
||||
clearVideo: () => void;
|
||||
}
|
||||
|
||||
type GameStore = GameState & GameActions;
|
||||
@@ -233,6 +236,7 @@ function createInitialGameState(): GameState {
|
||||
canMove: false,
|
||||
dialogMessage: null,
|
||||
playerName: "",
|
||||
currentVideo: null,
|
||||
},
|
||||
intro: {
|
||||
currentStep: "intro",
|
||||
@@ -342,4 +346,12 @@ export const useGameStore = create<GameStore>()((set) => ({
|
||||
set((state) => ({
|
||||
missionFlow: { ...state.missionFlow, dialogMessage },
|
||||
})),
|
||||
playVideo: (videoSrc) =>
|
||||
set((state) => ({
|
||||
missionFlow: { ...state.missionFlow, currentVideo: videoSrc },
|
||||
})),
|
||||
clearVideo: () =>
|
||||
set((state) => ({
|
||||
missionFlow: { ...state.missionFlow, currentVideo: null },
|
||||
})),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user