public SpecialEffects(GameRecords model, List<LaterShownItem> laterRevealedObjectsList) { this.model = model; propagateOn = false; researchOn = false; contentmentAward = false; propagation = 0; this.laterRevealedObjects = new ConcurrentQueue<LaterShownItem>(laterRevealedObjectsList); LaterShownItem l; this.laterRevealedObjects.TryDequeue(out l); timeToShowNewItem = l.timeToShow; followingItemToReveal = l.item; }
/// <summary> /// Creates new menu item. User can after build it. /// </summary> /// <param name="image">An image of the new item. </param> /// <param name="click">Specific PathFactory which the item represents. It is return if user clicks on this item.</param> public void CreateNewItem(Image image, MapObjectsFactory click) { Panel p = new Panel(); p.Parent = this; p.Width = 70; p.Height = 100; if (lastPanel != null) { if (lastPanel.Right + p.Width <= this.Width) { p.Top = lastPanel.Top; p.Left = lastPanel.Right; } else { p.Top = lastPanel.Bottom; p.Left = 0; } } else { p.Top = 10; p.Left = 0; } lastPanel = p; Label l = new Label(); l.Parent = p; l.Text = click.name; l.TextAlign = ContentAlignment.TopCenter; l.AutoSize = false; l.Top = 5; l.Left = 0; l.Width = 70; l.Height = 15; Button b = new Button(); b.Parent = p; b.Width = 50; b.Height = 50; b.BackgroundImage = image; b.Tag = click; b.Top = 25; b.Left = 10; b.Click += new System.EventHandler(this.Click); l = new Label(); l.Parent = p; l.Text = Labels.prize + click.prize.ToString(); l.TextAlign = ContentAlignment.TopCenter; l.Height = 15; l.Top = 80; l.Left = 0; l.Width = 70; }
public void SetNullToLastClick() { this.LastClick = null; }
/// <summary> /// Set MapObjectsFactory value to lastClick. /// </summary> /// <param name="lastClick">MapObjectsFactory item, but not null!</param> public void SetLastClick(MapObjectsFactory lastClick) { if (!mustBeEnter && !mustBeExit) this.LastClick = lastClick; else MessageBox.Show(Notices.unfinishedBuilding, Labels.warningMessBox, MessageBoxButtons.OK); }
/// <summary> /// Creates a new buyButton for the given item in an corresponding form. /// </summary> /// <param name="item">A MapObjectFactory item which represents new item to buy. </param> /// <param name="im">An Image which is corresponding to given MapObjectFactory item. </param> public void AddNewItemToForm(MapObjectsFactory item, Image im) { if (item is AmusementsFactory) amusform.CreateNewItem(im, (AmusementsFactory)item); else if (item is PathFactory) pathform.CreateNewItem(im, (PathFactory)item); else accform.CreateNewItem(im, item); }
private void ResearchOnAction(MainForm form) { model.MoneyAdd(-MainForm.researchPrize); timeToShowNewItem--; if (timeToShowNewItem == 0) { MessageBox.Show(Notices.newRevealedItem + followingItemToReveal.name, Labels.gratulationMessBox, MessageBoxButtons.OK); object[] args = { followingItemToReveal, model.images[followingItemToReveal.internTypeId] }; rvDelegate = new RevealItemDelegate(form.AddNewItemToForm); form.BeginInvoke(rvDelegate, args); LaterShownItem l; this.laterRevealedObjects.TryDequeue(out l); if (l != null) { timeToShowNewItem = l.timeToShow; followingItemToReveal = l.item; } else ProcessNewPrize(prize_NoMoreResearch, PrizeNotices.noMoreResearch); } }