Skip to content

Commit 8fbbab7

Browse files
committed
chore(release): merge dev into main for v0.2.31
2 parents 873284b + 6e29c9d commit 8fbbab7

646 files changed

Lines changed: 15332 additions & 1543 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/ritsulib-build/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ inputs:
1111
description: Build artifacts with dev-only package version (9999.0.0-dev.<run>+<sha>).
1212
required: false
1313
default: "false"
14+
upload-artifact:
15+
description: Upload artifacts/github and artifacts/nuget as a GitHub Actions artifact.
16+
required: false
17+
default: "true"
18+
artifact-retention-days:
19+
description: Number of days to retain the uploaded Actions artifact.
20+
required: false
21+
default: "30"
1422

1523
runs:
1624
using: composite
@@ -41,3 +49,23 @@ runs:
4149
--repo-root "${{ github.workspace }}"
4250
--signature-root "${{ inputs.signatures-root }}"
4351
$extra
52+
53+
- name: Resolve artifact name
54+
if: ${{ inputs.upload-artifact == 'true' }}
55+
id: artifact
56+
shell: bash
57+
working-directory: ${{ github.workspace }}
58+
run: |
59+
short_sha="$(git rev-parse --short=12 HEAD)"
60+
echo "name=ritsulib-${short_sha}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> "$GITHUB_OUTPUT"
61+
62+
- name: Upload build artifacts
63+
if: ${{ inputs.upload-artifact == 'true' }}
64+
uses: actions/upload-artifact@v7
65+
with:
66+
name: ${{ steps.artifact.outputs.name }}
67+
path: |
68+
artifacts/github/**
69+
artifacts/nuget/**
70+
if-no-files-found: error
71+
retention-days: ${{ inputs.artifact-retention-days }}

.github/labels.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,7 @@
132132
- name: area/other
133133
color: ededed
134134
description: Area is unclear or does not fit existing categories.
135+
136+
- name: ci/build
137+
color: 5319e7
138+
description: Maintainer-approved one-shot PR build that uploads Actions artifacts.

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Controlled CI build: manual ref builds and maintainer-approved PR builds.
2+
name: Build
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
ref:
8+
description: "Branch, tag, or commit SHA to build. Empty uses the selected workflow ref."
9+
required: false
10+
default: ""
11+
use-dev-version:
12+
description: "Use unique dev package version 9999.0.0-dev.<run>+<sha>."
13+
required: false
14+
type: boolean
15+
default: true
16+
pull_request:
17+
branches: [main, dev]
18+
types: [labeled]
19+
20+
permissions:
21+
contents: read
22+
23+
concurrency:
24+
group: ritsulib-build-${{ github.event_name }}-${{ github.event.pull_request.number || inputs.ref || github.ref }}
25+
cancel-in-progress: false
26+
27+
jobs:
28+
build:
29+
name: Build artifacts
30+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.label.name == 'ci/build' }}
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v6
34+
with:
35+
fetch-depth: 1
36+
persist-credentials: false
37+
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
38+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || inputs.ref || github.ref }}
39+
40+
- name: Checkout API signatures (shallow)
41+
uses: actions/checkout@v6
42+
with:
43+
repository: BAKAOLC/STS2-API-Signatures
44+
path: sts2-api-signatures
45+
fetch-depth: 1
46+
persist-credentials: false
47+
token: ${{ github.token }}
48+
49+
- uses: ./.github/actions/ritsulib-build
50+
with:
51+
signatures-root: ${{ github.workspace }}/sts2-api-signatures
52+
use-dev-version: ${{ github.event_name == 'pull_request' || inputs.use-dev-version }}

Audio/AudioAdaptiveMusicDirector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace STS2RitsuLib.Audio
44
{
55
/// <summary>
66
/// Coordinates adaptive room/combat/victory music playback in response to game lifecycle transitions.
7+
/// 根据游戏生命周期转换,协调自适应房间/战斗/胜利音乐播放。
78
/// </summary>
89
public sealed class AudioAdaptiveMusicDirector : IDisposable
910
{
@@ -32,11 +33,13 @@ private AudioAdaptiveMusicDirector()
3233

3334
/// <summary>
3435
/// Shared singleton director.
36+
/// 共享的单例 director。
3537
/// </summary>
3638
public static AudioAdaptiveMusicDirector Shared { get; } = new();
3739

3840
/// <summary>
3941
/// Disposes framework lifecycle subscriptions owned by this director.
42+
/// 释放此 director 拥有的框架生命周期订阅。
4043
/// </summary>
4144
public void Dispose()
4245
{
@@ -51,6 +54,7 @@ public void Dispose()
5154

5255
/// <summary>
5356
/// Starts following the supplied adaptive music plan and returns a handle for later shutdown.
57+
/// 开始跟随提供的自适应音乐计划,并返回用于稍后关闭的句柄。
5458
/// </summary>
5559
public AudioAdaptiveMusicHandle Attach(AudioAdaptiveMusicPlan plan)
5660
{
@@ -62,6 +66,7 @@ public AudioAdaptiveMusicHandle Attach(AudioAdaptiveMusicPlan plan)
6266

6367
/// <summary>
6468
/// Removes a previously attached adaptive music handle from lifecycle tracking.
69+
/// 从生命周期跟踪中移除先前附加的自适应音乐句柄。
6570
/// </summary>
6671
public void Detach(AudioAdaptiveMusicHandle handle)
6772
{

Audio/AudioAdaptiveMusicHandle.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace STS2RitsuLib.Audio
22
{
33
/// <summary>
44
/// Represents an active adaptive music binding that can switch tracks and restore vanilla state when stopped.
5+
/// 表示一个活动的自适应音乐绑定,可切换曲目,并在停止时恢复原版状态。
56
/// </summary>
67
public sealed class AudioAdaptiveMusicHandle : IDisposable
78
{
@@ -16,6 +17,7 @@ internal AudioAdaptiveMusicHandle(AudioAdaptiveMusicPlan plan)
1617

1718
/// <summary>
1819
/// Stops adaptive playback and unregisters this handle from the shared director.
20+
/// 停止自适应播放,并从共享 director 注销此句柄。
1921
/// </summary>
2022
public void Dispose()
2123
{
@@ -40,6 +42,7 @@ internal void RefreshVolume(float volume)
4042

4143
/// <summary>
4244
/// Stops the current adaptive override and optionally restores vanilla run music.
45+
/// 停止当前自适应覆盖,并可选择恢复原版跑局音乐。
4346
/// </summary>
4447
public void Stop(bool restoreVanillaMusic = true)
4548
{

Audio/AudioAdaptiveMusicPlan.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,61 @@ namespace STS2RitsuLib.Audio
22
{
33
/// <summary>
44
/// Declares room/combat/victory music sources that should follow the game's lifecycle transitions.
5+
/// 声明应跟随游戏生命周期转换的房间/战斗/胜利音乐源。
56
/// </summary>
67
public sealed class AudioAdaptiveMusicPlan
78
{
89
/// <summary>
910
/// Music source to use while the player is in a room outside combat.
11+
/// 玩家处于非战斗房间时使用的音乐源。
1012
/// </summary>
1113
public AudioSource? RoomSource { get; init; }
1214

1315
/// <summary>
1416
/// Music source to use while combat is active.
17+
/// 战斗进行时使用的音乐源。
1518
/// </summary>
1619
public AudioSource? CombatSource { get; init; }
1720

1821
/// <summary>
1922
/// Music source to use after combat victory, when provided.
23+
/// 提供后,在战斗胜利后使用的音乐源。
2024
/// </summary>
2125
public AudioSource? VictorySource { get; init; }
2226

2327
/// <summary>
2428
/// Restores vanilla run music when the adaptive handle is stopped.
29+
/// 自适应句柄停止时恢复原版跑局音乐。
2530
/// </summary>
2631
public bool RestoreVanillaMusicOnStop { get; init; } = true;
2732

2833
/// <summary>
2934
/// Restores vanilla run music after combat ends instead of returning to the room override.
35+
/// 战斗结束后恢复原版跑局音乐,而不是返回房间覆盖。
3036
/// </summary>
3137
public bool RestoreVanillaMusicOnCombatEnd { get; init; } = true;
3238

3339
/// <summary>
3440
/// Refreshes vanilla room track and ambience when entering a room with no room override.
41+
/// 进入没有房间覆盖的房间时刷新原版房间曲目和环境音。
3542
/// </summary>
3643
public bool RefreshVanillaRoomStateOnRoomEnter { get; init; } = true;
3744

3845
/// <summary>
3946
/// Playback options applied when starting room music.
47+
/// 启动房间音乐时应用的播放选项。
4048
/// </summary>
4149
public AudioPlaybackOptions RoomOptions { get; init; } = new() { Scope = AudioLifecycleScope.Room };
4250

4351
/// <summary>
4452
/// Playback options applied when starting combat music.
53+
/// 启动战斗音乐时应用的播放选项。
4554
/// </summary>
4655
public AudioPlaybackOptions CombatOptions { get; init; } = new() { Scope = AudioLifecycleScope.Combat };
4756

4857
/// <summary>
4958
/// Playback options applied when starting victory music.
59+
/// 启动胜利音乐时应用的播放选项。
5060
/// </summary>
5161
public AudioPlaybackOptions VictoryOptions { get; init; } = new() { Scope = AudioLifecycleScope.Combat };
5262
}

Audio/AudioAdaptivePlans.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ namespace STS2RitsuLib.Audio
22
{
33
/// <summary>
44
/// Convenience builders for common adaptive music override patterns.
5+
/// 常见自适应音乐覆盖模式的便捷构建器。
56
/// </summary>
67
public static class AudioAdaptivePlans
78
{
89
/// <summary>
910
/// Builds a plan that overrides combat music and optionally room and victory transitions.
11+
/// 构建覆盖战斗音乐,并可选择处理房间和胜利转换的计划。
1012
/// </summary>
1113
public static AudioAdaptiveMusicPlan CombatOverride(
1214
AudioSource combatSource,
@@ -30,6 +32,7 @@ public static AudioAdaptiveMusicPlan CombatOverride(
3032
/// <summary>
3133
/// Builds a plan that supplies room and combat overrides for the full run without restoring vanilla music after
3234
/// combat.
35+
/// 构建在整个跑局中提供房间和战斗覆盖,且战斗后不恢复原版音乐的计划。
3336
/// </summary>
3437
public static AudioAdaptiveMusicPlan FullRunOverride(
3538
AudioSource roomSource,

Audio/AudioChannelMode.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ namespace STS2RitsuLib.Audio
22
{
33
/// <summary>
44
/// How a named channel should behave when new playback arrives.
5+
/// 命名通道在新播放到达时应如何处理。
56
/// </summary>
67
public enum AudioChannelMode
78
{
89
/// <summary>
910
/// Keep the existing playback and ignore the new request.
11+
/// 保留现有播放并忽略新请求。
1012
/// </summary>
1113
KeepExisting = 0,
1214

1315
/// <summary>
1416
/// Stop the existing playback and replace it with the new one.
17+
/// 停止现有播放并用新播放替换。
1518
/// </summary>
1619
ReplaceExisting = 1,
1720
}

Audio/AudioChannelRegistry.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace STS2RitsuLib.Audio
55
{
66
/// <summary>
77
/// Tracks named channels and tagged playback groups for higher-level replacement and bulk stop semantics.
8+
/// 跟踪命名通道和带标签的播放组,用于更高层的替换和批量停止语义。
89
/// </summary>
910
public sealed class AudioChannelRegistry
1011
{
@@ -19,11 +20,13 @@ private AudioChannelRegistry()
1920

2021
/// <summary>
2122
/// Shared singleton registry.
23+
/// 共享的单例注册表。
2224
/// </summary>
2325
public static AudioChannelRegistry Shared { get; } = new();
2426

2527
/// <summary>
2628
/// Claims a named channel for a handle, optionally replacing the currently attached playback.
29+
/// 为句柄占用命名通道,并可选择替换当前附加的播放。
2730
/// </summary>
2831
public bool TryClaimChannel(string channel, IAudioHandle handle, AudioChannelMode mode, bool allowFadeOut)
2932
{
@@ -52,6 +55,7 @@ public bool TryClaimChannel(string channel, IAudioHandle handle, AudioChannelMod
5255

5356
/// <summary>
5457
/// Removes a handle from any named channel it currently owns.
58+
/// 从句柄当前拥有的任何命名通道中移除该句柄。
5559
/// </summary>
5660
public void ReleaseChannel(IAudioHandle handle)
5761
{
@@ -62,6 +66,7 @@ public void ReleaseChannel(IAudioHandle handle)
6266

6367
/// <summary>
6468
/// Attaches a handle to a tag group for later bulk stop operations.
69+
/// 将句柄附加到标签组,以便稍后执行批量停止操作。
6570
/// </summary>
6671
public void AttachTag(string tag, IAudioHandle handle)
6772
{
@@ -71,6 +76,7 @@ public void AttachTag(string tag, IAudioHandle handle)
7176

7277
/// <summary>
7378
/// Removes a handle from all tracked channels and tag groups.
79+
/// 从所有已跟踪通道和标签组中移除句柄。
7480
/// </summary>
7581
public void Detach(IAudioHandle handle)
7682
{
@@ -81,6 +87,7 @@ public void Detach(IAudioHandle handle)
8187

8288
/// <summary>
8389
/// Stops and releases every handle attached to a tag group.
90+
/// 停止并释放附加到标签组的每个句柄。
8491
/// </summary>
8592
public bool StopTag(string tag, bool allowFadeOut = true)
8693
{
@@ -101,6 +108,7 @@ public bool StopTag(string tag, bool allowFadeOut = true)
101108

102109
/// <summary>
103110
/// Stops and releases the handle currently attached to a named channel.
111+
/// 停止并释放当前附加到命名通道的句柄。
104112
/// </summary>
105113
public bool StopChannel(string channel, bool allowFadeOut = true)
106114
{

Audio/AudioEventHandle.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ namespace STS2RitsuLib.Audio
44
{
55
/// <summary>
66
/// Typed handle for FMOD Studio event instances.
7+
/// FMOD Studio 事件实例的类型化句柄。
78
/// </summary>
89
public sealed class AudioEventHandle : AudioHandleBase
910
{
1011
/// <summary>
1112
/// Initializes a typed handle for an FMOD Studio event instance.
13+
/// 为 FMOD Studio 事件实例初始化类型化句柄。
1214
/// </summary>
1315
public AudioEventHandle(AudioSource source, AudioLifecycleScope scope, GodotObject? rawInstance)
1416
: base(source, scope, rawInstance)

0 commit comments

Comments
 (0)