minor fixes

This commit is contained in:
ad044 2021-02-28 18:32:11 +04:00
parent 20934e2f19
commit 483d549bb1
7 changed files with 42 additions and 37 deletions

View file

@ -42,7 +42,11 @@ const App = () => {
return (
<div className="game">
<Canvas concurrent>
<Canvas
concurrent
gl={{ antialias: false }}
pixelRatio={1}
>
<Suspense fallback={null}>
{/*<Preloader />*/}
{dispatchScene[currentScene as keyof typeof dispatchScene]}

View file

@ -71,7 +71,7 @@ const BlueDigit = (props: BlueDigitProps) => {
return (
<a.mesh
scale={[0.04, 0.1, 0]}
scale={[props.type === 1 ? 0.04 : 0.08, 0.1, 0]}
position-x={props.posX}
position-y={props.posY}
renderOrder={5}

View file

@ -43,31 +43,31 @@ const IdleManager = (props: IdleManagerProps) => {
if (event) handleEvent(event);
}
if (now > props.idleSceneTimerRef.current + 500000) {
// put it on lock until the next action, since while the idle media plays, the
// Date.now() value keeps increasing, which can result in another idle media playing right after one finishes
// one way to work around this would be to modify the value depending on the last played idle media's duration
// but i'm way too lazy for that
props.idleSceneTimerRef.current = -1;
playAudio(audio.sound32);
const data = getRandomIdleMedia();
const { type, nodeName, images, media } = data;
let event;
if (type === "audio" && images && nodeName) {
event = playIdleAudio({
idleNodeName: nodeName,
idleImages: images,
idleMedia: media,
});
} else if (type === "video") {
event = playIdleVideo({ idleMedia: media });
}
if (event) handleEvent(event);
}
// if (now > props.idleSceneTimerRef.current + 5000) {
// // put it on lock until the next action, since while the idle media plays, the
// // Date.now() value keeps increasing, which can result in another idle media playing right after one finishes
// // one way to work around this would be to modify the value depending on the last played idle media's duration
// // but i'm way too lazy for that
// props.idleSceneTimerRef.current = -1;
//
// playAudio(audio.sound32);
//
// const data = getRandomIdleMedia();
//
// const { type, nodeName, images, media } = data;
// let event;
// if (type === "audio" && images && nodeName) {
// event = playIdleAudio({
// idleNodeName: nodeName,
// idleImages: images,
// idleMedia: media,
// });
// } else if (type === "video") {
// event = playIdleVideo({ idleMedia: media });
// }
//
// if (event) handleEvent(event);
// }
}
});

View file

@ -10,8 +10,6 @@ const About = () => {
const aboutBgTex = useLoader(THREE.TextureLoader, aboutBg);
const bgRef = useRef<THREE.Sprite>();
// todo im not sure where the other bg file is located,
// the one here is just the text, in the original game there's another one
useFrame(() => {
if (bgRef.current) {

View file

@ -59,7 +59,7 @@ const MediaPlayer = () => {
return (
<>
<video width="800" height="600" id="media" ref={videoRef} controls>
<video width="800" height="600" id="media" ref={videoRef}>
<track id={"track"} ref={trackRef} kind="captions" default />
</video>
<div id={"subtitle-container"}>

View file

@ -709,6 +709,8 @@ export const playIdleVideo = (calculatedState: { idleMedia: string }) => ({
mutation: {
idleStarting: true,
idleMedia: calculatedState.idleMedia,
idleImages: undefined,
idleNodeName: undefined,
inputCooldown: -1,
},
},
@ -739,7 +741,6 @@ export const playLainIdleAnim = (calculatedState: {
lainMoveState: string;
duration: number;
}) => ({
// todo appropriate disable-move here also
state: [
{
mutation: {

View file

@ -25,12 +25,14 @@ const IdleMediaScene = () => {
if (mediaElement) {
mediaElement.currentTime = 0;
import("../static/webvtt/" + idleNodeName + ".vtt")
.then((vtt) => {
if (vtt) trackElement.src = vtt.default;
})
// some entries have no spoken words, so the file doesnt exist. we catch that here.
.catch((e) => console.log(e));
if (idleNodeName) {
import("../static/webvtt/" + idleNodeName + ".vtt")
.then((vtt) => {
if (vtt) trackElement.src = vtt.default;
})
// some entries have no spoken words, so the file doesnt exist. we catch that here.
.catch(() => console.log("no subtitles for this media"));
}
if (idleMedia.includes("XA")) {
import("../static/audio/" + idleMedia + ".ogg").then((media) => {