public void BankItemAdded(long id, BigInteger amount) { if (amount > 0) { if (!bankText.ContainsKey(id)) { //TODO put this into function or something GameObject slotObject = Instantiate(slotPrefab); slotObject.transform.SetParent(slotListParent, false); Slot slot = slotObject.GetComponent <Slot>(); slot.SetItemName(Database.items[id].name); slot.SetId(id); slot.SetState(Slot.State.Bank); slots.Add(id, slot); bankText.Add(id, slot.amountText); bankImage.Add(id, slot.iconImage); bankImage[id].sprite = Database.sprites[(int)id]; } (bankText[id].text, bankText[id].color) = UtilityUI.FormatNumber(amount); slots[id].SetAlpha(1.0F); } }
private void InventoryItemAdded(long id, BigInteger amount) { if (amount > 0) { if (!inventoryText.ContainsKey(id)) { Slot slot = slots[nextAvailableSlot]; slot.SetItemName(Database.items[id].name); slot.SetId(id); slot.SetState(Slot.State.Inventory); slot.SetSlotActive(true); inventoryText.Add(id, slot.amountText); inventoryImage.Add(id, slot.iconImage); inventoryImage[id].sprite = Database.sprites[(int)id]; isUsed[nextAvailableSlot] = true; idIndex[id] = nextAvailableSlot; indexId[nextAvailableSlot] = id; UpdateNextAvailableSlot(); } (inventoryText[id].text, inventoryText[id].color) = UtilityUI.FormatNumber(amount); } }
private void EquipItem(long id, Equipment.EquipmentSlot equipmentSlot, BigInteger amount) { Slot slot = equipmentSlots[(int)equipmentSlot]; slot.SetItemName(Database.items[id].name); slot.SetId(id); slot.SetState(Slot.State.Equipped); slot.iconImage.sprite = Database.sprites[(int)id]; (slot.amountText.text, slot.amountText.color) = UtilityUI.FormatNumber(amount); slot.SetSlotActive(true); }
public void FormatNumberTest() { string text; Color color; (text, color) = UtilityUI.FormatNumber(55000); Assert.AreEqual("55000", text); Assert.AreEqual(Color.yellow, color); (text, color) = UtilityUI.FormatNumber(100_000); Assert.AreEqual("100K", text); Assert.AreEqual(Color.white, color); (text, color) = UtilityUI.FormatNumber(110_000); Assert.AreEqual("110K", text); Assert.AreEqual(Color.white, color); (text, color) = UtilityUI.FormatNumber(7_860_450); Assert.AreEqual("7860K", text); Assert.AreEqual(Color.white, color); (text, color) = UtilityUI.FormatNumber(10_000_000); Assert.AreEqual("10M", text); Assert.AreEqual(Color.green, color); (text, color) = UtilityUI.FormatNumber(11_450_000); Assert.AreEqual("11M", text); Assert.AreEqual(Color.green, color); (text, color) = UtilityUI.FormatNumber(980_450_000); Assert.AreEqual("980M", text); Assert.AreEqual(Color.green, color); (text, color) = UtilityUI.FormatNumber(1_000_000_000); Assert.AreEqual("1B", text); Assert.AreEqual(Color.blue, color); (text, color) = UtilityUI.FormatNumber(2_980_000_000); Assert.AreEqual("2B", text); Assert.AreEqual(Color.blue, color); (text, color) = UtilityUI.FormatNumber(45_000_000_000_000); Assert.AreEqual("45T", text); Assert.AreEqual(Color.red, color); }
private void UpdateUI(long id, BigInteger amountDiff) { if (!lastLootText.ContainsKey(id)) { GameObject slotObject = Instantiate(slotPrefab); slotObject.transform.SetParent(slotListParent, false); slotsObjects.Add(slotObject); Slot slot = slotObject.GetComponent <Slot>(); slot.SetItemName(Database.items[id].name); lastLootText.Add(id, slot.amountText); lastLootImage.Add(id, slot.iconImage); lastLootAmount.Add(id, 0); lastLootImage[id].sprite = Database.sprites[(int)id]; } lastLootAmount[id] += amountDiff; (lastLootText[id].text, lastLootText[id].color) = UtilityUI.FormatNumber(lastLootAmount[id]); }
// Start is called before the first frame update void Start() { // Get an instance of the propUI object and set it to false ( we ain't using it yet ). propUI = GameObject.FindObjectOfType <PropertyUI>(); propUI.gameObject.SetActive(false); // Get an instance of the buyRail object and set it to false ( we ain't using it yet ). buyRail = GameObject.FindObjectOfType <BuyRailRoadUI>(); buyRail.gameObject.SetActive(false); // Get an instance of the railOwnedUI object and set it to false. railOwned = GameObject.FindObjectOfType <RailOwnedUI>(); railOwned.gameObject.SetActive(false); // Get an instance of the ChanceCardUI object and set it to false. chanceCardUI = GameObject.FindObjectOfType <ChanceCardUI>(); chanceCardUI.gameObject.SetActive(false); // Get an instance of the CommunityChestUI object and set it to false. commUI = GameObject.FindObjectOfType <CommunityChestUI>(); commUI.gameObject.SetActive(false); // Get instance of property monopoly UI. propMonop = GameObject.FindObjectOfType <PropertyOwnMonopoly>(); propMonop.gameObject.SetActive(false); // Get instance of property owned UI. propOwnedUi = GameObject.FindObjectOfType <PropertyOwnedUI>(); propOwnedUi.gameObject.SetActive(false); // Get instance of pass go UI. passGoUi = GameObject.FindObjectOfType <PassGoUI>(); passGoUi.gameObject.SetActive(false); // Get instance of TaxUI. taxUI = GameObject.FindObjectOfType <TaxUI>(); taxUI.gameObject.SetActive(false); // Get instance of UtilUI. utilUI = GameObject.FindObjectOfType <UtilityUI>(); utilUI.gameObject.SetActive(false); // Get instance of jailLandedUI. jailLanded = GameObject.FindObjectOfType <JailLandedUI>(); jailLanded.gameObject.SetActive(false); // Get instance of GoToJailUI. goToJailUI = GameObject.FindObjectOfType <GoToJailUI>(); goToJailUI.gameObject.SetActive(false); // Get instance of InJailUI inJailUI = GameObject.FindObjectOfType <InJailUI>(); inJailUI.gameObject.SetActive(false); // Get instance of InJailUI doubleRollUI = GameObject.FindObjectOfType <DoubleRollUI>(); doubleRollUI.gameObject.SetActive(false); menu = GameObject.FindObjectOfType <PauseMenu>(); menu.gameObject.SetActive(false); // Get an instance of the ownership class. owner = GameObject.FindObjectOfType <Ownership>(); // Check the players money. CheckPlayerMoney(); Debug.Log("Current player is: " + (CurrentPlayerID + 1)); }