File size: 6,618 Bytes
fd41318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

// Extended customization data
const carData = {
    // Vehicle Types
    types: [
        { id: 'car', name: 'Cars' },
        { id: 'rocket', name: 'Rockets' },
        { id: 'spaceship', name: 'Spaceships' },
        { id: 'hovercraft', name: 'Hovercrafts' },
        { id: 'mech', name: 'Mechs' }
    ],
    
    // Bodies
    bodies: [
        { id: 'octane', name: 'Octane', type: 'car', image: 'http://static.photos/automotive/640x360/1' },
        { id: 'dominus', name: 'Dominus', type: 'car', image: 'http://static.photos/automotive/640x360/2' },
        { id: 'rocket1', name: 'Nova Rocket', type: 'rocket', image: 'http://static.photos/technology/640x360/1' },
        { id: 'spaceship1', name: 'Galaxy Cruiser', type: 'spaceship', image: 'http://static.photos/technology/640x360/2' },
        { id: 'hover1', name: 'Sky Glider', type: 'hovercraft', image: 'http://static.photos/technology/640x360/3' },
        { id: 'mech1', name: 'Titan Walker', type: 'mech', image: 'http://static.photos/technology/640x360/4' },
        { id: 'rocket2', name: 'Solar Flare', type: 'rocket', image: 'http://static.photos/technology/640x360/5' }
],
    decals: [
        { id: 'none', name: 'None' },
        { id: 'stripes', name: 'Racing Stripes' },
        { id: 'flames', name: 'Flame Decals' },
        { id: 'galaxy', name: 'Galaxy Pattern' },
        { id: 'circuit', name: 'Circuit Board' },
        { id: 'holographic', name: 'Holographic' },
        { id: 'neon', name: 'Neon Glow' },
        { id: 'carbon', name: 'Carbon Fiber' }
],
    wheels: [
        { id: 'default', name: 'Standard' },
        { id: 'spinner', name: 'Spinners' },
        { id: 'offroad', name: 'Off-Road' },
        { id: 'futuristic', name: 'Futuristic' },
        { id: 'chrome', name: 'Chrome' },
        { id: 'hover', name: 'Hover Discs' },
        { id: 'ion', name: 'Ion Thrusters' },
        { id: 'plasma', name: 'Plasma Rings' }
],
    boosts: [
        { id: 'standard', name: 'Standard' },
        { id: 'flamethrower', name: 'Flamethrower' },
        { id: 'ion', name: 'Ion Drive' },
        { id: 'plasma', name: 'Plasma Jet' },
        { id: 'lightning', name: 'Lightning' },
        { id: 'quantum', name: 'Quantum Field' },
        { id: 'gravity', name: 'Gravity Warp' },
        { id: 'antimatter', name: 'Antimatter' }
],
    toppers: [
        { id: 'none', name: 'None' },
        { id: 'halo', name: 'Energy Halo' },
        { id: 'crown', name: 'Neon Crown' },
        { id: 'antenna', name: 'Comm Antenna' },
        { id: 'propeller', name: 'VTOL Propeller' },
        { id: 'satellite', name: 'Mini Satellite' },
        { id: 'drone', name: 'Companion Drone' },
        { id: 'hologram', name: 'Hologram Projector' }
],
    antennas: [
        { id: 'none', name: 'None' },
        { id: 'flag', name: 'Team Flag' },
        { id: 'balloon', name: 'Hover Balloon' },
        { id: 'disco', name: 'Disco Ball' },
        { id: 'flower', name: 'Solar Flower' },
        { id: 'radar', name: 'Radar Dish' },
        { id: 'sensor', name: 'Sensor Array' },
        { id: 'beacon', name: 'Tracking Beacon' }
],
    colors: [
        { id: 'red', name: 'Crimson', value: '#ef4444' },
        { id: 'blue', name: 'Nebula Blue', value: '#3b82f6' },
        { id: 'green', name: 'Toxic Green', value: '#10b981' },
        { id: 'yellow', name: 'Solar Flare', value: '#f59e0b' },
        { id: 'purple', name: 'Quantum Purple', value: '#8b5cf6' },
        { id: 'black', name: 'Void Black', value: '#1f2937' },
        { id: 'white', name: 'Cosmic White', value: '#f3f4f6' },
        { id: 'pink', name: 'Neon Pink', value: '#ec4899' },
        { id: 'orange', name: 'Plasma Orange', value: '#f97316' },
        { id: 'teal', name: 'Holographic Teal', value: '#14b8a6' },
        { id: 'metallic', name: 'Chrome', value: 'linear-gradient(135deg, #c0c0c0 0%, #ffffff 50%, #c0c0c0 100%)' },
        { id: 'galaxy', name: 'Galaxy', value: 'linear-gradient(135deg, #000000 0%, #4c1d95 50%, #000000 100%)' }
]
};
    // New customization categories
    engines: [
        { id: 'standard', name: 'Standard' },
        { id: 'turbo', name: 'Turbo' },
        { id: 'ion', name: 'Ion Drive' },
        { id: 'plasma', name: 'Plasma Core' },
        { id: 'antimatter', name: 'Antimatter' }
    ],
    
    weaponry: [
        { id: 'none', name: 'None' },
        { id: 'laser', name: 'Laser Cannons' },
        { id: 'missiles', name: 'Missile Pods' },
        { id: 'plasma', name: 'Plasma Launchers' },
        { id: 'railgun', name: 'Railgun' }
    ],
    
    interiors: [
        { id: 'standard', name: 'Standard' },
        { id: 'luxury', name: 'Luxury' },
        { id: 'racing', name: 'Racing' },
        { id: 'futuristic', name: 'Futuristic' },
        { id: 'military', name: 'Military' }
    ],
    
    lighting: [
        { id: 'standard', name: 'Standard' },
        { id: 'neon', name: 'Neon' },
        { id: 'pulse', name: 'Pulse' },
        { id: 'strobe', name: 'Strobe' },
        { id: 'hologram', name: 'Hologram' }
    ]
};

// Current vehicle configuration
let currentCar = {
    type: 'car',
    body: 'octane',
    engine: 'standard',
    weapons: 'none',
    interior: 'standard',
    lighting: 'standard',
primaryColor: '#3b82f6',
    secondaryColor: '#f59e0b',
    decal: 'none',
    wheels: 'default',
    boost: 'standard',
    topper: 'none',
    antenna: 'none'
};

// Initialize the app
document.addEventListener('DOMContentLoaded', () => {
    updateCarView();
    populateCustomizationOptions();
});

function updateCarView() {
    const carViewer = document.querySelector('custom-car-viewer');
    if (carViewer) {
        carViewer.setAttribute('body', currentCar.body);
        carViewer.setAttribute('primary-color', currentCar.primaryColor);
        carViewer.setAttribute('secondary-color', currentCar.secondaryColor);
        carViewer.setAttribute('decal', currentCar.decal);
        carViewer.setAttribute('wheels', currentCar.wheels);
        carViewer.setAttribute('boost', currentCar.boost);
        carViewer.setAttribute('topper', currentCar.topper);
        carViewer.setAttribute('antenna', currentCar.antenna);
    }
}

function populateCustomizationOptions() {
    const panel = document.querySelector('custom-customization-panel');
    if (panel) {
        panel.setAttribute('car-data', JSON.stringify(carData));
        panel.setAttribute('current-car', JSON.stringify(currentCar));
    }
}

// Listen for customization changes
document.addEventListener('customization-change', (e) => {
    currentCar = { ...currentCar, ...e.detail };
    updateCarView();
});