added playType correct check
This commit is contained in:
@@ -78,6 +78,8 @@ const PartitionMagic = ({
|
|||||||
const cursorTop = (data?.cursors[cursorDisplayIdx]?.y ?? 0) - cursorPaddingVertical;
|
const cursorTop = (data?.cursors[cursorDisplayIdx]?.y ?? 0) - cursorPaddingVertical;
|
||||||
const cursorLeft = (data?.cursors[0]?.x ?? 0) - cursorPaddingHorizontal;
|
const cursorLeft = (data?.cursors[0]?.x ?? 0) - cursorPaddingHorizontal;
|
||||||
|
|
||||||
|
console.log(melodySound.current?._loaded);
|
||||||
|
|
||||||
if (!endPartitionReached && currentCurIdx.current + 1 === data?.cursors.length) {
|
if (!endPartitionReached && currentCurIdx.current + 1 === data?.cursors.length) {
|
||||||
// weird contraption but the mobile don't want classic functions to be called
|
// weird contraption but the mobile don't want classic functions to be called
|
||||||
// with the withTiming function :(
|
// with the withTiming function :(
|
||||||
@@ -86,7 +88,7 @@ const PartitionMagic = ({
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// In practice mode, no sound is played so just act as the piano is loaded
|
// In practice mode, no sound is played so just act as the piano is loaded
|
||||||
if (playType === 'practice' || playType === undefined) {
|
if (playType === 'practice' || !playType) {
|
||||||
setIsPianoLoaded(true);
|
setIsPianoLoaded(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -120,7 +122,7 @@ const PartitionMagic = ({
|
|||||||
piano.current = null;
|
piano.current = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, []);
|
}, [playType]);
|
||||||
const partitionDims = React.useMemo<[number, number]>(() => {
|
const partitionDims = React.useMemo<[number, number]>(() => {
|
||||||
return [data?.pageWidth ?? 0, data?.pageHeight ?? 1];
|
return [data?.pageWidth ?? 0, data?.pageHeight ?? 1];
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const PlayView = ({ songId }: PlayViewProps) => {
|
|||||||
const songHistory = useQuery(API.getSongHistory(songId));
|
const songHistory = useQuery(API.getSongHistory(songId));
|
||||||
const endCalled = useRef(false);
|
const endCalled = useRef(false);
|
||||||
const [score, setScore] = useState(0); // Between 0 and 100
|
const [score, setScore] = useState(0); // Between 0 and 100
|
||||||
const getElapsedTime = () => stopwatch.getElapsedRunningTime() - 3000;
|
const getElapsedTime = () => stopwatch.getElapsedRunningTime();
|
||||||
const [readyToPlay, setReadyToPlay] = useState(false);
|
const [readyToPlay, setReadyToPlay] = useState(false);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const [midiKeyboardFound, setMidiKeyboardFound] = useState<boolean>();
|
const [midiKeyboardFound, setMidiKeyboardFound] = useState<boolean>();
|
||||||
@@ -444,7 +444,9 @@ const PlayView = ({ songId }: PlayViewProps) => {
|
|||||||
setShouldPlay(false);
|
setShouldPlay(false);
|
||||||
}}
|
}}
|
||||||
onResume={() => {
|
onResume={() => {
|
||||||
setShouldPlay(true);
|
setTimeout(() => {
|
||||||
|
setShouldPlay(true);
|
||||||
|
}, 3000);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
Reference in New Issue
Block a user