/// <summary> /// Once all players are ready, adds players to the Game controller and starts the game /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void start_game_Click(object sender, EventArgs e) { var ds = NetworkClasses.GetServer(User.PlayerId, User.LocalIp); var row = ds.Tables[0].Rows[0]; var grabber = NetworkClasses.GetPlayer(int.Parse(row["Host"].ToString())); //Host LobbyController.AddPlayer(int.Parse(grabber.Tables[0].Rows[0]["Player_ID"].ToString()), grabber.Tables[0].Rows[0]["_Character"].ToString()); for (var i = 2; i <= 6; i++) { if (string.IsNullOrEmpty(row["Player_" + i].ToString())) { continue; } grabber = NetworkClasses.GetPlayer(int.Parse(row["Player_" + i].ToString())); LobbyController.AddPlayer(int.Parse(grabber.Tables[0].Rows[0]["Player_ID"].ToString()), grabber.Tables[0].Rows[0]["_Character"].ToString()); } NetworkClasses.UpdateServerValue("Status", "In Progress", "Host", User.PlayerId); NetworkClasses.UpdateUserValue("User_List", "Online", "In Game", User.PlayerId); LobbyController.StartGame(); Host.StartGame(); _timer.Stop(); //_chat.Dispose(); _gameTimer.Start(); if (!_profile.IsDisposed) { _profile.Dispose(); } Hide(); //MainMenuForm waiter = new MainMenuForm(); //waiter.Show(); }
public void EnterGame() { animator.SetBool("Selected", true); inText.SetActive(true); outText.SetActive(false); gameController.AddPlayer(); inGame = true; }
/// <summary> /// Once all players are ready, adds players to the Game controller and starts the game /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void start_game_Click(object sender, EventArgs e) { var ds = NetworkClasses.GetServer(User.PlayerId, User.LocalIp); var row = ds.Tables[0].Rows[0]; var grabber = NetworkClasses.GetPlayer(int.Parse(row["Host"].ToString())); //Host LobbyController.AddPlayer(int.Parse(grabber.Tables[0].Rows[0]["Player_ID"].ToString()), grabber.Tables[0].Rows[0]["_Character"].ToString()); for (var i = 2; i <= 6; i++) { if (string.IsNullOrEmpty(row["Player_" + i].ToString())) { continue; } grabber = NetworkClasses.GetPlayer(int.Parse(row["Player_" + i].ToString())); LobbyController.AddPlayer(int.Parse(grabber.Tables[0].Rows[0]["Player_ID"].ToString()), grabber.Tables[0].Rows[0]["_Character"].ToString()); } NetworkClasses.UpdateServerStatus("In Progress", User.PlayerId); LobbyController.StartGame(); Host.StartGame(); }
static void Main(string[] args) { LobbyController.AddPlayer(0, "0"); LobbyController.AddPlayer(1, "1"); LobbyController.StartGame(); }