change VitualNovelHandler to handle goTo and Connect introductionPage to VitualNovelHandler
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
defb5730a6
commit
25f8ed3f25
5 changed files with 17 additions and 14 deletions
|
@ -11,6 +11,7 @@ function ConversationPage({data , onClicked}) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
onClick={()=>onClicked(data.goTo-1)}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import '../css/global.css';
|
import '../css/global.css';
|
||||||
import BlackButton from './components/customButton';
|
import BlackButton from './components/customButton';
|
||||||
import Animation from './components/animation.jsx';
|
import Animation from './components/animation.jsx';
|
||||||
|
@ -9,7 +10,7 @@ import SelectionCharacter from './components/selectionCharacter.jsx';
|
||||||
import Character from './class/character.jsx';
|
import Character from './class/character.jsx';
|
||||||
|
|
||||||
function IntroductionPage() {
|
function IntroductionPage() {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [positionState, setPositionState] = useState("middle");
|
const [positionState, setPositionState] = useState("middle");
|
||||||
const [isClickedIntroduction, setIsClickedIntroduction] = useState(false);
|
const [isClickedIntroduction, setIsClickedIntroduction] = useState(false);
|
||||||
|
@ -34,6 +35,7 @@ function IntroductionPage() {
|
||||||
|
|
||||||
const handleClickedButton = () => {
|
const handleClickedButton = () => {
|
||||||
console.log(character.name(numChar))
|
console.log(character.name(numChar))
|
||||||
|
if(character.name(numChar)=='Porsche') navigate(`/vs/0`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -26,15 +26,10 @@ function OptionPage({data , onClicked}) {
|
||||||
<div className='spriteBox'>
|
<div className='spriteBox'>
|
||||||
<Animation src={`F${data.sprite}`}/>
|
<Animation src={`F${data.sprite}`}/>
|
||||||
</div>
|
</div>
|
||||||
{/* <div style={{width:'60vw'}}>
|
|
||||||
<div className='nameBox title'>
|
|
||||||
{data.name}
|
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
<div className='optionSection'>
|
<div className='optionSection'>
|
||||||
{
|
{
|
||||||
data.option.map((item,i) =>
|
data.option.map((item,i) =>
|
||||||
<div key={i} className='optionBox title'>{item.text}</div>)
|
<div onClick={()=>onClicked(item.goTo-1)} key={i} className='optionBox title'>{item.text}</div>)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@ function StoryPage({data , onClicked}) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={onClicked}
|
onClick={()=>onClicked(data.goTo-1)}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|
|
@ -46,12 +46,17 @@ function VitualNovelHandler() {
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleNextStep = () => {
|
const handleNextStep = (nextstep) => {
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
if (currentStep < data.length - 1) {
|
console.log(nextstep)
|
||||||
setCurrentStep(currentStep + 1);
|
setCurrentStep(nextstep);
|
||||||
navigate(`/vs/${currentStep + 1}`);
|
navigate(`/vs/${nextstep}`);
|
||||||
}
|
|
||||||
|
|
||||||
|
// else if (nextstep < data.length - 1) {
|
||||||
|
// setCurrentStep(nextstep + 1);
|
||||||
|
// navigate(`/vs/${nextstep + 1}`);
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentStepData = data[currentStep];
|
const currentStepData = data[currentStep];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue