private void setBonus(Label label, IResearchType researchType, int level) { if (level > 0 && level <= researchType.GetMaxLevel()) { label.Content = researchType.GetResearchBonus(level).GetFirstBonus() + " %"; } }
private void setPath(Rectangle rectangle, IResearchType researchType, int level) { // max level if (level == researchType.GetMaxLevel() + 1) { level--; } if (level <= 0 || level > researchType.GetMaxLevel()) { return; } var path = researchType.GetElementPath(level); rectangle.Fill = new ImageBrush { ImageSource = new BitmapImage(new Uri(@path, UriKind.RelativeOrAbsolute)) }; }
private void setNextBonus(Label label, IResearchType researchType, int level) { if (level >= 0 && level < researchType.GetMaxLevel()) { label.Content = researchType.GetResearchBonus(level + 1).GetFirstBonus() + " %"; } else { label.Content = "No research bonus next"; } }
private void setResearchCost(IResearchType researchType) { var level = researchType.GetLevel(); if (level >= 0 && level < researchType.GetMaxLevel()) { var researchCost = researchType.GetResearchCost(level + 1); researchType.GetResearchCostLabel().Content = researchCost.Research; researchType.GetGoldCostLabel().Content = researchCost.Gold; researchType.GetRessourceCostLabel().Content = researchCost.GetFirstCost(); } }
private void updateResearchInformations(IResearchType researchType) { setPath(researchType.GetImageRectangle(), researchType, researchType.GetLevel() + 1); setBonus(researchType.GetCurrentBonusLabel(), researchType, researchType.GetLevel()); setNextBonus(researchType.GetNextBonusLabel(), researchType, researchType.GetLevel()); setResearchCost(researchType); if (researchType.GetLevel() == researchType.GetMaxLevel()) { researchType.GetResearchButton().Visibility = Visibility.Hidden; researchType.GetCostCanvas().Visibility = Visibility.Hidden; } }
public bool Buy(IResearchType research) { if (research == null) return false; int researchLevel = research.GetLevel(); if (researchLevel < 0 || researchLevel >= research.GetMaxLevel()) return false; ResearchCost cost = research.GetResearchCost(researchLevel + 1); if (cost == null) return false; return CheckRessourcesAvailability(cost); }
public bool Buy(IResearchType research) { if (research == null) { return(false); } int researchLevel = research.GetLevel(); if (researchLevel < 0 || researchLevel >= research.GetMaxLevel()) { return(false); } ResearchCost cost = research.GetResearchCost(researchLevel + 1); if (cost == null) { return(false); } return(CheckRessourcesAvailability(cost)); }
private void setPath(Rectangle rectangle, IResearchType researchType, int level) { // max level if (level == researchType.GetMaxLevel() + 1) level--; if (level <= 0 || level > researchType.GetMaxLevel()) return; var path = researchType.GetElementPath(level); rectangle.Fill = new ImageBrush { ImageSource = new BitmapImage(new Uri(@path, UriKind.RelativeOrAbsolute)) }; }