public void prepareWinnerPanel() { Debug.Log("Prepare winner Panel"); AuctionHandler auction = State.getAuctionHandler(); int itemIndex = auction.getIndexOfCurrentItem(); Nation itemNation = State.getNations()[itemIndex]; Debug.Log(itemNation.getNationName()); GameObject itemFlag = Instantiate(Resources.Load <GameObject>("Flags/Prefabs/" + itemNation.getNationName())); itemFlag2.ObjectPrefab = itemFlag.transform; Nation winner = State.getNations()[auction.getHighestBidderSoFar()]; GameObject _winnerFlag = Instantiate(Resources.Load <GameObject>("Flags/Prefabs/" + winner.getNationName())); winnerFlag.ObjectPrefab = _winnerFlag.transform; auctionPrizeText.text = "The colony of " + itemNation.getName(); auctionWinnerText.text = "Goes to " + winner.getName() + "!"; }
private void prepareAuctionPanel(AuctionHandler auction) { increaseBid.enabled = true; decreaseBid.enabled = true; App app = UnityEngine.Object.FindObjectOfType <App>(); int playerIndex = app.GetHumanIndex(); Nation player = State.getNations()[playerIndex]; TextMeshProUGUI title = AuctionPanelTitleText.GetComponent <TextMeshProUGUI>(); Nation item = State.getNations()[0]; // Colony Auction backGroudImage.sprite = Resources.Load("Sprites/BackGrounds/imperialism_cartoon", typeof(Sprite)) as Sprite; title.text = "Colony Bids"; pointTypeText.text = "Colonial Points"; // PointTypeImage.sprite = Resources.Load("Sprites/GUI/eagle", typeof(Sprite)) as Sprite; item = State.getNations()[auction.getIndexOfCurrentItem()]; // GameObject mapPrefab = Instantiate(Resources.Load<GameObject>("RPG100set/512/Prop/06_letter" + item.getNationName())); currentNumberOfBiddingPoints.text = player.GetColonialPoints().ToString(); if (player.GetColonialPoints() < State.CurrentColonyAuctionBid || player.RecognizingTheseClaims.Contains(item.getIndex()) || player.landForces.Strength < 2) { increaseBid.interactable = false; } else { increaseBid.interactable = true; } TextMeshProUGUI itemName = ItemNameText.GetComponent <TextMeshProUGUI>(); itemName.text = item.getNationName(); GameObject itemFlag = Instantiate(Resources.Load <GameObject>("Flags/Prefabs/" + item.getNationName())); itemFlag1.ObjectPrefab = itemFlag.transform; // TextMeshProUGUI currentPlayerBid = currentBidAmount.GetComponent<TextMeshProUGUI>(); currentBidAmount.text = "00"; int firstProvIndex = -1; int secondProvIndex = -1; foreach (int provIndex in item.getProvinces()) { if (firstProvIndex == -1) { firstProvIndex = provIndex; } else { secondProvIndex = provIndex; } } assemblyCsharp.Province firstProvince = State.getProvince(firstProvIndex); itemProvinces.Rows[1].Cells[0].GetComponentInChildren <Text>().text = firstProvince.getProvName(); // itemProvinces.Rows[1].Cells[1].GetComponentInChildren<Image>().sprite = Transform P1Res = itemProvinces.Rows[1].Cells[1].transform.GetChild(0); Image P1ResImage = P1Res.GetComponent <Image>(); // Image provOneRes = itemProvinces.Rows[1].Cells[1].GetComponentInChildren<Image>() as Image; //resImg.sprite = Resources.Load("Resource/" + imp.getResourceType().ToString(), typeof(Sprite)) as Sprite; // Debug.Log("First Resource is: " + firstProvince.getResource()); P1ResImage.sprite = Resources.Load("Resource/" + firstProvince.getResource().ToString(), typeof(Sprite)) as Sprite; itemProvinces.Rows[1].Cells[2].GetComponentInChildren <Text>().text = firstProvince.getDevelopmentLevel().ToString(); Toggle provOneRail = itemProvinces.Rows[1].Cells[3].GetComponentInChildren <Toggle>(); if (firstProvince.getRail()) { provOneRail.isOn = true; } else { provOneRail.isOn = false; } assemblyCsharp.Province secondProvince = State.getProvince(secondProvIndex); itemProvinces.Rows[2].Cells[0].GetComponentInChildren <Text>().text = secondProvince.getProvName(); // itemProvinces.Rows[1].Cells[1].GetComponentInChildren<Image>().sprite = // Image provTwoRes = itemProvinces.Rows[2].Cells[1].GetComponentInChildren<Image>() as Image; // Debug.Log("Second Resource is: " + secondProvince.getResource()); Transform P2Res = itemProvinces.Rows[2].Cells[1].transform.GetChild(0); Image P2ResImage = P2Res.GetComponent <Image>(); P2ResImage.sprite = Resources.Load("Resource/" + secondProvince.getResource().ToString(), typeof(Sprite)) as Sprite; itemProvinces.Rows[2].Cells[2].GetComponentInChildren <Text>().text = secondProvince.getDevelopmentLevel().ToString(); Toggle provTwoRail = itemProvinces.Rows[2].Cells[3].GetComponentInChildren <Toggle>(); if (secondProvince.getRail()) { provTwoRail.isOn = true; } else { provTwoRail.isOn = false; } if (item.IsColonyOf() != -1) { Nation currentOwner = State.getNations()[item.IsColonyOf()]; currentOwnerName.text = currentOwner.getNationName(); relationWithCurrentOwner.text = player.Relations[currentOwner.getIndex()].ToString(); } else { currentOwnerName.text = "None"; } if (player.RecognizingTheseClaims.Contains(item.getIndex())) { isRecognizing.isOn = true; } else { isRecognizing.isOn = false; } }
private void updateAuctionPanel() { Debug.Log("Update Auction Panel ___________________________"); App app = UnityEngine.Object.FindObjectOfType <App>(); int playerIndex = app.GetHumanIndex(); Nation player = State.getNations()[playerIndex]; AuctionHandler auction = State.getAuctionHandler(); Nation item = State.getNations()[auction.getIndexOfCurrentItem()]; // Debug.Log(playerIndex); //TextMeshProUGUI currentPlayerBid = currentBidAmount.GetComponent<TextMeshProUGUI>(); currentBidAmount.text = auction.getPlayerBid(playerIndex).ToString(); if (auction.getPlayerBid(playerIndex) > 0 && !auction.getIfPlayerPass(playerIndex)) { decreaseBid.interactable = true; } else { decreaseBid.interactable = false; } if (player.ColonialPoints <= State.CurrentColonyAuctionBid || player.RecognizingTheseClaims.Contains(item.getIndex()) || auction.getIfPlayerPass(playerIndex) || player.landForces.Strength < 2) { increaseBid.interactable = false; } else { increaseBid.interactable = true; } biddingTable.ClearRows(); for (int i = 0; i < auction.getBiddingOrder().Count; i++) { int currNationIndex = auction.getBiddingOrder()[i]; Nation currNat = State.getNations()[currNationIndex]; TableRow newRow = Instantiate <TableRow>(biddingRow); newRow.gameObject.SetActive(true); newRow.preferredHeight = 30; newRow.name = currNat.getIndex().ToString(); biddingTable.AddRow(newRow); biddingConnector.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (biddingTable.transform as RectTransform).rect.height); int currNatIndex = currNat.getIndex(); // Debug.Log("Current Nation: " + currNatIndex); int currentNatBid = auction.getPlayerBid(currNatIndex); newRow.Cells[0].GetComponentInChildren <Text>().text = currentNatBid.ToString(); newRow.Cells[1].GetComponentInChildren <Text>().text = currNat.getNationName().ToString(); // Transform res = newRow.Cells[2].transform.GetChild(0); UIObject3D flagImage = newRow.Cells[2].GetComponentInChildren <UIObject3D>(); // flagImage.sprite = Resources.Load("Flags/" + currNat.getNationName().ToString(), typeof(Sprite)) as Sprite; GameObject flagPrefab = Instantiate(Resources.Load <GameObject>("Flags/Prefabs/" + currNat.getNationName())); flagImage.ObjectPrefab = flagPrefab.transform; flagImage.RenderScale = 0; flagImage.LightIntensity = 1; Transform statusTransform = newRow.Cells[3].transform.GetChild(0); Image statusImage = statusTransform.GetComponent <Image>(); if (auction.getIfPlayerPass(currNatIndex) == true) { statusImage.sprite = Resources.Load("Sprites/GUI/Dark_Red_x", typeof(Sprite)) as Sprite; } else { statusImage.sprite = Resources.Load("Sprites/GUI/AuctionHammer", typeof(Sprite)) as Sprite; } } if (auction.getPlayerBid(playerIndex) > State.CurrentColonyAuctionBid) { bid.interactable = true; } else { bid.interactable = false; } TextMeshProUGUI passButtonText = pass.GetComponentInChildren <TextMeshProUGUI>(); if (auction.getIfPlayerPass(playerIndex) || auction.getHighestBidderSoFar() == playerIndex) { passButtonText.SetText("Continue"); } else { passButtonText.SetText("Pass"); } }