コード例 #1
0
    protected virtual void Initialize()
    {
        Title.text   = Doc.Title;
        Date.text    = Utils.Get_String(Doc.Creation_time);
        details.text = Doc.Details;

        foreach (string url in Doc.Urls)
        {
            Button button = Instantiate(url_prefab, transform).GetComponent <Button>();
            button.onClick.AddListener(() =>
            {
                Message.ShowMessage("Enlace copiado, abriéndolo en el navegador.");
                GUIUtility.systemCopyBuffer = url;
                Application.OpenURL(url);
            });

            button.GetComponentInChildren <Text>().text = url;
        }

        Date.transform.SetAsLastSibling();

        if (Doc.Imgs[0] != "empty")
        {
            foreach (string image in Doc.Imgs)
            {
                Http_Client.Download_Image(image, transform, Handle_Img_Response);
            }
        }

        Canvas.ForceUpdateCanvases();
        GetComponentInChildren <VerticalLayoutGroup>().SetLayoutVertical();
    }
コード例 #2
0
    protected virtual void Initialize()
    {
        Title.text = news_entry.Title;
        string month = news_entry.Creation_time.ToString("MMMM").ToUpper().Substring(0, 3);

        Creation_time.text = month + " " + news_entry.Creation_time.Day.ToString() + " de " + news_entry.Creation_time.Year;
        Detail.text        = news_entry.Details;

        if (news_entry.Imgs.Count > 0 && news_entry.Imgs[0] != "empty")
        {
            foreach (string image in news_entry.Imgs)
            {
                Http_Client.Download_Image(image, transform, Handle_Img_Response);
            }
        }

        Canvas.ForceUpdateCanvases();
        GetComponentInChildren <VerticalLayoutGroup>().SetLayoutVertical();

        if (!news_entry.Seen)
        {
            string[] field_names  = { "REQUEST_TYPE", "news_id", "id" };
            string[] field_values = { "set_news_seen", news_entry.Id.ToString(), User.User_Info.Id.ToString() };
            Http_Client.Send_Post(field_names, field_values, (string response, Handler_Type type) => { }, Handler_Type.none);
            news_entry.Seen = true;
            User.User_Info.News_Data.Add(news_entry.Id);
            Database_Handler.Update_Unread(Handler_Type.news);
        }
    }