feat:修复部分问题

This commit is contained in:
2509_92447106 committed 2026-11-07 17:23:41 +08:00
1 parent 153ea88f4f
commit 5760fb77b0
38 files changed
+2273 -200

No files matched your search

+40 -9
View File
@@ -1,13 +1,14 @@
# 模型库(model/)
这个目录是**模型**,包含模型自己的**源码 + 数据 + 功能程序集 + 封面 + 语言包**。
`src/`(启动器)只做三件事:扫描模型、下载模型、开窗口加载模型。**启动器没有任何渲染逻辑**。
`src/`(启动器)只做四件事:扫描模型、下载模型、开窗口加载模型、检查更新。**启动器没有任何渲染逻辑,发布包也不内置模型**。
> 模型相关的一切都在 `model/` 里:共享引擎源码 `model/_engine/`、契约源码 `model/_sdk/`、
> 每个模型自己的源码 `model/<id>/src/`,编译产物与数据 `model/<id>/<id>.model/`。
> 仓库根目录只有 `src/`(启动器)和 `model/`,没有任何旁路目录。
- 启动器查找模型库的顺序:`EMS_MODELS` 环境变量 → 开发态仓库根 `model/` → 可执行文件旁边 `model/` → 用户数据目录
- 发布态模型库在 **`<可执行文件>/.GC/model/`**;开发态直接用仓库根 `model/`
- 优先级:`EMS_MODELS` 环境变量 → 开发态仓库根 `model/` → 发布态 `.GC/model/`
- 一个模型 = 一个文件夹,文件夹名即模型 id;`_sdk/`、`_engine/` 是下划线开头的共享目录,不会被当成模型
- 模型可以单独打包、单独分发,也可以放进 git 仓库当模型源
@@ -15,10 +16,12 @@
```
model/
_sdk/EarthModelStudio.ModelSdk/ # 模型契约(启动器与模型唯一的共享代码)
_engine/ # 共享引擎源码(可选,只有地球模型用)
version.json # 版本清单(与仓库根 version.json 相同,自动生成)
_sdk/EarthModelStudio.ModelSdk/ # 模型契约(启动器与模型唯一的共享代码)
_engine/ # 共享引擎源码
src/ # CelestialView / PlanetTexture / EarthModelView / SphereRaster…
PreviewGen/ # 用模型渲染器生成封面的小工具
VersionStamp/ # 按内容指纹自动打版本、生成 version.json
<模型 id>/
<模型 id>.json # 清单:名称、i18n、版本、程序集入口、封面
src/ # 模型自己的源码(csproj + IModelFactory 实现)
@@ -31,6 +34,23 @@ model/
i18n/en.json
```
## 版本是自动改的
`./build.sh models`(或 `./build.sh stamp`)会调用 `model/_engine/VersionStamp`:
1. 对每个模型,把 `<id>.json`(去掉 `version` / `updatedAt`)与 `<id>.model/` 下所有文件
按路径排序做 SHA-256 指纹,得到版本号 `1.0-<10位指纹>`;
2. 把这个版本写回 `<id>.json` 的 `version` 与 `updatedAt`;
3. 生成仓库根 `version.json` 和 `model/version.json`(内容相同),里面记录
启动器版本、各平台更新包地址、每个模型的 id / 版本 / 仓库目录。
**所以只要改了模型文件,版本号就自动变**,不需要手工维护;内容没变时重复构建版本号保持不变。
客户端启动时读 `version.json`,和 `.GC/settings.json` 里记录的版本一比对就知道要不要下载。
> 改了 `scene.json` 或引擎源码后,跑 `./build.sh models`,再把 `version.json` 和 `model/`
> 推送到 gitcode;客户端下次启动会下载新模型并**本次启动立即生效**。
> 启动器自身更新包由 `./build.sh publish` 生成(`dist/GC-<rid>.zip`),下载后**下次启动才应用**。
## `<id>.json`(模型清单,启动器只读它)
```json
@@ -40,7 +60,8 @@ model/
"nameI18n": { "zh-CN": "地球自转", "en": "Earth Rotation" },
"description": "……",
"descriptionI18n": { "zh-CN": "……", "en": "……" },
"version": "1.0.0",
"version": "1.0-3f9a2c1b7d",
"updatedAt": "2026-11-07T08:00:00Z",
"author": "NeoRF",
"tags": ["astronomy", "geography"],
"assembly": "EarthRotationModel.dll",
@@ -52,6 +73,7 @@ model/
| 字段 | 作用 |
| --- | --- |
| `version` | **自动生成**,模型包内容指纹;客户端靠它判断是否需要更新 |
| `assembly` | 功能程序集文件名,相对 `<id>.model`;留空按 `<id>.dll` 找 |
| `type` | 实现 `IModelFactory` 的完整类型名;留空则自动找第一个实现 |
| `preview` | 封面图,默认 `preview.png` |
@@ -95,6 +117,12 @@ public interface IModelContext
这两个文件的内容完全由模型自己定义(启动器不解析)。地球模型用的是:
- `scene.json`:`defaultView`、`views`、行星参数、颜色、轨道、`lessons` 教学要点
- `orbit.seasonLayout`:`springTopSummerLeft` = **上春分、左夏至**(下秋分、右冬至),季节角度与直射纬度读数不变
- `planet.axialTiltDeg` / `planet.tropicDeg`:教材值 **23.5°**(极圈自动算 90 − 23.5 = 66.5°)
- `orbit.seasons[].declinationDeg`:二分二至的太阳直射纬度(0 / +23.5 / 0 / −23.5),
定格时读数直接取这个值,不用近似公式
- `orbit.seasons[].teachingI18n`:该节气的课堂现象说明(中英双语,写在模型数据里)
- `orbit.seasons[].date`:教材日期(3/21、6/22、9/23、12/22),定格时 HUD 与课堂卡都用它
- `land.json`:大陆轮廓,`{ "polygons": [ { "name": "...", "points": [[lon,lat], ...] } ] }`
## 语言包
@@ -109,7 +137,7 @@ public interface IModelContext
封面是 `preview.png`,由 `model/_engine/PreviewGen` 用**模型自己的渲染器**生成:
```bash
./build.sh models # 编译模型 dll + 生成所有模型封面
./build.sh models # 编译模型 dll + 生成所有模型封面 + 自动打版本
```
## 做一个新模型
@@ -117,9 +145,12 @@ public interface IModelContext
1. 在 `model/<id>/src/` 里新建类库项目(可引用 `model/_engine/src` 的共享代码,也可完全自己写)
2. 写一个 `IModelFactory` 实现:`Prepare` 里读数据算纹理并 `ReportProgress`,`CreateView` 里返回控件
3. 在 `model/<id>/` 放清单和 `<id>.model/` 数据目录,用 `assembly` / `type` 指向你的 dll
4. `./build.sh models` 会自动编译每个模型、把 dll 复制进对应 `<id>.model/`,并生成封面
4. `./build.sh models` 会自动编译每个模型、把 dll 复制进对应 `<id>.model/`、生成封面、打版本并写进 `version.json`
5. 推送仓库,客户端下次启动自动下载 —— 不用改启动器、不用重新发布程序
## 作为模型源分发
把 `model/` 放到任意 git 仓库根目录并推送,用户在「下载」页粘贴仓库链接即可;
启动器读取仓库里的 `model/` 文件夹,一栏一个模型。
- **自动更新(推荐)**:把 `version.json` 和 `model/` 推到 gitcode 仓库,启动器开机自检并下载到 `.GC/model/`
- **离线源**:把整个仓库目录(含 `version.json` + `model/`)拷到 U 盘 / 共享盘,
在 `.GC/settings.json` 填 `updateLocalRoot` 指向它
- **手动导入**:在「下载」页粘贴任意 git 仓库 / zip / 本地目录,读取其中的 `model/` 文件夹
+152
View File
@@ -0,0 +1,152 @@
using System.Security.Cryptography;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
// VersionStamp:构建时自动给模型打版本。
// 用法:dotnet run --project model/_engine/VersionStamp -- <仓库根> <启动器版本>
// 输出:更新 model/<id>/<id>.json 的 version / updatedAt,并生成
// 仓库根 version.json 与 model/version.json(内容相同,便于两种源地址读取)。
var root = args.Length > 0 ? Path.GetFullPath(args[0]) : Directory.GetCurrentDirectory();
var launcherVersion = args.Length > 1 && !string.IsNullOrWhiteSpace(args[1]) ? args[1] : "1.0.0";
var modelRoot = Path.Combine(root, "model");
if (!Directory.Exists(modelRoot))
{
Console.Error.WriteLine($"找不到模型库: {modelRoot}");
return 1;
}
var relaxed = new JsonSerializerOptions
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
static string Rel(string baseDir, string file) =>
Path.GetRelativePath(baseDir, file).Replace('\\', '/');
static bool Distributable(string file)
{
var name = Path.GetFileName(file);
if (name.StartsWith('.')) return false;
if (name.EndsWith(".user", StringComparison.OrdinalIgnoreCase)) return false;
var rel = file.Replace('\\', '/');
return !rel.Contains("/bin/", StringComparison.OrdinalIgnoreCase) &&
!rel.Contains("/obj/", StringComparison.OrdinalIgnoreCase) &&
!rel.EndsWith(".installing", StringComparison.OrdinalIgnoreCase);
}
static string Fingerprint(IEnumerable<byte[]> chunks)
{
using var hash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256);
foreach (var chunk in chunks) hash.AppendData(chunk);
return Convert.ToHexString(hash.GetHashAndReset()).ToLowerInvariant();
}
Console.WriteLine("==> 自动计算模型版本(按模型包内容指纹)");
var models = new List<Dictionary<string, string>>();
foreach (var dir in Directory.GetDirectories(modelRoot)
.OrderBy(p => Path.GetFileName(p), StringComparer.Ordinal))
{
var id = Path.GetFileName(dir);
if (id.StartsWith('_')) continue; // _sdk / _engine 是共享源码,不是模型
var manifestPath = Path.Combine(dir, id + ".json");
var dataDir = Path.Combine(dir, id + ".model");
if (!File.Exists(manifestPath) || !Directory.Exists(dataDir)) continue;
var manifest = JsonNode.Parse(File.ReadAllText(manifestPath))?.AsObject();
if (manifest == null) continue;
// 版本号只由「清单内容 + 模型包数据」决定,重复构建结果稳定
manifest.Remove("version");
manifest.Remove("updatedAt");
var canonical = manifest.ToJsonString(new JsonSerializerOptions { WriteIndented = false });
var chunks = new List<byte[]> { Encoding.UTF8.GetBytes(canonical) };
foreach (var file in Directory.GetFiles(dataDir, "*", SearchOption.AllDirectories)
.Where(Distributable)
.OrderBy(f => Rel(dataDir, f), StringComparer.Ordinal))
{
chunks.Add(Encoding.UTF8.GetBytes("\n" + Rel(dataDir, file) + "\n"));
chunks.Add(File.ReadAllBytes(file));
}
var version = "1.0-" + Fingerprint(chunks)[..10];
manifest["version"] = version;
manifest["updatedAt"] = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ");
File.WriteAllText(manifestPath, manifest.ToJsonString(relaxed) + "\n");
models.Add(new Dictionary<string, string>
{
["id"] = id,
["version"] = version,
["dir"] = "model/" + id
});
Console.WriteLine($" {id,-20} {version}");
}
// 启动器源码指纹(只展示,不触发升级;升级看 launcher.version)
var srcRoot = Path.Combine(root, "src");
var srcChunks = new List<byte[]>();
if (Directory.Exists(srcRoot))
{
foreach (var file in Directory.GetFiles(srcRoot, "*", SearchOption.AllDirectories)
.Where(Distributable)
.Where(f => f.EndsWith(".cs", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".axaml", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".json", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".props", StringComparison.OrdinalIgnoreCase))
.OrderBy(f => Rel(srcRoot, f), StringComparer.Ordinal))
{
srcChunks.Add(Encoding.UTF8.GetBytes(Rel(srcRoot, file) + "\n"));
srcChunks.Add(File.ReadAllBytes(file));
}
}
var launcherRevision = srcChunks.Count > 0 ? Fingerprint(srcChunks)[..10] : "";
var packages = new Dictionary<string, Dictionary<string, object>>();
foreach (var rid in new[] { "win-x64", "win-arm64", "osx-arm64", "osx-x64", "linux-x64" })
{
var entry = new Dictionary<string, object>
{
["path"] = $"dist/GC-{rid}.zip",
["url"] = "" // 大文件建议填 Release 直链;留空则用仓库内 path
};
// 已生成的启动器更新包:把校验值和体积写进清单,供下载端校验
var zipPath = Path.Combine(root, "dist", $"GC-{rid}.zip");
if (File.Exists(zipPath))
{
var bytes = File.ReadAllBytes(zipPath);
entry["sha256"] = Convert.ToHexString(SHA256.HashData(bytes)).ToLowerInvariant();
entry["size"] = bytes.LongLength;
}
packages[rid] = entry;
}
var versionDoc = new Dictionary<string, object>
{
["schema"] = 1,
["generated"] = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"),
["repository"] = "https://gitcode.com/2509_92447106/GC",
["branch"] = "main",
["modelDir"] = "model",
["launcher"] = new Dictionary<string, object>
{
["version"] = launcherVersion,
["revision"] = launcherRevision,
["packages"] = packages
},
["models"] = models
};
var json = JsonSerializer.Serialize(versionDoc, relaxed) + "\n";
File.WriteAllText(Path.Combine(root, "version.json"), json);
File.WriteAllText(Path.Combine(modelRoot, "version.json"), json);
Console.WriteLine($"==> version.json 已生成(启动器 {launcherVersion},模型 {models.Count} 个)");
return 0;
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>VersionStamp</AssemblyName>
<RootNamespace>VersionStamp</RootNamespace>
</PropertyGroup>
</Project>
+72 -15
View File
@@ -152,7 +152,34 @@ public class CelestialView : Control
}
public string DeclinationLabel => DeclinationText(SubsolarLatitude);
public string CurrentDate => DateForAngle(_orbitDeg);
/// <summary>定格在二分二至时,日期直接取模型数据里的教材日期,避免近似公式差一两天。</summary>
public string CurrentDate
{
get
{
if (View == SceneView.Revolution)
{
var season = NearestSeason(2.5);
if (season?.Date != null) return FormatSeasonDate(season.Date);
}
return DateForAngle(_orbitDeg);
}
}
private string FormatSeasonDate(string monthDay)
{
var parts = monthDay.Split('/');
if (parts.Length == 2 && int.TryParse(parts[0], out var m) && int.TryParse(parts[1], out var d)
&& m is >= 1 and <= 12 && d is >= 1 and <= 31)
{
var date = new DateTime(2025, m, d);
var chinese = Texts.Language.StartsWith("zh", StringComparison.OrdinalIgnoreCase);
return date.ToString(chinese ? "M月d日" : "MMM d", CultureInfo.InvariantCulture);
}
return monthDay;
}
public event Action? AnglesChanged;
/// <summary>缩放目标变化(滚轮、按钮、捏合)。</summary>
public event Action<double>? ZoomChanged;
@@ -256,8 +283,9 @@ public class CelestialView : Control
if (!_dragging) return;
var dx = p.X - _dragLast.X;
var dy = p.Y - _dragLast.Y;
_dragLast = p;
DragBy(dx, p.Y - _dragLast.Y + (p.Y - _dragLast.Y));
DragBy(dx, dy);
e.Handled = true;
}
@@ -330,9 +358,13 @@ public class CelestialView : Control
if (!_pinching) { BeginPinch(); return; }
var pts = _pointers.Values.Take(2).ToArray();
var d = Math.Max(8.0, Distance(pts[0], pts[1]));
SetZoom(_pinchStartZoom * d / _pinchStartDistance, immediate: true);
SetZoom(PinchZoom(_pinchStartZoom, _pinchStartDistance, d), immediate: true);
}
/// <summary>捏合比例换算:两指间距放大多少倍,缩放就放大多少倍(限幅 0.6–6)。</summary>
public static double PinchZoom(double startZoom, double startDistance, double currentDistance)
=> Math.Clamp(startZoom * Math.Max(8.0, currentDistance) / Math.Max(8.0, startDistance), 0.6, 6.0);
private static double Distance(Point a, Point b)
{
var dx = a.X - b.X;
@@ -654,11 +686,34 @@ public class CelestialView : Control
t => LatLonToUnit(lat, t * 360.0), 144);
if (label == null) return;
var world = Vector3.Transform(LatLonToUnit(lat, 64), planet);
var c = Vector3.Transform(world, cam);
if (c.Z <= 0.05f) return;
var p = new Point(center.X + c.X * radius, center.Y - c.Y * radius);
DrawText(ctx, label, p.X + 5, p.Y - 13, 10.5, labelBrush, FontWeight.SemiBold);
// 找该纬线上「最靠右且可见」的点作为标签锚点:
// 地球自转时标签始终留在可见半球右侧,不会忽隐忽现
Vector3 best = default;
var bestScore = double.NegativeInfinity;
for (var lon = -180; lon < 180; lon += 6)
{
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; }
}
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>
private static void DrawLabelChip(DrawingContext ctx, string text, Point anchor,
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);
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,
new Rect(x - 5, y - 2, formatted.Width + 10, formatted.Height + 5), 4, 4);
ctx.DrawText(formatted, new Point(x, y));
}
private void DrawGraticule(DrawingContext ctx, Matrix4x4 cam, Matrix4x4 planet, Point center, double radius)
@@ -732,11 +787,12 @@ public class CelestialView : Control
{
if (light.Z <= 0.02f) return;
var p = new Point(center.X + light.X * radius, center.Y - light.Y * radius);
ctx.DrawEllipse(SubsolarGlowBrush, null, p, 9, 9);
ctx.DrawEllipse(null, SubsolarPen, p, 5, 5);
var marker = InsetMode ? 6.5 : 5.0;
ctx.DrawEllipse(SubsolarGlowBrush, null, p, marker * 2.5, marker * 2.5);
ctx.DrawEllipse(null, SubsolarPen, p, marker, marker);
if (withLabel)
DrawText(ctx, Texts["directPoint"] + " " + DeclinationText(SubsolarLatitude),
p.X + 12, p.Y - 9, 11.5, SubsolarBrush, FontWeight.SemiBold);
DrawLabelChip(ctx, Texts["directPoint"] + " " + DeclinationText(SubsolarLatitude),
p, 11.5, SubsolarBrush, toRight: p.X < center.X);
}
private void DrawAxis(DrawingContext ctx, Matrix4x4 cam, Matrix4x4 planet, Point center, double radius,
@@ -780,7 +836,7 @@ public class CelestialView : Control
var cam = CameraMatrix(0, _camElev);
var theta = Deg2Rad(_orbitDeg);
var earthPos = new Vector3((float)(-a * Math.Sin(theta)), 0, (float)(a * Math.Cos(theta)));
var earthPos = new Vector3((float)(-a * Math.Sin(theta)), 0, (float)(-a * Math.Cos(theta)));
var earthScreen = ToScreen(earthPos, cam, center);
var lightWorld = Vector3.Normalize(-earthPos);
var lightCam = Vector3.TransformNormal(lightWorld, cam);
@@ -864,7 +920,7 @@ public class CelestialView : Control
for (var i = 0; i <= 240; i++)
{
var t = i / 240.0 * Math.PI * 2;
var p = new Vector3((float)(-a * Math.Sin(t)), 0, (float)(a * Math.Cos(t)));
var p = new Vector3((float)(-a * Math.Sin(t)), 0, (float)(-a * Math.Cos(t)));
var c = Vector3.Transform(p, cam);
var sp = new Point(center.X + c.X, center.Y - c.Y);
if (c.Z < 0)
@@ -899,7 +955,7 @@ public class CelestialView : Control
foreach (var s in seasons)
{
var t = Deg2Rad(s.AngleDeg);
var pos = new Vector3((float)(-a * Math.Sin(t)), 0, (float)(a * Math.Cos(t)));
var pos = new Vector3((float)(-a * Math.Sin(t)), 0, (float)(-a * Math.Cos(t)));
var outer = pos * 1.19f;
var p = ToScreen(outer, cam, center);
ctx.DrawEllipse(SeasonDotBrush, null, ToScreen(pos, cam, center), 2.4, 2.4);
@@ -985,6 +1041,7 @@ public class CelestialView : Control
private static readonly IBrush AxisBrush = new SolidColorBrush(Color.FromArgb(220, 255, 214, 130));
private static readonly IBrush SubsolarBrush = new SolidColorBrush(Color.FromArgb(240, 255, 236, 170));
private static readonly IBrush SubsolarGlowBrush = new SolidColorBrush(Color.FromArgb(64, 255, 214, 110));
private static readonly IBrush ChipBg = new SolidColorBrush(Color.FromArgb(185, 8, 16, 34));
private static readonly IBrush TropicBrush = new SolidColorBrush(Color.FromArgb(240, 255, 196, 120));
private static readonly IBrush PolarBrush = new SolidColorBrush(Color.FromArgb(210, 164, 210, 255));
private static readonly Pen SubsolarPen = new Pen(new SolidColorBrush(Color.FromArgb(230, 255, 226, 150)), 1.4);
+13 -6
View File
@@ -45,6 +45,7 @@ public sealed class EarthModelView : UserControl
private StackPanel? _seasonPanel;
private Border? _lessons;
private Border? _closeupHost;
private TextBlock? _closeupLabel;
private ModelButton? _playButton;
private ModelButton? _overheadButton;
private ModelButton? _closeupButton;
@@ -71,6 +72,8 @@ public sealed class EarthModelView : UserControl
_runtime = runtime;
_texts = ModelStrings.Load(context.DataDirectory, context.Language);
_views = ResolveViews(runtime.Scene);
// 自转模型主画布本身就是放大的地球,不需要再来一份特写
_showCloseup = IsRevolution;
Background = new SolidColorBrush(Color.Parse("#05070F"));
@@ -535,13 +538,14 @@ public sealed class EarthModelView : UserControl
});
readouts.Children.Add(_cardDirect);
readouts.Children.Add(_cardNote);
readouts.Children.Add(new TextBlock
_closeupLabel = new TextBlock
{
Text = _texts["closeup"],
Foreground = MutedBrush,
FontSize = 11,
Margin = new Thickness(0, 6, 0, 0)
});
};
readouts.Children.Add(_closeupLabel);
readouts.Children.Add(_closeupHost);
var list = new StackPanel { Spacing = 2 };
@@ -675,13 +679,15 @@ public sealed class EarthModelView : UserControl
_cardTitle.Text = season != null
? _texts[season.Key]
: (IsRevolution ? _texts["seasons"] : _texts.Pick(_runtime.Scene.NameI18n, _texts["title"]));
_cardDate!.Text = _canvas.CurrentDate + (season?.Date != null ? " · " + season.Date : "");
_cardDate!.Text = IsRevolution ? _canvas.CurrentDate : _texts["dayNight"];
_cardDirect!.Text = season?.DeclinationDeg.HasValue == true
? FormatDeclination(season.DeclinationDeg.Value)
: _canvas.DeclinationLabel;
_cardNote!.Text = season != null
? _texts.Pick(season.TeachingI18n, _texts["orbitTeach"])
: _texts["orbitTeach"];
_cardNote!.Text = !IsRevolution
? _texts["rotationTeach"]
: season != null
? _texts.Pick(season.TeachingI18n, _texts["orbitTeach"])
: _texts["orbitTeach"];
if (_showCloseup && (double.IsNaN(_lastDeclination) || Math.Abs(_lastDeclination - decl) > 0.04))
{
@@ -811,6 +817,7 @@ public sealed class EarthModelView : UserControl
if (_lessons != null) _lessons.IsVisible = _showLessons;
if (_seasonPanel != null) _seasonPanel.IsVisible = IsRevolution;
if (_closeupHost != null) _closeupHost.IsVisible = _showCloseup;
if (_closeupLabel != null) _closeupLabel.IsVisible = _showCloseup;
}
/// <summary>带悬停过渡的按钮:本地基础色 + 悬停提亮。</summary>
+4
View File
@@ -106,6 +106,8 @@ internal static class DefaultTexts
["sideview"] = "侧视",
["zoom"] = "缩放",
["orbitTeach"] = "太阳直射点在南北回归线之间往返,形成四季更替。",
["rotationTeach"] = "晨昏线把地球分成昼半球与夜半球;自转产生昼夜交替与地方时差。",
["dayNight"] = "昼夜交替周期 24 小时",
["lat.equator"] = "赤道",
["lat.tropicN"] = "北回归线 23.5°N",
["lat.tropicS"] = "南回归线 23.5°S",
@@ -157,6 +159,8 @@ internal static class DefaultTexts
["sideview"] = "Side view",
["zoom"] = "Zoom",
["orbitTeach"] = "The subsolar point travels between the tropics, producing the seasons.",
["rotationTeach"] = "The terminator splits day and night; rotation drives the day–night cycle and local time.",
["dayNight"] = "Day–night cycle: 24 h",
["lat.equator"] = "Equator",
["lat.tropicN"] = "Tropic of Cancer 23.5°N",
["lat.tropicS"] = "Tropic of Capricorn 23.5°S",
+2
View File
@@ -50,6 +50,8 @@ public sealed class OrbitDefinition
public double SemiMajorAxis { get; set; } = 4.0;
public double Eccentricity { get; set; } = 0.0167;
public bool Show { get; set; } = true;
/// <summary>节气方位声明:springTopSummerLeft = 上春分 / 左夏至(引擎按此布局绘制轨道)。</summary>
public string SeasonLayout { get; set; } = "springTopSummerLeft";
public List<SeasonPoint> Seasons { get; set; } = new();
}
+3 -3
View File
@@ -6,7 +6,6 @@
"zh-CN": "地球公转",
"en": "Earth Revolution"
},
"version": "1.0.0",
"author": "NeoRF",
"description": "四季更替、黄赤交角与二分二至",
"descriptionI18n": {
@@ -20,9 +19,10 @@
],
"entry": "scene.json",
"license": "MIT",
"updatedAt": "2026-11-07",
"assembly": "EarthRevolutionModel.dll",
"type": "NeoRF.EarthModels.RevolutionModelFactory",
"preview": "preview.png",
"apiVersion": 1
"apiVersion": 1,
"version": "1.0-b8139bb568",
"updatedAt": "2026-11-07T09:23:04Z"
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 67 KiB

@@ -42,6 +42,7 @@
"semiMajorAxis": 4.0,
"eccentricity": 0.0167,
"show": true,
"seasonLayout": "springTopSummerLeft",
"seasons": [
{
"angleDeg": 0,
+3 -3
View File
@@ -6,7 +6,6 @@
"zh-CN": "地球自转",
"en": "Earth Rotation"
},
"version": "1.0.0",
"author": "NeoRF",
"description": "昼夜交替、晨昏线与太阳直射点",
"descriptionI18n": {
@@ -20,9 +19,10 @@
],
"entry": "scene.json",
"license": "MIT",
"updatedAt": "2026-11-07",
"assembly": "EarthRotationModel.dll",
"type": "NeoRF.EarthModels.RotationModelFactory",
"preview": "preview.png",
"apiVersion": 1
"apiVersion": 1,
"version": "1.0-52ac06496e",
"updatedAt": "2026-11-07T09:23:04Z"
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 178 KiB

+51
View File
@@ -0,0 +1,51 @@
{
"schema": 1,
"generated": "2026-11-07T09:23:04Z",
"repository": "https://gitcode.com/2509_92447106/GC",
"branch": "main",
"modelDir": "model",
"launcher": {
"version": "1.0.0",
"revision": "eee4fbbfbc",
"packages": {
"win-x64": {
"path": "dist/GC-win-x64.zip",
"url": "",
"sha256": "dbd4997d111c4a60c5d06eadaf0962f41750bafa5b26946e216200ddf7d6c1cf",
"size": 39378935
},
"win-arm64": {
"path": "dist/GC-win-arm64.zip",
"url": "",
"sha256": "662589f9b315357702d855c46b12c1d088475bdf160c0c042793f2af404f8cb7",
"size": 37679907
},
"osx-arm64": {
"path": "dist/GC-osx-arm64.zip",
"url": "",
"sha256": "01dbf8b4787717aeb804a157ebaf0a75b8fffb1e9ab5e3fb0279fa9299ebee0a",
"size": 39853456
},
"osx-x64": {
"path": "dist/GC-osx-x64.zip",
"url": ""
},
"linux-x64": {
"path": "dist/GC-linux-x64.zip",
"url": ""
}
}
},
"models": [
{
"id": "earth-revolution",
"version": "1.0-b8139bb568",
"dir": "model/earth-revolution"
},
{
"id": "earth-rotation",
"version": "1.0-52ac06496e",
"dir": "model/earth-rotation"
}
]
}