add new sound for established chats

This commit is contained in:
yuni 2024-03-19 06:24:27 +01:00
parent d63ad5b0d7
commit 51bd6d3867
4 changed files with 29 additions and 10 deletions

View file

@ -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",

View file

@ -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);
chat.timer = now + branch.delay;
info!(">chat.timer={:.2}, branch.delay={:.2}, epoch={:.2}", chat.timer, branch.delay, now);
}
}

View file

@ -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<AudioSource>);
#[derive(Resource)] pub struct SoundIncomingMessage(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundPing(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundConnect(Handle<AudioSource>);
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<SoundSwitch>,
sound_incoming_message: Res<SoundIncomingMessage>,
sound_ping: Res<SoundPing>,
sound_connect: Res<SoundConnect>,
) {
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,
};
}

View file

@ -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,