From 116da382c0bfb246bd7317bc077510dba936675d Mon Sep 17 00:00:00 2001 From: morishintarou <134926335+morishintarou@users.noreply.github.com> Date: Sun, 25 Feb 2024 02:31:10 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9F=E3=83=8B=E3=82=B2=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E9=81=B7=E7=A7=BB=E6=99=82=E3=81=AB=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=81=8C=E6=AE=8B=E3=82=8B=E3=83=90=E3=82=B0=E3=81=A8=E3=80=81?= =?UTF-8?q?=E3=82=B2=E3=83=BC=E3=83=A0=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AB=E5=B8=B0=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=8D=E3=81=9F=E9=9A=9B=E3=81=AB2=E9=87=8D=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B=E3=83=90=E3=82=B0?= =?UTF-8?q?=E3=81=AE=E8=A7=A3=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/components/Game/index.tsx | 40 +++++++++++++------ .../pelmanism/components/Pelmanism.tsx | 2 +- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/src/components/Game/index.tsx b/app/src/components/Game/index.tsx index 1ff12e3..22fa420 100644 --- a/app/src/components/Game/index.tsx +++ b/app/src/components/Game/index.tsx @@ -40,6 +40,9 @@ export const GameComponent = ({ score }: { score?: number }) => { const [diceMaximum, setdiceMaximum] = useState(0);//出目の最大値を設定 const [diceMinimum, setdiceMinimum] = useState(0);//出目の最小値を設定 const [Minigame, setMinigame] = React.useState(-1);//ミニゲームの種類を設定 + const [Playerscore, setScore] = useState(0); + const [isFinisedMinigame, setFinisedMinigame] = React.useState(false);//ミニゲームの種類を設定 + const containerStyle: React.CSSProperties = { margin: 0, @@ -167,8 +170,8 @@ export const GameComponent = ({ score }: { score?: number }) => { const stopMasu = () => { //止まるマスの決定 if (isdiceroll) { //サイコロがふられたか - if (turn == 1){ - if(coordinates[i1].eventflag){ //止まるマスにイベントがあるか + if (turn == 1) { + if (coordinates[i1].eventflag) { //止まるマスにイベントがあるか setMinigame(Math.floor(Math.random() * 4)); } } @@ -257,6 +260,16 @@ export const GameComponent = ({ score }: { score?: number }) => { setIsBoxVisible(true); }, []); + useEffect(() => { + if (typeof score !== 'undefined') { + setScore(Playerscore + score); + console.log("スコア") + } else { + setScore(Playerscore); + } + setFinisedMinigame(true) + }, [score]); + const Cpu = () => { dice_roll() let cpumove @@ -308,7 +321,8 @@ export const GameComponent = ({ score }: { score?: number }) => { const Mini_init = () => { setMinigame(-1) return
- } + } + return ( @@ -317,16 +331,16 @@ export const GameComponent = ({ score }: { score?: number }) => {
)} - {(turn == 2 && Minigame == 0) ?
: - (turn == 2 && Minigame == 1) ?
: - (turn == 2 && Minigame == 2) ?
: - (turn == 2 && Minigame == 3 && (i1 < 3 || i3 > 39)) ?
: - (turn == 2 && Minigame == 3 && (i1 < 8)) ?
: - (turn == 2 && Minigame == 3 && (i1 < 13)) ?
: - (turn == 2 && Minigame == 3 && (i1 < 20)) ?
: - (turn == 2 && Minigame == 3 && (i1 < 25)) ?
: - (turn == 2 && Minigame == 3 && (i1 < 30)) ?
: - (turn == 2 && Minigame == 3 && (i1 < 40)) ?
:
} + {(turn == 2 && Minigame == 0) ?
: + (turn == 2 && Minigame == 1) ?
: + (turn == 2 && Minigame == 2) ?
: + (turn == 2 && Minigame == 3 && (i1 < 3 || i3 > 39)) ?
: + (turn == 2 && Minigame == 3 && (i1 < 8)) ?
: + (turn == 2 && Minigame == 3 && (i1 < 13)) ?
: + (turn == 2 && Minigame == 3 && (i1 < 20)) ?
: + (turn == 2 && Minigame == 3 && (i1 < 25)) ?
: + (turn == 2 && Minigame == 3 && (i1 < 30)) ?
: + (turn == 2 && Minigame == 3 && (i1 < 40)) ?
:
} {(turn == 3 && Minigame >= 0) ? :
} diff --git a/app/src/features/pelmanism/components/Pelmanism.tsx b/app/src/features/pelmanism/components/Pelmanism.tsx index 4dbc5b5..40bae22 100644 --- a/app/src/features/pelmanism/components/Pelmanism.tsx +++ b/app/src/features/pelmanism/components/Pelmanism.tsx @@ -227,6 +227,6 @@ export function Pelmanism({ pairNumber }: { pairNumber: number }) { ); } else { - return ; + return } }