/*In case the player selects a node that is being upgrades, the costs of upgrading must be hidden and only the remaining * amount of time will be displayed*/ public void showProgress(Steward steward) { Enabled = false; imgGold.Visibility = Visibility.Collapsed; txtGoldCost.Visibility = Visibility.Collapsed; imgStone.Visibility = Visibility.Collapsed; txtStoneCost.Visibility = Visibility.Collapsed; txtTime.Text = steward.working.ToString(); }
public void addSteward(Steward steward) { AgentCounter++; Stewards.Add(steward); }
/*The following function shows the costs necessary for an upgrade, disabled the ability to upgrade in case there * is not enough gold or stone and, in case the holding is being upgraded, progress will be shown instead of costs*/ public void show(Node node, Steward steward, Player player) { imgGold.Visibility = Visibility.Visible; txtGoldCost.Visibility = Visibility.Visible; imgStone.Visibility = Visibility.Visible; txtStoneCost.Visibility = Visibility.Visible; Enabled = true; if (steward.working != 0) { showProgress(steward); } else if (node.NodeType == enmNodeType.Metropolis) { txtGoldCost.Text = metropolisGoldCosts[node.DefenseLevel].ToString(); txtStoneCost.Text = metropolisStoneCosts[node.DefenseLevel].ToString(); txtTime.Text = metropolisTimeCosts[node.DefenseLevel].ToString(); if (player.Gold < metropolisGoldCosts[node.DefenseLevel] || player.Stone < metropolisStoneCosts[node.DefenseLevel]) { Enabled = false; } } else if (node.NodeType == enmNodeType.Castle) { txtGoldCost.Text = castleGoldCosts[node.DefenseLevel].ToString(); txtStoneCost.Text = castleStoneCosts[node.DefenseLevel].ToString(); txtTime.Text = castleTimeCosts[node.DefenseLevel].ToString(); if (player.Gold < castleGoldCosts[node.DefenseLevel] || player.Stone < castleStoneCosts[node.DefenseLevel]) { Enabled = false; } } else if (node.NodeType == enmNodeType.City) { txtGoldCost.Text = cityGoldCosts[node.DefenseLevel].ToString(); txtStoneCost.Text = cityStoneCosts[node.DefenseLevel].ToString(); txtTime.Text = cityTimeCosts[node.DefenseLevel].ToString(); if (player.Gold < cityGoldCosts[node.DefenseLevel] || player.Stone < cityStoneCosts[node.DefenseLevel]) { Enabled = false; } } else if (node.NodeType == enmNodeType.Church) { txtGoldCost.Text = churchGoldCosts[node.DefenseLevel].ToString(); txtStoneCost.Text = churchStoneCosts[node.DefenseLevel].ToString(); txtTime.Text = churchTimeCosts[node.DefenseLevel].ToString(); if (player.Gold < churchGoldCosts[node.DefenseLevel] || player.Stone < churchStoneCosts[node.DefenseLevel]) { Enabled = false; } } else if (node.NodeType == enmNodeType.Village) { txtGoldCost.Text = villageGoldCosts[node.DefenseLevel].ToString(); txtStoneCost.Text = villageStoneCosts[node.DefenseLevel].ToString(); txtTime.Text = villageTimeCosts[node.DefenseLevel].ToString(); if (player.Gold < villageGoldCosts[node.DefenseLevel] || player.Stone < villageStoneCosts[node.DefenseLevel]) { Enabled = false; } } }