private void destroyGameLobby(GameInfos game) { if (game.Playing) { m_clientAPI.DeleteScene(game.SceneName); m_log.Debug("GAMECreation", "Game " + game.SceneName + " deleted."); } foreach (IScenePeerClient client in m_scene.RemotePeers) if (game.IDPlayers.ContainsKey(client.Id) && client.Id != game.IDOwner) client.Send("OwnerDestroyedGame", game); m_games.Remove(game); }
void Start() { player = RTypeLobby.player; client = RTypeLobby.client; actualGame = RTypeLobby.actualGame; m_connected = false; m_connecting = true; m_scene = null; m_time = 0; for (int i = 0; i < m_allies.Length; i++) m_allies[i] = null; if (actualGame != null) { Debug.Log("Connecting to " + actualGame.SceneName + "..."); client.GetPublicScene(actualGame.SceneName, player).ContinueWith(onSceneConnecting); } }
private void onJoinStartedGame(Packet<IScenePeer> packet) { actualGame = packet.ReadObject<GameInfos>(); MainThread.Post(() => SceneManager.LoadScene("Game")); }
void Start() { m_connected = false; m_connecting = false; ClientConfiguration config = ClientConfiguration.ForAccount("5c8354d8-9fd0-5c5f-4c00-3eff266d1836", "rtype"); client = new Client(config); m_scene = null; actualGame = null; }
public void onQuitGame() { MainThread.Post(() => { gamePannelInfos.gamePannel.SetActive(false); menuPannel.SetActive(true); }); gamePannelInfos.gameName.text = ""; m_scene.Send("QuitGame", actualGame); actualGame = null; onRefresh(); }
public void onDestroyGame() { MainThread.Post(() => { gamePannelInfos.gamePannel.SetActive(false); menuPannel.SetActive(true); }); gamePannelInfos.ready.isOn = false; gamePannelInfos.gameName.text = ""; gameCreationInfos.gameName.text = ""; m_scene.Send("DestroyGame", actualGame); actualGame = null; onRefresh(); }
public void onJoinGame() { GameObject objet = EventSystem.current.currentSelectedGameObject; if (objet == null || !m_listGamesInv.Keys.Contains(objet)) return; m_scene.Rpc<GameInfos, GameInfos>("JoinGame", m_listGamesInv[objet]).Subscribe(resp => { if (resp == null) Debug.Log("Error while joining"); else { actualGame = resp; affInfosGame(); MainThread.Post(() => { menuPannel.SetActive(false); gamePannelInfos.gamePannel.SetActive(true); }); } }); }
public void onCreateGame() { MainThread.Post(() => { gameCreationInfos.gameCreatingPannel.SetActive(false); gamePannelInfos.buttonOwner.gameObject.SetActive(true); gamePannelInfos.gamePannel.SetActive(true); }); actualGame = new GameInfos(); actualGame.Name = gameCreationInfos.gameName.text; actualGame.IDOwner = player.ID; actualGame.IDPlayers = new Dictionary<long, Player>(); actualGame.MaxPlayer = uint.Parse(gameCreationInfos.maxPlayers.text); m_scene.Send("CreateGame", actualGame); gamePannelInfos.playerText[0].text = connectionInfos.username.text; affInfosGame(); }
private void onUpdateGame(Packet<IScenePeer> packet) { GameInfos infos = packet.ReadObject<GameInfos>(); if (actualGame.IDOwner == infos.IDOwner) { actualGame = infos; affPlayersGame(); } else onRefresh(); }
void Start () { actualGame = RTypeLobby.actualGame; player = RTypeLobby.player; }
public RTypeMainGame(ISceneHost scene) { m_running = false; m_started = false; m_game = null; m_nbPlayer = 0; m_scene = scene; m_log = m_scene.GetComponent<ILogger>(); m_env = m_scene.GetComponent<IEnvironment>(); m_scene.Starting.Add(onStarting); m_scene.Shuttingdown.Add(onShutdown); m_scene.Connecting.Add(onConnecting); m_scene.Connected.Add(onConnected); m_scene.Disconnected.Add(onDisconnected); m_scene.AddRoute("PosUpdate", onPosUpdate); m_scene.AddRoute("Fire", onFire); m_scene.AddRoute("GameInfos", onGetGameInfos); m_scene.AddRoute("Collision", onGetCollision); m_scene.AddRoute("OutOfScreen", onEntityOutOfScreen); }
private void onGetGameInfos(Packet<IScenePeerClient> packet) { m_game = packet.ReadObject<GameInfos>(); m_log.Debug("Game", "Setting name to " + m_game.SceneName); m_log.Debug("Game", "Setting max players to " + m_game.MaxPlayer.ToString()); m_game.IDPlayers.Clear(); if (m_game.MaxPlayer == m_nbPlayer) { m_started = true; m_log.Debug("Game", "Game " + m_game.SceneName + " is running."); } }