sskn node handlers, tweaked some lain code

This commit is contained in:
ad044 2020-11-19 19:28:32 +04:00
parent 1ff702568f
commit a4b42ebee2
5 changed files with 41 additions and 46 deletions

View file

@ -121,7 +121,7 @@ const Lain = () => {
move_right: <LainMoveRight />, move_right: <LainMoveRight />,
move_up: <LainMoveUp />, move_up: <LainMoveUp />,
move_down: <LainMoveDown />, move_down: <LainMoveDown />,
throwNode: <LainThrowNode />, throw_node: <LainThrowNode />,
}; };
return ( return (

View file

@ -7,40 +7,25 @@ const LainManager = (props: StateManagerProps) => {
const dispatchObject = useCallback( const dispatchObject = useCallback(
(event: string) => { (event: string) => {
const dispatcherObjects = { switch (event) {
move_up: { case "move_up":
case "move_down":
case "move_left":
case "move_right":
return {
action: setLainMoveState, action: setLainMoveState,
value: "move_up", value: event,
duration: 3904.704, duration: 3900,
},
move_down: {
action: setLainMoveState,
value: "move_down",
duration: 3904.704,
},
move_left: {
action: setLainMoveState,
value: "move_left",
duration: 3904.704,
},
move_right: {
action: setLainMoveState,
value: "move_right",
duration: 3904.704,
},
throw_node_media: {
action: setLainMoveState,
value: "throwNode",
duration: 3904.704,
},
throw_node_gate: {
action: setLainMoveState,
value: "throwNode",
duration: 3904.704,
},
}; };
case "throw_node_media":
return dispatcherObjects[event as keyof typeof dispatcherObjects]; case "throw_node_gate":
case "throw_node_sskn":
return {
action: setLainMoveState,
value: "throw_node",
duration: 3904.704,
};
}
}, },
[setLainMoveState] [setLainMoveState]
); );

View file

@ -96,6 +96,7 @@ const NodeManager = (props: StateManagerProps) => {
}; };
case "throw_node_media": case "throw_node_media":
case "throw_node_gate": case "throw_node_gate":
case "throw_node_sskn":
return { return {
action: animateActiveNodeThrow, action: animateActiveNodeThrow,
value: [0, true], value: [0, true],

View file

@ -10,6 +10,7 @@ const SceneManager = (props: StateManagerProps) => {
switch (event) { switch (event) {
case "throw_node_media": case "throw_node_media":
case "throw_node_gate": case "throw_node_gate":
case "throw_node_sskn":
return { return {
action: setScene, action: setScene,
value: newScene, value: newScene,
@ -17,11 +18,18 @@ const SceneManager = (props: StateManagerProps) => {
}; };
case "exit_select": case "exit_select":
case "exit_gate": case "exit_gate":
case "sskn_cancel_select":
return { return {
action: setScene, action: setScene,
value: "main", value: "main",
delay: 0, delay: 0,
}; };
case "sskn_ok_select":
return {
action: setScene,
value: "main",
delay: 6000,
};
} }
}, },
[setScene] [setScene]

View file

@ -92,12 +92,11 @@ const handleMainSceneEvent = (gameContext: GameContext) => {
// new active blue orb here. // new active blue orb here.
const newActiveNodeId = const newActiveNodeId =
newLevel + newLevel +
node_matrices[ node_matrices[newSiteRotIdx as keyof typeof node_matrices][
newSiteRotIdx as keyof typeof node_matrices newNodeRowIdx as number
][newNodeRowIdx as number][newNodeColIdx as number]; ][newNodeColIdx as number];
const nodeType = (site_a as any)[newLevel][newActiveNodeId] const nodeType = (site_a as any)[newLevel][newActiveNodeId].type;
.type;
const eventAnimation = "throw_node_"; const eventAnimation = "throw_node_";
@ -111,19 +110,21 @@ const handleMainSceneEvent = (gameContext: GameContext) => {
event = eventAnimation + "gate"; event = eventAnimation + "gate";
newScene = "gate"; newScene = "gate";
break; break;
case 7:
event = eventAnimation + "sskn";
newScene = "sskn";
break;
} }
} }
const newActiveNodeId = const newActiveNodeId =
newLevel + newLevel +
node_matrices[ node_matrices[newSiteRotIdx as keyof typeof node_matrices][
newSiteRotIdx as keyof typeof node_matrices newNodeRowIdx as number
][newNodeRowIdx as number][newNodeColIdx as number]; ][newNodeColIdx as number];
const newActiveHudId = const newActiveHudId =
hudAssocs[ hudAssocs[`${newNodeRowIdx}${newNodeColIdx}` as keyof typeof hudAssocs];
`${newNodeRowIdx}${newNodeColIdx}` as keyof typeof hudAssocs
];
return { return {
event: event, event: event,