Skip to content

Commit

Permalink
url
Browse files Browse the repository at this point in the history
  • Loading branch information
aratama committed Nov 16, 2024
1 parent 7b754cb commit 9bbd6ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use bevy_rapier2d::prelude::*;
#[allow(dead_code)]
pub const CRATE_NAME: &str = "magiacircle";

pub const WEBSOCKET_URL: &str = "wss://magia-server-38847751193.asia-northeast1.run.app";

// Setupステートでの初期化が完了した直後に遷移する先のステート
// 本来は MainMenu にするが、開発時はここで起動時の画面を切り替えています
pub const INITIAL_STATE: GameState = GameState::InGame;
Expand Down
9 changes: 3 additions & 6 deletions src/controller/remote.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::constant::WEBSOCKET_URL;
use crate::controller::player::Player;
use crate::entity::bullet::SpawnBulletProps;
use crate::{
Expand All @@ -13,7 +14,6 @@ use bevy::{core::FrameCount, prelude::*, utils::HashMap};
use bevy_kira_audio::Audio;
use bevy_rapier2d::{plugin::PhysicsSet, prelude::Velocity};
use bevy_simple_websocket::{ClientMessage, ReadyState, ServerMessage, WebSocketState};
use dotenvy_macro::dotenv;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use uuid::Uuid;
Expand Down Expand Up @@ -140,12 +140,9 @@ fn send_player_states(
}

fn on_enter(config: Res<GameConfig>, mut writer: EventWriter<ClientMessage>) {
info!("on_enter {}", config.online);

if config.online {
let url = dotenv!("url");
info!("Connecting to {}", url);
writer.send(ClientMessage::Open(url.to_string()));
info!("Connecting to {}", WEBSOCKET_URL);
writer.send(ClientMessage::Open(WEBSOCKET_URL.to_string()));
}
}

Expand Down

0 comments on commit 9bbd6ef

Please sign in to comment.