тест загрузка
This commit is contained in:
parent
2ec32077bf
commit
b0f9a6353b
@ -22,7 +22,7 @@ import { useAuth } from '../auth/PlayerAuth';
|
|||||||
import RublocsLogo from '../components/RublocsLogo/RublocsLogo';
|
import RublocsLogo from '../components/RublocsLogo/RublocsLogo';
|
||||||
import useDeviceType from '../hooks/useDeviceType';
|
import useDeviceType from '../hooks/useDeviceType';
|
||||||
import KubikonMobileControls from './KubikonMobileControls';
|
import KubikonMobileControls from './KubikonMobileControls';
|
||||||
|
// загрузка плейсов начинается на строке 1163
|
||||||
// Плеер живёт на player.rublox.pro — он не знает SPA-роутов Майнкрафтии
|
// Плеер живёт на player.rublox.pro — он не знает SPA-роутов Майнкрафтии
|
||||||
// (/kubikon, /login, /auth). Поэтому вместо navigate(...) делаем
|
// (/kubikon, /login, /auth). Поэтому вместо navigate(...) делаем
|
||||||
// явный window.location.assign на внешний домен.
|
// явный window.location.assign на внешний домен.
|
||||||
@ -254,6 +254,7 @@ const KubikonPlayer = () => {
|
|||||||
const [ratingToast, setRatingToast] = useState(null);
|
const [ratingToast, setRatingToast] = useState(null);
|
||||||
const [placeName, setPlaceName] = useState('Загрузка игры…');
|
const [placeName, setPlaceName] = useState('Загрузка игры…');
|
||||||
const [placeImage, setPlaceImage] = useState(null);
|
const [placeImage, setPlaceImage] = useState(null);
|
||||||
|
const [studioName, setStudioName] = useState(null);
|
||||||
const timerRafRef = useRef(null);
|
const timerRafRef = useRef(null);
|
||||||
/** Кэш загруженного project_data для soft-restart игры. */
|
/** Кэш загруженного project_data для soft-restart игры. */
|
||||||
const initialStateRef = useRef(null);
|
const initialStateRef = useRef(null);
|
||||||
@ -689,24 +690,22 @@ const KubikonPlayer = () => {
|
|||||||
}, [projectId, userId, sessionId, loading]);
|
}, [projectId, userId, sessionId, loading]);
|
||||||
|
|
||||||
// Загрузка названия и картинки плейса с сервера
|
// Загрузка названия и картинки плейса с сервера
|
||||||
|
// Загрузка названия, картинки и автора плейса с сервера
|
||||||
|
// Загрузка названия, картинки и автора плейса
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
if (!userId) {
|
||||||
|
console.log('[Loading] Ждём userId...');
|
||||||
|
return; // Ждём пока userId загрузится
|
||||||
|
}
|
||||||
|
|
||||||
async function loadPlaceData() {
|
async function loadPlaceData() {
|
||||||
try {
|
try {
|
||||||
// Пробуем получить данные из meta (уже загружено в проекте)
|
// Пытаемся загрузить данные через API
|
||||||
if (meta?.title) {
|
|
||||||
setPlaceName(meta.title);
|
|
||||||
}
|
|
||||||
if (meta?.thumbnail) {
|
|
||||||
setPlaceImage(meta.thumbnail);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Если нет — загружаем через API
|
|
||||||
const response = await Kubikon3DApi.getProjectForPlay(projectId, userId);
|
const response = await Kubikon3DApi.getProjectForPlay(projectId, userId);
|
||||||
const title = response?.data?.title;
|
const title = response?.data?.title;
|
||||||
const thumbnail = response?.data?.thumbnail;
|
const thumbnail = response?.data?.thumbnail;
|
||||||
|
const author = response?.data?.author_username;
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
setPlaceName(title);
|
setPlaceName(title);
|
||||||
@ -717,6 +716,11 @@ const KubikonPlayer = () => {
|
|||||||
if (thumbnail) {
|
if (thumbnail) {
|
||||||
setPlaceImage(thumbnail);
|
setPlaceImage(thumbnail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (author) {
|
||||||
|
setStudioName(author);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('[KubikonPlayer] Не удалось загрузить данные плейса:', error);
|
console.warn('[KubikonPlayer] Не удалось загрузить данные плейса:', error);
|
||||||
setPlaceName(`Плейс ${projectId}`);
|
setPlaceName(`Плейс ${projectId}`);
|
||||||
@ -724,7 +728,7 @@ const KubikonPlayer = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadPlaceData();
|
loadPlaceData();
|
||||||
}, [projectId, userId, meta]);
|
}, [projectId, userId]); // Убрал meta из зависимостей!
|
||||||
|
|
||||||
// Хоткеи 1-5 для слотов инвентаря.
|
// Хоткеи 1-5 для слотов инвентаря.
|
||||||
// Babylon ловит ввод на canvas — слушаем в capture-phase на window
|
// Babylon ловит ввод на canvas — слушаем в capture-phase на window
|
||||||
@ -1175,8 +1179,6 @@ const KubikonPlayer = () => {
|
|||||||
/>
|
/>
|
||||||
{/* Loading-оверлей */}
|
{/* Loading-оверлей */}
|
||||||
{/*не меняйте пожалуйста загрузку, работаю над ней*/}
|
{/*не меняйте пожалуйста загрузку, работаю над ней*/}
|
||||||
{/* Loading-оверлей */}
|
|
||||||
{/*ЗДЕСЬ БУДЕТ ТВОЙ СКРИПТ*/}
|
|
||||||
{loading && (
|
{loading && (
|
||||||
<div style={{
|
<div style={{
|
||||||
position: 'absolute', inset: 0,
|
position: 'absolute', inset: 0,
|
||||||
@ -1209,25 +1211,36 @@ const KubikonPlayer = () => {
|
|||||||
<RublocsLogo size={90} />
|
<RublocsLogo size={90} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{/* Полупрозрачный тёмно-серый пузырь для текста */}
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'flex', alignItems: 'center', gap: 10,
|
background: 'rgba(30, 35, 55, 0.6)',
|
||||||
fontSize: 15, fontWeight: 700, letterSpacing: 0.3,
|
borderRadius: 60,
|
||||||
|
padding: '10px 24px',
|
||||||
|
marginTop: 8,
|
||||||
}}>
|
}}>
|
||||||
<div style={{
|
<div style={{
|
||||||
width: 14, height: 14,
|
display: 'flex', alignItems: 'center', gap: 10,
|
||||||
border: `2.5px solid ${HUD.accentBg}`,
|
fontSize: 15, fontWeight: 700, letterSpacing: 0.3,
|
||||||
borderTopColor: "#ffffff",
|
}}>
|
||||||
borderRadius: '50%',
|
<div style={{
|
||||||
animation: 'hudSpin 0.8s linear infinite',
|
width: 14, height: 14,
|
||||||
}} />
|
border: `2.5px solid ${HUD.accentBg}`,
|
||||||
{placeName || 'Загрузка игры…'}
|
borderTopColor: "#ffffff",
|
||||||
</div>
|
borderRadius: '50%',
|
||||||
<div style={{
|
animation: 'hudSpin 0.8s linear infinite',
|
||||||
fontSize: 15, color: HUD.textDim,
|
}} />
|
||||||
textTransform: 'uppercase', letterSpacing: 1.4, fontWeight: 700,
|
{placeName || 'Загрузка игры…'}
|
||||||
}}>
|
</div>
|
||||||
Рублокс • 3D
|
|
||||||
</div>
|
<div style={{
|
||||||
|
fontSize: 13, color: HUD.textDim,
|
||||||
|
textTransform: 'uppercase', letterSpacing: 1.4, fontWeight: 700,
|
||||||
|
textAlign: 'center',
|
||||||
|
marginTop: 6,
|
||||||
|
}}>
|
||||||
|
{studioName || 'Имя автора'}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* Игровой UI (HUD, GUI, hotbar, прицел в первом лице) */}
|
{/* Игровой UI (HUD, GUI, hotbar, прицел в первом лице) */}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user