This commit is contained in:
2509_92447106 committed 2026-11-07 20:01:58 +08:00
1 parent d81ab2acaa
commit 639ff1ba57
15 files changed
+227 -151

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@
-->
<AvaloniaVersion>11.3.9</AvaloniaVersion>
<MvvmVersion>8.2.2</MvvmVersion>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Company>NeoRF</Company>
<Product>Earth Model Studio</Product>
<NeutralLanguage>zh-Hans</NeutralLanguage>
+10 -2
View File
@@ -42,7 +42,7 @@ $TestProj = 'src/test/dotnet/EarthModelStudio.Tests/EarthModelStudio.Tests.cspro
$PreviewProj = 'model/_engine/PreviewGen/PreviewGen.csproj'
$StampProj = 'model/_engine/VersionStamp/VersionStamp.csproj'
$Sln = 'EarthModelStudio.sln'
$Version = '1.0.0'
$Version = '1.0.1'
function Stamp-Versions {
Write-Host '==> 自动计算模型版本并生成 version.json'
@@ -123,6 +123,8 @@ function Prepare-RuntimeLayout([string]$RelDir) {
function Publish-Rid([string]$Rid, [string]$OutDir) {
Write-Host "==> 编译 $Rid -> $OutDir"
# 先删旧产物目录,避免残留文件混进新包
if (Test-Path "$Root/$OutDir") { Remove-Item -Recurse -Force "$Root/$OutDir" }
dotnet publish $AppProj -c Release -r $Rid --self-contained true `
-p:Version=$Version -p:DebugType=none -p:PublishSingleFile=true `
-p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=false -o "$Root/$OutDir"
@@ -186,10 +188,16 @@ function Pack-Launcher {
}
switch ($Task) {
'build' { dotnet build $Sln -c Debug }
'build' {
Get-ChildItem "$Root/dist/GC-*.zip","$Root/dist/models-*.zip" -ErrorAction SilentlyContinue |
Remove-Item -Force
dotnet build $Sln -c Debug
}
'run' { dotnet run --project $AppProj -c Debug }
'test' { dotnet run --project $TestProj -c Debug -- "$Root/build/screenshots" }
'publish' {
# 先清理 dist 旧产物,再重新生成
if (Test-Path "$Root/dist") { Remove-Item -Recurse -Force "$Root/dist" }
New-Item -ItemType Directory -Force -Path "$Root/dist" | Out-Null
Stamp-Versions
Publish-Rid 'osx-arm64' 'dist/mac-arm64'
+25 -50
View File
@@ -38,7 +38,7 @@ PREVIEW_PROJ="model/_engine/PreviewGen/PreviewGen.csproj"
STAMP_PROJ="model/_engine/VersionStamp/VersionStamp.csproj"
TEST_PROJ="src/test/dotnet/EarthModelStudio.Tests/EarthModelStudio.Tests.csproj"
SLN="EarthModelStudio.sln"
VERSION="1.0.0"
VERSION="1.0.1"
TASK="${1:-build}"
# 按模型包内容指纹自动写回 <id>.json 的 version,并生成 version.json
@@ -113,25 +113,16 @@ JSON
echo " 运行目录 -> $REL/.GC (settings.json + model/ + cache/ + update/)"
}
# 系统/架构名(用于 Release 附件命名:GC-版本-系统-架构-是否内置dotnet)
rid_label() {
case "$1" in
win-x64) echo "Win-Amd64" ;;
win-arm64) echo "Win-Arm64" ;;
osx-arm64) echo "Mac-Arm64" ;;
*) echo "$1" ;;
esac
}
# $1=RID $2=输出目录 $3=self-contained(true/false)
publish_rid() {
RID="$1"; OUT="$2"; SELF="$3"
RID="$1"; OUT="$2"
echo ""
echo "==> 编译 ${RID} (self-contained=${SELF}) -> ${OUT}"
echo "==> 编译 ${RID} -> ${OUT}"
# 先删旧产物,避免上次 publish 的残留文件混进新包
rm -rf "$ROOT_DIR/$OUT"
dotnet publish "$APP_PROJ" \
-c Release \
-r "$RID" \
--self-contained "$SELF" \
--self-contained true \
-p:Version="$VERSION" \
-p:DebugType=none \
-p:PublishSingleFile=true \
@@ -153,35 +144,20 @@ pack_models() {
}
# 启动器更新包:只包含程序文件,排除 .GC(否则会覆盖用户已下载的模型与设置)
# 命名:GC-<版本>-<系统>-<架构>-<是否内置dotnet>.zip
# selfcontained = 内置 .NET 运行时(免安装,体积大)
# framework = 不内置(需机器已装 .NET 8,体积小)
# 3 平台 × 2 种 = 6 个发布包
pack_launcher() {
echo "==> 生成 6 个启动器发布包(不含 .GC)"
echo "==> 生成启动器更新包(不含 .GC)"
WIN64="$ROOT_DIR/dist/win-x64"
WINARM="$ROOT_DIR/dist/win-arm64"
MACBIN="$ROOT_DIR/dist/mac-arm64/EarthModelStudio.app/Contents/MacOS"
[ -d "$MACBIN" ] || MACBIN="$ROOT_DIR/dist/mac-arm64"
pack_one "Win-Amd64" "$WIN64"
pack_one "Win-Arm64" "$WINARM"
pack_one "Mac-Arm64" "$MACBIN"
[ -d "$WIN64" ] && ( cd "$WIN64" && zip -qr "$ROOT_DIR/dist/GC-win-x64.zip" . \
-x "./.GC" "./.GC/*" "*.DS_Store" )
[ -d "$WINARM" ] && ( cd "$WINARM" && zip -qr "$ROOT_DIR/dist/GC-win-arm64.zip" . \
-x "./.GC" "./.GC/*" "*.DS_Store" )
[ -d "$MACBIN" ] && ( cd "$MACBIN" && zip -qr "$ROOT_DIR/dist/GC-osx-arm64.zip" . \
-x "./.GC" "./.GC/*" "*.DS_Store" )
stamp_versions
ls -lh "$ROOT_DIR"/dist/GC-"$VERSION"-*.zip 2>/dev/null || true
}
# 同一份产物打两个包(内置 / 不内置 dotnet 的区分由 publish 阶段分别输出到
# dist/<rid>-selfcontained 与 dist/<rid>-framework,文件名后缀标识即可)
pack_one() {
LABEL="$1"; SRC="$2"
[ -d "$SRC" ] || return 0
for KIND in selfcontained framework; do
DIR="${SRC}-${KIND}"
[ -d "$DIR" ] || DIR="$SRC"
ZIP="$ROOT_DIR/dist/GC-${VERSION}-${LABEL}-${KIND}.zip"
( cd "$DIR" && zip -qr "$ZIP" . -x "./.GC" "./.GC/*" "*.DS_Store" )
echo " -> $(basename "$ZIP")"
done
ls -lh "$ROOT_DIR"/dist/GC-*.zip 2>/dev/null || true
}
package_mac_app() {
@@ -218,6 +194,8 @@ PLIST
case "$TASK" in
build)
# 清理上次遗留的发布包 zip,避免误用旧产物
rm -f "$ROOT_DIR"/dist/GC-*.zip "$ROOT_DIR"/dist/models-*.zip 2>/dev/null || true
dotnet build "$SLN" -c Debug
;;
run)
@@ -227,26 +205,23 @@ case "$TASK" in
dotnet run --project "$TEST_PROJ" -c Debug -- "$ROOT_DIR/build/screenshots"
;;
publish)
# 先清掉 dist 旧产物(含历史 zip / 目录),再重新生成
echo "==> 清理 dist 旧产物"
rm -rf "$ROOT_DIR/dist"
mkdir -p "$ROOT_DIR/dist"
stamp_versions
# 3 平台 × {内置dotnet, 不内置dotnet} = 6 个发布包
for RID in osx-arm64 win-x64 win-arm64; do
publish_rid "$RID" "dist/$RID-selfcontained" true
publish_rid "$RID" "dist/$RID-framework" false
done
# 兼容原有 .app 结构与 .GC 骨架(取内置版作为代表)
[ -d "$ROOT_DIR/dist/mac-arm64" ] || cp -R "$ROOT_DIR/dist/osx-arm64-selfcontained" "$ROOT_DIR/dist/mac-arm64"
[ -d "$ROOT_DIR/dist/win-x64" ] || cp -R "$ROOT_DIR/dist/win-x64-selfcontained" "$ROOT_DIR/dist/win-x64"
[ -d "$ROOT_DIR/dist/win-arm64" ] || cp -R "$ROOT_DIR/dist/win-arm64-selfcontained" "$ROOT_DIR/dist/win-arm64"
publish_rid "osx-arm64" "dist/mac-arm64"
publish_rid "win-x64" "dist/win-x64"
publish_rid "win-arm64" "dist/win-arm64"
package_mac_app
prepare_runtime_layout "dist/win-x64"
prepare_runtime_layout "dist/win-arm64"
prepare_runtime_layout "dist/mac-arm64/EarthModelStudio.app/Contents/MacOS"
pack_launcher
echo ""
echo "==> 三平台 × 2 模式 = 6 个发布包完成(不含模型,首次启动自动下载):"
ls -lh "$ROOT_DIR"/dist/GC-"$VERSION"-*.zip 2>/dev/null || true
echo " 把 6 个 zip 传 Release,把 version.json / model/ 推送到 gitcode"
echo "==> 三个平台编译完成(发布包不含模型,首次启动自动下载):"
du -sh "$ROOT_DIR/dist"/* 2>/dev/null || true
echo " 把 version.json / model/ 推送到 gitcode,启动器就会自动检查更新"
;;
models)
build_models
+49 -33
View File
@@ -705,40 +705,52 @@ public class CelestialView : Control, IDisposable
var tropic = TropicDegrees(runtime);
var polar = 90.0 - tropic;
DrawParallel(ctx, cam, planet, center, radius, 0, EquatorPen,
labels ? Texts["lat.equator"] : null, LabelBrush);
DrawParallel(ctx, cam, planet, center, radius, tropic, TropicPen,
labels ? Texts["lat.tropicN"] : null, TropicBrush);
DrawParallel(ctx, cam, planet, center, radius, -tropic, TropicPen,
labels ? Texts["lat.tropicS"] : null, TropicBrush);
DrawParallel(ctx, cam, planet, center, radius, polar, PolarPen,
labels ? Texts["lat.polarN"] : null, PolarBrush);
DrawParallel(ctx, cam, planet, center, radius, -polar, PolarPen,
labels ? Texts["lat.polarS"] : null, PolarBrush);
}
private void DrawParallel(DrawingContext ctx, Matrix4x4 cam, Matrix4x4 planet,
Point center, double radius, double lat, IPen pen, string? label, IBrush labelBrush)
{
DrawSpherePolyline(ctx, cam, planet, center, radius, pen,
t => LatLonToUnit(lat, t * 360.0), 144);
if (label == null) return;
// 找该纬线上「最靠右且可见」的点作为标签锚点:
// 地球自转时标签始终留在可见半球右侧,不会忽隐忽现
Vector3 best = default;
var bestScore = double.NegativeInfinity;
for (var lon = -180; lon < 180; lon += 6)
// 五条纬线一起画:先画线,再统一布置标签,避免自转时多个标签
// 被投影到相近位置而互相覆盖 / 抖动(原来的逐条独立绘制会重叠)。
var lines = new (double Lat, IPen Pen, string? Label, IBrush Brush)[]
{
var world = Vector3.Transform(LatLonToUnit(lat, lon), planet);
var c = Vector3.Transform(world, cam);
if (c.Z < 0.10f) continue;
var score = c.X * 2.0 + c.Z;
if (score > bestScore) { bestScore = score; best = c; }
(0, EquatorPen, labels ? Texts["lat.equator"] : null, LabelBrush),
(tropic, TropicPen, labels ? Texts["lat.tropicN"] : null, TropicBrush),
(-tropic, TropicPen, labels ? Texts["lat.tropicS"] : null, TropicBrush),
(polar, PolarPen, labels ? Texts["lat.polarN"] : null, PolarBrush),
(-polar, PolarPen, labels ? Texts["lat.polarS"] : null, PolarBrush)
};
foreach (var l in lines)
DrawSpherePolyline(ctx, cam, planet, center, radius, l.Pen,
t => LatLonToUnit(l.Lat, t * 360.0), 144);
if (!labels) return;
// 收集每个标签的锚点,按屏幕 Y 排序后做垂直去重叠
var placed = new List<(double Y, double X, string Text, IBrush Brush)>();
foreach (var l in lines)
{
if (l.Label == null) continue;
Vector3 best = default;
var bestScore = double.NegativeInfinity;
for (var lon = -180; lon < 180; lon += 6)
{
var world = Vector3.Transform(LatLonToUnit(l.Lat, lon), planet);
var c = Vector3.Transform(world, cam);
if (c.Z < 0.10f) continue;
var score = c.X * 2.0 + c.Z;
if (score > bestScore) { bestScore = score; best = c; }
}
if (double.IsNegativeInfinity(bestScore)) continue;
placed.Add((center.Y - best.Y * radius, center.X + best.X * radius, l.Label, l.Brush));
}
placed.Sort((a, b) => a.Y.CompareTo(b.Y));
const double minGap = 16.0;
var lastY = double.NegativeInfinity;
foreach (var p in placed)
{
var y = p.Y;
if (y - lastY < minGap) y = lastY + minGap;
lastY = y;
DrawLabelChip(ctx, p.Text, new Point(p.X, y), InsetMode ? 9.0 : 10.5, p.Brush, toRight: false);
}
if (double.IsNegativeInfinity(bestScore)) return;
var p = new Point(center.X + best.X * radius, center.Y - best.Y * radius);
DrawLabelChip(ctx, label, p, InsetMode ? 9.0 : 10.5, labelBrush, toRight: false);
}
/// <summary>带深色底衬的标签:压在明亮的地球上也读得清,且不会被画布边缘裁掉。</summary>
@@ -746,7 +758,11 @@ public class CelestialView : Control, IDisposable
double fontSize, IBrush brush, bool toRight)
{
var formatted = new FormattedText(text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
new Typeface(FontFamily.Default, FontStyle.Normal, FontWeight.SemiBold), fontSize, brush);
new Typeface(FontFamily.Default, FontStyle.Normal, FontWeight.SemiBold), fontSize, brush)
{
TextAlignment = TextAlignment.Left,
Trimming = TextTrimming.None
};
var x = toRight ? anchor.X + 9 : Math.Max(3, anchor.X - formatted.Width - 9);
var y = anchor.Y - formatted.Height - 4;
ctx.DrawRectangle(ChipBg, null,
+2 -2
View File
@@ -23,6 +23,6 @@
"type": "NeoRF.EarthModels.RevolutionModelFactory",
"preview": "preview.png",
"apiVersion": 1,
"version": "1.0-0a73a257ec",
"updatedAt": "2026-11-07T10:46:02Z"
"version": "1.0-7380e0cff3",
"updatedAt": "2026-11-07T12:01:08Z"
}
+2 -2
View File
@@ -23,6 +23,6 @@
"type": "NeoRF.EarthModels.RotationModelFactory",
"preview": "preview.png",
"apiVersion": 1,
"version": "1.0-6c97454f58",
"updatedAt": "2026-11-07T10:46:02Z"
"version": "1.0-c74907bbce",
"updatedAt": "2026-11-07T12:01:08Z"
}
+11 -11
View File
@@ -1,30 +1,30 @@
{
"schema": 1,
"generated": "2026-11-07T10:46:02Z",
"generated": "2026-11-07T12:01:09Z",
"repository": "https://gitcode.com/2509_92447106/GC",
"branch": "main",
"modelDir": "model",
"launcher": {
"version": "1.0.0",
"revision": "0d59eff631",
"version": "1.0.1",
"revision": "ba909d4dc3",
"packages": {
"win-x64": {
"path": "dist/GC-win-x64.zip",
"url": "",
"sha256": "7bfb1cfab07934642eff4c52078a8f5f034f1d2432a7613f04674403c70f2b6d",
"size": 78755039
"sha256": "2704fbc3e3acba5630a13a313af0eca45128827ed90e4718fd143a554ca70c3c",
"size": 39379924
},
"win-arm64": {
"path": "dist/GC-win-arm64.zip",
"url": "",
"sha256": "9fddf07fa18cbdb368e37204cfb96f5828207e5fe74ecb31fa66b61fa400fd1c",
"size": 75360988
"sha256": "c8f69370b9e381418a6568aca11cac44cb034e0ab2a99f7e14fcbef1dc503a44",
"size": 37684316
},
"osx-arm64": {
"path": "dist/GC-osx-arm64.zip",
"url": "",
"sha256": "3517548b598eda62c92d873528f39e305c52c6fb246fa5ba5f3613f8b8cb315a",
"size": 39847910
"sha256": "8588892dcfb982b7b52c3d74f3493fd8f27a327a0571095ab62dd4130857e082",
"size": 39852236
},
"osx-x64": {
"path": "dist/GC-osx-x64.zip",
@@ -39,12 +39,12 @@
"models": [
{
"id": "earth-revolution",
"version": "1.0-0a73a257ec",
"version": "1.0-7380e0cff3",
"dir": "model/earth-revolution"
},
{
"id": "earth-rotation",
"version": "1.0-6c97454f58",
"version": "1.0-c74907bbce",
"dir": "model/earth-rotation"
}
]
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Threading;
@@ -23,18 +22,26 @@ namespace EarthModelStudio.Services;
public sealed class GitCodeReleaseRemote : IModelRemote
{
private readonly GitCodeRemote _content;
private readonly HttpClient _http;
private readonly string _releasesUrl;
private readonly Dictionary<string, (string Url, string? Sha256, long Size, string Name)> _assets = new();
public GitCodeReleaseRemote(string? manifestUrl, string? repository, HttpClient? http = null)
// 共享静态 HttpClient:避免每次检查更新都创建新实例导致端口耗尽;
// headers 只在一处设置,多个线程并发读取是线程安全的。
private static readonly HttpClient Http = CreateHttp();
private static HttpClient CreateHttp()
{
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(15) };
client.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio-Updater/1.0");
client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
return client;
}
public GitCodeReleaseRemote(string? manifestUrl, string? repository)
{
_content = new GitCodeRemote(manifestUrl, repository);
var (owner, repo) = ParseOwnerRepo(repository);
_releasesUrl = $"https://api.gitcode.com/api/v5/repos/{owner}/{repo}/releases";
_http = http ?? new HttpClient { Timeout = TimeSpan.FromSeconds(15) };
_http.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio-Updater/1.0");
_http.DefaultRequestHeaders.Accept.ParseAdd("application/json");
DisplayName = (string.IsNullOrWhiteSpace(repository)
? GitCodeRemote.DefaultRepository : repository!.TrimEnd('/')) + " (Release)";
}
@@ -77,7 +84,7 @@ public sealed class GitCodeReleaseRemote : IModelRemote
using var timeout = CancellationTokenSource.CreateLinkedTokenSource(ct);
timeout.CancelAfter(TimeSpan.FromSeconds(12));
var text = await _http.GetStringAsync(_releasesUrl, timeout.Token);
var text = await Http.GetStringAsync(_releasesUrl, timeout.Token);
var trimmed = text.TrimStart();
if (trimmed.Length == 0 || trimmed[0] != '[') return; // 可能是错误页/对象
@@ -20,13 +20,19 @@ public sealed class ReleaseInfo
/// <summary>从 tag_name / name 里抽出的版本号(去掉前缀 v、GC- 等)。</summary>
public string Version => NormalizeVersion(TagName, Name);
private static readonly string[] VersionPrefixes =
{ "v", "V", "GC-", "gc-", "release-", "Release-" };
private static readonly string[] PrereleaseTags =
{ "alpha", "beta", "rc", "pre", "dev", "snapshot" };
public static string NormalizeVersion(string tag, string name)
{
var raw = !string.IsNullOrWhiteSpace(tag) ? tag : name;
if (string.IsNullOrWhiteSpace(raw)) return "";
raw = raw!.Trim();
// "v1.0.1" / "GC-1.0.1" / "release-1.0.1" -> 取第一段像版本号的部分
foreach (var prefix in new[] { "v", "V", "GC-", "gc-", "release-", "Release-" })
foreach (var prefix in VersionPrefixes)
if (raw.StartsWith(prefix, StringComparison.Ordinal)) { raw = raw[prefix.Length..]; break; }
// 形如 GC-1.0.1-Win-amd64 时只取版本段;但 2.3.0-beta 这类预发布串要保留完整。
// 用「后缀是否常见预发布标签」区分,避免把 "-Win" 误当成预发布。
@@ -34,9 +40,7 @@ public sealed class ReleaseInfo
if (dash > 0 && System.Version.TryParse(raw[..dash], out _))
{
var tail = raw[(dash + 1)..].ToLowerInvariant();
bool isPrerelease = tail.StartsWith("alpha") || tail.StartsWith("beta") ||
tail.StartsWith("rc") || tail.StartsWith("pre") ||
tail.StartsWith("dev") || tail.StartsWith("snapshot");
var isPrerelease = Array.Exists(PrereleaseTags, p => tail.StartsWith(p, StringComparison.Ordinal));
if (!isPrerelease) raw = raw[..dash];
}
return raw;
@@ -25,6 +25,16 @@
<GradientStop Color="#1A3057" Offset="0.55" />
<GradientStop Color="#0E1A31" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="TitleBarBg" StartPoint="0%,0%" EndPoint="100%,100%">
<GradientStop Color="#101C33" Offset="0" />
<GradientStop Color="#0B1322" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="SideBgBrush" StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="#0E1729" Offset="0" />
<GradientStop Color="#0A1120" Offset="1" />
</LinearGradientBrush>
</Styles.Resources>
<Style Selector="Window">
@@ -139,12 +149,6 @@
</Transitions>
</Setter>
</Style>
<Style Selector="Button:pointerover">
<Setter Property="RenderTransform" Value="translateY(-1px)" />
</Style>
<Style Selector="Button:pressed">
<Setter Property="RenderTransform" Value="translateY(1px)" />
</Style>
<Style Selector="Button.primary">
<Setter Property="Foreground" Value="White" />
</Style>
@@ -220,6 +224,8 @@
<Style Selector="Button.nav.active /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#1C2C4C" />
<Setter Property="Foreground" Value="#FFFFFF" />
<Setter Property="BorderBrush" Value="{DynamicResource Accent}" />
<Setter Property="BorderThickness" Value="3,0,0,0" />
</Style>
<!-- 输入 -->
@@ -274,14 +280,19 @@
<Setter Property="Foreground" Value="#FFFFFF" />
</Style>
<!-- 所有按钮按下时的缩放反馈(MENU 按钮同样生效) -->
<!--
按下反馈用 TransformOperations 语法,与上面 Button 的
TransformOperationsTransition 保持一致;若改成 ScaleTransform 对象,
状态切换时过渡器无法转换类型,会导致悬停/按下时渲染异常。
-->
<Style Selector="Button">
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
</Style>
<Style Selector="Button:pointerover">
<Setter Property="RenderTransform" Value="scale(0.98)" />
</Style>
<Style Selector="Button:pressed">
<Setter Property="RenderTransform">
<ScaleTransform ScaleX="0.94" ScaleY="0.94" />
</Setter>
<Setter Property="RenderTransform" Value="scale(0.94)" />
</Style>
</Styles>
@@ -5,14 +5,20 @@
Title="{loc:Loc app.name}"
Width="1220" Height="800"
MinWidth="1040" MinHeight="700"
Background="{DynamicResource AppBg}"
Background="#0A1120"
TransparencyLevelHint="None"
SystemDecorations="None"
WindowStartupLocation="CenterScreen">
<!-- 禁用系统标题栏,改用自建标题栏(第 13/14 项) -->
<Grid RowDefinitions="44,*">
<!-- 禁用系统标题栏,改用自建标题栏;外层圆角容器让整个窗口四角变圆。
用深色不透明底,避免透明/亚克力在无边框窗口下露出系统白边。 -->
<Border CornerRadius="16" ClipToBounds="True"
Background="{DynamicResource AppBg}"
BorderBrush="#0A1120" BorderThickness="1"
BoxShadow="0 18 50 0 #400A1226">
<Grid RowDefinitions="44,*">
<!-- 自建标题栏 -->
<Border x:Name="TitleBar" Grid.Row="0" Background="{DynamicResource SideBg}"
<Border x:Name="TitleBar" Grid.Row="0" Background="{DynamicResource TitleBarBg}"
PointerPressed="OnTitleBarPointerPressed">
<Grid ColumnDefinitions="*,Auto,Auto" Margin="16,0,8,0">
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
@@ -33,22 +39,16 @@
<!-- 原内容整体下移一行 -->
<Grid Grid.Row="1" ColumnDefinitions="236,*" RowDefinitions="*,Auto">
<!-- 侧栏 -->
<Border Grid.Column="0" Grid.RowSpan="2" Background="{DynamicResource SideBg}">
<Grid RowDefinitions="Auto,*,Auto" Margin="16,22,16,18">
<!-- 侧栏:品牌已在标题栏展示,这里只留一句副标题,避免重复 -->
<Border Grid.Column="0" Grid.RowSpan="2" Background="{DynamicResource SideBgBrush}">
<Grid RowDefinitions="Auto,*,Auto" Margin="16,20,16,18">
<StackPanel Orientation="Horizontal" Spacing="11">
<Border Width="38" Height="38" CornerRadius="12" Background="#1C2C4C">
<TextBlock Text="◎" FontSize="20" Foreground="#8FB6FF"
HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<StackPanel VerticalAlignment="Center" Spacing="1">
<TextBlock Text="{loc:Loc app.name}" Foreground="#F2F6FF" FontSize="13.5" FontWeight="SemiBold" />
<TextBlock Text="{loc:Loc app.tagline}" Foreground="#7C90B4" FontSize="10" />
</StackPanel>
<StackPanel Spacing="3" Margin="2,0,0,0">
<TextBlock Text="{loc:Loc app.tagline}" Foreground="#7C90B4" FontSize="10.5"
TextWrapping="Wrap" />
</StackPanel>
<StackPanel Grid.Row="1" Margin="0,30,0,0" Spacing="6">
<StackPanel Grid.Row="1" Margin="0,26,0,0" Spacing="6">
<TextBlock Text="MENU" Foreground="#4C5F80" FontSize="9.5" FontWeight="SemiBold" Margin="14,0,0,4" />
<Button Classes="nav" Classes.active="{Binding IsHomeActive}"
Command="{Binding GoHomeCommand}" Content="{loc:Loc nav.home}" />
@@ -95,4 +95,5 @@
</Border>
</Grid>
</Grid>
</Border>
</Window>
@@ -2,6 +2,7 @@ using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
using System.Collections.Generic;
using EarthModelStudio.Models;
@@ -28,12 +29,65 @@ public sealed class PlayerWindow : Window
MinHeight = 680;
Background = new SolidColorBrush(Color.Parse("#05070F"));
WindowStartupLocation = WindowStartupLocation.CenterOwner;
Content = model.View;
// 与启动器一致:去掉系统标题栏,自己做一个极简顶栏(否则 Esc 之外无法关闭)
SystemDecorations = Avalonia.Controls.SystemDecorations.None;
var titleBar = new Border
{
Height = 34,
Background = new SolidColorBrush(Color.Parse("#0A1120")),
Child = new Grid
{
ColumnDefinitions = new ColumnDefinitions("*,Auto"),
Children =
{
new TextBlock
{
Text = package.LocalizedName,
Foreground = new SolidColorBrush(Color.Parse("#A9B8D4")),
FontSize = 11.5,
Margin = new Thickness(14, 0, 0, 0),
VerticalAlignment = VerticalAlignment.Center,
[Grid.ColumnProperty] = 0
},
new Button
{
Content = "✕",
Width = 40,
Height = 28,
Background = Brushes.Transparent,
Foreground = new SolidColorBrush(Color.Parse("#A9B8D4")),
BorderThickness = new Thickness(0),
FontSize = 13,
CornerRadius = new CornerRadius(7),
Margin = new Thickness(0, 0, 8, 0),
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
[Grid.ColumnProperty] = 1
}
}
}
};
titleBar.PointerPressed += OnTitleBarPointerPressed;
if (titleBar.Child is Grid g)
foreach (var child in g.Children)
if (child is Button b) b.Click += (_, _) => Close();
Content = new DockPanel { LastChildFill = true };
DockPanel.SetDock(titleBar, Dock.Top);
((DockPanel)Content).Children.Add(titleBar);
((DockPanel)Content).Children.Add(model.View);
KeyDown += OnKeyDown;
Closed += OnClosed;
}
private void OnTitleBarPointerPressed(object? sender, PointerPressedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
BeginMoveDrag(e);
}
private void OnKeyDown(object? sender, KeyEventArgs e)
{
switch (e.Key)
+11 -11
View File
@@ -1,30 +1,30 @@
{
"schema": 1,
"generated": "2026-11-07T10:46:02Z",
"generated": "2026-11-07T12:01:09Z",
"repository": "https://gitcode.com/2509_92447106/GC",
"branch": "main",
"modelDir": "model",
"launcher": {
"version": "1.0.0",
"revision": "0d59eff631",
"version": "1.0.1",
"revision": "ba909d4dc3",
"packages": {
"win-x64": {
"path": "dist/GC-win-x64.zip",
"url": "",
"sha256": "7bfb1cfab07934642eff4c52078a8f5f034f1d2432a7613f04674403c70f2b6d",
"size": 78755039
"sha256": "2704fbc3e3acba5630a13a313af0eca45128827ed90e4718fd143a554ca70c3c",
"size": 39379924
},
"win-arm64": {
"path": "dist/GC-win-arm64.zip",
"url": "",
"sha256": "9fddf07fa18cbdb368e37204cfb96f5828207e5fe74ecb31fa66b61fa400fd1c",
"size": 75360988
"sha256": "c8f69370b9e381418a6568aca11cac44cb034e0ab2a99f7e14fcbef1dc503a44",
"size": 37684316
},
"osx-arm64": {
"path": "dist/GC-osx-arm64.zip",
"url": "",
"sha256": "3517548b598eda62c92d873528f39e305c52c6fb246fa5ba5f3613f8b8cb315a",
"size": 39847910
"sha256": "8588892dcfb982b7b52c3d74f3493fd8f27a327a0571095ab62dd4130857e082",
"size": 39852236
},
"osx-x64": {
"path": "dist/GC-osx-x64.zip",
@@ -39,12 +39,12 @@
"models": [
{
"id": "earth-revolution",
"version": "1.0-0a73a257ec",
"version": "1.0-7380e0cff3",
"dir": "model/earth-revolution"
},
{
"id": "earth-rotation",
"version": "1.0-6c97454f58",
"version": "1.0-c74907bbce",
"dir": "model/earth-rotation"
}
]