Merge branch 'master' of http://82.157.175.59:3000/GenarrativeAI/Genarrative
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -1262,26 +1262,6 @@ pub(crate) fn map_big_fish_works_procedure_result(
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn map_big_fish_run_procedure_result(
|
||||
result: BigFishRunProcedureResult,
|
||||
) -> Result<BigFishRuntimeRecord, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::Procedure(
|
||||
result
|
||||
.error_message
|
||||
.unwrap_or_else(|| "SpacetimeDB procedure 返回未知错误".to_string()),
|
||||
));
|
||||
}
|
||||
|
||||
let run = result.run.ok_or_else(|| {
|
||||
SpacetimeClientError::Procedure(
|
||||
"SpacetimeDB procedure 未返回 big fish runtime 快照".to_string(),
|
||||
)
|
||||
})?;
|
||||
|
||||
Ok(map_big_fish_runtime_snapshot(run))
|
||||
}
|
||||
|
||||
pub(crate) fn map_story_session_procedure_result(
|
||||
result: StorySessionProcedureResult,
|
||||
) -> Result<StorySessionResultRecord, SpacetimeClientError> {
|
||||
@@ -2492,53 +2472,6 @@ pub(crate) fn map_big_fish_agent_message_snapshot(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn map_big_fish_runtime_snapshot(
|
||||
snapshot: BigFishRuntimeSnapshot,
|
||||
) -> BigFishRuntimeRecord {
|
||||
BigFishRuntimeRecord {
|
||||
run_id: snapshot.run_id,
|
||||
session_id: snapshot.session_id,
|
||||
status: format_big_fish_run_status(snapshot.status).to_string(),
|
||||
tick: snapshot.tick,
|
||||
player_level: snapshot.player_level,
|
||||
win_level: snapshot.win_level,
|
||||
leader_entity_id: snapshot.leader_entity_id,
|
||||
owned_entities: snapshot
|
||||
.owned_entities
|
||||
.into_iter()
|
||||
.map(map_big_fish_runtime_entity)
|
||||
.collect(),
|
||||
wild_entities: snapshot
|
||||
.wild_entities
|
||||
.into_iter()
|
||||
.map(map_big_fish_runtime_entity)
|
||||
.collect(),
|
||||
camera_center: map_big_fish_vector2(snapshot.camera_center),
|
||||
last_input: map_big_fish_vector2(snapshot.last_input),
|
||||
event_log: snapshot.event_log,
|
||||
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn map_big_fish_runtime_entity(
|
||||
snapshot: BigFishRuntimeEntity,
|
||||
) -> BigFishRuntimeEntityRecord {
|
||||
BigFishRuntimeEntityRecord {
|
||||
entity_id: snapshot.entity_id,
|
||||
level: snapshot.level,
|
||||
position: map_big_fish_vector2(snapshot.position),
|
||||
radius: snapshot.radius,
|
||||
offscreen_seconds: snapshot.offscreen_seconds,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn map_big_fish_vector2(snapshot: BigFishVector2) -> BigFishVector2Record {
|
||||
BigFishVector2Record {
|
||||
x: snapshot.x,
|
||||
y: snapshot.y,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn map_story_session_snapshot(snapshot: StorySessionSnapshot) -> StorySessionRecord {
|
||||
StorySessionRecord {
|
||||
story_session_id: snapshot.story_session_id,
|
||||
@@ -3244,14 +3177,6 @@ pub(crate) fn format_big_fish_asset_status(value: BigFishAssetStatus) -> &'stati
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn format_big_fish_run_status(value: BigFishRunStatus) -> &'static str {
|
||||
match value {
|
||||
BigFishRunStatus::Running => "running",
|
||||
BigFishRunStatus::Won => "won",
|
||||
BigFishRunStatus::Failed => "failed",
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn format_custom_world_theme_mode(value: DomainCustomWorldThemeMode) -> &'static str {
|
||||
match value {
|
||||
DomainCustomWorldThemeMode::Martial => "martial",
|
||||
@@ -4503,23 +4428,6 @@ pub struct BigFishAssetGenerateRecordInput {
|
||||
pub generated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct BigFishRunStartRecordInput {
|
||||
pub run_id: String,
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub started_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct BigFishRunInputSubmitRecordInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub input_x: f32,
|
||||
pub input_y: f32,
|
||||
pub submitted_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct BigFishAnchorItemRecord {
|
||||
pub key: String,
|
||||
@@ -4652,38 +4560,6 @@ pub struct BigFishWorkSummaryRecord {
|
||||
pub background_ready: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct BigFishVector2Record {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct BigFishRuntimeEntityRecord {
|
||||
pub entity_id: String,
|
||||
pub level: u32,
|
||||
pub position: BigFishVector2Record,
|
||||
pub radius: f32,
|
||||
pub offscreen_seconds: f32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct BigFishRuntimeRecord {
|
||||
pub run_id: String,
|
||||
pub session_id: String,
|
||||
pub status: String,
|
||||
pub tick: u64,
|
||||
pub player_level: u32,
|
||||
pub win_level: u32,
|
||||
pub leader_entity_id: Option<String>,
|
||||
pub owned_entities: Vec<BigFishRuntimeEntityRecord>,
|
||||
pub wild_entities: Vec<BigFishRuntimeEntityRecord>,
|
||||
pub camera_center: BigFishVector2Record,
|
||||
pub last_input: BigFishVector2Record,
|
||||
pub event_log: Vec<String>,
|
||||
pub updated_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ResolveNpcBattleInteractionInput {
|
||||
pub npc_interaction: DomainResolveNpcInteractionInput,
|
||||
|
||||
Reference in New Issue
Block a user