/// <summary> /// /// </summary> public void Suicide() { PhotonView view = PhotonView.Find(bl_GameManager.m_view); if (view != null) { bl_PlayerDamageManager pdm = view.GetComponent <bl_PlayerDamageManager>(); pdm.Suicide(); bl_UtilityHelper.LockCursor(true); showMenu = false; if (view.IsMine) { bl_GameManager.SuicideCount++; //Debug.Log("Suicide " + bl_GameManager.SuicideCount + " times"); //if player is a joker o abuse of suicide, them kick of room if (bl_GameManager.SuicideCount >= 3)//Max number of suicides = 3, you can change { isPlaying = false; bl_GameManager.isAlive = false; bl_UtilityHelper.LockCursor(false); LeftOfRoom(); } } } else { Debug.LogError("This view " + bl_GameManager.m_view + " is not found"); } }
/// <summary> /// /// </summary> void MenuButtons() { if (isPlaying) { if (GUI.Button(new Rect(Screen.width / 2 - 75, Screen.height / 2 - 180, 150, 30), "Resume")) { m_window = 1; bl_UtilityHelper.LockCursor(true); showMenu = false; } if (GUI.Button(new Rect(Screen.width / 2 - 225, Screen.height / 2 - 180, 150, 30), "Settings")) { m_window = 2; } if (GUI.Button(new Rect(Screen.width / 2 + 75, Screen.height / 2 - 180, 150, 30), "ScoreBoard")) { m_window = 1; } if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 200, 150, 30), "Suicide") && bl_GameManager.isAlive) { PhotonView view = PhotonView.Find(bl_GameManager.m_view); if (view != null) { bl_PlayerDamageManager pdm = view.GetComponent <bl_PlayerDamageManager>(); pdm.Suicide(); m_window = 1; bl_UtilityHelper.LockCursor(true); showMenu = false; if (view.isMine) { bl_GameManager.SuicideCount++; //Debug.Log("Suicide " + bl_GameManager.SuicideCount + " times"); //if player is a joker o abuse of suicide, them kick of room if (bl_GameManager.SuicideCount >= 3)//Max number de suicides = 3, you can change { isPlaying = false; bl_GameManager.isAlive = false; bl_UtilityHelper.LockCursor(false); LeftOfRoom(); } } } else { Debug.LogError("This view " + bl_GameManager.m_view + " is not found"); } } } }
void MainMenu() { if (GetGameMode == GameMode.TDM || GetGameMode == GameMode.CTF) { //ScoreBoards for TDM if (!isPlaying && !isFinish && !AutoTeamSelection) { if (GUI.Button(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 190, 200, 40), "Join Delta")) { m_window = 1; Screen.lockCursor = true; showMenu = false; GM.SpawnPlayer(Team.Delta); bl_EventHandler.KillEvent(PhotonNetwork.player.name, "", "Joined in Delta", Team.Delta.ToString(), 777, 30); isPlaying = true; } } if (m_window == 1) { GUILayout.BeginArea(new Rect(Screen.width / 2 - 400, Screen.height / 2 - 150, 400, 350), "", ScoreBoardStyle); GUILayout.Space(5); GUILayout.BeginHorizontal("box"); GUILayout.Label("Player", GUILayout.Width(175)); GUILayout.Label("K", GUILayout.Width(50)); GUILayout.Label("D", GUILayout.Width(50)); GUILayout.Label("S", GUILayout.Width(50)); GUILayout.Label("Ms", GUILayout.Width(50)); GUILayout.EndHorizontal(); scroll_1 = GUILayout.BeginScrollView(scroll_1, false, false); foreach (PhotonPlayer player in PhotonNetwork.playerList) { if ((string)player.customProperties[PropiertiesKeys.TeamKey] == Team.Delta.ToString()) { if (player.name == PhotonNetwork.player.name)//if this player is Mine { GUI.color = new Color(1, 0.6f, 0, 1); } else { GUI.color = Color.white; } GUILayout.BeginHorizontal(); GUILayout.Label((string)player.name, GUILayout.Width(175)); GUILayout.Label(player.customProperties[PropiertiesKeys.KillsKey].ToString(), GUILayout.Width(50)); GUILayout.Label(player.customProperties[PropiertiesKeys.DeathsKey].ToString(), GUILayout.Width(50)); GUILayout.Label(player.customProperties[PropiertiesKeys.ScoreKey].ToString(), GUILayout.Width(50)); int Ping = (int)player.customProperties["Ping"]; GUILayout.Label(Ping.ToString("000") + "<size=10>ms</size>", GUILayout.Width(50)); GUILayout.EndHorizontal(); GUI.color = Color.white; } } GUILayout.EndScrollView(); GUILayout.EndArea(); } if (isPlaying) { if (GUI.Button(new Rect(Screen.width / 2 - 75, Screen.height / 2 - 180, 150, 30), "Resume")) { m_window = 1; Screen.lockCursor = true; showMenu = false; } if (GUI.Button(new Rect(Screen.width / 2 - 225, Screen.height / 2 - 180, 150, 30), "Settings")) { m_window = 2; } if (GUI.Button(new Rect(Screen.width / 2 + 75, Screen.height / 2 - 180, 150, 30), "ScoreBoard")) { m_window = 1; } if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 200, 150, 30), "Suicide") && bl_GameManager.isAlive) { PhotonView view = PhotonView.Find(bl_GameManager.m_view); if (view != null) { bl_PlayerDamageManager pdm = view.GetComponent <bl_PlayerDamageManager>(); pdm.Suicide(); m_window = 1; Screen.lockCursor = true; showMenu = false; if (view.isMine) { bl_GameManager.SuicideCount++; Debug.Log("Suicide " + bl_GameManager.SuicideCount + " times"); //if player is a joker o abuse of suicide, them kick of room if (bl_GameManager.SuicideCount >= 3)//Max number de suicides = 3, you can change { isPlaying = false; bl_GameManager.isAlive = false; if (PhotonNetwork.connected) { PhotonNetwork.LeaveRoom(); } else { Application.LoadLevel(0); } Screen.lockCursor = false; } } } else { Debug.LogError("This view " + bl_GameManager.m_view + " is not found"); } } } if (!isPlaying && !isFinish) { SelectClassMenu(); } if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2 + 200, 150, 30), "Disconnect")) { PhotonNetwork.LeaveRoom(); } if (m_window == 1) { //Scorenoard for team2 if (!isPlaying && !isFinish && !AutoTeamSelection) { if (GUI.Button(new Rect(Screen.width / 2 + 100, Screen.height / 2 - 190, 200, 40), "Joined Recon")) { m_window = 1; Screen.lockCursor = true; showMenu = false; GM.SpawnPlayer(Team.Recon); bl_EventHandler.KillEvent(PhotonNetwork.player.name, "", "Joined in Recon", Team.Recon.ToString(), 777, 30); isPlaying = true; } } GUILayout.BeginArea(new Rect(Screen.width / 2 + 5, Screen.height / 2 - 150, 400, 350), "", ScoreBoardStyle); GUILayout.Space(5); GUILayout.BeginHorizontal("box"); GUILayout.Label("Player", GUILayout.Width(175)); GUILayout.Label("K", GUILayout.Width(50)); GUILayout.Label("D", GUILayout.Width(50)); GUILayout.Label("S", GUILayout.Width(50)); GUILayout.Label("Ms", GUILayout.Width(50)); GUILayout.EndHorizontal(); scroll_2 = GUILayout.BeginScrollView(scroll_2, false, false); foreach (PhotonPlayer player in PhotonNetwork.playerList) { if ((string)player.customProperties["Team"] == Team.Recon.ToString()) { if (player.name == PhotonNetwork.player.name)//if this player is Mine { GUI.color = new Color(1, 0.6f, 0, 1); } else { GUI.color = Color.white; } GUILayout.BeginHorizontal(); GUILayout.Label((string)player.name, GUILayout.Width(175)); GUILayout.Label(player.customProperties[PropiertiesKeys.KillsKey].ToString(), GUILayout.Width(50)); GUILayout.Label(player.customProperties[PropiertiesKeys.DeathsKey].ToString(), GUILayout.Width(50)); GUILayout.Label(player.customProperties[PropiertiesKeys.ScoreKey].ToString(), GUILayout.Width(50)); int Ping = (int)player.customProperties["Ping"]; GUILayout.Label(Ping.ToString("000") + "<size=10>ms</size>", GUILayout.Width(50)); GUILayout.EndHorizontal(); GUI.color = Color.white; } } GUILayout.EndScrollView(); GUILayout.EndArea(); } } else if (GetGameMode == GameMode.FFA) { //Scorenoard for All in FFA if (!isPlaying && !isFinish) { if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 190, 200, 40), "Join")) { m_window = 1; Screen.lockCursor = true; showMenu = false; GM.SpawnPlayer(Team.All); bl_EventHandler.KillEvent(PhotonNetwork.player.name, "", "Joined in match", Team.All.ToString(), 777, 30); isPlaying = true; } } if (!isPlaying && !isFinish) { SelectClassMenu(); } if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2 + 200, 150, 30), "Disconnect")) { PhotonNetwork.LeaveRoom(); } if (isPlaying) { if (GUI.Button(new Rect(Screen.width / 2 - 75, Screen.height / 2 - 180, 150, 30), "Resumen")) { m_window = 1; Screen.lockCursor = true; showMenu = false; } if (GUI.Button(new Rect(Screen.width / 2 - 225, Screen.height / 2 - 180, 150, 30), "Setting")) { m_window = 2; } if (GUI.Button(new Rect(Screen.width / 2 + 75, Screen.height / 2 - 180, 150, 30), "ScoreBoard")) { m_window = 1; } if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 200, 150, 30), "Suicide") && bl_GameManager.isAlive) { PhotonView view = FindPlayerView(bl_GameManager.m_view); if (view != null) { bl_PlayerDamageManager pdm = view.GetComponent <bl_PlayerDamageManager>(); pdm.Suicide(); m_window = 1; Screen.lockCursor = true; showMenu = false; if (view.isMine) { bl_GameManager.SuicideCount++; Debug.Log("Suicide " + bl_GameManager.SuicideCount + " times"); //if player is a joker o abuse of suicide, them kick of room if (bl_GameManager.SuicideCount >= 3)//Max number de suicides = 3, you can change { if (PhotonNetwork.connected) { PhotonNetwork.LeaveRoom(); } else { Application.LoadLevel(0); } Screen.lockCursor = false; } } } else { Debug.LogError("This view " + bl_GameManager.m_view + " is not found"); } } } if (m_window == 1) { GUILayout.BeginArea(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 350), "", ScoreBoardStyle); GUILayout.Space(5); GUILayout.BeginHorizontal("box"); GUILayout.Label("Player", GUILayout.Width(175)); GUILayout.Label("K", GUILayout.Width(50)); GUILayout.Label("D", GUILayout.Width(50)); GUILayout.Label("S", GUILayout.Width(50)); GUILayout.Label("Ms", GUILayout.Width(50)); GUILayout.EndHorizontal(); scroll_2 = GUILayout.BeginScrollView(scroll_2, false, false); foreach (PhotonPlayer player in PhotonNetwork.playerList) { if (player.name == PhotonNetwork.player.name)//if this player is Mine { GUI.color = new Color(1, 0.6f, 0, 1); GUILayout.BeginHorizontal("Box"); } else { GUI.color = Color.white; GUILayout.BeginHorizontal(); } GUILayout.Label((string)player.name, GUILayout.Width(173)); GUILayout.Label(player.customProperties[PropiertiesKeys.KillsKey].ToString(), GUILayout.Width(50)); GUILayout.Label(player.customProperties[PropiertiesKeys.DeathsKey].ToString(), GUILayout.Width(50)); GUILayout.Label(player.customProperties[PropiertiesKeys.ScoreKey].ToString(), GUILayout.Width(50)); int Ping = (int)player.customProperties["Ping"]; GUILayout.Label(Ping.ToString("000") + "<size=10>ms</size>", GUILayout.Width(50)); GUILayout.EndHorizontal(); GUI.color = Color.white; } GUILayout.EndScrollView(); GUILayout.EndArea(); } } if (m_window == 2) { SettingMenu(); } }