// Start is called before the first frame update void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent <SocketIOComponent>(); socket.On("response", (E) => { Debug.Log(E.data["team"]); if (E.data[1].ToString().Equals("false")) { SSTools.ShowMessage("La sala no existe o esta llena", SSTools.Position.bottom, SSTools.Time.twoSecond); } else if (E.data[0].ToString().Equals("true")) { string id = E.data["team"].ToString(); id = id.Substring(0, id.Length - 1); id = id.Substring(1, id.Length - 1); if (id.Equals(team.GetComponent <TeamInfo>().id)) { socket.Emit("callTeams", JSONObject.CreateStringObject(code.GetComponent <UnityEngine.UI.Text>().text)); team.GetComponent <TeamInfo>().name = name.GetComponent <UnityEngine.UI.Text>().text; team.GetComponent <TeamInfo>().code = code.GetComponent <UnityEngine.UI.Text>().text; Navegar navegar = new Navegar(); navegar.navegarSalaEspera(); } } }); }
// Start is called before the first frame update void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent <SocketIOComponent>(); team = GameObject.FindWithTag("team"); socket.Emit("disconnect", JSONObject.CreateStringObject(team.GetComponent <TeamInfo>().name)); socket.On("onDisconnectTeamResponse", (E) => { Debug.Log(E.data.ToString() + "en el desconectar"); TeamCollection[] equipo = JsonHelper.FromJson <TeamCollection>(E.data.ToString()); llenarCampos(equipo.Length, equipo); Navegar navegar = new Navegar(); navegar.navegarSala(); }); socket.On("onStartGame", (E) => { StartCoroutine(Camera.main.GetComponent <CountDownController>().CountDownStart()); }); socket.On("getTeams", (E) => { Debug.Log(E.data.ToString() + "en el get teams"); TeamCollection[] equipo = JsonHelper.FromJson <TeamCollection>(E.data.ToString()); llenarCampos(equipo.Length, equipo); }); }
public IEnumerator gameOver() { concept.text = "Juego terminado"; //countdownDiplay.gameObject.SetActive(true); while (countdownTime > 0) { yield return(new WaitForSeconds(1f)); countdownTime--; } //displayRoom.gameObject.SetActive(false); Navegar navegar = new Navegar(); navegar.navegarSala(); }
public IEnumerator CountDownStart() { countdownDiplay.fontSize = 60; //countdownDiplay.gameObject.SetActive(true); while (countdownTime > 0) { countdownDiplay.text = countdownTime.ToString(); yield return(new WaitForSeconds(1f)); countdownTime--; } countdownDiplay.gameObject.SetActive(false); Navegar navegar = new Navegar(); navegar.navegarJuego(); }
public void setupEvents() { On("open", (E) => { Debug.Log("conection made to the server"); }); On("response", (E) => { Navegar navegar = new Navegar(); navegar.navegarSalaEspera(); }); Emit("disconnect", (E) => { Debug.Log("desconectado"); }); getTeams(); }