This commit is contained in:
ad044 2021-03-09 16:09:47 +04:00
parent 65d16f7e3f
commit 75bf23f8ef
5 changed files with 18 additions and 31 deletions

View file

@ -1,7 +1,7 @@
import React, { useEffect } from "react";
import "./static/css/page.css";
import Game from "./dom-components/Game";
import { BrowserRouter, Route, Switch } from "react-router-dom";
import { HashRouter, Route, Switch } from "react-router-dom";
import Notes from "./dom-components/Notes";
const App = () => {
@ -10,12 +10,12 @@ const App = () => {
}, []);
return (
<BrowserRouter>
<HashRouter>
<Switch>
<Route path={"/"} exact component={Notes} />
<Route path={"/game"} exact component={Game} />
</Switch>
</BrowserRouter>
</HashRouter>
);
};

View file

@ -17,7 +17,6 @@ import handleEvent from "../core/handleEvent";
import { GameEvent } from "../types/types";
import { MouseEvent, useLoader } from "react-three-fiber";
import circleButton from "../static/sprites/controller/circle.png";
import squareButton from "../static/sprites/controller/square.png";
import triangleButton from "../static/sprites/controller/triangle.png";
import crossButton from "../static/sprites/controller/cross.png";
import startButton from "../static/sprites/controller/start.png";
@ -36,7 +35,6 @@ const InputHandler = (props: InputHandlerProps) => {
const circleButtonTex = useLoader(THREE.TextureLoader, circleButton);
const crossButtonTex = useLoader(THREE.TextureLoader, crossButton);
const squareButtonTex = useLoader(THREE.TextureLoader, squareButton);
const triangleButtonTex = useLoader(THREE.TextureLoader, triangleButton);
const startButtonTex = useLoader(THREE.TextureLoader, startButton);
const l2ButtonTex = useLoader(THREE.TextureLoader, l2Button);
@ -54,8 +52,8 @@ const InputHandler = (props: InputHandlerProps) => {
now > timeSinceLastKeyPress.current + inputCooldown &&
inputCooldown !== -1
) {
timeSinceLastKeyPress.current = now;
if (scene === "main") {
timeSinceLastKeyPress.current = now;
lainIdleTimerRef.current = now;
idleSceneTimerRef.current = now;
}
@ -250,19 +248,6 @@ const InputHandler = (props: InputHandlerProps) => {
opacity={0.8}
/>
</sprite>
<sprite
scale={[1.5, 1.5, 0]}
position={[-1, 0, 0]}
onClick={handleVirtualButtonPress}
name={"square"}
>
<spriteMaterial
attach="material"
map={squareButtonTex}
depthTest={false}
opacity={0.8}
/>
</sprite>
</group>
</>
)}

View file

@ -49,7 +49,7 @@ export const siteMoveHorizontal = (calculatedState: {
delay: 3900,
},
],
audio: [{ sfx: [audio.sound6, audio.sound34], delay: 1100 }],
audio: [{ sfx: [audio.sound6] }, { sfx: [audio.sound34], delay: 1100 }],
});
export const siteMoveVertical = (calculatedState: {
@ -360,12 +360,7 @@ export const saveGame = (calculatedState: {
export const loadGameFail = {
state: [
{
mutation: {
loadSuccessful: false,
inputCooldown: 1200,
},
},
{ mutation: { loadSuccessful: false, inputCooldown: 1200 } },
{ mutation: { loadSuccessful: undefined }, delay: 1200 },
],
audio: [{ sfx: [audio.sound28] }],

View file

@ -155,10 +155,14 @@ const handleMainSceneInput = (
const upperLimit = activeSite === "a" ? 22 : 13;
if (
(direction === "up" && level === upperLimit) ||
(direction === "down" && level === 1)
(activeNode.matrixIndices?.rowIdx === 0 &&
direction === "up" &&
level === upperLimit) ||
(activeNode.matrixIndices?.rowIdx === 2 &&
direction === "down" &&
level === 1)
)
return;
return resetInputCooldown;
const nodeData = findNode(
activeNode,
@ -175,6 +179,7 @@ const handleMainSceneInput = (
const newLevel = (direction === "up" ? level + 1 : level - 1)
.toString()
.padStart(2, "0");
const newNode = {
...(nodeData.node !== "unknown"
? getNodeById(nodeData.node, activeSite)
@ -184,6 +189,7 @@ const handleMainSceneInput = (
if (nodeData.didMove) {
if (!canLainMove) return resetInputCooldown;
return siteMoveVertical({
lainMoveAnimation: lainMoveAnimation,
activeLevel: newLevel,

View file

@ -1,5 +1,6 @@
import React from "react";
import "../static/css/notes.css";
import { Link } from "react-router-dom";
const Notes = () => {
return (
@ -12,7 +13,7 @@ const Notes = () => {
</td>
<td>
<p>
The game performs best on chromium-based browsers. Chromium,
The game performs best on chromium-based browsers - Chromium,
Chrome, Edge, Brave, Opera, Iridium, Vivaldi, etc. It's highly
recommended that you use one of those for an optimal experience.
This is especially true if you're using a bad setup, and even
@ -148,7 +149,7 @@ const Notes = () => {
</tr>
</tbody>
</table>
<a href="/game">start</a>
<Link to="/game">start</Link>
<br />
</>
);