protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); List <int> tiePlayerNumbers = GetTiePlayerNumbers(Application.GameScoreSubmitScoreData, Game.RoundNumber); LinearLayout container = FindViewById <LinearLayout>(Resource.Id.container); PlayersBuildingChose playersPanel = new PlayersBuildingChose(this, Resources.GetString(Resource.String.medina), 2, 10, new List <int>(), tiePlayerNumbers.ToDictionary(p => p, p => Game.GetPlayer(p).Name), SettingsType.ValidateBuildingsPrice); container.AddView(playersPanel); container.RequestLayout(); Button confirmButton = FindViewById <Button>(Resource.Id.confirmButton); confirmButton.Click += new EventHandler((object sender, EventArgs e) => { if (playersPanel.PlayersPanels.ValidatePlayerPanels()) { Dictionary <int, int> playersHighestPrices = new Dictionary <int, int>(); foreach (int playerNumber in tiePlayerNumbers) { playersHighestPrices[playerNumber] = playersPanel.PlayersPanels[playerNumber - 1].Value; } Application.ConfirmMedinasNumber(this, playersHighestPrices); } }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Dictionary <GranadaBuildingType, List <int> > tiePlayerNumbers = GetTiePlayerNumbers(Application.GameScoreSubmitScoreData, Game.RoundNumber); LinearLayout container = FindViewById <LinearLayout>(Resource.Id.container); Dictionary <GranadaBuildingType, PlayersBuildingChose> playersPanels = new Dictionary <GranadaBuildingType, PlayersBuildingChose>(); foreach (GranadaBuildingType building in Game.GranadaBuildingsOrder) { PlayersBuildingChose playersPanel = null; if (tiePlayerNumbers[building].Count != 0) { playersPanel = new PlayersBuildingChose(this, building.GetEnumDescription(Resources), 2, 12, new List <int>() { 3, 5, 7, 9, 11 }, tiePlayerNumbers[building].ToDictionary(p => p, p => Game.GetPlayer(p).Name), SettingsType.ValidateBuildingsPrice); container.AddView(playersPanel); container.RequestLayout(); } playersPanels[building] = playersPanel; } Button confirmButton = FindViewById <Button>(Resource.Id.confirmButton); confirmButton.Click += new EventHandler((object sender, EventArgs e) => { bool correct = true; Dictionary <GranadaBuildingType, Dictionary <int, int> > result = new Dictionary <GranadaBuildingType, Dictionary <int, int> >(); foreach (KeyValuePair <GranadaBuildingType, PlayersBuildingChose> playersPanel in playersPanels) { Dictionary <int, int> playersHighestPrices = new Dictionary <int, int>(); if (playersPanel.Value != null) { if (!playersPanel.Value.PlayersPanels.ValidatePlayerPanels()) { correct = false; break; } foreach (int playerNumber in tiePlayerNumbers[playersPanel.Key]) { playersHighestPrices[playerNumber] = playersPanel.Value.PlayersPanels[playerNumber - 1].Value; } } result[playersPanel.Key] = playersHighestPrices; } if (correct) { Application.ConfirmGranadaBuildingsNumbers(this, result); } }); }