コード例 #1
0
    //Initialize the ad with its given ad image
    public void Initialize(Sprite adImage, Sprite gameBackground, AdManager adManager, AdShape shape, float adImageWidth, float adImageLength)
    {
        this.adImage        = adImage;
        this.gameBackground = gameBackground;
        this.adManager      = adManager;
        this.shape          = shape;
        this.adImageLength  = adImageLength;
        this.adImageWidth   = adImageWidth;

        renderer        = GetComponent <SpriteRenderer>();
        renderer.sprite = adImage;
        currState       = AdState.Unclicked;
    }
コード例 #2
0
ファイル: AdPane.cs プロジェクト: ShomreiTorah/Journal
        void SetAd(AdShape newAd, bool force = false)
        {
            if (this.ad == newAd && !force) {
                CheckWarnings();
                return;
            }
            Focus();	// Commit any pending edits.
            DisposeDataSources();

            this.ad = newAd;
            layoutControl1.Visible = ad != null;
            if (ad == null) return;
            adsBindingSource.Position = adsBindingSource.IndexOf(ad.Row);
            adType.EditValue = ad.AdType;

            //Singularity's dependency parser cannot handle
            //external rows, so I can't use ad.Row inside of
            //the filter. However, I want to pick up changes
            //to the ad's ExternalId, so I use a function.
            Func<int> externalId = () => ad.Row.ExternalId;

            pledgesSource.DataSource = pledges = Program.Table<Pledge>().Filter(
                p => p.ExternalSource == "Journal " + journal.Year && p.ExternalId == externalId()
            );
            paymentsSource.DataSource = payments = Program.Table<Payment>().Filter(
                p => p.ExternalSource == "Journal " + journal.Year && p.ExternalId == externalId()
            );
            CheckWarnings();

            //I need to call BeginInvoke so that the new row gets painted first.
            pledges.RowAdded += delegate { BeginInvoke(new Action(pledgesView.BestFitColumns)); };
            payments.RowAdded += delegate { BeginInvoke(new Action(paymentsView.BestFitColumns)); };
        }