public void ShowNewAchievement(AchievementRequirements newAchi) { HidePanels(pAchievementsCards); foreach (var achi in AchievementRequirements.AchivementList) { if (!Equals(achi, Achievements.Achievements.Classic)) { _createAchivementPanels.PanelForAchievements(this, pAchievementsCards, achi); } _backNames.Add(achi.BackInfo); _rotateBacks.Add(new Bitmap(achi.BackInfo.Item1)); if (achi.PackInfo == null) { continue; } _packNames.Add(achi.PackInfo); _rotatePacks.Add(new Bitmap(achi.PackPreview)); } foreach (Panel panel in pAchievementsCards.Controls.Cast <Panel>().Where(panel => panel.Name == @"pGet" + newAchi.Name)) { panel.Focus(); pAchievementsCards.ScrollControlIntoView(panel); CreatePanels.TempPanel = panel; panel.Paint += new CreatePanels().UnlockNewAchivementBorder_Paint; break; } ShowDialog(); }
private void bPrevious_Click(object sender, EventArgs e) { Bitmap currentImage = (Bitmap)pickCards.Image; if (_showCardPacks) { for (int i = 0; i < _rotatePacks.Count; i++) { if (!AreEqual(currentImage, _rotatePacks[i])) { continue; } try { pickCards.Image = _rotatePacks[i - 1]; NewPack = _packNames[i - 1].Item1; NewBack = _backNames[i - 1].Item1; AchievementNumber = _packNames[i - 1].Item2; } catch (Exception) { pickCards.Image = _rotatePacks[_rotatePacks.Count - 1]; NewPack = _packNames[_packNames.Count - 1].Item1; NewBack = _backNames[_backNames.Count - 1].Item1; AchievementNumber = _packNames[_packNames.Count - 1].Item2; } } } else if (_showCardBacks) { for (int i = 0; i < _rotateBacks.Count; i++) { if (!AreEqual(currentImage, _rotateBacks[i])) { continue; } try { pickCards.Image = _rotateBacks[i - 1]; NewBack = _backNames[i - 1].Item1; AchievementNumber = _backNames[i - 1].Item2; } catch (Exception) { pickCards.Image = _rotateBacks[_rotateBacks.Count - 1]; NewBack = _backNames[_backNames.Count - 1].Item1; AchievementNumber = _backNames[_backNames.Count - 1].Item2; } } } }
private static bool IsAvailable(AchievementRequirements achievement, string options) { if (achievement == Achievements.Achievements.Classic) { return(true); } if (achievement != null) { if (MainPoker.AllAchievements[achievement.EnumCasted] >= achievement.Requirement) { return(true); } MessageBox.Show(options == "Pack" ? @"You haven't unlocked this card pack yet !" : @"You haven't unlocked this card back yet !"); } return(false); }
public void PanelForAchievements(Form currentForm, FlowLayoutPanel flp, AchievementRequirements achievement) { FlowLayoutPanel retFlp = flp; string pGetAchivementName = @"pGet" + achievement.Name; string lbAchivementName = @"lb" + achievement.Name; string lbAchivementRewardName = @"lb" + achievement.Name + @"Reward"; string cbGetAchivementName = @"cbGet" + achievement.Name; string pbAchivementName = @"pb" + achievement.Name; var pGetAchivement = new Panel { Name = pGetAchivementName, Size = new Size(350, 100), BorderStyle = BorderStyle.FixedSingle, }; currentForm.Controls.Add(pGetAchivement); var lbAchivement = new Label { Name = lbAchivementName, Location = new Point(pGetAchivement.Location.X + 5, pGetAchivement.Location.Y + 5), Size = new Size(135, 30), AutoSize = false, BorderStyle = BorderStyle.FixedSingle, Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, (byte)0), Text = achievement.TitleText, }; var lbAchivementReward = new Label { Name = lbAchivementRewardName, AutoSize = true, Top = (pGetAchivement.Height - pGetAchivement.Height) / 2, Text = achievement.RewardLabelText, TabIndex = 2, BorderStyle = BorderStyle.FixedSingle, Location = new Point(lbAchivement.Location.X, lbAchivement.Location.Y + lbAchivement.Height + 5) }; var cbGetAchivement = new CheckBox { Name = cbGetAchivementName, AutoCheck = false, AutoSize = true, Location = new Point(lbAchivement.Location.X + lbAchivement.Width + 10, lbAchivement.Location.Y + 5), TabIndex = 1, UseVisualStyleBackColor = true }; achievement.IsUnlocked(MainPoker.AllAchievements[achievement.EnumCasted], achievement.Requirement, cbGetAchivement); var pbAchivement = new PictureBox { Name = pbAchivementName, BackgroundImage = achievement.PackPreview, BackgroundImageLayout = achievement.PictureBoxImageLayout, Size = new Size(140, pGetAchivement.Height - 10), TabIndex = 9, TabStop = false, }; pbAchivement.Location = new Point(pGetAchivement.Location.X + pGetAchivement.Width - pbAchivement.Width - 5, pGetAchivement.Location.Y + 3); pGetAchivement.Controls.Add(lbAchivement); pGetAchivement.Controls.Add(lbAchivementReward); pGetAchivement.Controls.Add(cbGetAchivement); pGetAchivement.Controls.Add(pbAchivement); retFlp.Controls.Add(pGetAchivement); achievement.Title = lbAchivement; achievement.RewardLabel = lbAchivementReward; achievement.Unlocked = cbGetAchivement; achievement.Preview = pbAchivement; }