Implement cubemap skybox, multi-active skyboxes, and 2D scene backgrounds

- Server: Add SkyboxType + 6 CubeUrl fields to SkyboxDefinition entity
- Server: EF migration AddSkyboxCubemapType
- Server: GetSkyboxConfigResponse now returns array of all active skyboxes
- Admin: SkyboxManagerPage supports Panoramic/AnimatedPanorama/Cubemap types,
  6 face URL fields for cubemap, and independent per-skybox active toggle
- Client: ContentCache fetches + caches skyboxes; adds get_random_skybox,
  get_skybox_bg_url, load_texture_async, apply_scene_background helpers
- Client: game_screen replaces _fetch_skybox with ContentCache-based approach;
  adds _load_cubemap_skybox / _apply_cubemap_images / _apply_cubemap_material
- Client: 12 2D scene scripts call ContentCache.apply_scene_background(self)
  in _ready() to replace solid-color backgrounds with CDN skybox images

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-25 16:11:02 -04:00
co-authored by Claude Happy
parent 453f008620
commit 843660dfce
22 changed files with 1184 additions and 124 deletions
@@ -21,6 +21,7 @@ const CACHE_DIR := "user://content"
const CACHE_PATH := "user://content/defs.json"
const TILE_MODELS_PATH := "user://content/tile_models.json"
const TILE_BOTTOMS_PATH := "user://content/tile_bottoms.json"
const SKYBOXES_PATH := "user://content/skyboxes.json"
const PAGE_SIZE := 200
const REFRESH_INTERVAL_SECS := 300.0 # re-sync every 5 minutes during live play
@@ -42,12 +43,16 @@ var _tile_textures: Dictionary = {}
## Array of CDN URL strings for tile bottom (stalagmite) models.
var _tile_bottom_urls: Array = []
## Array of Dictionary (SkyboxDefinitionDto) for all active skyboxes.
var _skyboxes: Array = []
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
_load_from_disk()
_load_tile_models_from_disk()
_load_tile_bottoms_from_disk()
_load_skyboxes_from_disk()
# ── Public API ────────────────────────────────────────────────────────────────
@@ -91,6 +96,7 @@ func start_sync() -> void:
_fetch_page(_sync_version)
fetch_tile_models()
fetch_tile_bottoms()
fetch_skyboxes()
## Return the GLB animation track name for a card action.
@@ -141,6 +147,87 @@ func fetch_tile_bottoms() -> void:
)
## Fetch active skybox definitions from the server and update the local cache.
func fetch_skyboxes() -> void:
Network.request(
"content.get_skybox_config",
{},
func(_type: String, p: Variant): _on_skyboxes(p),
func(code: String, msg: String):
push_warning("ContentCache: skyboxes fetch failed — %s %s" % [code, msg])
)
## Returns a random active skybox Dictionary, or {} if none are cached.
func get_random_skybox() -> Dictionary:
if _skyboxes.is_empty():
return {}
return _skyboxes[randi() % _skyboxes.size()] as Dictionary
## Returns the best URL to use as a flat 2D background from this skybox dict.
## For Cubemap: returns the +Z (Front) face URL.
## For Panoramic/AnimatedPanorama: returns the cdnPath.
func get_skybox_bg_url(skybox: Dictionary) -> String:
var sky_type := str(skybox.get("type", "Panoramic"))
if sky_type == "Cubemap":
return str(skybox.get("cubePzUrl", ""))
return str(skybox.get("cdnPath", ""))
## Downloads an image from url and calls callback(Texture2D).
## Adds a temporary HTTPRequest child; frees itself on completion.
func load_texture_async(url: String, callback: Callable) -> void:
var http := HTTPRequest.new()
add_child(http)
http.request_completed.connect(func(result: int, code: int, _hdrs: PackedStringArray, body: PackedByteArray):
http.queue_free()
if result != HTTPRequest.RESULT_SUCCESS or code != 200:
callback.call(null)
return
var img := Image.new()
var ext := url.split("?")[0].get_extension().to_lower()
var err: Error
if ext in ["jpg", "jpeg"]:
err = img.load_jpg_from_buffer(body)
elif ext == "webp":
err = img.load_webp_from_buffer(body)
else:
err = img.load_png_from_buffer(body)
if err != OK:
callback.call(null)
return
callback.call(ImageTexture.create_from_image(img)))
http.request(url)
## Hides the first direct-child ColorRect of `parent` and injects a full-rect
## TextureRect (from a random active skybox) as the new first child.
## Call from _ready() in any 2D scene that has a solid-color background.
func apply_scene_background(parent: Control) -> void:
var skybox := get_random_skybox()
if skybox.is_empty():
return
var url := get_skybox_bg_url(skybox)
if url.is_empty():
return
load_texture_async(url, func(tex: Texture2D):
if not is_instance_valid(parent) or tex == null:
return
for child in parent.get_children():
if child is ColorRect:
child.visible = false
break
var tr := TextureRect.new()
tr.texture = tex
tr.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
tr.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED
tr.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
tr.mouse_filter = Control.MOUSE_FILTER_IGNORE
parent.add_child(tr)
parent.move_child(tr, 0))
## Fetch tile model bindings from the server and update the local cache.
## Emits tile_models_ready when done (even on error, using cached data).
func fetch_tile_models() -> void:
@@ -226,6 +313,15 @@ func _on_tile_bottoms(payload: Variant) -> void:
_tile_bottom_urls.append(u as String)
_save_tile_bottoms_to_disk()
func _on_skyboxes(payload: Variant) -> void:
var p := payload as Dictionary
_skyboxes.clear()
for item in p.get("skyboxes", []):
if typeof(item) == TYPE_DICTIONARY:
_skyboxes.append(item as Dictionary)
_save_skyboxes_to_disk()
# ── Persistence ───────────────────────────────────────────────────────────────
func _load_from_disk() -> void:
@@ -298,3 +394,24 @@ func _save_tile_bottoms_to_disk() -> void:
return
file.store_string(JSON.stringify(_tile_bottom_urls))
file.close()
func _load_skyboxes_from_disk() -> void:
if not FileAccess.file_exists(SKYBOXES_PATH):
return
var file := FileAccess.open(SKYBOXES_PATH, FileAccess.READ)
if not file:
return
var parsed: Variant = JSON.parse_string(file.get_as_text())
file.close()
if typeof(parsed) == TYPE_ARRAY:
_skyboxes = parsed as Array
func _save_skyboxes_to_disk() -> void:
DirAccess.make_dir_recursive_absolute(CACHE_DIR)
var file := FileAccess.open(SKYBOXES_PATH, FileAccess.WRITE)
if not file:
return
file.store_string(JSON.stringify(_skyboxes))
file.close()
@@ -14,6 +14,7 @@ const NOTIF_ROW = preload("res://scenes/account/components/NotificationRow.tscn"
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
back_btn.pressed.connect(_on_back)
_load_profile()
_load_notifications()
@@ -207,7 +208,7 @@ func _show_notification_dialog(notification: Dictionary, focus_reply: bool) -> v
func _extract_bug_report_payload(notification: Dictionary) -> Dictionary:
var payload_raw := notification.get("payloadJson", null)
var payload_raw : String = notification.get("payloadJson", null)
if payload_raw == null:
return {}
@@ -215,7 +216,7 @@ func _extract_bug_report_payload(notification: Dictionary) -> Dictionary:
if payload_text.is_empty():
return {}
var parsed := JSON.parse_string(payload_text)
var parsed : Variant = JSON.parse_string(payload_text)
if typeof(parsed) == TYPE_DICTIONARY:
return parsed as Dictionary
return {}
@@ -65,6 +65,7 @@ var _type_filter : String = ""
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
back_btn.pressed.connect(_on_back)
boosters_tab_btn.pressed.connect(func(): _switch_tab(Tab.BOOSTERS))
decks_tab_btn.pressed.connect(func(): _switch_tab(Tab.DECKS))
@@ -22,6 +22,7 @@ var _card_popup: Control = null
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
back_btn.pressed.connect(_on_back)
cards_tab_btn.pressed.connect(func(): _show_tab(0))
decks_tab_btn.pressed.connect(func(): _show_tab(1))
@@ -36,6 +36,7 @@ var _deck_btn_group : ButtonGroup = null
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
Chat.set_bubble_visible(true)
_setup_ui()
_load_decks() # load decks first; lobbies load after decks arrive
@@ -49,6 +49,7 @@ var _current_rules : Dictionary = {}
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
_setup_ui()
_connect_signals()
_refresh_display()
@@ -139,7 +140,7 @@ func _refresh_display() -> void:
lobby_title_label.text = "LOBBY: %s" % lobby_name
# Host slot
host_name_label.text = "Host: %s" % str(lobby.get("hostDisplayName", Auth.user_id))
host_name_label.text = "Host: %s" % str(lobby.get("hostDisplayName", Auth.display_name))
host_deck_label.text = "Deck: (selected)"
# Guest slot
+75 -26
View File
@@ -340,7 +340,7 @@ func _setup_environment() -> void:
_setup_live_skybox(env)
"cdn":
_setup_procedural_sky(env)
_fetch_skybox()
_apply_skybox_from_cache()
_: # "off" or any unknown value
_setup_procedural_sky(env)
@@ -410,7 +410,7 @@ func _on_skybox_setting_changed() -> void:
_setup_live_skybox(env)
"cdn":
_setup_procedural_sky()
_fetch_skybox()
_apply_skybox_from_cache()
_:
_setup_procedural_sky()
@@ -517,30 +517,79 @@ func _clear_stars() -> void:
# ── CDN skybox helpers ─────────────────────────────────────────────────────────
func _fetch_skybox() -> void:
Network.request("content.get_skybox_config", {},
func(_type: String, resp: Variant) -> void:
var d := resp as Dictionary
# Use a Variant to safely detect null before treating as Dictionary.
var skybox_raw : Variant = d.get("skybox", null)
if skybox_raw == null or not skybox_raw is Dictionary:
print("[GameScreen] No active skybox configured — keeping procedural sky.")
return
var skybox := skybox_raw as Dictionary
var cdn_path : String = str(skybox.get("cdnPath", ""))
var is_animated : bool = bool(skybox.get("isAnimated", false))
var frame_count : int = int(skybox.get("frameCount", 1))
var fps : float = float(skybox.get("fps", 24.0))
if cdn_path.is_empty():
push_warning("[GameScreen] Skybox has empty cdnPath — skipping.")
return
print("[GameScreen] Loading CDN skybox: animated=%s url=%s" % [is_animated, cdn_path])
if is_animated:
_load_animated_skybox(cdn_path, frame_count, fps)
else:
_load_static_skybox(cdn_path),
func(code: String, msg: String) -> void:
push_warning("[GameScreen] Skybox fetch failed — %s: %s" % [code, msg]))
func _apply_skybox_from_cache() -> void:
var skybox := ContentCache.get_random_skybox()
if skybox.is_empty():
print("[GameScreen] No active skybox — keeping procedural sky.")
return
var sky_type := str(skybox.get("type", "Panoramic"))
print("[GameScreen] Applying skybox type=%s" % sky_type)
if sky_type == "Cubemap":
_load_cubemap_skybox(skybox)
elif bool(skybox.get("isAnimated", false)) or sky_type == "AnimatedPanorama":
_load_animated_skybox(
str(skybox.get("cdnPath", "")),
int(skybox.get("frameCount", 1)),
float(skybox.get("fps", 24.0)))
else:
_load_static_skybox(str(skybox.get("cdnPath", "")))
func _load_cubemap_skybox(skybox: Dictionary) -> void:
# Face order for Godot 4 Cubemap.create_from_images():
# index 0=+X(Right) 1=-X(Left) 2=+Y(Top) 3=-Y(Bottom) 4=+Z(Front) 5=-Z(Back)
var urls := [
str(skybox.get("cubePxUrl", "")),
str(skybox.get("cubeNxUrl", "")),
str(skybox.get("cubePyUrl", "")),
str(skybox.get("cubeNyUrl", "")),
str(skybox.get("cubePzUrl", "")),
str(skybox.get("cubeNzUrl", "")),
]
var images: Array = []
images.resize(6)
var pending := 6
for i in 6:
var idx := i
var url := urls[idx]
if url.is_empty():
images[idx] = null
pending -= 1
if pending == 0:
_apply_cubemap_images(images)
continue
ContentCache.load_texture_async(url, func(tex: Texture2D):
images[idx] = tex.get_image() if tex != null else null
pending -= 1
if pending == 0:
_apply_cubemap_images.call_deferred(images))
func _apply_cubemap_images(images: Array) -> void:
for i in 6:
if images[i] == null:
var img := Image.create(1, 1, false, Image.FORMAT_RGB8)
img.fill(Color.BLACK)
images[i] = img
else:
(images[i] as Image).convert(Image.FORMAT_RGB8)
var cubemap := Cubemap.new()
cubemap.create_from_images(images)
_apply_cubemap_material(cubemap)
func _apply_cubemap_material(cubemap: Cubemap) -> void:
var shader := Shader.new()
shader.code = """
shader_type sky;
uniform samplerCube environment : filter_linear, repeat_disable;
void sky() { COLOR = texture(environment, EYEDIR).rgb; }
"""
var mat := ShaderMaterial.new()
mat.shader = shader
mat.set_shader_parameter("environment", cubemap)
var sky := Sky.new()
sky.sky_material = mat
$WorldEnvironment.environment.sky = sky
$WorldEnvironment.environment.background_mode = Environment.BG_SKY
print("[GameScreen] Cubemap sky applied.")
func _load_static_skybox(url: String) -> void:
var http := HTTPRequest.new()
@@ -33,6 +33,7 @@ var _pulse_tween : Tween = null
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
update_panel.visible = false
retry_btn.visible = false
progress_bar.value = 0.0
@@ -19,6 +19,7 @@ var _page_count : int = 1
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
back_btn.pressed.connect(_on_back)
prev_btn.pressed.connect(func(): _go_page(_page - 1))
next_btn.pressed.connect(func(): _go_page(_page + 1))
@@ -42,6 +42,7 @@ var _pending_pass := ""
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
# If already authenticated (e.g. scene reloaded), skip straight to main.
# Use call_deferred so the scene tree is not modified while _ready() is running.
if not Auth.user_id.is_empty():
@@ -20,6 +20,7 @@ extends Control
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
welcome_label.text = "Welcome, %s!" % Auth.display_name
Chat.set_bubble_visible(true)
@@ -25,6 +25,7 @@ var _searching : bool = false
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
cancel_btn.pressed.connect(_on_cancel)
Game.match_found.connect(_on_match_found)
_show_deck_panel()
@@ -15,6 +15,7 @@ const _HI_LABELS: Array = ["Movement", "Attack", "Ability", "Terramorpha", "Sele
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
# Populate controls from current settings (no signal spam).
music_slider.set_value_no_signal(Settings.music_volume)
music_mute_btn.set_pressed_no_signal(Settings.music_muted)
@@ -23,6 +23,7 @@ var _confirming: bool = false
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
ContentCache.apply_scene_background(self)
confirm_btn.disabled = true
confirm_btn.pressed.connect(_on_confirm_pressed)
_fetch_decks()
@@ -12,7 +12,17 @@
<h1 class="mb-0">Skyboxes</h1>
<div class="text-muted small">
Configure 3D environment skyboxes displayed in gameplay scenes.
Only the active skybox is sent to clients.
@{
var activeCount = _skyboxes.Count(s => s.IsActive);
}
@if (activeCount == 0)
{
<span>No active skyboxes — clients use the procedural sky.</span>
}
else
{
<span><strong>@activeCount</strong> active skybox@(activeCount == 1 ? "" : "es") — client picks one randomly per session.</span>
}
</div>
</div>
<button class="btn btn-outline-secondary btn-sm" @onclick="LoadAsync" disabled="@_loading">
@@ -45,10 +55,10 @@
<thead>
<tr>
<th>Name</th>
<th style="width:100px" class="text-center">Type</th>
<th>CDN Path</th>
<th style="width:90px" class="text-center">Frames</th>
<th style="width:80px" class="text-center">FPS</th>
<th style="width:160px">Type</th>
<th>CDN Path / Face URLs</th>
<th style="width:80px" class="text-center">Frames</th>
<th style="width:70px" class="text-center">FPS</th>
<th style="width:80px" class="text-center">Active</th>
<th style="width:130px"></th>
</tr>
@@ -57,34 +67,70 @@
@foreach (var s in _skyboxes.OrderByDescending(s => s.IsActive).ThenBy(s => s.Name))
{
var skybox = s;
var skyboxType = skybox.SkyboxType ?? "Panoramic";
<tr class="@(skybox.IsActive ? "table-success" : "")">
<td>
<input @bind="skybox.Name" class="form-control form-control-sm"
placeholder="e.g. Night Sky" />
</td>
<td class="text-center">
<div class="form-check form-switch d-flex justify-content-center">
<input @bind="skybox.IsAnimated" type="checkbox"
class="form-check-input" role="switch"
title="@(skybox.IsAnimated ? "Animated" : "Static")" />
<label class="form-check-label ms-2 small text-muted">
@(skybox.IsAnimated ? "Anim" : "Static")
</label>
</div>
<td>
<select @bind="skybox.SkyboxType" class="form-select form-select-sm">
<option value="Panoramic">Panoramic</option>
<option value="AnimatedPanorama">Animated Panorama</option>
<option value="Cubemap">Cubemap</option>
</select>
</td>
<td>
<input @bind="skybox.CdnPath" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/skyboxes/…" />
@if (skyboxType == "Cubemap")
{
<div class="row g-1">
<div class="col-6">
<label class="form-label small mb-0">+X Right</label>
<input @bind="skybox.CubePxUrl" class="form-control form-control-sm"
placeholder="https://cdn…/px.png" />
</div>
<div class="col-6">
<label class="form-label small mb-0">-X Left</label>
<input @bind="skybox.CubeNxUrl" class="form-control form-control-sm"
placeholder="https://cdn…/nx.png" />
</div>
<div class="col-6">
<label class="form-label small mb-0">+Y Top</label>
<input @bind="skybox.CubePyUrl" class="form-control form-control-sm"
placeholder="https://cdn…/py.png" />
</div>
<div class="col-6">
<label class="form-label small mb-0">-Y Bottom</label>
<input @bind="skybox.CubeNyUrl" class="form-control form-control-sm"
placeholder="https://cdn…/ny.png" />
</div>
<div class="col-6">
<label class="form-label small mb-0">+Z Front (2D bg)</label>
<input @bind="skybox.CubePzUrl" class="form-control form-control-sm"
placeholder="https://cdn…/pz.png" />
</div>
<div class="col-6">
<label class="form-label small mb-0">-Z Back</label>
<input @bind="skybox.CubeNzUrl" class="form-control form-control-sm"
placeholder="https://cdn…/nz.png" />
</div>
</div>
}
else
{
<input @bind="skybox.CdnPath" class="form-control form-control-sm"
placeholder="@(skyboxType == "AnimatedPanorama" ? "https://cdn.sor.gg/skyboxes/aurora (base folder)" : "https://cdn.sor.gg/skyboxes/night.png")" />
}
</td>
<td class="text-center">
<input @bind="skybox.FrameCount" type="number" min="1"
class="form-control form-control-sm text-center"
disabled="@(!skybox.IsAnimated)" />
disabled="@(skyboxType != "AnimatedPanorama")" />
</td>
<td class="text-center">
<input @bind="skybox.Fps" type="number" min="1" max="60" step="1"
class="form-control form-control-sm text-center"
disabled="@(!skybox.IsAnimated)" />
disabled="@(skyboxType != "AnimatedPanorama")" />
</td>
<td class="text-center">
<span class="badge @(skybox.IsActive ? "bg-success" : "bg-secondary")">
@@ -126,57 +172,92 @@
<div class="card shadow-sm">
<div class="card-header fw-medium">Add Skybox</div>
<div class="card-body">
<div class="row g-2 align-items-end">
<div class="col-md-2">
<div class="row g-2 align-items-end mb-2">
<div class="col-md-3">
<label class="form-label small">Name</label>
<input @bind="_newName" class="form-control form-control-sm" placeholder="Night Sky" />
</div>
<div class="col-md-1 text-center">
<label class="form-label small d-block">Animated</label>
<div class="form-check form-switch d-flex justify-content-center pt-1">
<input @bind="_newIsAnimated" type="checkbox" class="form-check-input" role="switch" />
</div>
<div class="col-md-2">
<label class="form-label small">Type</label>
<select @bind="_newSkyboxType" class="form-select form-select-sm">
<option value="Panoramic">Panoramic</option>
<option value="AnimatedPanorama">Animated Panorama</option>
<option value="Cubemap">Cubemap</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label small">
CDN Path
@if (_newIsAnimated)
{
<span class="text-muted ms-1">(base folder — frames at /0.png, /1.png …)</span>
}
else
{
<span class="text-muted ms-1">(full URL to panoramic image)</span>
}
</label>
<input @bind="_newCdnPath" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/skyboxes/…" />
</div>
@if (_newIsAnimated)
@if (_newSkyboxType != "Cubemap")
{
<div class="col-md-1">
<label class="form-label small">Frames</label>
<input @bind="_newFrameCount" type="number" min="1"
class="form-control form-control-sm" />
</div>
<div class="col-md-1">
<label class="form-label small">FPS</label>
<input @bind="_newFps" type="number" min="1" max="60" step="1"
class="form-control form-control-sm" />
<div class="col-md-4">
<label class="form-label small">
CDN Path
@if (_newSkyboxType == "AnimatedPanorama")
{
<span class="text-muted ms-1">(base folder — frames at /0.png, /1.png …)</span>
}
else
{
<span class="text-muted ms-1">(full URL to panoramic image)</span>
}
</label>
<input @bind="_newCdnPath" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/skyboxes/…" />
</div>
@if (_newSkyboxType == "AnimatedPanorama")
{
<div class="col-md-1">
<label class="form-label small">Frames</label>
<input @bind="_newFrameCount" type="number" min="1"
class="form-control form-control-sm" />
</div>
<div class="col-md-1">
<label class="form-label small">FPS</label>
<input @bind="_newFps" type="number" min="1" max="60" step="1"
class="form-control form-control-sm" />
</div>
}
}
<div class="col-md-2">
<button class="btn btn-primary btn-sm w-100"
@onclick="AddAsync"
disabled="@(string.IsNullOrWhiteSpace(_newName) || string.IsNullOrWhiteSpace(_newCdnPath))">
disabled="@IsAddDisabled()">
<i class="bi bi-plus-lg me-1"></i>Add
</button>
</div>
</div>
<div class="text-muted small mt-2">
<strong>Static</strong>: Set CDN path to a single panoramic/equirectangular image (PNG/JPG recommended).<br />
<strong>Animated</strong>: Upload frames as <code>/0.png</code>, <code>/1.png</code>, … <code>/{FrameCount-1}.png</code>
inside the base folder, then set CDN path to that folder URL.
@if (_newSkyboxType == "Cubemap")
{
<div class="row g-2 mb-2">
<div class="col-md-4">
<label class="form-label small">+X Right</label>
<input @bind="_newCubePxUrl" class="form-control form-control-sm" placeholder="https://cdn…/px.png" />
</div>
<div class="col-md-4">
<label class="form-label small">-X Left</label>
<input @bind="_newCubeNxUrl" class="form-control form-control-sm" placeholder="https://cdn…/nx.png" />
</div>
<div class="col-md-4">
<label class="form-label small">+Y Top</label>
<input @bind="_newCubePyUrl" class="form-control form-control-sm" placeholder="https://cdn…/py.png" />
</div>
<div class="col-md-4">
<label class="form-label small">-Y Bottom</label>
<input @bind="_newCubeNyUrl" class="form-control form-control-sm" placeholder="https://cdn…/ny.png" />
</div>
<div class="col-md-4">
<label class="form-label small">+Z Front <span class="text-muted">(also 2D bg)</span></label>
<input @bind="_newCubePzUrl" class="form-control form-control-sm" placeholder="https://cdn…/pz.png" />
</div>
<div class="col-md-4">
<label class="form-label small">-Z Back</label>
<input @bind="_newCubeNzUrl" class="form-control form-control-sm" placeholder="https://cdn…/nz.png" />
</div>
</div>
}
<div class="text-muted small mt-1">
<strong>Panoramic</strong>: Set CDN path to a single equirectangular image (PNG/JPG recommended).<br />
<strong>Animated Panorama</strong>: Upload frames as <code>/0.png</code>, <code>/1.png</code>, … <code>/{FrameCount-1}.png</code>
inside the base folder, then set CDN path to that folder URL.<br />
<strong>Cubemap</strong>: Supply six face images (+X/-X/+Y/-Y/+Z/-Z). The +Z (Front) face also appears as the 2D background in non-game scenes.
</div>
</div>
</div>
@@ -187,11 +268,17 @@
private string? _message;
private bool _isError;
private string _newName = "";
private bool _newIsAnimated = false;
private string _newCdnPath = "";
private int _newFrameCount = 1;
private float _newFps = 24f;
private string _newName = "";
private string _newSkyboxType = "Panoramic";
private string _newCdnPath = "";
private int _newFrameCount = 1;
private float _newFps = 24f;
private string _newCubePxUrl = "";
private string _newCubeNxUrl = "";
private string _newCubePyUrl = "";
private string _newCubeNyUrl = "";
private string _newCubePzUrl = "";
private string _newCubeNzUrl = "";
protected override async Task OnInitializedAsync() => await LoadAsync();
@@ -202,9 +289,19 @@
_loading = false;
}
private bool IsAddDisabled()
{
if (string.IsNullOrWhiteSpace(_newName)) return true;
if (_newSkyboxType == "Cubemap") return false; // face URLs are optional individually
return string.IsNullOrWhiteSpace(_newCdnPath);
}
private async Task SaveAsync(SkyboxDefinition skybox)
{
if (!skybox.IsAnimated) { skybox.FrameCount = 1; skybox.Fps = 0f; }
var type = skybox.SkyboxType ?? "Panoramic";
if (type != "AnimatedPanorama") { skybox.FrameCount = 1; skybox.Fps = 0f; }
// Keep IsAnimated in sync with SkyboxType for backward compat
skybox.IsAnimated = type == "AnimatedPanorama";
try
{
await Db.SaveChangesAsync();
@@ -220,14 +317,11 @@
private async Task SetActiveAsync(SkyboxDefinition skybox)
{
// Deactivate all, then activate the chosen one.
foreach (var s in _skyboxes)
s.IsActive = false;
skybox.IsActive = true;
try
{
await Db.SaveChangesAsync();
_message = $"\"{skybox.Name}\" is now the active skybox.";
_message = $"\"{skybox.Name}\" is now active.";
_isError = false;
}
catch (Exception ex)
@@ -243,7 +337,7 @@
try
{
await Db.SaveChangesAsync();
_message = $"\"{skybox.Name}\" deactivated. No skybox is now active (clients use procedural sky).";
_message = $"\"{skybox.Name}\" deactivated.";
_isError = false;
}
catch (Exception ex)
@@ -272,14 +366,23 @@
private async Task AddAsync()
{
var isCubemap = _newSkyboxType == "Cubemap";
var isAnimated = _newSkyboxType == "AnimatedPanorama";
var s = new SkyboxDefinition
{
Id = Guid.NewGuid(),
Name = _newName.Trim(),
IsAnimated = _newIsAnimated,
CdnPath = _newCdnPath.Trim(),
FrameCount = _newIsAnimated ? Math.Max(1, _newFrameCount) : 1,
Fps = _newIsAnimated ? Math.Max(1f, _newFps) : 0f,
SkyboxType = _newSkyboxType,
IsAnimated = isAnimated,
CdnPath = isCubemap ? "" : _newCdnPath.Trim(),
FrameCount = isAnimated ? Math.Max(1, _newFrameCount) : 1,
Fps = isAnimated ? Math.Max(1f, _newFps) : 0f,
CubePxUrl = isCubemap ? NullIfEmpty(_newCubePxUrl) : null,
CubeNxUrl = isCubemap ? NullIfEmpty(_newCubeNxUrl) : null,
CubePyUrl = isCubemap ? NullIfEmpty(_newCubePyUrl) : null,
CubeNyUrl = isCubemap ? NullIfEmpty(_newCubeNyUrl) : null,
CubePzUrl = isCubemap ? NullIfEmpty(_newCubePzUrl) : null,
CubeNzUrl = isCubemap ? NullIfEmpty(_newCubeNzUrl) : null,
IsActive = false,
CreatedAt = DateTimeOffset.UtcNow,
};
@@ -289,9 +392,10 @@
await Db.SaveChangesAsync();
_skyboxes.Add(s);
_newName = _newCdnPath = "";
_newIsAnimated = false;
_newSkyboxType = "Panoramic";
_newFrameCount = 1;
_newFps = 24f;
_newCubePxUrl = _newCubeNxUrl = _newCubePyUrl = _newCubeNyUrl = _newCubePzUrl = _newCubeNzUrl = "";
_message = $"Skybox \"{s.Name}\" added.";
_isError = false;
}
@@ -301,4 +405,7 @@
_isError = true;
}
}
private static string? NullIfEmpty(string s) =>
string.IsNullOrWhiteSpace(s) ? null : s.Trim();
}
+21 -11
View File
@@ -134,28 +134,38 @@ public sealed record CardAnimationBindingDto(
// ── Skybox config ─────────────────────────────────────────────────────────────
/// <summary>Fetch the currently active skybox definition (if any).</summary>
/// <summary>Fetch all active skybox definitions.</summary>
public sealed record GetSkyboxConfigRequest;
/// <summary>
/// Response for content.get_skybox_config.
/// Skybox is null when no skybox is active (client keeps the default procedural sky).
/// Returns all active skyboxes; the client picks one randomly each session.
/// Empty array means no skybox is active (client keeps the default procedural sky).
/// </summary>
public sealed record GetSkyboxConfigResponse(SkyboxDefinitionDto? Skybox);
public sealed record GetSkyboxConfigResponse(SkyboxDefinitionDto[] Skyboxes);
/// <summary>
/// Describes one skybox for use in the 3D gameplay scene.
///
/// Static: CdnPath is the full URL to a panoramic image (PNG/JPG).
/// Animated: CdnPath is the base folder URL; frames are at {CdnPath}/0.png, /1.png, etc.
/// Panoramic: CdnPath is the full URL to a panoramic image (PNG/JPG).
/// AnimatedPanorama: CdnPath is the base folder URL; frames are at {CdnPath}/0.png, /1.png, etc.
/// Cubemap: Six face URLs (CubePxUrl … CubeNzUrl) assemble a Godot 4 Cubemap sky.
/// CubePzUrl (front face) also serves as the 2D background for non-game scenes.
/// </summary>
public sealed record SkyboxDefinitionDto(
Guid Id,
string Name,
bool IsAnimated,
string CdnPath,
int FrameCount,
float Fps);
Guid Id,
string Name,
string Type,
bool IsAnimated,
string CdnPath,
int FrameCount,
float Fps,
string? CubePxUrl,
string? CubeNxUrl,
string? CubePyUrl,
string? CubeNyUrl,
string? CubePzUrl,
string? CubeNzUrl);
// ── Highlight config ──────────────────────────────────────────────────────────
@@ -26,14 +26,19 @@ internal sealed class ContentGetSkyboxConfigHandler : IMessageHandler
AuthenticatedConnection connection,
CancellationToken ct)
{
var skybox = await _catalogDb.SkyboxDefinitions
var skyboxes = await _catalogDb.SkyboxDefinitions
.AsNoTracking()
.Where(s => s.IsActive)
.OrderByDescending(s => s.CreatedAt)
.Select(s => new SkyboxDefinitionDto(s.Id, s.Name, s.IsAnimated, s.CdnPath, s.FrameCount, s.Fps))
.FirstOrDefaultAsync(ct);
.OrderBy(s => s.CreatedAt)
.ToListAsync(ct);
var dtos = skyboxes.Select(s => new SkyboxDefinitionDto(
s.Id, s.Name, s.SkyboxType ?? "Panoramic", s.IsAnimated,
s.CdnPath, s.FrameCount, s.Fps,
s.CubePxUrl, s.CubeNxUrl, s.CubePyUrl, s.CubeNyUrl, s.CubePzUrl, s.CubeNzUrl
)).ToArray();
return ServerMessage.Reply("content.get_skybox_config.ack", message.Seq,
new GetSkyboxConfigResponse(skybox));
new GetSkyboxConfigResponse(dtos));
}
}
@@ -171,6 +171,13 @@ public sealed class CatalogDbContext : DbContext
e.HasKey(s => s.Id);
e.Property(s => s.Name).IsRequired();
e.Property(s => s.CdnPath).IsRequired();
e.Property(s => s.SkyboxType).HasColumnName("skybox_type");
e.Property(s => s.CubePxUrl).HasColumnName("cube_px_url");
e.Property(s => s.CubeNxUrl).HasColumnName("cube_nx_url");
e.Property(s => s.CubePyUrl).HasColumnName("cube_py_url");
e.Property(s => s.CubeNyUrl).HasColumnName("cube_ny_url");
e.Property(s => s.CubePzUrl).HasColumnName("cube_pz_url");
e.Property(s => s.CubeNzUrl).HasColumnName("cube_nz_url");
e.HasIndex(s => s.IsActive);
});
@@ -3,13 +3,13 @@ namespace SOR.Database.Entities.Catalog;
/// <summary>
/// Defines a skybox displayed in the 3D gameplay scene.
///
/// Static skyboxes: CdnPath is the full URL to a single panoramic image (PNG/JPG/HDR).
/// Animated skyboxes: CdnPath is the base URL of a frame folder.
/// Panoramic skyboxes: CdnPath is the full URL to a single panoramic image (PNG/JPG/HDR).
/// AnimatedPanorama skyboxes: CdnPath is the base URL of a frame folder.
/// Frames are named {CdnPath}/0.png, {CdnPath}/1.png, … {CdnPath}/{FrameCount-1}.png.
/// The client downloads all frames and cycles through them at Fps frames per second.
/// Cubemap skyboxes: Six face URLs (CubePxUrl … CubeNzUrl) are assembled into a Godot 4 Cubemap.
///
/// Only the skybox with IsActive = true is served to clients.
/// At most one skybox should be active at a time; the admin panel enforces this.
/// Multiple skyboxes may be active simultaneously; the client picks one randomly each session.
/// </summary>
public sealed class SkyboxDefinition
{
@@ -18,15 +18,20 @@ public sealed class SkyboxDefinition
/// <summary>Human-readable display name shown in the admin panel.</summary>
public string Name { get; set; } = string.Empty;
/// <summary>"Panoramic" | "AnimatedPanorama" | "Cubemap". Null treated as "Panoramic".</summary>
public string? SkyboxType { get; set; }
/// <summary>
/// When false: CdnPath is a direct URL to a single panoramic image.
/// When true: CdnPath is a base folder URL; frames are sequential PNGs starting at /0.png.
/// Kept for backward compatibility; prefer SkyboxType.
/// </summary>
public bool IsAnimated { get; set; }
/// <summary>
/// For static: full CDN URL to the panoramic image (e.g. https://cdn.sor.gg/skyboxes/night.png).
/// For animated: base folder URL without trailing slash (e.g. https://cdn.sor.gg/skyboxes/aurora).
/// For Panoramic: full CDN URL to the panoramic image (e.g. https://cdn.sor.gg/skyboxes/night.png).
/// For AnimatedPanorama: base folder URL without trailing slash (e.g. https://cdn.sor.gg/skyboxes/aurora).
/// Not used for Cubemap type.
/// </summary>
public string CdnPath { get; set; } = string.Empty;
@@ -39,9 +44,23 @@ public sealed class SkyboxDefinition
/// <summary>Playback speed in frames per second. Ignored for static skyboxes.</summary>
public float Fps { get; set; } = 24f;
// ── Cubemap face URLs (used when SkyboxType == "Cubemap") ──────────────
/// <summary>+X Right face URL.</summary>
public string? CubePxUrl { get; set; }
/// <summary>-X Left face URL.</summary>
public string? CubeNxUrl { get; set; }
/// <summary>+Y Top face URL.</summary>
public string? CubePyUrl { get; set; }
/// <summary>-Y Bottom face URL.</summary>
public string? CubeNyUrl { get; set; }
/// <summary>+Z Front face URL. Also used as the 2D background image for 2D scenes.</summary>
public string? CubePzUrl { get; set; }
/// <summary>-Z Back face URL.</summary>
public string? CubeNzUrl { get; set; }
/// <summary>
/// When true, this skybox is served to game clients.
/// Deactivate all others before activating a new one.
/// When true, this skybox is included in the active pool served to game clients.
/// Multiple skyboxes may be active; the client picks one randomly each session.
/// </summary>
public bool IsActive { get; set; }
@@ -0,0 +1,604 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SOR.Database.Contexts;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
[DbContext(typeof(CatalogDbContext))]
[Migration("20260325201027_AddSkyboxCubemapType")]
partial class AddSkyboxCubemapType
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("catalog")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ActionName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationTrackName")
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CastSoundCdnUrl")
.HasColumnType("text");
b.Property<string>("ImpactSoundCdnUrl")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "ActionName")
.IsUnique();
b.ToTable("card_animation_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AssetType")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ContentETag")
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("MimeType")
.HasColumnType("text");
b.Property<string>("ModelFacingDirection")
.HasColumnType("text");
b.Property<string>("ModelTintMaskUrl")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "AssetType");
b.ToTable("card_assets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AbilitiesJson")
.HasColumnType("jsonb")
.HasColumnName("abilities");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AttackSoundUrl")
.HasColumnType("text");
b.Property<string>("AttackType")
.HasColumnType("text");
b.Property<string>("BlockedSoundUrl")
.HasColumnType("text");
b.Property<bool?>("CanAttack")
.HasColumnType("boolean");
b.Property<bool?>("CanBeAttacked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeBlocked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeObstructed")
.HasColumnType("boolean");
b.Property<bool?>("CanBeSacrificed")
.HasColumnType("boolean");
b.Property<bool?>("CanDefend")
.HasColumnType("boolean");
b.Property<bool?>("CanMove")
.HasColumnType("boolean");
b.Property<bool?>("CanUseAbility")
.HasColumnType("boolean");
b.Property<string>("CardType")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("CollectorNumber")
.HasColumnType("integer");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int?>("Damage")
.HasColumnType("integer");
b.Property<string>("DamagedSoundUrl")
.HasColumnType("text");
b.Property<string>("DeathSoundUrl")
.HasColumnType("text");
b.Property<long>("DefinitionVersion")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasDefaultValue(0L);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EffectsJson")
.HasColumnType("jsonb")
.HasColumnName("effects");
b.Property<string[]>("Genus")
.HasColumnType("text[]");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<bool>("IsRetired")
.HasColumnType("boolean");
b.Property<int?>("MaxAttackRange")
.HasColumnType("integer");
b.Property<int?>("MaxChannelRange")
.HasColumnType("integer");
b.Property<int?>("MaxDefense")
.HasColumnType("integer");
b.Property<int?>("MaxHealth")
.HasColumnType("integer");
b.Property<int?>("MinAttackRange")
.HasColumnType("integer");
b.Property<int?>("MinChannelRange")
.HasColumnType("integer");
b.Property<float?>("ModelScale")
.HasColumnType("real");
b.Property<string>("ModelTintColor")
.HasColumnType("text");
b.Property<string>("MoveSoundUrl")
.HasColumnType("text");
b.Property<int?>("MovementPoints")
.HasColumnType("integer");
b.Property<string>("MovementType")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("OtherCostsJson")
.HasColumnType("jsonb")
.HasColumnName("other_costs");
b.Property<Guid?>("PreviousTierId")
.HasColumnType("uuid");
b.Property<string>("Rarity")
.IsRequired()
.HasColumnType("text");
b.Property<bool?>("RequiresLos")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("RetiredAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("SetId")
.HasColumnType("uuid");
b.Property<int>("SpCost")
.HasColumnType("integer");
b.Property<int>("StCost")
.HasColumnType("integer");
b.Property<string>("TerramorphaMode")
.HasColumnType("text");
b.Property<int?>("Tier")
.HasColumnType("integer");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity");
b.HasIndex("CardType");
b.HasIndex("DefinitionVersion");
b.HasIndex("Name");
b.HasIndex("PreviousTierId");
b.HasIndex("Rarity");
b.HasIndex("SetId");
b.HasIndex("IsPublished", "SetId");
b.ToTable("card_definitions", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateOnly?>("ReleaseDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("card_sets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ContentType")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("ObjectKey")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Prefix")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UploadedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsAiGenerated");
b.HasIndex("ObjectKey")
.IsUnique();
b.HasIndex("Prefix");
b.ToTable("cdn_upload_records", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.GameAudioConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Context")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("TrackCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TrackName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Context");
b.HasIndex("IsActive");
b.ToTable("game_audio_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.HighlightConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnPath")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FallbackHex")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Fps")
.HasColumnType("real");
b.Property<int>("FrameCount")
.HasColumnType("integer");
b.Property<string>("HighlightType")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAnimated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("HighlightType")
.IsUnique();
b.ToTable("highlight_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.SkyboxDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnPath")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("CubeNxUrl")
.HasColumnType("text")
.HasColumnName("cube_nx_url");
b.Property<string>("CubeNyUrl")
.HasColumnType("text")
.HasColumnName("cube_ny_url");
b.Property<string>("CubeNzUrl")
.HasColumnType("text")
.HasColumnName("cube_nz_url");
b.Property<string>("CubePxUrl")
.HasColumnType("text")
.HasColumnName("cube_px_url");
b.Property<string>("CubePyUrl")
.HasColumnType("text")
.HasColumnName("cube_py_url");
b.Property<string>("CubePzUrl")
.HasColumnType("text")
.HasColumnName("cube_pz_url");
b.Property<float>("Fps")
.HasColumnType("real");
b.Property<int>("FrameCount")
.HasColumnType("integer");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsAnimated")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SkyboxType")
.HasColumnType("text")
.HasColumnName("skybox_type");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("skybox_definitions", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileBottomModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("tile_bottom_models", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ModelCdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ModelPublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Shape")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TexturePublicUrl")
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity", "Shape")
.IsUnique();
b.ToTable("tile_model_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("AnimationBindings")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("Assets")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier")
.WithMany()
.HasForeignKey("PreviousTierId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set")
.WithMany("Cards")
.HasForeignKey("SetId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("PreviousTier");
b.Navigation("Set");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Navigation("AnimationBindings");
b.Navigation("Assets");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Navigation("Cards");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,102 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
/// <inheritdoc />
public partial class AddSkyboxCubemapType : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "cube_nx_url",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "cube_ny_url",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "cube_nz_url",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "cube_px_url",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "cube_py_url",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "cube_pz_url",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "skybox_type",
schema: "catalog",
table: "skybox_definitions",
type: "text",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "cube_nx_url",
schema: "catalog",
table: "skybox_definitions");
migrationBuilder.DropColumn(
name: "cube_ny_url",
schema: "catalog",
table: "skybox_definitions");
migrationBuilder.DropColumn(
name: "cube_nz_url",
schema: "catalog",
table: "skybox_definitions");
migrationBuilder.DropColumn(
name: "cube_px_url",
schema: "catalog",
table: "skybox_definitions");
migrationBuilder.DropColumn(
name: "cube_py_url",
schema: "catalog",
table: "skybox_definitions");
migrationBuilder.DropColumn(
name: "cube_pz_url",
schema: "catalog",
table: "skybox_definitions");
migrationBuilder.DropColumn(
name: "skybox_type",
schema: "catalog",
table: "skybox_definitions");
}
}
}
@@ -431,6 +431,30 @@ namespace SOR.Database.Migrations.Catalog
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("CubeNxUrl")
.HasColumnType("text")
.HasColumnName("cube_nx_url");
b.Property<string>("CubeNyUrl")
.HasColumnType("text")
.HasColumnName("cube_ny_url");
b.Property<string>("CubeNzUrl")
.HasColumnType("text")
.HasColumnName("cube_nz_url");
b.Property<string>("CubePxUrl")
.HasColumnType("text")
.HasColumnName("cube_px_url");
b.Property<string>("CubePyUrl")
.HasColumnType("text")
.HasColumnName("cube_py_url");
b.Property<string>("CubePzUrl")
.HasColumnType("text")
.HasColumnName("cube_pz_url");
b.Property<float>("Fps")
.HasColumnType("real");
@@ -447,6 +471,10 @@ namespace SOR.Database.Migrations.Catalog
.IsRequired()
.HasColumnType("text");
b.Property<string>("SkyboxType")
.HasColumnType("text")
.HasColumnName("skybox_type");
b.HasKey("Id");
b.HasIndex("IsActive");