обновил загрузку плейсов
This commit is contained in:
parent
24b6360266
commit
2ec32077bf
10
package-lock.json
generated
10
package-lock.json
generated
@ -65,7 +65,6 @@
|
|||||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.0",
|
"@babel/code-frame": "^7.29.0",
|
||||||
"@babel/generator": "^7.29.0",
|
"@babel/generator": "^7.29.0",
|
||||||
@ -321,8 +320,7 @@
|
|||||||
"version": "7.54.3",
|
"version": "7.54.3",
|
||||||
"resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-7.54.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-7.54.3.tgz",
|
||||||
"integrity": "sha512-P5ncXVd8GEUJLhwloP9V0oVwQYIrvZztguVeLlvd5Rx+9aQnenKjpV8auJ6SRsUlAmNZU4pFTKzwF6o2EUfhAw==",
|
"integrity": "sha512-P5ncXVd8GEUJLhwloP9V0oVwQYIrvZztguVeLlvd5Rx+9aQnenKjpV8auJ6SRsUlAmNZU4pFTKzwF6o2EUfhAw==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@babylonjs/loaders": {
|
"node_modules/@babylonjs/loaders": {
|
||||||
"version": "7.54.3",
|
"version": "7.54.3",
|
||||||
@ -1495,7 +1493,6 @@
|
|||||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@ -1802,7 +1799,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.10.12",
|
"baseline-browser-mapping": "^2.10.12",
|
||||||
"caniuse-lite": "^1.0.30001782",
|
"caniuse-lite": "^1.0.30001782",
|
||||||
@ -2466,7 +2462,6 @@
|
|||||||
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
@ -4278,7 +4273,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||||
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0"
|
"loose-envify": "^1.1.0"
|
||||||
},
|
},
|
||||||
@ -4291,7 +4285,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||||
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0",
|
"loose-envify": "^1.1.0",
|
||||||
"scheduler": "^0.23.2"
|
"scheduler": "^0.23.2"
|
||||||
@ -5151,7 +5144,6 @@
|
|||||||
"integrity": "sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==",
|
"integrity": "sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.21.3",
|
"esbuild": "^0.21.3",
|
||||||
"postcss": "^8.4.43",
|
"postcss": "^8.4.43",
|
||||||
|
|||||||
@ -252,6 +252,8 @@ const KubikonPlayer = () => {
|
|||||||
// Появляется после submitLeaderboard если бэк выдал rating_award текущему юзеру.
|
// Появляется после submitLeaderboard если бэк выдал rating_award текущему юзеру.
|
||||||
// null | { place: 1|2|3, amount: number }
|
// null | { place: 1|2|3, amount: number }
|
||||||
const [ratingToast, setRatingToast] = useState(null);
|
const [ratingToast, setRatingToast] = useState(null);
|
||||||
|
const [placeName, setPlaceName] = useState('Загрузка игры…');
|
||||||
|
const [placeImage, setPlaceImage] = 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);
|
||||||
@ -686,6 +688,44 @@ const KubikonPlayer = () => {
|
|||||||
return () => { alive = false; clearInterval(t); };
|
return () => { alive = false; clearInterval(t); };
|
||||||
}, [projectId, userId, sessionId, loading]);
|
}, [projectId, userId, sessionId, loading]);
|
||||||
|
|
||||||
|
// Загрузка названия и картинки плейса с сервера
|
||||||
|
useEffect(() => {
|
||||||
|
if (!projectId) return;
|
||||||
|
|
||||||
|
async function loadPlaceData() {
|
||||||
|
try {
|
||||||
|
// Пробуем получить данные из meta (уже загружено в проекте)
|
||||||
|
if (meta?.title) {
|
||||||
|
setPlaceName(meta.title);
|
||||||
|
}
|
||||||
|
if (meta?.thumbnail) {
|
||||||
|
setPlaceImage(meta.thumbnail);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если нет — загружаем через API
|
||||||
|
const response = await Kubikon3DApi.getProjectForPlay(projectId, userId);
|
||||||
|
const title = response?.data?.title;
|
||||||
|
const thumbnail = response?.data?.thumbnail;
|
||||||
|
|
||||||
|
if (title) {
|
||||||
|
setPlaceName(title);
|
||||||
|
} else {
|
||||||
|
setPlaceName(`Плейс ${projectId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thumbnail) {
|
||||||
|
setPlaceImage(thumbnail);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[KubikonPlayer] Не удалось загрузить данные плейса:', error);
|
||||||
|
setPlaceName(`Плейс ${projectId}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadPlaceData();
|
||||||
|
}, [projectId, userId, meta]);
|
||||||
|
|
||||||
// Хоткеи 1-5 для слотов инвентаря.
|
// Хоткеи 1-5 для слотов инвентаря.
|
||||||
// Babylon ловит ввод на canvas — слушаем в capture-phase на window
|
// Babylon ловит ввод на canvas — слушаем в capture-phase на window
|
||||||
// и не привязываемся к isPlaying (state-флаг может быть ещё false на старте).
|
// и не привязываемся к isPlaying (state-флаг может быть ещё false на старте).
|
||||||
@ -1134,13 +1174,16 @@ const KubikonPlayer = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/* Loading-оверлей */}
|
{/* Loading-оверлей */}
|
||||||
|
{/*не меняйте пожалуйста загрузку, работаю над ней*/}
|
||||||
|
{/* Loading-оверлей */}
|
||||||
|
{/*ЗДЕСЬ БУДЕТ ТВОЙ СКРИПТ*/}
|
||||||
{loading && (
|
{loading && (
|
||||||
<div style={{
|
<div style={{
|
||||||
position: 'absolute', inset: 0,
|
position: 'absolute', inset: 0,
|
||||||
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
|
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
|
||||||
background:
|
background: 'radial-gradient(ellipse at center, rgba(51,87,255,0.22) 0%, rgba(7,10,20,0.96) 60%)',
|
||||||
'radial-gradient(ellipse at center, rgba(51,87,255,0.22) 0%, rgba(7,10,20,0.96) 60%)',
|
|
||||||
gap: 18, color: HUD.text,
|
gap: 18, color: HUD.text,
|
||||||
|
zIndex: 50,
|
||||||
}}>
|
}}>
|
||||||
<div style={{
|
<div style={{
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
@ -1151,7 +1194,20 @@ const KubikonPlayer = () => {
|
|||||||
borderRadius: 20,
|
borderRadius: 20,
|
||||||
animation: 'hudPulseRing 1.6s ease-out infinite',
|
animation: 'hudPulseRing 1.6s ease-out infinite',
|
||||||
}} />
|
}} />
|
||||||
<RublocsLogo size={72} />
|
{placeImage ? (
|
||||||
|
<img
|
||||||
|
src={placeImage}
|
||||||
|
alt={placeName}
|
||||||
|
style={{
|
||||||
|
width: 90, height: 90,
|
||||||
|
borderRadius: 16,
|
||||||
|
objectFit: 'cover',
|
||||||
|
boxShadow: '0 6px 20px rgba(0,0,0,0.4)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<RublocsLogo size={90} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'flex', alignItems: 'center', gap: 10,
|
display: 'flex', alignItems: 'center', gap: 10,
|
||||||
@ -1160,20 +1216,21 @@ const KubikonPlayer = () => {
|
|||||||
<div style={{
|
<div style={{
|
||||||
width: 14, height: 14,
|
width: 14, height: 14,
|
||||||
border: `2.5px solid ${HUD.accentBg}`,
|
border: `2.5px solid ${HUD.accentBg}`,
|
||||||
borderTopColor: HUD.accent,
|
borderTopColor: "#ffffff",
|
||||||
borderRadius: '50%',
|
borderRadius: '50%',
|
||||||
animation: 'hudSpin 0.8s linear infinite',
|
animation: 'hudSpin 0.8s linear infinite',
|
||||||
}} />
|
}} />
|
||||||
Загрузка игры…
|
{placeName || 'Загрузка игры…'}
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div style={{
|
||||||
fontSize: 11, color: HUD.textDim,
|
fontSize: 15, color: HUD.textDim,
|
||||||
textTransform: 'uppercase', letterSpacing: 1.4, fontWeight: 700,
|
textTransform: 'uppercase', letterSpacing: 1.4, fontWeight: 700,
|
||||||
}}>
|
}}>
|
||||||
Рублокс • 3D
|
Рублокс • 3D
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{/* Игровой UI (HUD, GUI, hotbar, прицел в первом лице) */}
|
||||||
|
|
||||||
{/* Игровой UI (HUD, GUI, hotbar, прицел в первом лице) */}
|
{/* Игровой UI (HUD, GUI, hotbar, прицел в первом лице) */}
|
||||||
{!loading && (
|
{!loading && (
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
{loading && (
|
||||||
|
<div style={{
|
||||||
|
position: 'absolute', inset: 0,
|
||||||
|
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
|
||||||
|
background:
|
||||||
|
'radial-gradient(ellipse at center, rgba(51,87,255,0.22) 0%, rgba(7,10,20,0.96) 60%)',
|
||||||
|
gap: 18, color: HUD.text,
|
||||||
|
}}>
|
||||||
|
<div style={{
|
||||||
|
position: 'relative',
|
||||||
|
animation: 'hudFloat 3s ease-in-out infinite',
|
||||||
|
}}>
|
||||||
|
<div style={{
|
||||||
|
position: 'absolute', inset: -10,
|
||||||
|
borderRadius: 20,
|
||||||
|
animation: 'hudPulseRing 1.6s ease-out infinite',
|
||||||
|
}} />
|
||||||
|
<RublocsLogo size={72} />
|
||||||
|
</div>
|
||||||
|
<div style={{
|
||||||
|
display: 'flex', alignItems: 'center', gap: 10,
|
||||||
|
fontSize: 15, fontWeight: 700, letterSpacing: 0.3,
|
||||||
|
}}>
|
||||||
|
<div style={{
|
||||||
|
width: 14, height: 14,
|
||||||
|
border: `2.5px solid ${HUD.accentBg}`,
|
||||||
|
borderTopColor: HUD.accent,
|
||||||
|
borderRadius: '50%',
|
||||||
|
animation: 'hudSpin 0.8s linear infinite',
|
||||||
|
}} />
|
||||||
|
Загрузка игры…
|
||||||
|
</div>
|
||||||
|
<div style={{
|
||||||
|
fontSize: 11, color: HUD.textDim,
|
||||||
|
textTransform: 'uppercase', letterSpacing: 1.4, fontWeight: 700,
|
||||||
|
}}>
|
||||||
|
Рублокс • 3D
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
Loading…
x
Reference in New Issue
Block a user