This commit is contained in:
2026-04-22 23:44:57 +08:00
parent 76ac9d22a5
commit 84dc92646a
484 changed files with 9598 additions and 9135 deletions

View File

@@ -66,8 +66,7 @@ use module_puzzle::{
};
use module_runtime::{
RuntimeBrowseHistoryRecord, RuntimeBrowseHistoryThemeMode, RuntimePlatformTheme,
RuntimeProfileDashboardRecord, RuntimeProfilePlayStatsRecord,
RuntimeProfileSaveArchiveRecord,
RuntimeProfileDashboardRecord, RuntimeProfilePlayStatsRecord, RuntimeProfileSaveArchiveRecord,
RuntimeProfileWalletLedgerEntryRecord, RuntimeProfileWalletLedgerSourceType,
RuntimeSettingsRecord, RuntimeSnapshotRecord, build_runtime_browse_history_clear_input,
build_runtime_browse_history_list_input, build_runtime_browse_history_record,
@@ -125,8 +124,7 @@ use crate::module_bindings::{
BigFishAgentMessageKind as BindingBigFishAgentMessageKind,
BigFishAgentMessageRole as BindingBigFishAgentMessageRole,
BigFishAgentMessageSnapshot as BindingBigFishAgentMessageSnapshot,
BigFishAnchorItem as BindingBigFishAnchorItem,
BigFishAnchorPack as BindingBigFishAnchorPack,
BigFishAnchorItem as BindingBigFishAnchorItem, BigFishAnchorPack as BindingBigFishAnchorPack,
BigFishAnchorStatus as BindingBigFishAnchorStatus,
BigFishAssetCoverage as BindingBigFishAssetCoverage,
BigFishAssetGenerateInput as BindingBigFishAssetGenerateInput,
@@ -152,12 +150,11 @@ use crate::module_bindings::{
BigFishSessionGetInput as BindingBigFishSessionGetInput,
BigFishSessionProcedureResult as BindingBigFishSessionProcedureResult,
BigFishSessionSnapshot as BindingBigFishSessionSnapshot,
BigFishVector2 as BindingBigFishVector2,
CombatOutcome as BindingCombatOutcome,
CustomWorldAgentMessageSnapshot as BindingCustomWorldAgentMessageSnapshot,
BigFishVector2 as BindingBigFishVector2, CombatOutcome as BindingCombatOutcome,
CustomWorldAgentActionExecuteInput as BindingCustomWorldAgentActionExecuteInput,
CustomWorldAgentActionExecuteResult as BindingCustomWorldAgentActionExecuteResult,
CustomWorldAgentCardDetailGetInput as BindingCustomWorldAgentCardDetailGetInput,
CustomWorldAgentMessageSnapshot as BindingCustomWorldAgentMessageSnapshot,
CustomWorldAgentMessageSubmitInput as BindingCustomWorldAgentMessageSubmitInput,
CustomWorldAgentOperationGetInput as BindingCustomWorldAgentOperationGetInput,
CustomWorldAgentOperationProcedureResult as BindingCustomWorldAgentOperationProcedureResult,
@@ -175,6 +172,7 @@ use crate::module_bindings::{
CustomWorldGalleryListResult as BindingCustomWorldGalleryListResult,
CustomWorldLibraryDetailInput as BindingCustomWorldLibraryDetailInput,
CustomWorldLibraryMutationResult as BindingCustomWorldLibraryMutationResult,
CustomWorldProfileDeleteInput as BindingCustomWorldProfileDeleteInput,
CustomWorldProfileListInput as BindingCustomWorldProfileListInput,
CustomWorldProfileListResult as BindingCustomWorldProfileListResult,
CustomWorldProfilePublishInput as BindingCustomWorldProfilePublishInput,
@@ -185,10 +183,10 @@ use crate::module_bindings::{
CustomWorldPublishWorldInput as BindingCustomWorldPublishWorldInput,
CustomWorldPublishWorldResult as BindingCustomWorldPublishWorldResult,
CustomWorldPublishedProfileCompileSnapshot as BindingCustomWorldPublishedProfileCompileSnapshot,
CustomWorldThemeMode as BindingCustomWorldThemeMode,
CustomWorldWorkSummarySnapshot as BindingCustomWorldWorkSummarySnapshot,
CustomWorldWorksListInput as BindingCustomWorldWorksListInput,
CustomWorldWorksListResult as BindingCustomWorldWorksListResult,
CustomWorldThemeMode as BindingCustomWorldThemeMode, DbConnection,
CustomWorldWorksListResult as BindingCustomWorldWorksListResult, DbConnection,
InventoryContainerKind as BindingInventoryContainerKind,
InventoryEquipmentSlot as BindingInventoryEquipmentSlot,
InventoryItemRarity as BindingInventoryItemRarity,
@@ -201,6 +199,24 @@ use crate::module_bindings::{
NpcInteractionStatus as BindingNpcInteractionStatus,
NpcRelationStance as BindingNpcRelationStance, NpcRelationState as BindingNpcRelationState,
NpcStanceProfile as BindingNpcStanceProfile, NpcStateSnapshot as BindingNpcStateSnapshot,
PuzzleAgentMessageSubmitInput as BindingPuzzleAgentMessageSubmitInput,
PuzzleAgentSessionCreateInput as BindingPuzzleAgentSessionCreateInput,
PuzzleAgentSessionGetInput as BindingPuzzleAgentSessionGetInput,
PuzzleAgentSessionProcedureResult as BindingPuzzleAgentSessionProcedureResult,
PuzzleDraftCompileInput as BindingPuzzleDraftCompileInput,
PuzzleGeneratedImagesSaveInput as BindingPuzzleGeneratedImagesSaveInput,
PuzzlePublishInput as BindingPuzzlePublishInput,
PuzzleRunDragInput as BindingPuzzleRunDragInput, PuzzleRunGetInput as BindingPuzzleRunGetInput,
PuzzleRunNextLevelInput as BindingPuzzleRunNextLevelInput,
PuzzleRunProcedureResult as BindingPuzzleRunProcedureResult,
PuzzleRunStartInput as BindingPuzzleRunStartInput,
PuzzleRunSwapInput as BindingPuzzleRunSwapInput,
PuzzleSelectCoverImageInput as BindingPuzzleSelectCoverImageInput,
PuzzleWorkGetInput as BindingPuzzleWorkGetInput,
PuzzleWorkProcedureResult as BindingPuzzleWorkProcedureResult,
PuzzleWorkUpsertInput as BindingPuzzleWorkUpsertInput,
PuzzleWorksListInput as BindingPuzzleWorksListInput,
PuzzleWorksProcedureResult as BindingPuzzleWorksProcedureResult,
ResolveCombatActionInput as BindingResolveCombatActionInput,
ResolveCombatActionProcedureResult as BindingResolveCombatActionProcedureResult,
ResolveCombatActionResult as BindingResolveCombatActionResult,
@@ -223,14 +239,14 @@ use crate::module_bindings::{
RuntimeProfileDashboardGetInput as BindingRuntimeProfileDashboardGetInput,
RuntimeProfileDashboardProcedureResult as BindingRuntimeProfileDashboardProcedureResult,
RuntimeProfileDashboardSnapshot as BindingRuntimeProfileDashboardSnapshot,
RuntimeProfileSaveArchiveListInput as BindingRuntimeProfileSaveArchiveListInput,
RuntimeProfileSaveArchiveProcedureResult as BindingRuntimeProfileSaveArchiveProcedureResult,
RuntimeProfileSaveArchiveResumeInput as BindingRuntimeProfileSaveArchiveResumeInput,
RuntimeProfileSaveArchiveSnapshot as BindingRuntimeProfileSaveArchiveSnapshot,
RuntimeProfilePlayStatsGetInput as BindingRuntimeProfilePlayStatsGetInput,
RuntimeProfilePlayStatsProcedureResult as BindingRuntimeProfilePlayStatsProcedureResult,
RuntimeProfilePlayStatsSnapshot as BindingRuntimeProfilePlayStatsSnapshot,
RuntimeProfilePlayedWorldSnapshot as BindingRuntimeProfilePlayedWorldSnapshot,
RuntimeProfileSaveArchiveListInput as BindingRuntimeProfileSaveArchiveListInput,
RuntimeProfileSaveArchiveProcedureResult as BindingRuntimeProfileSaveArchiveProcedureResult,
RuntimeProfileSaveArchiveResumeInput as BindingRuntimeProfileSaveArchiveResumeInput,
RuntimeProfileSaveArchiveSnapshot as BindingRuntimeProfileSaveArchiveSnapshot,
RuntimeProfileWalletLedgerEntrySnapshot as BindingRuntimeProfileWalletLedgerEntrySnapshot,
RuntimeProfileWalletLedgerListInput as BindingRuntimeProfileWalletLedgerListInput,
RuntimeProfileWalletLedgerProcedureResult as BindingRuntimeProfileWalletLedgerProcedureResult,
@@ -239,29 +255,10 @@ use crate::module_bindings::{
RuntimeSettingProcedureResult as BindingRuntimeSettingProcedureResult,
RuntimeSettingSnapshot as BindingRuntimeSettingSnapshot,
RuntimeSettingUpsertInput as BindingRuntimeSettingUpsertInput,
RuntimeSnapshot as BindingRuntimeSnapshot,
RuntimeSnapshotDeleteInput as BindingRuntimeSnapshotDeleteInput,
RuntimeSnapshotGetInput as BindingRuntimeSnapshotGetInput,
RuntimeSnapshotProcedureResult as BindingRuntimeSnapshotProcedureResult,
PuzzleAgentMessageSubmitInput as BindingPuzzleAgentMessageSubmitInput,
PuzzleAgentSessionCreateInput as BindingPuzzleAgentSessionCreateInput,
PuzzleAgentSessionGetInput as BindingPuzzleAgentSessionGetInput,
PuzzleAgentSessionProcedureResult as BindingPuzzleAgentSessionProcedureResult,
PuzzleDraftCompileInput as BindingPuzzleDraftCompileInput,
PuzzleGeneratedImagesSaveInput as BindingPuzzleGeneratedImagesSaveInput,
PuzzlePublishInput as BindingPuzzlePublishInput,
PuzzleRunDragInput as BindingPuzzleRunDragInput,
PuzzleRunGetInput as BindingPuzzleRunGetInput,
PuzzleRunNextLevelInput as BindingPuzzleRunNextLevelInput,
PuzzleRunProcedureResult as BindingPuzzleRunProcedureResult,
PuzzleRunStartInput as BindingPuzzleRunStartInput,
PuzzleRunSwapInput as BindingPuzzleRunSwapInput,
PuzzleSelectCoverImageInput as BindingPuzzleSelectCoverImageInput,
PuzzleWorkGetInput as BindingPuzzleWorkGetInput,
PuzzleWorkProcedureResult as BindingPuzzleWorkProcedureResult,
PuzzleWorkUpsertInput as BindingPuzzleWorkUpsertInput,
PuzzleWorksListInput as BindingPuzzleWorksListInput,
PuzzleWorksProcedureResult as BindingPuzzleWorksProcedureResult,
RuntimeSnapshot as BindingRuntimeSnapshot,
RuntimeSnapshotUpsertInput as BindingRuntimeSnapshotUpsertInput,
StoryContinueInput as BindingStoryContinueInput, StoryEventKind as BindingStoryEventKind,
StoryEventSnapshot as BindingStoryEventSnapshot, StorySessionInput as BindingStorySessionInput,
@@ -270,8 +267,8 @@ use crate::module_bindings::{
StorySessionStateInput as BindingStorySessionStateInput,
StorySessionStateProcedureResult as BindingStorySessionStateProcedureResult,
StorySessionStatus as BindingStorySessionStatus,
append_ai_text_chunk_and_return_procedure::append_ai_text_chunk_and_return as _,
advance_puzzle_next_level_procedure::advance_puzzle_next_level as _,
append_ai_text_chunk_and_return_procedure::append_ai_text_chunk_and_return as _,
attach_ai_result_reference_and_return_procedure::attach_ai_result_reference_and_return as _,
begin_story_session_and_return_procedure::begin_story_session_and_return as _,
bind_asset_object_to_entity_and_return_procedure::bind_asset_object_to_entity_and_return as _,
@@ -288,6 +285,7 @@ use crate::module_bindings::{
create_big_fish_session_procedure::create_big_fish_session as _,
create_custom_world_agent_session_procedure::create_custom_world_agent_session as _,
create_puzzle_agent_session_procedure::create_puzzle_agent_session as _,
delete_custom_world_profile_and_return_procedure::delete_custom_world_profile_and_return as _,
delete_runtime_snapshot_and_return_procedure::delete_runtime_snapshot_and_return as _,
drag_puzzle_piece_or_group_procedure::drag_puzzle_piece_or_group as _,
execute_custom_world_agent_action_procedure::execute_custom_world_agent_action as _,
@@ -328,10 +326,10 @@ use crate::module_bindings::{
resume_profile_save_archive_and_return_procedure::resume_profile_save_archive_and_return as _,
save_puzzle_generated_images_procedure::save_puzzle_generated_images as _,
select_puzzle_cover_image_procedure::select_puzzle_cover_image as _,
start_big_fish_run_procedure::start_big_fish_run as _,
start_puzzle_run_procedure::start_puzzle_run as _,
start_ai_task_reducer::start_ai_task as _,
start_ai_task_stage_reducer::start_ai_task_stage as _,
start_big_fish_run_procedure::start_big_fish_run as _,
start_puzzle_run_procedure::start_puzzle_run as _,
submit_big_fish_input_procedure::submit_big_fish_input as _,
submit_big_fish_message_procedure::submit_big_fish_message as _,
submit_custom_world_agent_message_procedure::submit_custom_world_agent_message as _,
@@ -749,6 +747,31 @@ impl SpacetimeClient {
.await
}
pub async fn delete_custom_world_profile(
&self,
profile_id: String,
owner_user_id: String,
deleted_at_micros: i64,
) -> Result<Vec<CustomWorldLibraryEntryRecord>, SpacetimeClientError> {
let procedure_input = BindingCustomWorldProfileDeleteInput {
profile_id,
owner_user_id,
deleted_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.delete_custom_world_profile_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_profile_list_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn list_custom_world_gallery_entries(
&self,
) -> Result<Vec<CustomWorldGalleryEntryRecord>, SpacetimeClientError> {
@@ -877,14 +900,15 @@ impl SpacetimeClient {
let procedure_input = BindingCustomWorldWorksListInput { owner_user_id };
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.list_custom_world_works_then(procedure_input, move |_, result| {
connection.procedures().list_custom_world_works_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_works_list_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -954,14 +978,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.create_puzzle_agent_session_then(procedure_input, move |_, result| {
connection.procedures().create_puzzle_agent_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_agent_session_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -1109,15 +1134,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().publish_puzzle_work_then(
procedure_input,
move |_, result| {
connection
.procedures()
.publish_puzzle_work_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_work_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1129,15 +1153,14 @@ impl SpacetimeClient {
let procedure_input = BindingPuzzleWorksListInput { owner_user_id };
self.call_after_connect(move |connection, sender| {
connection.procedures().list_puzzle_works_then(
procedure_input,
move |_, result| {
connection
.procedures()
.list_puzzle_works_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_works_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1178,15 +1201,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().update_puzzle_work_then(
procedure_input,
move |_, result| {
connection
.procedures()
.update_puzzle_work_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_work_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1195,12 +1217,14 @@ impl SpacetimeClient {
&self,
) -> Result<Vec<PuzzleWorkProfileRecord>, SpacetimeClientError> {
self.call_after_connect(move |connection, sender| {
connection.procedures().list_puzzle_gallery_then(move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_works_procedure_result);
send_once(&sender, mapped);
});
connection
.procedures()
.list_puzzle_gallery_then(move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_works_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
@@ -1237,15 +1261,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().start_puzzle_run_then(
procedure_input,
move |_, result| {
connection
.procedures()
.start_puzzle_run_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_run_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1261,15 +1284,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().get_puzzle_run_then(
procedure_input,
move |_, result| {
connection
.procedures()
.get_puzzle_run_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_run_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1287,15 +1309,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().swap_puzzle_pieces_then(
procedure_input,
move |_, result| {
connection
.procedures()
.swap_puzzle_pieces_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_run_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1365,14 +1386,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.create_big_fish_session_then(procedure_input, move |_, result| {
connection.procedures().create_big_fish_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_big_fish_session_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -1388,15 +1410,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().get_big_fish_session_then(
procedure_input,
move |_, result| {
connection
.procedures()
.get_big_fish_session_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_big_fish_session_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1519,15 +1540,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().start_big_fish_run_then(
procedure_input,
move |_, result| {
connection
.procedures()
.start_big_fish_run_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_big_fish_run_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1734,15 +1754,14 @@ impl SpacetimeClient {
);
self.call_after_connect(move |connection, sender| {
connection.procedures().get_runtime_snapshot_then(
procedure_input,
move |_, result| {
connection
.procedures()
.get_runtime_snapshot_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_snapshot_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1769,15 +1788,14 @@ impl SpacetimeClient {
);
self.call_after_connect(move |connection, sender| {
connection.procedures().upsert_runtime_snapshot_and_return_then(
procedure_input,
move |_, result| {
connection
.procedures()
.upsert_runtime_snapshot_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_snapshot_required_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1792,15 +1810,14 @@ impl SpacetimeClient {
);
self.call_after_connect(move |connection, sender| {
connection.procedures().delete_runtime_snapshot_and_return_then(
procedure_input,
move |_, result| {
connection
.procedures()
.delete_runtime_snapshot_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_snapshot_delete_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -1832,7 +1849,8 @@ impl SpacetimeClient {
&self,
user_id: String,
world_key: String,
) -> Result<(RuntimeProfileSaveArchiveRecord, RuntimeSnapshotRecord), SpacetimeClientError> {
) -> Result<(RuntimeProfileSaveArchiveRecord, RuntimeSnapshotRecord), SpacetimeClientError>
{
let procedure_input = map_runtime_profile_save_archive_resume_input(
build_runtime_profile_save_archive_resume_input(user_id, world_key)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
@@ -1841,15 +1859,12 @@ impl SpacetimeClient {
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.resume_profile_save_archive_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_profile_save_archive_resume_procedure_result);
send_once(&sender, mapped);
},
);
.resume_profile_save_archive_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_profile_save_archive_resume_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
@@ -2822,7 +2837,9 @@ fn map_runtime_snapshot_required_procedure_result(
result: BindingRuntimeSnapshotProcedureResult,
) -> Result<RuntimeSnapshotRecord, SpacetimeClientError> {
map_runtime_snapshot_procedure_result(result)?.ok_or_else(|| {
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回 runtime snapshot 快照".to_string())
SpacetimeClientError::Procedure(
"SpacetimeDB procedure 未返回 runtime snapshot 快照".to_string(),
)
})
}
@@ -2847,9 +2864,9 @@ fn map_runtime_profile_save_archive_list_procedure_result(
.entries
.into_iter()
.map(|snapshot| {
build_runtime_profile_save_archive_record(
map_runtime_profile_save_archive_snapshot(snapshot),
)
build_runtime_profile_save_archive_record(map_runtime_profile_save_archive_snapshot(
snapshot,
))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))
})
.collect()
@@ -2867,15 +2884,21 @@ fn map_runtime_profile_save_archive_resume_procedure_result(
}
let archive = result.record.ok_or_else(|| {
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回 save archive 快照".to_string())
SpacetimeClientError::Procedure(
"SpacetimeDB procedure 未返回 save archive 快照".to_string(),
)
})?;
let snapshot = result.current_snapshot.ok_or_else(|| {
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回恢复后的 runtime snapshot".to_string())
SpacetimeClientError::Procedure(
"SpacetimeDB procedure 未返回恢复后的 runtime snapshot".to_string(),
)
})?;
Ok((
build_runtime_profile_save_archive_record(map_runtime_profile_save_archive_snapshot(archive))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
build_runtime_profile_save_archive_record(map_runtime_profile_save_archive_snapshot(
archive,
))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
build_runtime_snapshot_record(map_runtime_snapshot_snapshot(snapshot))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
))
@@ -3154,9 +3177,7 @@ fn map_puzzle_agent_session_procedure_result(
})?;
let session: DomainPuzzleAgentSessionSnapshot =
serde_json::from_str(&session_json).map_err(|error| {
SpacetimeClientError::Runtime(format!(
"puzzle agent session_json 非法: {error}"
))
SpacetimeClientError::Runtime(format!("puzzle agent session_json 非法: {error}"))
})?;
Ok(map_puzzle_agent_session_snapshot(session))
}
@@ -3173,9 +3194,7 @@ fn map_puzzle_work_procedure_result(
}
let item_json = result.item_json.ok_or_else(|| {
SpacetimeClientError::Procedure(
"SpacetimeDB procedure 未返回 puzzle work 快照".to_string(),
)
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回 puzzle work 快照".to_string())
})?;
let item: DomainPuzzleWorkProfile = serde_json::from_str(&item_json).map_err(|error| {
SpacetimeClientError::Runtime(format!("puzzle work item_json 非法: {error}"))
@@ -3218,9 +3237,7 @@ fn map_puzzle_run_procedure_result(
}
let run_json = result.run_json.ok_or_else(|| {
SpacetimeClientError::Procedure(
"SpacetimeDB procedure 未返回 puzzle run 快照".to_string(),
)
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回 puzzle run 快照".to_string())
})?;
let run: DomainPuzzleRunSnapshot = serde_json::from_str(&run_json).map_err(|error| {
SpacetimeClientError::Runtime(format!("puzzle run run_json 非法: {error}"))
@@ -4103,7 +4120,9 @@ fn map_puzzle_run_snapshot(snapshot: DomainPuzzleRunSnapshot) -> PuzzleRunRecord
current_grid_size: snapshot.current_grid_size,
played_profile_ids: snapshot.played_profile_ids,
previous_level_tags: snapshot.previous_level_tags,
current_level: snapshot.current_level.map(map_puzzle_runtime_level_snapshot),
current_level: snapshot
.current_level
.map(map_puzzle_runtime_level_snapshot),
recommended_next_profile_id: snapshot.recommended_next_profile_id,
}
}
@@ -4243,7 +4262,9 @@ fn map_big_fish_background_blueprint(
}
}
fn map_big_fish_runtime_params(snapshot: BindingBigFishRuntimeParams) -> BigFishRuntimeParamsRecord {
fn map_big_fish_runtime_params(
snapshot: BindingBigFishRuntimeParams,
) -> BigFishRuntimeParamsRecord {
BigFishRuntimeParamsRecord {
level_count: snapshot.level_count,
merge_count_per_upgrade: snapshot.merge_count_per_upgrade,
@@ -5283,17 +5304,13 @@ fn parse_custom_world_publish_gate_record(
.map(str::trim)
.filter(|value| !value.is_empty())
.ok_or_else(|| {
SpacetimeClientError::Runtime(
"custom world publish_gate.profileId 缺失".to_string(),
)
SpacetimeClientError::Runtime("custom world publish_gate.profileId 缺失".to_string())
})?;
let blockers = object
.get("blockers")
.and_then(serde_json::Value::as_array)
.ok_or_else(|| {
SpacetimeClientError::Runtime(
"custom world publish_gate.blockers 缺失".to_string(),
)
SpacetimeClientError::Runtime("custom world publish_gate.blockers 缺失".to_string())
})?
.iter()
.cloned()
@@ -5346,17 +5363,13 @@ fn parse_custom_world_publish_gate_record(
.and_then(serde_json::Value::as_u64)
.and_then(|value| u32::try_from(value).ok())
.ok_or_else(|| {
SpacetimeClientError::Runtime(
"custom world publish_gate.blockerCount 缺失".to_string(),
)
SpacetimeClientError::Runtime("custom world publish_gate.blockerCount 缺失".to_string())
})?;
let publish_ready = object
.get("publishReady")
.and_then(serde_json::Value::as_bool)
.ok_or_else(|| {
SpacetimeClientError::Runtime(
"custom world publish_gate.publishReady 缺失".to_string(),
)
SpacetimeClientError::Runtime("custom world publish_gate.publishReady 缺失".to_string())
})?;
let can_enter_world = object
.get("canEnterWorld")