Esempio n. 1
0
        public MainDialog()
        {
            InitializeComponent();

            lst_Stocks.Clear();

            m_StockPanel = new StockPanel();
            m_StockPanel.StockChanged += new EventHandler <StockChangedEventArgs>(StockPanel_StockChanged_EventHandler);
            m_StockPanel.StockChecked += new EventHandler <StockChangedEventArgs>(StockPanel_StockChecked_EventHandler);
            TabPage_Stock.Controls.Add(m_StockPanel);

            m_IndexPanel = new IndexPanel();
            m_IndexPanel.IndexItemChanged += new EventHandler <IndexEventArgs>(IndexPanel_IndexItemChanged_EventHandler);
            TabPage_Market.Controls.Add(m_IndexPanel);

            m_StockList = new StockDetailView("");
            TabPage_StockDetail.Controls.Add(m_StockList);

            m_DealPanel = new DealPanel();
            TabPage_Deal.Controls.Add(m_DealPanel);
        }
Esempio n. 2
0
    public IEnumerator SetData(VideoSerialize video, bool local, IndexPanel indexPanel)
    {
        if (video.id == this.video?.id)
        {
            yield break;
        }

        titleText.text     = video.title;
        authorText.text    = video.username;
        sizeText.text      = MathHelper.FormatBytes(video.downloadsize);
        lengthText.text    = MathHelper.FormatSeconds(video.length);
        timestampText.text = MathHelper.FormatTimestampToTimeAgo(video.realTimestamp);
        isLocal            = local;
        this.video         = video;
        this.indexPanel    = indexPanel;

        if (video.title == "Corrupted file")
        {
            titleText.color = Color.red;
        }

        if (!video.compatibleVersion)
        {
            error.transform.parent.gameObject.SetActive(true);
            error.GetComponent <Text>().text = $"This project uses a version that's higher than the player's. Please update the player. [{video.id}]";
        }
        else
        {
            error.transform.parent.gameObject.SetActive(false);
        }

        if (isLocal)
        {
            imageDownload = UnityWebRequestTexture.GetTexture("file:///" + Path.Combine(Application.persistentDataPath, Path.Combine(video.id, SaveFile.thumbFilename)));
        }
        else
        {
            imageDownload = UnityWebRequestTexture.GetTexture(Web.thumbnailUrl + "?id=" + video.id);
        }

        using (imageDownload)
        {
            yield return(imageDownload.SendWebRequest());

            if (imageDownload == null)
            {
                Assert.IsTrue(false, "This isn't supposed to happen. Investigate! " + imageDownload.url);
            }

            if (imageDownload.isNetworkError || imageDownload.isHttpError)
            {
                Debug.Log("Failed to download thumbnail " + imageDownload.url + ": " + imageDownload.error);
            }
            else if (imageDownload.isDone)
            {
                var texture = DownloadHandlerTexture.GetContent(imageDownload);
                thumbnailImage.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                thumbnailImage.color  = Color.white;
            }
            else
            {
                Assert.IsTrue(false, "This isn't supposed to happen. Investigate! " + imageDownload.url);
            }
        }

        imageDownload = null;
    }