private void FillConferenceData(string data, OnResponseCallback response = null)
        {
            var n = JSON.Parse(data);
            //Debug.Log(n);
            List <Exposition> arrExpo = new List <Exposition>();

            for (int i = 0; i < n["message"].Count; i++)
            {
                Exposition e = new Exposition();

                e.id                  = n["message"][i]["id"].AsInt;
                e.date                = DateTime.Parse(n["message"][i]["date"].Value);
                e.name_exposition     = n["message"][i]["name_exposition"].Value;
                e.info_exposition     = n["message"][i]["info_exposition"].Value;
                e.hour                = n["message"][i]["hour"].Value;
                e.room                = n["message"][i]["room"].Value;
                e.name_expositor      = n["message"][i]["name_expositor"].Value;
                e.url_photo_expositor = n["message"][i]["photo_expositor"].Value;
                e.info_expositor      = n["message"][i]["info_expositor"].Value;

                arrExpo.Add(e);
            }

            ConferenceControl.Instance.FillExpositionsInformation(arrExpo);

            if (response != null)
            {
                response(true, "Datos cargado correctamente");
            }
        }
Example #2
0
        private string getFormatStringInfo(Exposition expo)
        {
            //string textFormat = "<size=80%>@NameExposition\n\n<size=60%>@Hour\n<size=60%><color=#3fcf4e>Room @Room</color>\n<size=100%><b>@NameExpositor";
            // TODO Cambiar formato
            string textFormat = "<line-height=70%><size=90%>@NameExposition\n\n<line-height=50%><size=80%><color=#3fcf4e>@Hour\n<size=60%>Room @Room</color>\n\n<line-height=100%><size=100%><b>@NameExpositor";

            textFormat = textFormat.Replace("@NameExposition", expo.name_exposition);
            textFormat = textFormat.Replace("@Hour", expo.hour);
            textFormat = textFormat.Replace("@Room", expo.room);
            textFormat = textFormat.Replace("@NameExpositor", expo.name_expositor);

            if (String.IsNullOrEmpty(expo.room))
            {
                textFormat = textFormat.Replace("Room", "");
            }

            return(textFormat);
        }
Example #3
0
        public void initMainMenu()
        {
            _popUp = FindObjectOfType <PopUp>();

            // Cambiar color del boton del dia y mostrar charlas

            int today = DateTime.Now.Day;

            Button bttnToday = null;

            bttnDayOne.transform.Find("bar").GetComponent <Image>().color   = colorMaptek;
            bttnDayTwo.transform.Find("bar").GetComponent <Image>().color   = colorMaptek;
            bttnDayThree.transform.Find("bar").GetComponent <Image>().color = colorMaptek;

            if (today <= 20)
            {
                bttnToday = bttnDayOne;
            }
            if (today == 21)
            {
                bttnToday = bttnDayTwo;
            }
            if (today >= 22)
            {
                bttnToday = bttnDayThree;
            }

            bttnToday.transform.Find("bar").GetComponent <Image>().color = Color.white;
            bttnToday.GetComponent <Image>().color = colorMaptek;
            bttnToday.GetComponentInChildren <TextMeshProUGUI>().color = Color.white;

            // Cargar charlas del dia
            if (ConferenceControl.Instance.currExposition.isOpen)
            {
                Exposition e = ConferenceControl.Instance.currExposition;
                Button     b = null;

                if (e.date.Day <= 20)
                {
                    b = bttnDayOne;
                }
                ;

                if (e.date.Day == 21)
                {
                    b = bttnDayOne;
                }

                if (e.date.Day >= 22)
                {
                    b = bttnDayOne;
                }

                b.onClick.Invoke();
                b.Select();
            }
            else
            {
                bttnToday.onClick.Invoke();
                bttnToday.Select();
            }
        }
        public void setLikeExposition(Webservice.OnResponseCallback response = null)
        {
            Exposition expo = arrExposition.Single((ex) => ex.id == currExposition.id);

            User u = new User();

            u.id                = AppManager.Instance.currUser.id;
            u.email             = AppManager.Instance.currUser.email;
            u.idLikeExpositions = AppManager.Instance.currUser.idLikeExpositions;

            bool exists = u.idLikeExpositions.Any((l) => l == expo.id);

            if (exists)
            {
                // Eliminar like
                u.idLikeExpositions.Remove(expo.id);

                Webservice.Instance.deleteLike(expo.id, (s, m) =>
                {
                    if (s)
                    {
                        expo.isLiked = !exists;

                        AppManager.Instance.currUser = u;
                    }
                    else
                    {
                        // Problemas con el servidor
                    }

                    if (response != null)
                    {
                        response(s, m);
                    }
                });
            }
            else
            {
                // Agregar like
                u.idLikeExpositions.Add(expo.id);

                Webservice.Instance.addLike(expo.id, (s, m) =>
                {
                    if (s)
                    {
                        expo.isLiked = !exists;

                        AppManager.Instance.currUser = u;
                    }
                    else
                    {
                        // Problemas con el servidor
                    }

                    if (response != null)
                    {
                        response(s, m);
                    }
                });
            }
        }