public void Load(AdGame game)
    {
        Title.text = game.Name;
        Desc.text  = game.Desc;
        string urlIconPreview = game.Preview;

        try
        {
            WebClient preview = new WebClient();
            byte[]    bitIcon = preview.DownloadData(urlIconPreview);
            if (bitIcon != null && bitIcon.Length != 0)
            {
                Texture2D tex = new Texture2D(200, 150);
                tex.LoadImage(bitIcon);
                Preview.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
            }
            preview.Dispose();
            preview = null;
        }
        catch
        {
        }

        Install.onClick.AddListener(() => { Application.OpenURL(game.Url + game.Query); });
    }
示例#2
0
    public void LoadGrid(LitJson.JsonData json)
    {
        if (json != null)
        {
            if (json["newVersion"] != null)
            {
                newVersion = json["newVersion"]["v"].ToString();
                apkUrl     = json["newVersion"]["url"].ToString();
            }

            if (json["moreGame"] != null)
            {
                for (int i = 0; i < json["moreGame"].Count; i++)
                {
                    AdGame g = new AdGame();
                    g.Name    = json["moreGame"][i]["Name"].ToString();
                    g.Url     = json["moreGame"][i]["Url"].ToString();
                    g.Preview = json["moreGame"][i]["Preview"].ToString();
                    g.Desc    = json["moreGame"][i]["Desc"].ToString();
                    g.Query   = json["moreGame"][i]["Query"].ToString();
                    moreGame.Add(g);
                }
            }

            if (json["Notice"] != null)
            {
                notice = json["Notice"].ToString();
            }
        }
    }