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_up: <LainMoveUp />,
move_down: <LainMoveDown />,
throwNode: <LainThrowNode />,
throw_node: <LainThrowNode />,
};
return (

View file

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

View file

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

View file

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

View file

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