|
|
@@ -11,6 +11,7 @@ import {
|
|
|
setStorage,
|
|
|
getStorage,
|
|
|
getUserLevel,
|
|
|
+ getHasSharedAvatar,
|
|
|
STORAGE_KEYS,
|
|
|
markRouteVisited,
|
|
|
getUserId,
|
|
|
@@ -24,6 +25,7 @@ import { px2vw, px2vh, px2vmin } from '@/utils/viewport';
|
|
|
import type { Message, EnergyStoneSpawnMessage } from '@/types';
|
|
|
import '@/styles/chatbot-fix.css';
|
|
|
import avatarC from '@/assets/Avatar-C.svg';
|
|
|
+import avatarGift from '@/assets/avatar-gift.png';
|
|
|
import treesImage from '@/assets/Group-3465183.svg';
|
|
|
import audioButton from '@/assets/audio-button.png';
|
|
|
import avatarHint from '@/assets/Avatar-hint.png';
|
|
|
@@ -104,6 +106,7 @@ export const ChatBotPage = () => {
|
|
|
const audioWaveRef = useRef<AudioWaveHandle | null>(null);
|
|
|
const [userLevelValue, setUserLevelValue] = useState(() => getUserLevel());
|
|
|
const levelRedirectRef = useRef(false);
|
|
|
+ const [hasSharedAvatar, setHasSharedAvatarState] = useState(() => getHasSharedAvatar());
|
|
|
// 初始化时检查 localStorage,确保第一次打开时立即显示提示
|
|
|
const [showTapToChat, setShowTapToChat] = useState(() => {
|
|
|
const hasShown = getStorage(STORAGE_KEYS.HAS_SHOWN_TAP_TO_CHAT);
|
|
|
@@ -635,6 +638,10 @@ export const ChatBotPage = () => {
|
|
|
setIsAvatarCUnlocked(true);
|
|
|
setStorage(STORAGE_KEYS.AVATAR_C_UNLOCKED, 'true');
|
|
|
}
|
|
|
+ if (state.has_shared_avatar) {
|
|
|
+ setStorage(STORAGE_KEYS.HAS_SHARED_AVATAR, 'true');
|
|
|
+ setHasSharedAvatarState(true);
|
|
|
+ }
|
|
|
if (state.has_shown_mission_stone_modal) {
|
|
|
setStorage(STORAGE_KEYS.HAS_SHOWN_MISSION_STONE_MODAL, 'true');
|
|
|
}
|
|
|
@@ -1313,7 +1320,7 @@ export const ChatBotPage = () => {
|
|
|
height: px2vmin(40),
|
|
|
top: px2vmin(63),
|
|
|
right: px2vmin(33),
|
|
|
- zIndex: isAvatarCUnlocked ? 30 : 5,
|
|
|
+ zIndex: hasSharedAvatar ? 5 : 30,
|
|
|
pointerEvents: isAvatarCUnlocked ? 'auto' : 'none',
|
|
|
cursor: isAvatarCUnlocked ? 'pointer' : 'default',
|
|
|
}}
|
|
|
@@ -1330,7 +1337,7 @@ export const ChatBotPage = () => {
|
|
|
/>
|
|
|
)}
|
|
|
<img
|
|
|
- src={avatarC}
|
|
|
+ src={hasSharedAvatar ? avatarC : avatarGift}
|
|
|
alt="Avatar C"
|
|
|
className="rounded-full"
|
|
|
style={{
|
|
|
@@ -1339,7 +1346,7 @@ export const ChatBotPage = () => {
|
|
|
opacity: isAvatarCUnlocked ? 1 : 0.2,
|
|
|
transition: 'opacity 0.4s ease',
|
|
|
position: 'relative',
|
|
|
- zIndex: 1,
|
|
|
+ zIndex: hasSharedAvatar ? 1 : 30,
|
|
|
}}
|
|
|
/>
|
|
|
{userInitial && (
|