Alpha V2.1
This commit is contained in:
parent
7caaa8758d
commit
55ea72e13a
BIN
assets/pasted-20260226-155248-f13efd72.png
Normal file
BIN
assets/pasted-20260226-155248-f13efd72.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
105
index.php
105
index.php
@ -139,11 +139,10 @@ if ($view === 'sector') {
|
|||||||
$stmt->execute([$galaxy_id]);
|
$stmt->execute([$galaxy_id]);
|
||||||
$all_planets = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$all_planets = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// We need controls to calculate status even in galaxy view
|
|
||||||
// For performance in a real app, we'd cache this or use a simplified query
|
|
||||||
$planet_ids = array_column($all_planets, 'id');
|
$planet_ids = array_column($all_planets, 'id');
|
||||||
$orb_controls = [];
|
$orb_controls = [];
|
||||||
$terr_controls = [];
|
$terr_controls = [];
|
||||||
|
$city_counts = [];
|
||||||
|
|
||||||
if (!empty($planet_ids)) {
|
if (!empty($planet_ids)) {
|
||||||
$placeholders = implode(',', array_fill(0, count($planet_ids), '?'));
|
$placeholders = implode(',', array_fill(0, count($planet_ids), '?'));
|
||||||
@ -153,19 +152,37 @@ if ($view === 'sector') {
|
|||||||
$o_stmt->execute($planet_ids);
|
$o_stmt->execute($planet_ids);
|
||||||
while($r = $o_stmt->fetch()) $orb_controls[$r['planet_id']][$r['faction_id']] = $r['control_level'];
|
while($r = $o_stmt->fetch()) $orb_controls[$r['planet_id']][$r['faction_id']] = $r['control_level'];
|
||||||
|
|
||||||
// Terrestrial (Simplified for Galaxy view: use aggregated if available or skip)
|
// Terrestrial (Aggregated per planet)
|
||||||
// Let's at least get city counts to know if it's empty
|
$t_stmt = $db->prepare("SELECT c.planet_id, cfc.faction_id, SUM(cfc.control_level) as total_lvl
|
||||||
|
FROM city_faction_control cfc
|
||||||
|
JOIN cities c ON cfc.city_id = c.id
|
||||||
|
WHERE c.planet_id IN ($placeholders)
|
||||||
|
GROUP BY c.planet_id, cfc.faction_id");
|
||||||
|
$t_stmt->execute($planet_ids);
|
||||||
|
while($r = $t_stmt->fetch()) {
|
||||||
|
$terr_controls[$r['planet_id']][$r['faction_id']] = $r['total_lvl'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// City counts to know if it's empty
|
||||||
$c_stmt = $db->prepare("SELECT planet_id, COUNT(*) as cnt FROM cities WHERE planet_id IN ($placeholders) GROUP BY planet_id");
|
$c_stmt = $db->prepare("SELECT planet_id, COUNT(*) as cnt FROM cities WHERE planet_id IN ($placeholders) GROUP BY planet_id");
|
||||||
$c_stmt->execute($planet_ids);
|
$c_stmt->execute($planet_ids);
|
||||||
$city_counts = []; while($r = $c_stmt->fetch()) $city_counts[$r['planet_id']] = $r['cnt'];
|
while($r = $c_stmt->fetch()) $city_counts[$r['planet_id']] = $r['cnt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sector_data = [];
|
$sector_data = [];
|
||||||
$active_sectors = [];
|
$active_sectors = [];
|
||||||
foreach ($all_planets as $p) {
|
foreach ($all_planets as $p) {
|
||||||
$p['orbital_controls'] = $orb_controls[$p['id']] ?? [];
|
$p['orbital_controls'] = $orb_controls[$p['id']] ?? [];
|
||||||
$p['terrestrial_controls'] = []; // Simplified
|
|
||||||
$p['cities'] = isset($city_counts[$p['id']]) ? array_fill(0, $city_counts[$p['id']], []) : [];
|
$p['cities'] = isset($city_counts[$p['id']]) ? array_fill(0, $city_counts[$p['id']], []) : [];
|
||||||
|
$p['terrestrial_controls'] = [];
|
||||||
|
if (!empty($p['cities'])) {
|
||||||
|
$num_cities = count($p['cities']);
|
||||||
|
if (isset($terr_controls[$p['id']])) {
|
||||||
|
foreach ($terr_controls[$p['id']] as $fid => $total_lvl) {
|
||||||
|
$p['terrestrial_controls'][$fid] = round($total_lvl / $num_cities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$dynamic_status = calculateCelestialStatus($p, $db, $statuses_map);
|
$dynamic_status = calculateCelestialStatus($p, $db, $statuses_map);
|
||||||
$sector_data[$p['sector_id']][$p['slot']] = ['status' => $dynamic_status, 'type' => $p['type']];
|
$sector_data[$p['sector_id']][$p['slot']] = ['status' => $dynamic_status, 'type' => $p['type']];
|
||||||
@ -188,9 +205,81 @@ function getStatusColor($status, $statuses_map) {
|
|||||||
<style>
|
<style>
|
||||||
body { background: #000; color: #fff; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; }
|
body { background: #000; color: #fff; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; }
|
||||||
#main-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
|
#main-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
|
||||||
.user-auth-bar { display: flex; justify-content: flex-end; gap: 20px; font-size: 11px; color: #8c92a3; margin-bottom: 10px; }
|
|
||||||
|
/* HEADER STYLES */
|
||||||
|
#top-bar {
|
||||||
|
background: #0f172a;
|
||||||
|
border-bottom: 1px solid #1e293b;
|
||||||
|
padding: 10px 40px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.user-auth-bar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #8c92a3;
|
||||||
|
}
|
||||||
.user-auth-bar a { color: #88c0d0; text-decoration: none; font-weight: bold; }
|
.user-auth-bar a { color: #88c0d0; text-decoration: none; font-weight: bold; }
|
||||||
.user-auth-bar .username { color: #ebcb8b; }
|
.user-auth-bar .username { color: #ebcb8b; }
|
||||||
|
|
||||||
|
.resource-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 30px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.resource-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
background: rgba(30, 41, 59, 0.4);
|
||||||
|
padding: 6px 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid rgba(136, 192, 208, 0.1);
|
||||||
|
min-width: 140px;
|
||||||
|
}
|
||||||
|
.resource-icon {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #88c0d0;
|
||||||
|
width: 24px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.resource-icon img {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
.resource-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.resource-name {
|
||||||
|
font-size: 9px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
color: #64748b;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
.resource-val-prod {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.resource-value {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #f8fafc;
|
||||||
|
}
|
||||||
|
.resource-prod {
|
||||||
|
font-size: 10px;
|
||||||
|
color: #10b981;
|
||||||
|
}
|
||||||
|
|
||||||
#game-container { flex: 1; padding: 30px; display: flex; flex-direction: column; align-items: center; }
|
#game-container { flex: 1; padding: 30px; display: flex; flex-direction: column; align-items: center; }
|
||||||
.nav-panel { background: rgba(10, 15, 30, 0.95); border: 1px solid #2d3545; padding: 20px; width: 180px; }
|
.nav-panel { background: rgba(10, 15, 30, 0.95); border: 1px solid #2d3545; padding: 20px; width: 180px; }
|
||||||
@ -842,4 +931,4 @@ function getStatusColor($status, $statuses_map) {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user