/// <summary> /// Initialise the Table UI /// </summary> /// <param name="c"></param> public TableUI(Coordinator c) { InitializeComponent(); coordinator = c; //get the local IP address yourIPAddressField.Content = coordinator.client.ipAddr.ToString(); lvPlayers.ItemsSource = players; }
public AIStrategy(char mode, Coordinator c) { InitializeComponent(); //there are two modes (so far) //'V' for vanilla //'L' for leaders //fill the available AI list //Add vanilla strats to AIStrategy UI combobox if (mode == 'V') { } else if (mode == 'L') { ComboBoxItem item0 = new ComboBoxItem(); item0.Content = "Discard random card (Leaders)"; strategyBox.Items.Add(item0); ComboBoxItem item1 = new ComboBoxItem(); item1.Content = "Build anything that's buildable (Leaders)"; strategyBox.Items.Add(item1); ComboBoxItem item2 = new ComboBoxItem(); item2.Content = "Prefer Victory Points (Leaders)"; strategyBox.Items.Add(item2); ComboBoxItem item3 = new ComboBoxItem(); item3.Content = "Prefer Military (Leaders)"; strategyBox.Items.Add(item3); ComboBoxItem item4 = new ComboBoxItem(); item4.Content = "\"Difficult\" (Leaders)"; strategyBox.Items.Add(item4); } coordinator = c; }
public GetDebtToken(Coordinator coordinator, NameValueCollection p) { InitializeComponent(); this.coordinator = coordinator; coinsInTreasury = int.Parse(p["coin"]); coinsToLose = int.Parse(p["coinsToLose"]); lblMessageToPlayer.Content = string.Format("You have a {0}-coin debt to pay.\n", coinsToLose); lblMessageToPlayer.Content += string.Format("There are currently {0} coins in your treasury.\n", coinsInTreasury); lblMessageToPlayer.Content += string.Format("How much of this debt to you want to pay now?\n"); lblMessageToPlayer.Content += string.Format("Any debt not paid off immediately counts as minus 1\n"); lblMessageToPlayer.Content += string.Format("Victory Points at the conclusion of the game.\n"); sliderResponse.Maximum = coinsToLose; sliderResponse.Minimum = Math.Max(0, coinsToLose - coinsInTreasury); // The default is for the player to pay all of the debt (or as much as possible) sliderResponse.Value = sliderResponse.Minimum; lblDebt.Content = sliderResponse.Value; lblCoins.Content = coinsInTreasury - (coinsToLose - sliderResponse.Value); }
public CourtesanUI(Coordinator c, string information) { throw new NotImplementedException(); /* CourtesanGuildInformation info = (CourtesanGuildInformation)(Marshaller.StringToObject(information)); this.c = c; InitializeComponent(); leaderComboBoxItems = new ComboBoxItem[info.card.Count]; //first, add a "Choose none" option ComboBoxItem noneComboBoxItem = new ComboBoxItem(); noneComboBoxItem.Tag = 0; noneComboBoxItem.Content = "Choose nothing"; leaderComboBox.Items.Add(noneComboBoxItem); //populate the Combo box with names and id for (int i = 0; i < info.card.Count; i++) { leaderComboBoxItems[i] = new ComboBoxItem(); leaderComboBoxItems[i].Tag = (int)info.card[i].Item2; leaderComboBoxItems[i].Content = (string)info.card[i].Item1; leaderComboBox.Items.Add(leaderComboBoxItems[i]); } //make graphics bettter RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.HighQuality); currentPath = Environment.CurrentDirectory; */ }
public Client(Coordinator c, String user) { this.c = c; nickname = user; }
//constructor: create the UI. create the Coordinator object public MainWindow() { //create the coordinator coordinator = new Coordinator(this); InitializeComponent(); //make graphics better RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.Fant); /* Test code for displaying the Final Score window without actually having to play through a game. * Uncomment if you want the UI to display this window, then exit. * NameValueCollection testScores = HttpUtility.ParseQueryString("JaPlayer1=1,2,3,4,5,6,7,8,9,69&Player2=2,2,2,2,2,2,2,2,2,22&Player3=-3,-3,-3,-3,-3,-3,-3,-3,-3,33"); NameValueCollection testScores = HttpUtility.ParseQueryString("Player1=1,2,3,4,5,6,7,8,9,69&Player2=2,2,2,2,2,2,2,2,2,22&Player3=-3,-3,-3,-3,-3,-3,-3,-3,-3,33&Player4=4,4,4,4,4,4,4,4,4,44&Player5=5,5,5,5,5,5,5,5,5,55&Player6=6,6,6,6,6,6,6,6,6,66&Player7=7,7,7,7,7,7,7,7,7,77"); NameValueCollection testScores = HttpUtility.ParseQueryString("Player1=1,2,3,4,5,6,7,8,9,69&Player2=2,2,2,2,2,2,2,2,2,22&Player3=-3,-3,-3,-3,-3,-3,-3,-3,-3,33&Player4=4,4,4,4,4,4,4,4,4,44&Player5=5,5,5,5,5,5,5,5,5,55&Player6=6,6,6,6,6,6,6,6,6,66&Player7=7,7,7,7,7,7,7,7,7,77&Player8=8,8,8,8,8,8,8,8,8,88"); FinalScore finalScoreUI = new FinalScore(this, testScores); finalScoreUI.ShowDialog(); return; */ /* Test code for displaying the debt token window without having to play a game. * Uncomment if you want the UI to display this window, then exit. * //NameValueCollection testDebtWindow = HttpUtility.ParseQueryString("GetDebtTokens&coin=15&coinsToLose=10"); NameValueCollection testDebtWindow = HttpUtility.ParseQueryString("GetDebtTokens&coin=10&coinsToLose=15"); GetDebtToken d = new GetDebtToken(coordinator, testDebtWindow); d.ShowDialog(); return; */ JoinTableUI joinGameDlg = new JoinTableUI(); bool succeeded = (bool)joinGameDlg.ShowDialog(); if (!succeeded) { Close(); return; } // Maybe I should have the ability to choose between Joining and Creating? // Original code allowed the creator to add AI and select the leaders. coordinator.joinGame(joinGameDlg.userName, IPAddress.Parse(joinGameDlg.ipAddressAsText)); // coordinator.createGame(); if (!coordinator.client.Connected) { Close(); return; } PlayerStateWindow[,] seatMap = new PlayerStateWindow[,] { { SeatA, SeatF, SeatD, null, null, null, null, null }, // 3 players { SeatA, SeatG, SeatE, SeatC, null, null, null, null }, // 4 players { SeatA, SeatG, SeatF, SeatD, SeatC, null, null, null }, // 5 players { SeatA, SeatH, SeatF, SeatE, SeatD, SeatB, null, null }, // 6 players { SeatA, SeatH, SeatG, SeatF, SeatD, SeatC, SeatB, null}, // 7 players { SeatA, SeatH, SeatG, SeatF, SeatE, SeatD, SeatC, SeatB }, // 8 players }; int playerIndex = 0; // each player should see the "A" position for his cards. Find our index. Will be 0 for the // first player (the game creator), 1 for the 2nd player, 2 for the 3rd, etc. while (coordinator.playerNames[playerIndex] != coordinator.nickname) playerIndex++; for (int i = 0; i < coordinator.playerNames.Length; ++i) { playerState.Add(coordinator.playerNames[playerIndex], new PlayerState(seatMap[coordinator.playerNames.Length - 3, i], coordinator.playerNames[playerIndex])); ++playerIndex; if (playerIndex == coordinator.playerNames.Length) playerIndex = 0; } // coordinator.sendToHost("U"); }
public changeNicknameUI(Coordinator c) { coordinator = c; InitializeComponent(); ShowDialog(); }
/// <summary> /// Set the coordinator and handle CommerceInformation, which contains all necessary UI data, from GameManager /// </summary> public NewCommerce(Coordinator coordinator, Card cardToBuild, bool isWonderStage, /* List<Card> cardList, */ /*string cardName, int wonderStage,*/ NameValueCollection qscoll) { //intialise all the UI components in the xaml file (labels, etc.) to avoid null pointer InitializeComponent(); this.coordinator = coordinator; leftName = "Left Neighbor"; middleName = "Player"; rightName = "Right Neighbor"; this.cardToBuild = cardToBuild; this.isStage = isWonderStage; if (isStage) { string strWonderName = qscoll["WonderStageCard"]; cardToBuild = coordinator.FindCard(strWonderName); } cardCost = cardToBuild.cost; string strLeaderDiscounts = qscoll["LeaderDiscountCards"]; if (strLeaderDiscounts != string.Empty) { foreach (string strCardId in strLeaderDiscounts.Split(',')) { Card leaderDiscountCard = coordinator.FindCard(strCardId); if (((StructureDiscountEffect)leaderDiscountCard.effect).discountedStructureType == cardToBuild.structureType) { leaderDiscountCardId = leaderDiscountCard.Id.ToString(); } } } leftRawMarket = qscoll["hasWestTradingPost"] != null; rightRawMarket = qscoll["hasEastTradingPost"] != null; marketplace = qscoll["hasMarketplace"] != null; leftDock = qscoll["hasClandestineDockWest"] != null; rightDock = qscoll["hasClandestineDockEast"] != null; hasSecretWarehouse = qscoll["hasSecretWarehouse"] != null; string strBlackMarkets = qscoll["nBlackMarket"]; if (strBlackMarkets != null) { nBlackMarkets = int.Parse(strBlackMarkets); } else { nBlackMarkets = 0; } PLAYER_COIN = int.Parse(qscoll["coin"]); CreateDag(middleDag, qscoll["PlayerResources"]); CreateDag(leftDag, qscoll["LeftResources"]); CreateDag(rightDag, qscoll["RightResources"]); //set the name labels leftNameLabel.Content = leftName; middleNameLabel.Content = middleName; rightNameLabel.Content = rightName; //set the player's total coins playerCoinsLabel.Content = PLAYER_COIN; bankCoinsLabel.Content = cardCost.coin; //set the market images leftRawImage.Source = FindResource(leftRawMarket ? "1r" : "2r") as BitmapImage; rightRawImage.Source = FindResource(rightRawMarket ? "1r" : "2r") as BitmapImage; leftManuImage.Source = rightManuImage.Source = FindResource(marketplace ? "1m" : "2m") as BitmapImage; if (leftDock) clandestineDockWestImage.Source = FindResource("Icons/Clandestine_Dock_West") as BitmapImage; if (rightDock) clandestineDockEastImage.Source = FindResource("Icons/Clandestine_Dock_East") as BitmapImage; if (leaderDiscountCardId != null) { middleDag.add(new ResourceEffect(false, "WSBOCGP")); } if (nBlackMarkets != 0) { string strBlackMarketResources = "WSBOCGP"; foreach (ResourceEffect re in middleDag.getResourceList(false)) { // The Black Market only excludes resources produced by this // city's brown or grey structures, which only have 1 or 2 resource types // So this excludes the Caravansery, Forum, and any Wonder stages. if (re.resourceTypes.Length <= 2) { foreach (char c in re.resourceTypes) { int index = strBlackMarketResources.IndexOf(c); if (index >= 0) strBlackMarketResources = strBlackMarketResources.Remove(index, 1); } } } if (strBlackMarketResources != string.Empty) { for (int i = 0; i < nBlackMarkets; i++) middleDag.add(new ResourceEffect(false, strBlackMarketResources)); } } hasBilkis = qscoll["Bilkis"] != null; if (hasBilkis) { imgBilkisPower.Visibility = Visibility.Visible; // Add Bilkis' choice middleDag.add(new ResourceEffect(false, "WSBOCGP")); } if (hasSecretWarehouse) { SecretWarehouseImage.Source = FindResource("Icons/Secret_Warehouse") as BitmapImage; } //generate mutable elements (DAG buttons, Price representations, currentResources, etc.) reset(); }