Beispiel #1
0
    void OnEnable()
    {
        ArtistaData artista = DataManager.Instance.artistaActual;

        asistencia.size = artista.concierto.asistencia;
        porcentaje.text = (int)(asistencia.size * 100) + "%";
    }
Beispiel #2
0
    void Start()
    {
        if (!PlayerPrefs.HasKey("ConciertosRestantes"))
        {
            PlayerPrefs.SetInt("ConciertosRestantes", conciertosRestantes);
        }
        else
        {
            conciertosRestantes = PlayerPrefs.GetInt("ConciertosRestantes");
        }
        //DontDestroyOnLoad(gameObject);
        if (!PlayerPrefs.HasKey("Money"))
        {
            PlayerPrefs.SetInt("Money", 500);
        }
        else
        {
            currentMoney = PlayerPrefs.GetInt("Money");
        }
        artistaActual = null;
        instruments   = XMLManager.Deserializar <List <InstrumentData> >("listaInstrumentos");
        artistas      = XMLManager.Deserializar <List <ArtistaData> >("artistas");

        canciones = XMLManager.Deserializar <List <Cancion> >("nuevasCanciones");

        ciudades = XMLManager.Deserializar <List <Ciudad> >("ciudades");

        Invoke("manejarDatos", 0.2f);
        InvokeRepeating("timerConcierto", 0, 1);
        artistaActual = artistas[0];
    }
Beispiel #3
0
    public void MostrarDatos()
    {
        Debug.Log("mostrarDatos");
        ArtistaData data = DataManager.Instance.artistaActual;

        if (data != null)
        {
            if (propiedad == Propiedad.Popularidad)
            {
                txt.text = data.influencia.ToString();
            }
            if (propiedad == Propiedad.Talento)
            {
                txt.text = data.talento.ToString();
            }
        }
        else
        {
            data = DataManager.Instance.artistas[0];
            if (propiedad == Propiedad.Popularidad)
            {
                txt.text = data.influencia.ToString();
            }
            if (propiedad == Propiedad.Talento)
            {
                txt.text = data.talento.ToString();
            }
        }
    }
Beispiel #4
0
 public void contratarArtista(ArtistaData artista)
 {
     if (currentMoney >= artista.costoContrato)
     {
         currentMoney -= artista.costoContrato;
         PlayerPrefs.SetInt("Money", currentMoney);
         artista.contratado = true;
         XMLManager.Serializar(artistas, "artistas");
     }
 }
Beispiel #5
0
    public void MostrarDatos(ArtistaData data)
    {
        extras.text = "Talento: " + data.talento + "\nPopularidad: " + data.influencia;
        Button contratar = textoDespedir.GetComponentInParent <Button>();

        textoGenero.text = data.genero.ToString();

        if (!data.contratado)
        {
            contratar.onClick.AddListener(Contratar);
            contratar.onClick.RemoveAllListeners();
            contratar.onClick.AddListener(Contratar);
            textoAccion.text = "No contratado";
            textoAccion.GetComponentInParent <Button>().interactable = false;
            textoDespedir.text    = "Contratar";
            contratar.image.color = Color.green;
        }
        else
        {
            contratar.onClick.AddListener(Despedir);
            contratar.onClick.RemoveAllListeners();
            contratar.onClick.AddListener(Despedir);
            contratar.image.color = Color.red;
            textoDespedir.text    = "Despedir";

            textoAccion.GetComponentInParent <Button>().interactable = true;

            textoAccion.text = "¡A rockear!";
            if (data.concierto.activo)
            {
                System.TimeSpan t = System.TimeSpan.FromSeconds(data.concierto.tiempo - (int)data.concierto.newTime);
                textoAccion.text = "En concierto\n" + t.Minutes.ToString("#00") + ":" + t.Seconds.ToString("#00");
                textoAccion.GetComponentInParent <Button>().interactable = false;
            }
        }
        if (data.concierto.recoger)
        {
            textoAccion.text = ("Recoger ganancia\n$" + data.concierto.ganancia);
            textoAccion.GetComponentInParent <Button>().onClick.AddListener(mostrarDetalles);
            textoAccion.GetComponentInParent <Button>().onClick.AddListener(data.concierto.recogerDinero);
            textoAccion.GetComponentInParent <Button>().onClick.RemoveListener(UI_SceneNavigator.Instance.showSeleccionAccion);
            textoAccion.GetComponentInParent <Button>().image.color = Color.magenta;
            textoAccion.color = Color.white;
        }
        else
        {
            textoAccion.GetComponentInParent <Button>().onClick.AddListener(UI_SceneNavigator.Instance.showSeleccionAccion);
            textoAccion.GetComponentInParent <Button>().onClick.RemoveListener(data.concierto.recogerDinero);
            textoAccion.GetComponentInParent <Button>().onClick.RemoveListener(mostrarDetalles);
            textoAccion.color = Color.black;
            textoAccion.GetComponentInParent <Button>().image.color = Color.white;
        }
        textoSueldo.text = "Porcentaje de ganancia: <b>" + (data.porcentajeGanancias).ToString() + "%</b>";
    }
Beispiel #6
0
    public void mostrarDatos(Ciudad ciudad, Color c)
    {
        ciu = ciudad;
        nombre.GetComponentInParent <Image>().color = c;
        nombre.text = ciudad.nombre;
        viaje       = ciudad.distancia * 6;
        ArtistaData artista = DataManager.Instance.artistaActual;


        if (ciudad.capacidad < 400)
        {
            entrada = (int)(4 * ciudad.capacidad / 5.3f) / 40;
        }
        else
        {
            entrada = (int)(4 * ciudad.capacidad / 5.3f) / 137;
        }

        entrada /= 2;
        if (entrada < 2)
        {
            entrada = 2;
        }
        if (ciudad.generoFavorito == artista.genero)
        {
            entrada = (int)(entrada * 1.7634f);
        }

        asistencia = Mathf.Clamp(((artista.influencia / 50) / 1.113f) + Mathf.Log(ciudad.capacidad) / 15, 0, 1);
        if (ciudad.generoFavorito == artista.genero)
        {
            asistencia *= 1.3f;
            if (asistencia > 1)
            {
                asistencia = 0.93f;
            }
        }

        TimeSpan t        = TimeSpan.FromSeconds(viaje);
        string   duracion = t.ToString();

        texto.text = "Duracion: <b>" + duracion + "</b>\n" +
                     "Capacidad: <b>" + ciudad.capacidad + "</b>\n" +
                     "Entradas: <b>$" + entrada + "</b>\n" +
                     "Género favorito: <b>" + ciudad.generoFavorito + "</b>";

        porcentaje_asistencia.SetText((int)(asistencia * 100) + "%");
    }