From 8817389cabae7a3b9b7c9b792222098037724345 Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Tue, 2 Dec 2025 12:58:00 +0800 Subject: [PATCH] 1.0.0 --- frontend/src/components/CelestialBody.tsx | 65 ++++++++++++++++++++++- frontend/src/pages/admin/Users.tsx | 3 +- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/CelestialBody.tsx b/frontend/src/components/CelestialBody.tsx index 046b07e..90f1cf5 100644 --- a/frontend/src/components/CelestialBody.tsx +++ b/frontend/src/components/CelestialBody.tsx @@ -2,7 +2,8 @@ * CelestialBody component - renders a planet or probe with textures */ import { useRef, useMemo, useState, useEffect } from 'react'; -import { Mesh, DoubleSide } from 'three'; +import { Mesh, DoubleSide } from 'three'; // Removed AdditiveBlending here +import * as THREE from 'three'; // Imported as * to access AdditiveBlending, SpriteMaterial, CanvasTexture import { useFrame } from '@react-three/fiber'; import { useTexture, Html } from '@react-three/drei'; import type { CelestialBody as CelestialBodyType } from '../types'; @@ -139,6 +140,52 @@ function Planet({ body, size, emissive, emissiveIntensity, allBodies, isSelected />; } +// Comet Particles Component +function CometParticles({ radius, count = 6, color = '#88ccff' }: { radius: number; count?: number; color?: string }) { + const positions = useMemo(() => { + const p = new Float32Array(count * 3); + for (let i = 0; i < count; i++) { + // Random spherical distribution + const r = radius * (1.2 + Math.random() * 2.0); // Spread: 1.2x to 3.2x radius + const theta = Math.random() * Math.PI * 2; + const phi = Math.acos(2 * Math.random() - 1); + + p[i * 3] = r * Math.sin(phi) * Math.cos(theta); + p[i * 3 + 1] = r * Math.sin(phi) * Math.sin(theta); + p[i * 3 + 2] = r * Math.cos(phi); + } + return p; + }, [radius, count]); + + // Ref for animation + const pointsRef = useRef(null); + + useFrame((_, delta) => { + if (pointsRef.current) { + // Subtle rotation + pointsRef.current.rotation.y += delta * 0.1; + pointsRef.current.rotation.z += delta * 0.05; + } + }); + + return ( + + + + + + + ); +} + // Separate component to handle texture loading function PlanetMesh({ body, size, emissive, emissiveIntensity, scaledPos, texturePath, position, meshRef, hasOffset, allBodies, isSelected = false }: { body: CelestialBodyType; @@ -199,6 +246,11 @@ function PlanetMesh({ body, size, emissive, emissiveIntensity, scaledPos, textur {/* Saturn Rings */} {body.id === '699' && } + {/* Comet Particles */} + {body.type === 'comet' && ( + + )} + {/* Sun glow effect */} {body.type === 'star' && ( <> @@ -216,7 +268,7 @@ function PlanetMesh({ body, size, emissive, emissiveIntensity, scaledPos, textur center distanceFactor={10} style={{ - color: body.type === 'star' ? '#FDB813' : '#ffffff', + color: body.type === 'star' ? '#FDB813' : (body.type === 'comet' ? '#88ccff' : '#ffffff'), fontSize: '9px', // 从 11px 减小到 9px fontWeight: 'bold', textShadow: '0 0 4px rgba(0,0,0,0.8)', @@ -265,6 +317,15 @@ export function CelestialBody({ body, allBodies, isSelected = false }: Celestial }; } + // Comet - bright core with glow + if (body.type === 'comet') { + return { + size: getCelestialSize(body.name, body.type), + emissive: '#000000', // Revert to no special emissive color for texture + emissiveIntensity: 0, // Revert to no special emissive intensity + }; + } + // Satellite (natural moons) - small size with slight glow for visibility if (body.type === 'satellite') { return { diff --git a/frontend/src/pages/admin/Users.tsx b/frontend/src/pages/admin/Users.tsx index c573180..2dd5a1b 100644 --- a/frontend/src/pages/admin/Users.tsx +++ b/frontend/src/pages/admin/Users.tsx @@ -2,7 +2,8 @@ * User Management Page */ import { useState, useEffect } from 'react'; -import { Modal, Button, Popconfirm } from 'antd'; +import { Button, Popconfirm } from 'antd'; +import { ReloadOutlined } from '@ant-design/icons'; import type { ColumnsType } from 'antd/es/table'; import { request } from '../../utils/request'; import { DataTable } from '../../components/admin/DataTable';