Cleanup batch 4: Remove 8 unused exports
- analytics/index.ts: Removed exports for AnalyticsService, NewRelicAdapter - sphereLightmap.ts: Deleted createColoredSphereLightmap function - scoreCalculator.ts: Made getTimeStars, getAccuracyStars, getFuelStars, getHullStars internal - loginScreen.ts: Deleted showLoginScreen function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bff8d2b33f
commit
e60280cf83
@ -4,11 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Core service
|
// Core service
|
||||||
export { AnalyticsService, getAnalytics } from './analyticsService';
|
export { getAnalytics } from './analyticsService';
|
||||||
|
|
||||||
// Adapters (interfaces exported as types)
|
// Adapters (interfaces exported as types)
|
||||||
export type { AnalyticsAdapter, EventOptions, AnalyticsConfig } from './adapters/analyticsAdapter';
|
export type { AnalyticsAdapter, EventOptions, AnalyticsConfig } from './adapters/analyticsAdapter';
|
||||||
export { NewRelicAdapter } from './adapters/newRelicAdapter';
|
|
||||||
export type { NewRelicAdapterConfig } from './adapters/newRelicAdapter';
|
export type { NewRelicAdapterConfig } from './adapters/newRelicAdapter';
|
||||||
|
|
||||||
// Event types
|
// Event types
|
||||||
|
|||||||
@ -83,66 +83,3 @@ export function createSphereLightmap(
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a colored lightmap with tinted lights
|
|
||||||
*/
|
|
||||||
export function createColoredSphereLightmap(
|
|
||||||
name: string,
|
|
||||||
size: number,
|
|
||||||
scene: Scene,
|
|
||||||
brightLightDir: Vector3 = new Vector3(1, 0, 0),
|
|
||||||
brightColor: { r: number; g: number; b: number } = { r: 1, g: 1, b: 0.8 },
|
|
||||||
brightIntensity: number = 1.0,
|
|
||||||
dimLightDir: Vector3 = new Vector3(-1, 0, 0),
|
|
||||||
dimColor: { r: number; g: number; b: number } = { r: 0.3, g: 0.3, b: 0.5 },
|
|
||||||
dimIntensity: number = 0.2,
|
|
||||||
ambientColor: { r: number; g: number; b: number } = { r: 0.1, g: 0.1, b: 0.1 }
|
|
||||||
): DynamicTexture {
|
|
||||||
const texture = new DynamicTexture(name, { width: size, height: size }, scene, false);
|
|
||||||
const context = texture.getContext() as CanvasRenderingContext2D;
|
|
||||||
const imageData = context.createImageData(size, size);
|
|
||||||
|
|
||||||
const brightDir = brightLightDir.normalize();
|
|
||||||
const dimDir = dimLightDir.normalize();
|
|
||||||
|
|
||||||
for (let y = 0; y < size; y++) {
|
|
||||||
for (let x = 0; x < size; x++) {
|
|
||||||
const u = x / (size - 1);
|
|
||||||
const v = y / (size - 1);
|
|
||||||
|
|
||||||
const theta = u * Math.PI * 2;
|
|
||||||
const phi = v * Math.PI;
|
|
||||||
|
|
||||||
const normal = new Vector3(
|
|
||||||
Math.sin(phi) * Math.cos(theta),
|
|
||||||
Math.cos(phi),
|
|
||||||
Math.sin(phi) * Math.sin(theta)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Calculate lighting from each source
|
|
||||||
const brightDot = Math.max(0, Vector3.Dot(normal, brightDir)) * brightIntensity;
|
|
||||||
const dimDot = Math.max(0, Vector3.Dot(normal, dimDir)) * dimIntensity;
|
|
||||||
|
|
||||||
// Combine colored lights
|
|
||||||
const r = ambientColor.r + (brightColor.r * brightDot) + (dimColor.r * dimDot);
|
|
||||||
const g = ambientColor.g + (brightColor.g * brightDot) + (dimColor.g * dimDot);
|
|
||||||
const b = ambientColor.b + (brightColor.b * brightDot) + (dimColor.b * dimDot);
|
|
||||||
|
|
||||||
// Clamp and convert to 0-255
|
|
||||||
const red = Math.floor(Math.min(1, Math.max(0, r)) * 255);
|
|
||||||
const green = Math.floor(Math.min(1, Math.max(0, g)) * 255);
|
|
||||||
const blue = Math.floor(Math.min(1, Math.max(0, b)) * 255);
|
|
||||||
|
|
||||||
const index = (y * size + x) * 4;
|
|
||||||
imageData.data[index + 0] = red;
|
|
||||||
imageData.data[index + 1] = green;
|
|
||||||
imageData.data[index + 2] = blue;
|
|
||||||
imageData.data[index + 3] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.putImageData(imageData, 0, 0);
|
|
||||||
texture.update();
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -177,7 +177,7 @@ export function calculateScore(
|
|||||||
* @param par - Par time in seconds
|
* @param par - Par time in seconds
|
||||||
* @returns 0-3 stars
|
* @returns 0-3 stars
|
||||||
*/
|
*/
|
||||||
export function getTimeStars(seconds: number, par: number): number {
|
function getTimeStars(seconds: number, par: number): number {
|
||||||
const ratio = seconds / par;
|
const ratio = seconds / par;
|
||||||
if (ratio <= 0.5) return 3; // Finished in half the par time
|
if (ratio <= 0.5) return 3; // Finished in half the par time
|
||||||
if (ratio <= 1.0) return 2; // Finished at or under par
|
if (ratio <= 1.0) return 2; // Finished at or under par
|
||||||
@ -191,7 +191,7 @@ export function getTimeStars(seconds: number, par: number): number {
|
|||||||
* @param accuracy - Shot accuracy percentage (0-100)
|
* @param accuracy - Shot accuracy percentage (0-100)
|
||||||
* @returns 0-3 stars
|
* @returns 0-3 stars
|
||||||
*/
|
*/
|
||||||
export function getAccuracyStars(accuracy: number): number {
|
function getAccuracyStars(accuracy: number): number {
|
||||||
if (accuracy >= 75) return 3; // Excellent accuracy
|
if (accuracy >= 75) return 3; // Excellent accuracy
|
||||||
if (accuracy >= 50) return 2; // Good accuracy
|
if (accuracy >= 50) return 2; // Good accuracy
|
||||||
if (accuracy >= 25) return 1; // Fair accuracy
|
if (accuracy >= 25) return 1; // Fair accuracy
|
||||||
@ -204,7 +204,7 @@ export function getAccuracyStars(accuracy: number): number {
|
|||||||
* @param fuelConsumed - Fuel consumed percentage (0-∞)
|
* @param fuelConsumed - Fuel consumed percentage (0-∞)
|
||||||
* @returns 0-3 stars
|
* @returns 0-3 stars
|
||||||
*/
|
*/
|
||||||
export function getFuelStars(fuelConsumed: number): number {
|
function getFuelStars(fuelConsumed: number): number {
|
||||||
// Stars only consider first 100% of fuel
|
// Stars only consider first 100% of fuel
|
||||||
// Refueling doesn't earn extra stars
|
// Refueling doesn't earn extra stars
|
||||||
if (fuelConsumed <= 30) return 3; // Used ≤30% fuel
|
if (fuelConsumed <= 30) return 3; // Used ≤30% fuel
|
||||||
@ -219,7 +219,7 @@ export function getFuelStars(fuelConsumed: number): number {
|
|||||||
* @param hullDamage - Hull damage percentage (0-∞)
|
* @param hullDamage - Hull damage percentage (0-∞)
|
||||||
* @returns 0-3 stars
|
* @returns 0-3 stars
|
||||||
*/
|
*/
|
||||||
export function getHullStars(hullDamage: number): number {
|
function getHullStars(hullDamage: number): number {
|
||||||
// Stars only consider first 100% of damage
|
// Stars only consider first 100% of damage
|
||||||
// Dying and respawning = 0 stars
|
// Dying and respawning = 0 stars
|
||||||
if (hullDamage <= 10) return 3; // Took ≤10% damage
|
if (hullDamage <= 10) return 3; // Took ≤10% damage
|
||||||
|
|||||||
@ -1,48 +1,5 @@
|
|||||||
import { AuthService } from '../../services/authService';
|
import { AuthService } from '../../services/authService';
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates and displays the login screen UI
|
|
||||||
* Shown when user is not authenticated
|
|
||||||
*/
|
|
||||||
export function showLoginScreen(): void {
|
|
||||||
const container = document.querySelector('#levelSelect');
|
|
||||||
if (!container) {
|
|
||||||
console.error('Level select container not found');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
container.innerHTML = `
|
|
||||||
<div class="login-screen" style="position: relative; z-index: 1;">
|
|
||||||
<div class="login-container">
|
|
||||||
<h1 class="login-title">Space Combat VR</h1>
|
|
||||||
|
|
||||||
<p class="login-subtitle">
|
|
||||||
Welcome, pilot! Authentication required to access your mission data and track your progress across the galaxy.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<button id="loginBtn" class="login-button">
|
|
||||||
Log In / Sign Up
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<p class="login-skip" style="color: #666; font-size: 0.9em; margin-top: 30px;">
|
|
||||||
Secured by Auth0
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Attach login handler
|
|
||||||
const loginBtn = document.getElementById('loginBtn');
|
|
||||||
if (loginBtn) {
|
|
||||||
loginBtn.addEventListener('click', async () => {
|
|
||||||
loginBtn.textContent = 'Redirecting...';
|
|
||||||
loginBtn.setAttribute('disabled', 'true');
|
|
||||||
const authService = AuthService.getInstance();
|
|
||||||
await authService.login();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the user profile display in the header
|
* Updates the user profile display in the header
|
||||||
* Shows username and logout button when authenticated, or login button when not
|
* Shows username and logout button when authenticated, or login button when not
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user