From 51bd6d386739063fc7f72f2477f0053010ee8c92 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 19 Mar 2024 06:24:27 +0100 Subject: [PATCH] add new sound for established chats --- assets/scenes/conversations.scn.ron | 28 +++++++++++++++++++++------- src/actor.rs | 2 -- src/audio.rs | 7 +++++++ src/hud.rs | 2 +- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/assets/scenes/conversations.scn.ron b/assets/scenes/conversations.scn.ron index 352706d..6160804 100644 --- a/assets/scenes/conversations.scn.ron +++ b/assets/scenes/conversations.scn.ron @@ -7,7 +7,7 @@ id: "hialien", name: "Icarus", label: "INIT", - delay: 3.0, + delay: 2.0, sound: "ping", reply: "Requesting permission to communicate...", goto: "requested", @@ -20,27 +20,41 @@ id: "hialien", name: "Icarus", label: "requested", - delay: 8.0, - sound: "chat", - reply: "Oh hey there, didn't even notice you! Was playing some VR game! What's up?", - goto: "reply1", + delay: 4.0, + sound: "connect", + reply: "Oh hey there!", + goto: "sup", ), }, ), 4294967298: ( + components: { + "outfly::actor::ChatBranch": ( + id: "hialien", + name: "Icarus", + label: "sup", + delay: 8.0, + sound: "chat", + reply: "Didn't even notice you! Was playing some VR game! What's up?", + goto: "reply1", + ), + }, + ), + + 4294967299: ( components: { "outfly::actor::ChatBranch": ( id: "hialien", name: "Icarus", label: "reply1", - delay: 1.0, + delay: 1.5, sound: "chat", reply: "Not so chatty, huh? That's ok. See you around.", goto: "disco", ), }, ), - 4294967299: ( + 4294967300: ( components: { "outfly::actor::ChatBranch": ( id: "hialien", diff --git a/src/actor.rs b/src/actor.rs index cb4f829..0c8fa48 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -243,9 +243,7 @@ pub fn handle_conversations( let sfx = audio::str2sfx(branch.sound.as_str()); ew_sfx.send(audio::PlaySfxEvent(sfx)); } - info!("chat.timer={:.2}, branch.delay={:.2}, epoch={:.2}", chat.timer, branch.delay, now); } } diff --git a/src/audio.rs b/src/audio.rs index 438c820..d37efc3 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -6,6 +6,7 @@ const ASSET_CLICK: &str = "sounds/click-button-140881-crop.ogg"; const ASSET_SWITCH: &str = "sounds/typosonic-typing-192811-crop.ogg"; const ASSET_INCOMING_MESSAGE: &str = "tmp/beep-6-96243.ogg"; const ASSET_PING: &str = "tmp/glitch-sound-fx-pack-04-118236.ogg"; +const ASSET_CONNECT: &str = "tmp/friend-request-14878.ogg"; const ASSET_RADIO: &str = "tmp/LP - Girls Go Wild (Official Music Video)-M7XRN0oHGIM.ogg"; const ASSET_BGM: &str = "tmp/FTL - Faster Than Light (2012) OST - 12 - Void (Explore)-edQw2yYXQJM.ogg"; @@ -26,6 +27,7 @@ pub enum Sfx { Click, Switch, Ping, + Connect, None, } @@ -40,6 +42,7 @@ pub enum Sfx { #[derive(Resource)] pub struct SoundSwitch(Handle); #[derive(Resource)] pub struct SoundIncomingMessage(Handle); #[derive(Resource)] pub struct SoundPing(Handle); +#[derive(Resource)] pub struct SoundConnect(Handle); pub fn setup( mut commands: Commands, @@ -91,6 +94,7 @@ pub fn setup( commands.insert_resource(SoundSwitch(asset_server.load(ASSET_SWITCH))); commands.insert_resource(SoundIncomingMessage(asset_server.load(ASSET_INCOMING_MESSAGE))); commands.insert_resource(SoundPing(asset_server.load(ASSET_PING))); + commands.insert_resource(SoundConnect(asset_server.load(ASSET_CONNECT))); } pub fn toggle_bgm( @@ -119,6 +123,7 @@ pub fn play_sfx( sound_switch: Res, sound_incoming_message: Res, sound_ping: Res, + sound_connect: Res, ) { if settings.mute_sfx && !events_sfx.is_empty() { events_sfx.clear(); @@ -130,6 +135,7 @@ pub fn play_sfx( Sfx::Click => sound_click.0.clone(), Sfx::IncomingChatMessage => sound_incoming_message.0.clone(), Sfx::Ping => sound_ping.0.clone(), + Sfx::Connect => sound_connect.0.clone(), Sfx::None => sound_ping.0.clone(), }, settings: PlaybackSettings::DESPAWN, @@ -143,6 +149,7 @@ pub fn str2sfx(sfx_label: &str) -> Sfx { "click" => Sfx::Click, "chat" => Sfx::IncomingChatMessage, "ping" => Sfx::Ping, + "connect" => Sfx::Connect, _ => Sfx::None, }; } diff --git a/src/hud.rs b/src/hud.rs index 00a57c2..50f38e0 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -227,7 +227,7 @@ fn setup( // Add Chat Box let bundle_chatbox = TextBundle::from_sections([ TextSection::new( - "Hello World!\nThis Is Cool, right?", + "Warning: System Log Uninitialized", TextStyle { font: asset_server.load(FONT), font_size: settings.font_size_hud,