/// <summary> /// Inicializa los botones para cerrar el dialogo /// </summary> /// <param name="_onCloseCallback"></param> private void InicializarBotonesCerrarDialogo(btnButton.guiAction _onCloseCallback = null) { // boton aceptar m_btnAceptar.action = (_name) => { // ocultar formulario transform.gameObject.SetActive(false); // ejecutar la accion asociada if (_onCloseCallback != null) { _onCloseCallback(""); } GeneralSounds_menu.instance.playOneShot(GeneralSounds_menu.instance.popupOffClip); Interfaz.ClickFX(); }; // velo (funciona como el boton aceptar) m_velo.action = (_name) => { // ocultar formulario transform.gameObject.SetActive(false); // ejecutar la accion asociada if (_onCloseCallback != null) { _onCloseCallback(""); } GeneralSounds_menu.instance.playOneShot(GeneralSounds_menu.instance.popupOffClip); }; }
/// <summary> /// Muestra la informacion asociada a un escudo /// </summary> /// <param name="_escudo"></param> public void ShowAsEscudo(Escudo _escudo) { ObtenerReferencias(); if (_escudo == null) { // ocultar este control SetVisible(false); } else { // mostrar este control SetVisible(true); // actualizar textos m_txtCantidad.text = _escudo.numUnidades.ToString(); m_txtCantidadSombra.text = m_txtCantidad.text; m_txtPrecio.text = "§ " + _escudo.precioHard.ToString(); m_txtPrecioSombra.text = m_txtPrecio.text; m_txtBoost.text = _escudo.boost.ToString("f1"); m_txtBoost.gameObject.SetActive(true); // textura del escudo Texture texturaEscudo; if (EscudosManager.escudoEquipado.boost == _escudo.boost) { texturaEscudo = AvataresManager.instance.GetTexturaEscudoTiendaEquipado(_escudo.idTextura); } else { texturaEscudo = AvataresManager.instance.GetTexturaEscudoTienda(_escudo.idTextura); } m_btnCompra.GetComponent <GUITexture>().texture = texturaEscudo; m_btnCompra.m_current = texturaEscudo; if (_escudo.faseDesbloqueo < Interfaz.ultimaMisionDesbloqueada) { // boton m_btnCompra.action = (_name) => { Interfaz.ClickFX(); AccionComprarEscudo(_escudo); }; } else { // boton m_btnCompra.action = (_name) => { Interfaz.ClickFX(); // mostrar el dialogo de compra / equipar escudo ifcDialogBox.instance.ShowOneButtonDialog( ifcDialogBox.OneButtonType.POSITIVE, LocalizacionManager.instance.GetTexto(78).ToUpper(), string.Format(LocalizacionManager.instance.GetTexto(79), "<color=#ddf108> " + (int)(_escudo.faseDesbloqueo + 1) + "</color>"), LocalizacionManager.instance.GetTexto(45).ToUpper()); }; } } }
void OnLoginInvitado(string _name) { Debug.Log(">>> PULSO EN LOGIN INVITADO"); Interfaz.ClickFX(); // ocultar esta pantalla por la izquierda y mostrar la siguiente new SuperTweener.move(gameObject, 0.25f, Stats.POS_PANTALLA_OCULTA_IZDA, SuperTweener.CubicOut, (_target) => { }); new SuperTweener.move(ifcMainMenu.instance.gameObject, 0.25f, Vector3.zero, SuperTweener.CubicOut, (_target) => { }); }
/// <summary> /// Obtienen las referencias a los elementos de la interfaz /// </summary> private void GetReferencias() { // referencia a los textos if (m_txtTitulo == null) { m_txtTitulo = transform.FindChild("ContenedorLogros/titulo").GetComponent <GUIText>(); } if (m_txtTituloSombra == null) { m_txtTituloSombra = transform.FindChild("ContenedorLogros/tituloSombra").GetComponent <GUIText>(); } // referencia a los botones if (m_btnAtras == null) { m_btnAtras = getComponentByName("btnAtras").GetComponent <btnButton>(); m_backMethod = Back; m_btnAtras.action = Back; } if (m_btnLanzador == null) { m_btnLanzador = transform.FindChild("botones/btnLanzador").GetComponent <btnButton>(); m_btnLanzador.action = (_name) => { Interfaz.ClickFX(); OnPulsadoBotonSeleccionModo(Modo.LANZADOR); }; } if (m_btnPortero == null) { m_btnPortero = transform.FindChild("botones/btnPortero").GetComponent <btnButton>(); m_btnPortero.action = (_name) => { Interfaz.ClickFX(); OnPulsadoBotonSeleccionModo(Modo.PORTERO); }; } if (m_btnDuelo == null) { m_btnDuelo = transform.FindChild("botones/btnDuelo").GetComponent <btnButton>(); m_btnDuelo.action = (_name) => { Interfaz.ClickFX(); OnPulsadoBotonSeleccionModo(Modo.DUELO); }; } // obtener la referencia a los visores de logros if (m_visualizadoresLogros == null) { m_visualizadoresLogros = new cntVisualizadorLogro[NUM_LOGROS_PAGINA]; for (int i = 0; i < NUM_LOGROS_PAGINA; ++i) { m_visualizadoresLogros[i] = transform.FindChild("ContenedorLogros/visualizadorLogro" + (i + 1).ToString()).GetComponent <cntVisualizadorLogro>(); } } }
// Use this for initialization void Start() { // ajustar las dimensiones y posiciones de los elementos de esta interfaz getComponentByName("Fondo").GetComponent <GUITexture>().pixelInset = Stats.FONDO_PIXEL_INSET; // Crear acciones asociadas a los botones de esta interfaz getComponentByName("btnAtras").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); new SuperTweener.move(gameObject, 0.25f, new Vector3(1.0f, 0.0f, 0.0f), SuperTweener.CubicOut); new SuperTweener.move(ifcMainMenu.instance.gameObject, 0.25f, new Vector3(0.0f, 0.0f, 0.0f), SuperTweener.CubicOut); }; }
// Use this for initialization void Start() { // obtener las referencias a los elementos de la interfaz m_cajaContenedora = transform.FindChild("caja"); m_tooltipItemDisponible = transform.Find("caja/tooltipItemDisponible").GetComponent <cntTooltipItemDisponible>(); //Debug.LogError("(m_tooltipItemDisponible.transform.localPosition.x / ifcBase.scaleWFactor) => " + (m_tooltipItemDisponible.transform.localPosition.x / ifcBase.scaleWFactor)); //m_tooltipItemDisponible.transform.localPosition = new Vector3(m_tooltipItemDisponible.transform.localPosition.x / ifcBase.scaleWFactor, m_tooltipItemDisponible.transform.localPosition.y, m_tooltipItemDisponible.transform.localPosition.z); float newX = (0.5f / Camera.main.aspect) * (16f / 9f); m_tooltipItemDisponible.transform.localPosition = new Vector3(newX, m_tooltipItemDisponible.transform.localPosition.y, m_tooltipItemDisponible.transform.localPosition.z); m_txtNombre = m_cajaContenedora.FindChild("nombre").GetComponent <GUIText>(); m_txtNombreSombra = m_cajaContenedora.FindChild("nombre/sombra").GetComponent <GUIText>(); m_txtPais = m_cajaContenedora.FindChild("pais").GetComponent <GUIText>(); m_txtPaisSombra = m_cajaContenedora.FindChild("pais/sombra").GetComponent <GUIText>(); m_iconoHabilidad = new GUITexture[3]; m_txtHabilidadesTitulo = new GUIText[3]; m_txtHabilidadesTexto = new GUIText[3]; for (int i = 0; i < m_txtHabilidadesTexto.Length; ++i) { m_iconoHabilidad[i] = m_cajaContenedora.FindChild("habilidad" + (i + 1) + "/icono").GetComponent <GUITexture>(); m_txtHabilidadesTitulo[i] = m_cajaContenedora.FindChild("habilidad" + (i + 1) + "/titulo").GetComponent <GUIText>(); m_txtHabilidadesTexto[i] = m_cajaContenedora.FindChild("habilidad" + (i + 1) + "/texto").GetComponent <GUIText>(); } m_btnPlegarDesplegar = m_cajaContenedora.FindChild("btnPlegarDesplegar").GetComponent <btnButton>(); m_btnPlegarDesplegar.action = (_name) => { Interfaz.ClickFX(); GeneralSounds_menu.instance.playOneShot(GeneralSounds_menu.instance.popupOffClip); Plegar(); }; m_btnVelo = transform.FindChild("velo").GetComponent <btnButton>(); m_btnVelo.action = (_name) => { Interfaz.ClickFX(); GeneralSounds_menu.instance.playOneShot(GeneralSounds_menu.instance.popupOffClip); Plegar(); }; m_avatar = m_cajaContenedora.FindChild("avatar").GetComponent <GUITexture>(); m_btnFichaSiguiente = m_cajaContenedora.Find("btnFichaSiguiente").GetComponent <btnButton>(); m_btnFichaAnterior = m_cajaContenedora.Find("btnFichaAnterior").GetComponent <btnButton>(); // ocultar este formulario gameObject.SetActive(false); }
/// <summary> /// Inicializa los valores de este control para mostrar un power up /// </summary> /// <param name="_powerUpDescriptor"></param> public void ShowAsPowerUp(PowerUpDescriptor _powerUpDescriptor) { ObtenerReferencias(); if (_powerUpDescriptor == null) { // ocultar este control SetVisible(false); // mostrar en el boton la textura por defecto m_btnCompra.GetComponent <GUITexture>().texture = AvataresManager.instance.m_texturaCompraPowerUp; m_btnCompra.m_current = AvataresManager.instance.m_texturaCompraPowerUp; } else { // mostrar este control SetVisible(true); // actualizar la cantidad de items if (PowerupService.ownInventory == null) { m_txtCantidad.text = "0"; } else { m_txtCantidad.text = PowerupService.ownInventory.GetCantidadPowerUp(_powerUpDescriptor.idWs).ToString(); } m_txtCantidadSombra.text = m_txtCantidad.text; //m_icono.texture = AvataresManager.instance.GetTexturaPowerUp((int) PowerupInventory.IdWsToPowerup(_powerUpDescriptor.idWs)); //m_icono.gameObject.SetActive(true); // actualizar el resto de textos m_txtPrecio.text = "¤ " + _powerUpDescriptor.precioSoft.ToString(); m_txtPrecioSombra.text = m_txtPrecio.text; m_txtBoost.gameObject.SetActive(false); // boton compra Texture textura = AvataresManager.instance.GetTexturaPowerUp((int)PowerupInventory.IdWsToPowerup(_powerUpDescriptor.idWs)); m_btnCompra.GetComponent <GUITexture>().texture = textura; m_btnCompra.m_current = textura; m_btnCompra.action = (_name) => { Interfaz.ClickFX(); AccionComprarPowerup(_powerUpDescriptor); }; } }
private void OnCarrera(string _name) { ifcCarrera.instance.SetVisible(true); ifcBase.activeIface = ifcCarrera.instance; m_goCarrera = false; Interfaz.ClickFX(); Interfaz.instance.CleanPlayers(); new SuperTweener.move(gameObject, 0.25f, new Vector3(-1.0f, 0.0f, 0.0f), SuperTweener.CubicOut, (_name2) => { SetVisible(false); }); new SuperTweener.move(ifcCarrera.instance.gameObject, 0.25f, new Vector3(0.0f, 0.0f, 0.0f), SuperTweener.CubicOut, (_target) => { }); // hacer que se muestre la ultima mision desbloqueada del modo carrera ifcCarrera.instance.MostrarUltimaMision(); // establecer el valor de recompena acumulada en la partida a "0" Interfaz.recompensaAcumulada = 0; }
// Use this for initialization void Start() { Time.timeScale = 1f; ifcBase.activeIface = this; GameplayService.networked = false; /* * // boton para Facebook * transform.FindChild("btnFacebook").GetComponent<btnButton>().action = (_name) => { * Debug.Log(">>> Has pulsado en el boton de Facebook"); * }; */ // botones duelo y carrera transform.FindChild("botones/btnCarrera").GetComponent <btnButton>().action = OnCarrera; transform.FindChild("botones/btnDuelo").GetComponent <btnButton>().action = OnDuelo; // boton para mostrar las opciones m_btnOpciones = transform.FindChild("btnOpciones").GetComponent <btnButton>(); m_btnOpciones.action = (_name) => { Interfaz.ClickFX(); // mostrar el menu de opciones y el velo m_btnOpciones.gameObject.SetActive(false); cntMenuDesplegableOpciones.instance.Desplegar(); m_btnVelo.gameObject.SetActive(true); }; // velo (que se muestra cuando aparecen las opciones y que funciona como boton de plegar) m_btnVelo = transform.FindChild("btnVelo").GetComponent <btnButton>(); m_btnVelo.action = (_name) => { Interfaz.ClickFX(); // ocultar el menu de opciones y el velo cntMenuDesplegableOpciones.instance.Plegar(); m_btnVelo.gameObject.SetActive(false); }; m_btnVelo.gameObject.SetActive(false); // <= ocultar por defecto el velo // esto no es hack, el otro jugador (IA o persona) tiene siempre el inventario falso PowerupService.rivalInventory = new PowerupInventory(true); }
// Use this for initialization void Start() { m_backMethod = Back; m_casillas = transform.Find("Casillas").gameObject; m_iniesta = transform.Find("Iniesta").gameObject; m_logros = transform.Find("Logros").gameObject; m_btnLeft = transform.Find("flecha_izq").gameObject; m_btnRigth = transform.Find("flecha_dcha").gameObject; getComponentByName("btnAtras").GetComponent <btnButton>().action = Back; getComponentByName("btnCasillas").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); ActivateButton(_name); }; getComponentByName("btnIniesta").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); ActivateButton(_name); }; getComponentByName("btnLogros").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); ActivateButton(_name); }; m_btnLeft.GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); setPage(m_page - 1); }; m_btnRigth.GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); setPage(m_page + 1); }; ActivateButton("btnIniesta"); }
/// <summary> /// Muestra la pantalla recibida como parametro y la lleva (con el supertweener a la posicion "_posicionDestino") /// </summary> /// <param name="_pantallaDestino"></param> /// <param name="_posicionDestino"></param> private void ShowPantalla(ifcBase _pantallaDestino, Vector3 _posicionDestino) { // obtener la interfaz actual ifcBase interfazActual = ifcBase.activeIface; // posicion destino de la interfaz que se va a ocultar Vector3 posicionDestinoInterfaz = new Vector3(-1.0f, 0.0f, 0.0f); // si la interfaz actual no es ninguna de las que se accede desde esta barra de botones => guardarla if (interfazActual != ifcPerfil.instance && interfazActual != ifcLogros.instance) { m_ultimaPantallaVisitada = interfazActual; m_posVisibleUltimaPantallaVisitada = interfazActual.transform.localPosition; // calcular la posicion destino de la interfaz que se va a ocultar posicionDestinoInterfaz = new Vector3(-1.0f, m_posVisibleUltimaPantallaVisitada.y, m_posVisibleUltimaPantallaVisitada.z); // guardar el estado de visibilidad de los modelos de los jugadores m_modeloLanzadorVisibleUltimaPantallaVisitada = Interfaz.instance.GetModeloLanzadorEstaVisible(); m_modeloPorteroVisibleUltimaPantallaVisitada = Interfaz.instance.GetModeloPorteroEstaVisible(); } Interfaz.ClickFX(); Interfaz.instance.CleanPlayers(); // ocultar esta pantalla y pasar a la que corresponda new SuperTweener.move(interfazActual.gameObject, 0.25f, posicionDestinoInterfaz, SuperTweener.CubicOut, // on endCallback (_name) => { if (interfazActual == ifcPerfil.instance) { ifcPerfil.instance.SetVisible(false); } if (interfazActual == ifcLogros.instance) { ifcLogros.instance.SetVisible(false); } }); new SuperTweener.move(_pantallaDestino.gameObject, 0.25f, _posicionDestino, SuperTweener.CubicOut); ifcBase.activeIface = _pantallaDestino; }
// Use this for initialization void Start() { m_backMethod = Back; // nombres de usuario del ranking m_txtNombres = new GUIText[6]; for (int i = 0; i < m_txtNombres.Length; ++i) { m_txtNombres[i] = transform.FindChild("Pos" + i + "/Nombre").GetComponent <GUIText>(); } // puntuaciones en el ranking m_txtPuntos = new GUIText[6]; for (int i = 0; i < m_txtPuntos.Length; ++i) { m_txtPuntos[i] = transform.FindChild("Pos" + i + "/Puntos").GetComponent <GUIText>(); } // boton de lanzador m_btnLanzador = getComponentByName("btnIniesta").GetComponent <btnButton>(); m_btnLanzador.action = (_name) => { Interfaz.ClickFX(); SetMode(mode.LANZADOR); }; // boton de portero m_btnPortero = getComponentByName("btnCasillas").GetComponent <btnButton>(); m_btnPortero.action = (_name) => { Interfaz.ClickFX(); SetMode(mode.PORTERO); }; // boton total m_btnTotal = getComponentByName("btnTotal").GetComponent <btnButton>(); m_btnTotal.action = (_name) => { Interfaz.ClickFX(); SetMode(mode.TOTAL); }; // boton atras getComponentByName("btnAtras").GetComponent <btnButton>().action = Back; }
private void OnDuelo(string _name) { ifcBase.activeIface = ifcVestuario.instance; Interfaz.ClickFX(); ifcVestuario.instance.SetPantallaBack(this); // mostrar por defecto el vestuario en modo lanzador ifcVestuario.instance.SetVisible(true); Interfaz.instance.RefrescarModelosJugadores(true, false); ifcVestuario.instance.ShowAs(ifcVestuario.instance.m_tipoVestuario); // ocultar esta interfaz y mostrar el vestuario new SuperTweener.move(gameObject, 0.25f, new Vector3(-1.0f, 0.0f, 0.0f), SuperTweener.CubicOut, (_name2) => { SetVisible(false); }); new SuperTweener.move(ifcVestuario.instance.gameObject, 0.25f, new Vector3(0.5f, 0.5f, 0.0f), SuperTweener.CubicOut, (_target) => { }); // establecer el valor de recompena acumulada en la partida a "0" Interfaz.recompensaAcumulada = 0; Interfaz.instance.CleanPlayers(); }
// Use this for initialization void Start() { GetReferencias(); // boton perfil m_btnAvatar.action = (_name) => { OnPerfil(); }; // boton moneda hard m_btnMonedaHard.action = (_name) => { Interfaz.ClickFX(); ifcBuyHardCashDialogBox.Instance.Show(true); }; // boton moneda soft m_btnMonedaSoft.action = (_name) => { Interfaz.ClickFX(); ifcBuyHardCashDialogBox.Instance.Show(false); }; // boton logros m_btnLogros.action = (_name) => { // mostrar la textura normal del boton de logros m_iconoBotonLogros.texture = m_texturaLogros; OnLogros(); }; // mostrar el dinero que el usuario tiene actualmente ActualizarDinero(); if (flagNuevosLogros) { flagNuevosLogros = false; MostrarQueHayNuevosLogros(); } }
/// <summary> /// Metodo generico para inicializar un boton /// </summary> /// <param name="_boton"></param> /// <param name="_textura"></param> /// <param name="_texto"></param> /// <param name="_onCallback"></param> /// <param name="_texturaIcono"></param> private void ShowButton(btnButton _boton, Texture _textura, string _texto, btnButton.guiAction _onCallback = null, Texture _texturaIcono = null, bool _mute = false) { if (_boton != null) { // texto del boton _boton.transform.FindChild("texto").GetComponent <GUIText>().text = _texto; _boton.transform.FindChild("textoSombra").GetComponent <GUIText>().text = _texto; // asignar la textura de fondo del boton _boton.GetComponent <GUITexture>().texture = _textura; _boton.m_current = _textura; // asignar la textura del icono del boton _boton.transform.FindChild("icono").GetComponent <GUITexture>().texture = _texturaIcono; // callback del boton _boton.action = (_name) => { Interfaz.ClickFX(); // indicar que ya no hay cierre de este dialogo por tiempo m_timeLimit = 0.0f; m_timeLimitCallback = null; // ocultar este control Hide(_mute); // ejecutar la accion asociada if (_onCallback != null) { _onCallback(_name); } }; // mostrarlo _boton.gameObject.SetActive(true); } }
/// <summary> /// obtener las referencias a los elementos de esta interfaz /// </summary> private void GetReferencias() { // boton plegar if (m_btnDesplegar == null) { m_btnDesplegar = transform.FindChild("btnDesplegar").GetComponent <btnButton>(); m_btnDesplegar.action = (_name) => { Interfaz.ClickFX(); Plegar(); }; } // boton fx if (m_btnFx == null) { m_btnFx = transform.FindChild("btnSonidoFx").GetComponent <btnButton>(); m_btnFx.Toggle = true; m_btnFx.action = (_name) => { ifcOpciones.fx = !ifcOpciones.fx; PlayerPrefs.SetInt("fx", ifcOpciones.fx ? 1 : 0); Interfaz.ClickFX(); RefrescarBotones(); }; } // boton musica if (m_btnMusica == null) { m_btnMusica = transform.FindChild("btnSonidoMusica").GetComponent <btnButton>(); m_btnMusica.Toggle = true; m_btnMusica.action = (_name) => { Interfaz.ClickFX(); ifcOpciones.music = !ifcOpciones.music; PlayerPrefs.SetInt("music", ifcOpciones.music ? 1 : 0); if (ifcOpciones.music) { ifcMusica.instance.musicOn(); } else { ifcMusica.instance.musicOff(); } RefrescarBotones(); }; } // boton calidad alta if (m_btnCalidadAlta == null) { m_btnCalidadAlta = transform.FindChild("btnCalidadAlta").GetComponent <btnButton>(); m_btnCalidadAlta.Toggle = true; m_btnCalidadAlta.action = (_name) => { Interfaz.ClickFX(); SetCalidad(2, "cntMenuDesplegableOpciones => btnCalidadAlta"); RefrescarBotones(); }; } // boton calidad media if (m_btnCalidadMedia == null) { m_btnCalidadMedia = transform.FindChild("btnCalidadMedia").GetComponent <btnButton>(); m_btnCalidadMedia.Toggle = true; m_btnCalidadMedia.action = (_name) => { Interfaz.ClickFX(); SetCalidad(1, "cntMenuDesplegableOpciones => btnCalidadMedia"); RefrescarBotones(); }; } // boton calidad baja if (m_btnCalidadBaja == null) { m_btnCalidadBaja = transform.FindChild("btnCalidadBaja").GetComponent <btnButton>(); m_btnCalidadBaja.Toggle = true; m_btnCalidadBaja.action = (_name) => { Interfaz.ClickFX(); SetCalidad(0, "cntMenuDesplegableOpciones => btnCalidadBaja"); RefrescarBotones(); }; } }
/// <summary> /// Obtiene las referencias a los elementos de esta interfaz /// </summary> private void GetReferencias() { // boton back if (m_btnBack == null) { m_btnBack = transform.FindChild("btnAtras").GetComponent <btnButton>(); m_backMethod = Back; m_btnBack.action = Back; } // tooltip para mostrar si un jugador o una equipacion esta disponible if (m_tooltipItemDisponible == null) { m_tooltipItemDisponible = transform.FindChild("tooltipItemDisponible").GetComponent <cntTooltipItemDisponible>(); } // boton lanzador if (m_btnLanzador == null) { m_btnLanzador = transform.FindChild("botones/btnLanzador").GetComponent <btnButton>(); } m_btnLanzador.Toggle = true; m_btnLanzador.action = (_name) => { Interfaz.ClickFX(); EquipacionManager.instance.ResetEquipacion(true); Interfaz.instance.ResetJugador(true); m_tipoVestuario = TipoVestuario.LANZADOR; // mostrar el modelo que corresponda Interfaz.instance.RefrescarModelosJugadores(true, false); // actualizar los controles ShowAs(m_tipoVestuario); }; // boton portero if (m_btnPortero == null) { m_btnPortero = transform.FindChild("botones/btnPortero").GetComponent <btnButton>(); } m_btnPortero.Toggle = true; m_btnPortero.action = (_name) => { Interfaz.ClickFX(); EquipacionManager.instance.ResetEquipacion(false); Interfaz.instance.ResetJugador(false); m_tipoVestuario = TipoVestuario.PORTERO; // mostrar el modelo que corresponda Interfaz.instance.RefrescarModelosJugadores(false, true); // actualizar los controles ShowAs(m_tipoVestuario); }; // grupos de items a comprar if (m_cntCompraPowerUpsLanzador == null) { m_cntCompraPowerUpsLanzador = transform.FindChild("CompraPowerUpsLanzador").GetComponent <cntCompraItemsContainer>(); } if (m_cntCompraPowerUpsPortero == null) { m_cntCompraPowerUpsPortero = transform.FindChild("CompraPowerUpsPortero").GetComponent <cntCompraItemsContainer>(); } if (m_cntCompraEscudos == null) { m_cntCompraEscudos = transform.FindChild("CompraEscudos").GetComponent <cntCompraItemsContainer>(); } // boton info lanzador if (m_btnInfo == null) { m_btnInfo = transform.FindChild("btnInfo").GetComponent <btnButton>(); m_btnInfo.action = (_name) => { Interfaz.ClickFX(); GeneralSounds_menu.instance.playOneShot(GeneralSounds_menu.instance.popupOnClip); // desplegar la info if (m_tipoVestuario == TipoVestuario.LANZADOR) { ifcDialogoInfoJugador.instance.Show(InfoJugadores.instance.GetTirador(Interfaz.instance.Thrower)); } else { ifcDialogoInfoJugador.instance.Show(InfoJugadores.instance.GetPortero(Interfaz.instance.Goalkeeper)); } ifcDialogoInfoJugador.instance.Desplegar(); // ocultar este boton m_btnInfo.gameObject.SetActive(false); }; } // boton listo if (m_btnListo == null) { m_btnListo = transform.FindChild("btnListo").GetComponent <btnButton>(); m_btnListo.action = (_name) => { GeneralSounds_menu.instance.playOneShot(GeneralSounds_menu.instance.confirmClip); // si la pantalla anterior era el "MainMenu" (estoy en modo multiplayer) bool estoyJugandoDuelo = (m_pantallaAnterior == ifcMainMenu.instance); // comprobar la fase desbloqueada int faseMinima = 4; if (estoyJugandoDuelo && Interfaz.ultimaMisionDesbloqueada < faseMinima) { ifcDialogBox.instance.ShowOneButtonDialog( ifcDialogBox.OneButtonType.POSITIVE, LocalizacionManager.instance.GetTexto(258).ToUpper(), string.Format(LocalizacionManager.instance.GetTexto(259), "<color=#ddf108>" + LocalizacionManager.instance.GetTexto(11) + " " + ((int)(faseMinima / 10) + 1) + "-" + (faseMinima % 10) + "</color>"), LocalizacionManager.instance.GetTexto(45).ToUpper()); return; } // si el usuario necesita al menos un lanzador para jugar => comprobar que lo tenga if ((estoyJugandoDuelo || (!estoyJugandoDuelo && GameplayService.initialGameMode == GameMode.Shooter)) && !InfoJugadores.instance.HayAlgunLanzadorAdquirido()) { ifcDialogBox.instance.ShowOneButtonDialog( ifcDialogBox.OneButtonType.POSITIVE, LocalizacionManager.instance.GetTexto(84).ToUpper(), LocalizacionManager.instance.GetTexto(94), LocalizacionManager.instance.GetTexto(45).ToUpper()); return; } // si el usuario necesita al menos un portero para jugar => comprobar que lo tenga if ((estoyJugandoDuelo || (!estoyJugandoDuelo && GameplayService.initialGameMode == GameMode.GoalKeeper)) && !InfoJugadores.instance.HayAlgunPorteroAdquirido()) { ifcDialogBox.instance.ShowOneButtonDialog( ifcDialogBox.OneButtonType.POSITIVE, LocalizacionManager.instance.GetTexto(84).ToUpper(), LocalizacionManager.instance.GetTexto(95), LocalizacionManager.instance.GetTexto(45).ToUpper()); return; } Interfaz.ClickFX(); // pedir el alias al usuario if (estoyJugandoDuelo && Interfaz.m_uname == "") { PedirAlias(Interfaz.m_uname); return; } // al salir de esta pantalla verificar que los jugadores y las equipaciones seleccionadas estan adquiridas ComprobarJugadoresYEquipacionesAdquiridos(); // comprobar si se esta jugando en modo "single" o "multi" if (m_pantallaAnterior == ifcMainMenu.instance) { // estoy jugando Duelo => ir al "Lobby" // ocultar la barra superior //cntBarraSuperior.instance.SetVisible(false); #if DEBUG_MULTI GoDuelo(); #else Interfaz.instance.getServerIP(Stats.tipo, Stats.zona); #endif ifcDialogBox.instance.ShowZeroButtonDialog( LocalizacionManager.instance.GetTexto(96).ToUpper(), LocalizacionManager.instance.GetTexto(97)); //ifcDialogBox.instance.Show(ifcDialogBox.TipoBotones.NONE, "Conectando...", "Por favor, espere."); } else if (m_pantallaAnterior == ifcCarrera.instance) { // estoy jugando Single => jugar mision Cortinilla.instance.Play(); } }; } // escudo multiplicador de puntuacion if (m_imgEscudo == null) { m_imgEscudo = transform.FindChild("escudo").GetComponent <GUITexture>(); } if (m_txtMultiplicador == null) { m_txtMultiplicador = transform.FindChild("escudo/txtMultiplicador").GetComponent <GUIText>(); } }
void Start() { transform.Find("encuesta/btnVotar").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); #if UNITY_WEBPLAYER Application.ExternalEval("window.open('http://opin.at/vli','Votar')"); #else Application.OpenURL("http://opin.at/vli"); #endif }; transform.Find("encuesta2/btnVotar").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); #if UNITY_WEBPLAYER Application.ExternalEval("window.open('http://opin.at/vli','Votar')"); #else Application.OpenURL("http://opin.at/vli"); #endif }; // botones para paginar los porteros transform.Find("selectGoalkeeper/btnRight").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); Interfaz.instance.Goalkeeper++; MostrarPorteroSeleccionado(); }; transform.Find("selectGoalkeeper/btnLeft").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); Interfaz.instance.Goalkeeper--; MostrarPorteroSeleccionado(); }; /* * // botones para paginar los tiradores * transform.Find("selectThrower/btnRight").GetComponent<btnButton>().action = (_name) => { * Interfaz.ClickFX(); * Interfaz.instance.Thrower++; * MostrarTiradorSeleccionado(); * }; * transform.Find("selectThrower/btnLeft").GetComponent<btnButton>().action = (_name) => { * Interfaz.ClickFX(); * Interfaz.instance.Thrower--; * MostrarTiradorSeleccionado(); * }; * * // crear el control para mostrar una alerta sobre los tiradores * GameObject go; * m_cntInfoTiradorDisponible = go.GetComponent<cntInfoJugadorDisponible>(); * m_cntInfoTiradorDisponible.Inicializar(this.transform, "infoTiradorDisponible", new Vector3(5.9051f, -1.07f, 0.0f)); * Scale(m_cntInfoTiradorDisponible.gameObject); * * // crear el control para mostrar una alerta sobre los porteros * m_cntInfoPorteroDisponible = go.GetComponent<cntInfoJugadorDisponible>(); * m_cntInfoPorteroDisponible.Inicializar(this.transform, "infoPorteroDisponible", new Vector3(6.1751f, -1.07f, 0.0f)); * Scale(m_cntInfoPorteroDisponible.gameObject); * * // obtener la referencia de las texturas de los candados * m_texturaCandadoTirador = transform.FindChild("infoTiradorDisponible/candado").GetComponent<GUITexture>(); * m_texturaCandadoPortero = transform.FindChild("infoPorteroDisponible/candado").GetComponent<GUITexture>(); * * // mostrar los jugadores seleccionados * MostrarTiradorSeleccionado(); * MostrarPorteroSeleccionado(); */ }
/// <summary> /// Muestra el control con los valores de los parametros recibidos /// </summary> /// <param name="_usuario"></param> /// <param name="_habilitarRetar">Indica si pulsar al pulsar sobre este control se permite retar a este jugador o no</param> /// <param name="_ocultarBotonesFavorito">Fuerza que no se muestren los botones añadir / eliminar favorito</param> public void AsignarValores(Usuario _usuario, bool _habilitarRetar = true, bool _ocultarBotonesFavorito = false) { // guardar la informacion del usuario m_usuario = _usuario; // actualizar textos m_txtUsuario.text = _usuario.alias; // actualizar collider if (_habilitarRetar) { m_btnRetar.action = (_name) => { Interfaz.ClickFX(); #if !DEBUG_RETO /* * // comprobar si el jugador tiene suficiente dinero para ofrecer un duelo * //H4CK para evitar pagar duelos * if (Interfaz.m_monedas< Stats.PRECIO_RETO) { * // informar al jugador de que no tiene suficiente dinero para retar al rival * ifcDialogBox.instance.Show(ifcDialogBox.TipoBotones.ACEPTAR_CANCELAR, "DINERO INSUFICIENTE", "Para retar a <color=#ffd200>" + _usuario.alias + "</color> a un duelo necesitas disponer al menos <color=#ffd200>" + Stats.PRECIO_RETO + "$</color>."); * * } else { */ #endif // retar al rival ifcDuelo.m_rival = _usuario; ifcDialogBox.instance.ShowTwoButtonDialog( ifcDialogBox.TwoButtonType.POSITIVE_NEGATIVE, LocalizacionManager.instance.GetTexto(102).ToUpper(), string.Format(LocalizacionManager.instance.GetTexto(103), "<color=#ddf108> " + _usuario.alias + "</color>", _usuario.getRatio() + "%"), LocalizacionManager.instance.GetTexto(45).ToUpper(), LocalizacionManager.instance.GetTexto(48).ToUpper(), // accion al pulsar aceptar (_name1) => { // enviar el mensaje al server MensajeBase msg = Shark.instance.mensaje <MsgRequestDuel>(); (msg as MsgRequestDuel).m_challenge = _usuario.alias; (msg as MsgRequestDuel).m_uid = _usuario.uid; msg.send(); // indicar que este jugador paga por el duelo // Interfaz.m_tegoQuePagarDuelo = true; // mostrar un dialogo mientras se espera la respuesta ifcDialogBox.instance.ShowZeroButtonDialog(LocalizacionManager.instance.GetTexto(104).ToUpper(), LocalizacionManager.instance.GetTexto(105)); ifcDialogBox.instance.WaitToCloseAutomatically(Stats.TIEMPO_ESPERA_CONFIRMACION_RETO_RIVAL); }); #if !DEBUG_RETO //} #endif }; m_btnRetar.gameObject.SetActive(true); } else { m_btnRetar.gameObject.SetActive(false); } // instanciar y mostrar el jugador en la escena if (m_jugadorEscena != null) { GameObject.Destroy(m_jugadorEscena); } Vector3 relPosition = new Vector3(transform.position.x, transform.position.y + 0.05f, transform.position.z); m_jugadorEscena = Interfaz.instance.InstantiatePlayerAtScreenRelative(relPosition, _usuario.initMode, _usuario.DefaultCharacter.idModelo, (_usuario.initMode) ? _usuario.equipacionGoalkeeper : _usuario.equipacionShooter); // actualizar control gameObject.SetActive(true); }
/// <summary> /// Obtiene la referencia a los elementos de esta interfaz /// </summary> private void GetReferencias() { // boton atras if (m_btnAtras == null) { m_btnAtras = getComponentByName("btnAtras").GetComponent <btnButton>(); m_backMethod = Back; m_btnAtras.action = Back; } // campos de texto if (m_txtTitulo == null) { m_txtTitulo = transform.FindChild("informacion/titulo").GetComponent <GUIText>(); } if (m_txtTituloSombra == null) { m_txtTituloSombra = transform.FindChild("informacion/tituloSombra").GetComponent <GUIText>(); } if (m_txtLogros == null) { m_txtLogros = transform.FindChild("informacion/logros/Puntos").GetComponent <GUIText>(); } if (m_infoTextos == null || m_infoValores == null) { m_infoTextos = new GUIText[4]; m_infoValores = new GUIText[4]; for (int i = 0; i < 4; ++i) { m_infoTextos[i] = transform.FindChild("informacion/info_" + i + "/Nombre").GetComponent <GUIText>(); m_infoValores[i] = transform.FindChild("informacion/info_" + i + "/Puntos").GetComponent <GUIText>(); } } // boton de lanzador if (m_btnLanzador == null) { m_btnLanzador = transform.FindChild("botones/btnLanzador").GetComponent <btnButton>(); m_btnLanzador.action = (_name) => { Interfaz.ClickFX(); ShowPagina(TipoPagina.LANZADOR); }; } // boton de portero if (m_btnPortero == null) { m_btnPortero = transform.FindChild("botones/btnPortero").GetComponent <btnButton>(); m_btnPortero.action = (_name) => { Interfaz.ClickFX(); ShowPagina(TipoPagina.PORTERO); }; } // boton de duelo if (m_btnDuelo == null) { m_btnDuelo = transform.FindChild("botones/btnDuelo").GetComponent <btnButton>(); m_btnDuelo.action = (_name) => { Interfaz.ClickFX(); ShowPagina(TipoPagina.DUELO); }; } }
/* * //Update is called once per frame * void Update () { * } */ void OnLoginFacebook(string _name) { Debug.Log(">>> PULSO EN LOGIN FACEBOOK"); Interfaz.ClickFX(); }
void OnLoginKicks(string _name) { Debug.Log(">>> PULSO EN LOGIN KICKS"); Interfaz.ClickFX(); }
// Use this for initialization void Start() { m_backMethod = Back; #if UNITY_IPHONE || UNITY_ANDROID transform.Find("btnAlta").gameObject.SetActive(false); transform.Find("btnMedia").gameObject.SetActive(false); transform.Find("btnBaja").gameObject.SetActive(false); transform.Find("SubtituloCalidad").gameObject.SetActive(false); Vector3 tempPos; tempPos = transform.Find("SubtituloAudio").position; tempPos.y -= 0.2f; transform.Find("SubtituloAudio").position = tempPos; tempPos = transform.Find("btnEfectos").position; tempPos.y -= 0.2f; transform.Find("btnEfectos").position = tempPos; tempPos = transform.Find("btnMusica").position; tempPos.y -= 0.2f; transform.Find("btnMusica").position = tempPos; calidad = 2; #else if (!PlayerPrefs.HasKey("calidad")) { calidad = 1; PlayerPrefs.SetInt("calidad", calidad); } else { calidad = PlayerPrefs.GetInt("calidad"); } #endif if (!PlayerPrefs.HasKey("fx")) { fx = true; PlayerPrefs.SetInt("fx", fx ? 1 : 0); } else { fx = PlayerPrefs.GetInt("fx") == 1; } if (!PlayerPrefs.HasKey("music")) { music = true; PlayerPrefs.SetInt("music", music ? 1 : 0); } else { music = PlayerPrefs.GetInt("music") == 1; } getComponentByName("btnEfectos").GetComponent <btnButton>().Toggle = true; getComponentByName("btnMusica").GetComponent <btnButton>().Toggle = true; getComponentByName("btnEfectos").GetComponent <btnButton>().action = (_name) => { fx = !fx; PlayerPrefs.SetInt("fx", fx ? 1 : 0); setFX(); Interfaz.ClickFX(); }; getComponentByName("btnMusica").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); music = !music; PlayerPrefs.SetInt("music", music ? 1 : 0); setMusic(); }; getComponentByName("btnAlta").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); if (calidad != 2) { calidad = 2; PlayerPrefs.SetInt("calidad", calidad); setCalidad(); } }; getComponentByName("btnMedia").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); if (calidad != 1) { calidad = 1; PlayerPrefs.SetInt("calidad", calidad); setCalidad(); } }; getComponentByName("btnBaja").GetComponent <btnButton>().action = (_name) => { Interfaz.ClickFX(); if (calidad != 0) { calidad = 0; PlayerPrefs.SetInt("calidad", calidad); setCalidad(); } }; getComponentByName("btnAtras").GetComponent <btnButton>().action = Back; setFX(); setMusic(); setCalidad(); }