diff --git a/api/main.proto b/api/main.proto index 8f45373..049bd21 100644 --- a/api/main.proto +++ b/api/main.proto @@ -1308,16 +1308,18 @@ enum ScreenCommand { } message ScreenState { - string id = 1; - string status = 2; - optional int32 game_id = 3; - ScreenMode mode = 4; - bool sound_enabled = 5; - string error = 6; - int64 state_version = 7; - int64 position_ms = 8; - string game_name = 9; - string cover_image = 10; + string id = 1; + string status = 2; + optional int32 game_id = 3; + ScreenMode mode = 4; + bool sound_enabled = 5; + string error = 6; + int64 state_version = 7; + int64 position_ms = 8; + string game_name = 9; + string cover_image = 10; + string intro_audio = 11; + string conclusion_video = 12; } message CreateScreenSessionReq {} diff --git a/bin/evening_detective_server b/bin/evening_detective_server index 18f803a..48840c5 100755 Binary files a/bin/evening_detective_server and b/bin/evening_detective_server differ diff --git a/cmd/evening_detective_server/main.swagger.json b/cmd/evening_detective_server/main.swagger.json index 3d143a9..35241c8 100644 --- a/cmd/evening_detective_server/main.swagger.json +++ b/cmd/evening_detective_server/main.swagger.json @@ -3797,6 +3797,12 @@ }, "coverImage": { "type": "string" + }, + "introAudio": { + "type": "string" + }, + "conclusionVideo": { + "type": "string" } } }, diff --git a/internal/app/server.go b/internal/app/server.go index e0cf01a..5e0da62 100644 --- a/internal/app/server.go +++ b/internal/app/server.go @@ -307,6 +307,14 @@ func (s *server) enrichScreenState(ctx context.Context, session *screen_sessions if game.Scenario != nil && game.Scenario.Image != nil { state.CoverImage = *game.Scenario.Image } + if game.Scenario != nil && game.Scenario.Story != nil { + if game.Scenario.Story.Introduction != nil { + state.IntroAudio = game.Scenario.Story.Introduction.Audio + } + if game.Scenario.Story.Conclusion != nil { + state.ConclusionVideo = game.Scenario.Story.Conclusion.Video + } + } } func (s *server) SetScreenMode(ctx context.Context, req *proto.SetScreenModeReq) (*proto.SetScreenModeRsp, error) { diff --git a/proto/main.pb.go b/proto/main.pb.go index cd354b0..7beda37 100644 --- a/proto/main.pb.go +++ b/proto/main.pb.go @@ -4698,19 +4698,21 @@ func (x *Game) GetEndedAt() *timestamppb.Timestamp { } type ScreenState struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` - GameId *int32 `protobuf:"varint,3,opt,name=game_id,json=gameId,proto3,oneof" json:"game_id,omitempty"` - Mode ScreenMode `protobuf:"varint,4,opt,name=mode,proto3,enum=crabs.evening_detective_server.ScreenMode" json:"mode,omitempty"` - SoundEnabled bool `protobuf:"varint,5,opt,name=sound_enabled,json=soundEnabled,proto3" json:"sound_enabled,omitempty"` - Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` - StateVersion int64 `protobuf:"varint,7,opt,name=state_version,json=stateVersion,proto3" json:"state_version,omitempty"` - PositionMs int64 `protobuf:"varint,8,opt,name=position_ms,json=positionMs,proto3" json:"position_ms,omitempty"` - GameName string `protobuf:"bytes,9,opt,name=game_name,json=gameName,proto3" json:"game_name,omitempty"` - CoverImage string `protobuf:"bytes,10,opt,name=cover_image,json=coverImage,proto3" json:"cover_image,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + GameId *int32 `protobuf:"varint,3,opt,name=game_id,json=gameId,proto3,oneof" json:"game_id,omitempty"` + Mode ScreenMode `protobuf:"varint,4,opt,name=mode,proto3,enum=crabs.evening_detective_server.ScreenMode" json:"mode,omitempty"` + SoundEnabled bool `protobuf:"varint,5,opt,name=sound_enabled,json=soundEnabled,proto3" json:"sound_enabled,omitempty"` + Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` + StateVersion int64 `protobuf:"varint,7,opt,name=state_version,json=stateVersion,proto3" json:"state_version,omitempty"` + PositionMs int64 `protobuf:"varint,8,opt,name=position_ms,json=positionMs,proto3" json:"position_ms,omitempty"` + GameName string `protobuf:"bytes,9,opt,name=game_name,json=gameName,proto3" json:"game_name,omitempty"` + CoverImage string `protobuf:"bytes,10,opt,name=cover_image,json=coverImage,proto3" json:"cover_image,omitempty"` + IntroAudio string `protobuf:"bytes,11,opt,name=intro_audio,json=introAudio,proto3" json:"intro_audio,omitempty"` + ConclusionVideo string `protobuf:"bytes,12,opt,name=conclusion_video,json=conclusionVideo,proto3" json:"conclusion_video,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ScreenState) Reset() { @@ -4813,6 +4815,20 @@ func (x *ScreenState) GetCoverImage() string { return "" } +func (x *ScreenState) GetIntroAudio() string { + if x != nil { + return x.IntroAudio + } + return "" +} + +func (x *ScreenState) GetConclusionVideo() string { + if x != nil { + return x.ConclusionVideo + } + return "" +} + type CreateScreenSessionReq struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -8556,7 +8572,7 @@ const file_main_proto_rawDesc = "" + "started_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampH\x00R\tstartedAt\x88\x01\x01\x12:\n" + "\bended_at\x18\t \x01(\v2\x1a.google.protobuf.TimestampH\x01R\aendedAt\x88\x01\x01B\r\n" + "\v_started_atB\v\n" + - "\t_ended_at\"\xde\x02\n" + + "\t_ended_at\"\xaa\x03\n" + "\vScreenState\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + "\x06status\x18\x02 \x01(\tR\x06status\x12\x1c\n" + @@ -8570,7 +8586,10 @@ const file_main_proto_rawDesc = "" + "\tgame_name\x18\t \x01(\tR\bgameName\x12\x1f\n" + "\vcover_image\x18\n" + " \x01(\tR\n" + - "coverImageB\n" + + "coverImage\x12\x1f\n" + + "\vintro_audio\x18\v \x01(\tR\n" + + "introAudio\x12)\n" + + "\x10conclusion_video\x18\f \x01(\tR\x0fconclusionVideoB\n" + "\n" + "\b_game_id\"\x18\n" + "\x16CreateScreenSessionReq\"n\n" +