1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-02 20:43:41 +08:00
parent 543ccf2509
commit 5831703156
36 changed files with 799 additions and 254 deletions

View File

@@ -1373,8 +1373,8 @@ pub fn advance_to_new_work_first_level_at(
return Err(PuzzleFieldError::InvalidOperation);
}
// 中文注释:跨作品代表进入一个新作品,关卡序号、切割规格和倒计时都从第 1 关重新开始
let next_level_index = 1;
// 中文注释:跨作品只切换到候选作品的第一张图,运行时关卡序号和难度循环继续累进
let next_level_index = run.current_level_index + 1;
let level_config = resolve_puzzle_level_config(next_level_index);
let grid_size = level_config.grid_size;
let shuffle_seed = puzzle_shuffle_seed(
@@ -1391,8 +1391,8 @@ pub fn advance_to_new_work_first_level_at(
Ok(PuzzleRunSnapshot {
run_id: run.run_id.clone(),
entry_profile_id: next_profile.profile_id.clone(),
cleared_level_count: 0,
entry_profile_id: run.entry_profile_id.clone(),
cleared_level_count: run.cleared_level_count,
current_level_index: next_level_index,
current_grid_size: grid_size,
played_profile_ids,
@@ -2998,7 +2998,7 @@ mod tests {
}
#[test]
fn advance_to_new_work_first_level_restarts_level_progress() {
fn advance_to_new_work_first_profile_level_keeps_runtime_progress() {
let first_profile = build_published_profile("entry", "owner-a", vec!["奇幻", "遗迹"]);
let next_profile = build_published_profile("next", "owner-b", vec!["奇幻", "魔法"]);
let mut run = start_run("run-cross-work".to_string(), &first_profile, 2).expect("run");
@@ -3011,14 +3011,14 @@ mod tests {
let next_run =
advance_to_new_work_first_level_at(&run, &next_profile, 3_000).expect("next run");
assert_eq!(next_run.entry_profile_id, "next");
assert_eq!(next_run.cleared_level_count, 0);
assert_eq!(next_run.current_level_index, 1);
assert_eq!(next_run.entry_profile_id, "entry");
assert_eq!(next_run.cleared_level_count, 3);
assert_eq!(next_run.current_level_index, 4);
let next_level = next_run.current_level.expect("next level");
assert_eq!(next_level.profile_id, "next");
assert_eq!(next_level.level_index, 1);
assert_eq!(next_level.grid_size, 3);
assert_eq!(next_level.time_limit_ms, 300_000);
assert_eq!(next_level.level_index, 4);
assert_eq!(next_level.grid_size, 5);
assert_eq!(next_level.time_limit_ms, 210_000);
}
#[test]

View File

@@ -213,6 +213,8 @@ pub struct PuzzleRunDragInput {
pub struct PuzzleRunNextLevelInput {
pub run_id: String,
pub owner_user_id: String,
#[serde(default)]
pub target_profile_id: Option<String>,
pub advanced_at_micros: i64,
}