diff --git a/app/(tabs)/Pet-debug/index.tsx b/app/(tabs)/Pet-debug/index.tsx
new file mode 100644
index 0000000..299f143
--- /dev/null
+++ b/app/(tabs)/Pet-debug/index.tsx
@@ -0,0 +1,268 @@
+import React from 'react';
+import { ScrollView } from 'react-native';
+import { YStack, XStack, Text, Button, Separator, H3, Card } from 'tamagui';
+import { usePetStateContext } from '@/hooks/usePetState';
+import { DiseaseType } from '@/types';
+import { DISEASE_KEYS, diseaseData } from '@/constants/diseases';
+
+export default function DebugScreen() {
+ const {
+ petState,
+ isLoading,
+ survivalDays,
+ updateStats,
+ updateMood,
+ updateActiveSymptom,
+ updateDeathRiskLevel,
+ killPet,
+ revivePet,
+ setBirthDate,
+ } = usePetStateContext();
+
+ if (isLoading) {
+ return (
+
+ Loading...
+
+ );
+ }
+
+ // パラメータを増減
+ const adjustStat = (key: DiseaseType, amount: number) => {
+ updateStats({ [key]: amount });
+ };
+
+ // 全パラメータを特定値に設定
+ const setAllStatsTo = (value: number) => {
+ const updates: Partial> = {};
+ DISEASE_KEYS.forEach((key) => {
+ const diff = value - petState.stats[key];
+ updates[key] = diff;
+ });
+ updateStats(updates);
+ };
+
+ // 生存日数を設定
+ const setSurvivalDays = (days: number) => {
+ const newBirthDate = new Date();
+ newBirthDate.setDate(newBirthDate.getDate() - days);
+ setBirthDate(newBirthDate);
+ };
+
+ return (
+
+
+ 🛠️ デバッグ画面
+
+ {/* 現在の状態表示 */}
+
+
+
+ 📊 現在の状態
+
+
+
+ 生存状態:
+
+ {petState.isAlive ? '🌟 生存' : '💀 死亡'}
+
+
+
+ 生存日数:
+ {survivalDays} 日
+
+
+ 危険度レベル:
+
+ {petState.deathRiskLevel}
+
+
+
+ 機嫌:
+ {petState.mood}
+
+
+ 症状:
+
+ {petState.activeSymptom?.text ?? 'なし'}
+
+
+
+
+
+ {/* 生存日数設定 */}
+
+
+
+ 📅 生存日数設定
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 健康パラメータ */}
+
+
+
+ 💉 健康パラメータ
+
+
+ {DISEASE_KEYS.map((key) => (
+
+
+
+ {diseaseData[key].name}
+
+
+ {petState.stats[key]}
+
+
+
+
+
+
+
+
+
+
+
+ ))}
+
+
+
+ {/* 状態再計算 */}
+
+
+
+ ⚡ 状態を再計算
+
+
+
+
+
+
+
+
+
+
+
+
+ {petState.isAlive ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ {/* パラメータ一括設定 */}
+
+
+
+ 🎛️ プリセット
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx
index ec2a29b..c030c40 100644
--- a/app/(tabs)/_layout.tsx
+++ b/app/(tabs)/_layout.tsx
@@ -1,7 +1,7 @@
import { Tabs } from 'expo-router';
import React from 'react';
import { useTheme } from 'tamagui';
-import { Home, Footprints, ActivitySquare } from '@tamagui/lucide-icons';
+import { Home, Footprints, ActivitySquare, Bug } from '@tamagui/lucide-icons';
import { HapticTab } from '@/components/haptic-tab';
@@ -40,7 +40,13 @@ export default function TabLayout() {
tabBarIcon: ({ color }) => ,
}}
/>
- r
+ ,
+ }}
+ />
);
}
diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx
index 43dc404..0ea115f 100644
--- a/app/(tabs)/index.tsx
+++ b/app/(tabs)/index.tsx
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useWindowDimensions } from 'react-native';
-import { ZStack, YStack, useTheme, Text, XStack } from 'tamagui';
+import { YStack, useTheme, Text, XStack } from 'tamagui';
import Svg, { Path } from 'react-native-svg';
import LottieView from 'lottie-react-native';
import { LinearGradient } from '@tamagui/linear-gradient';
@@ -9,9 +9,21 @@ import { MaterialCommunityIcons } from '@expo/vector-icons';
import { PetSurvivalDays } from '@/components/PetSurvivalDays';
import { PetNameEditModal } from '@/components/PetName/PetNameEditModal';
import { usePetName } from '@/hooks/usePetName';
+import { usePetStateContext } from '@/hooks/usePetState';
+import { SpeechBubble } from '@/components/speech-bubble';
+import { Modal } from '@/components/modal';
+import { Symptom } from '@/types';
import BootCameraButton from '@/components/BootCameraButton';
+// デフォルトの健康メッセージ
+const DEFAULT_SYMPTOM: Symptom = {
+ id: 'healthy',
+ text: '今日も元気!',
+ tipsTitle: '健康状態',
+ tipsContent: 'ペットはとても元気です!この調子で健康的な食生活を続けましょう。',
+};
+
/**
* 曲線の地面を描画するコンポーネント
* @param color
@@ -38,7 +50,12 @@ const CurveGround = ({ color, height }: { color: string; height: number }) => {
export default function WorldScreen() {
const theme = useTheme();
const { petName, updatePetName } = usePetName();
+ const { petState } = usePetStateContext();
const [isNameModalVisible, setIsNameModalVisible] = useState(false);
+ const [isTipsModalOpen, setIsTipsModalOpen] = useState(false);
+
+ // 現在の症状(activeSymptomがなければデフォルト)
+ const currentSymptom = petState.activeSymptom ?? DEFAULT_SYMPTOM;
const groundColor = theme.background.get();
@@ -126,6 +143,19 @@ export default function WorldScreen() {
+ {/* 吹き出し */}
+
+ setIsTipsModalOpen(true)} />
+
+
+ {/* Tips モーダル */}
+
+
);
diff --git a/components/speech-bubble.tsx b/components/speech-bubble.tsx
index 3e4f907..bd08c6f 100644
--- a/components/speech-bubble.tsx
+++ b/components/speech-bubble.tsx
@@ -1,20 +1,19 @@
import React from 'react';
-import { YStack, Text, useTheme } from 'tamagui';
+import { YStack, Text } from 'tamagui';
import { Symptom } from '@/types';
type Props = {
symptom: Symptom;
+ onPress?: () => void;
};
// 統一された色設定
const BUBBLE_BACKGROUND = '$color5'; // 優しいクリーム色
-export const SpeechBubble: React.FC = ({ symptom }) => {
- const theme = useTheme();
- const backgroundColor = theme.background.val;
-
+export const SpeechBubble: React.FC = ({ symptom, onPress }) => {
const handlePress = () => {
console.log(symptom.tipsTitle, symptom.tipsContent);
+ onPress?.();
};
return (
diff --git a/package.json b/package.json
index 31597ba..7f77968 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
"react-native-reanimated": "~4.1.1",
"react-native-safe-area-context": "~5.6.0",
"react-native-screens": "~4.16.0",
- "react-native-svg": "^15.15.0",
+ "react-native-svg": "15.12.1",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.5.1",
"tamagui": "^1.138.6"