コード例 #1
0
        public void HandleTradeOfferUpdate(Dictionary <string, object> props)
        {
            ConvertList(true, (List <object>)props["offer1"]);
            ConvertList(false, (List <object>)props["offer2"]);
            myCurrencyOffers.Clear();
            Dictionary <string, object> myCurrencies = (Dictionary <string, object>)props["currencyOffer1"];

            foreach (string currencyID in myCurrencies.Keys)
            {
                myCurrencyOffers.Add(currencyID, (int)myCurrencies[currencyID]);
            }
            theirCurrencyOffers.Clear();
            Dictionary <string, object> theirCurrencies = (Dictionary <string, object>)props["currencyOffer2"];

            foreach (string currencyID in theirCurrencies.Keys)
            {
                CurrencyDisplay currencyDisplay = Inventory.Instance.GenerateCurrencyDisplay(int.Parse(currencyID), (int)theirCurrencies[currencyID]);
                theirCurrencyOffers.Add(currencyDisplay);
            }
            acceptedByMe      = (bool)props["accepted1"];
            acceptedByPartner = (bool)props["accepted2"];
            cancelled         = false;

            // dispatch a ui event to tell the rest of the system
            string[] event_args = new string[1];
            AtavismEventSystem.DispatchEvent("TRADE_OFFER_UPDATE", event_args);
        }
 public static string FormatToCurrency(this decimal value, CurrencyDisplay currencyDisplay)
 {
     return(currencyDisplay switch
     {
         CurrencyDisplay.EnUs => FormatToUsdCurrency(value),
         CurrencyDisplay.PtBr => FormatToBrlCurrency(value),
         _ => throw new InvalidCommandException("currency display not found")
     });
コード例 #3
0
    void Start()
    {
        myCamera        = Camera.main;
        currencyDisplay = GameObject.FindObjectOfType <CurrencyDisplay>();

        defenderParent = GameObject.Find("Defenders");
        if (!defenderParent)
        {
            defenderParent = new GameObject("Defenders");
        }
    }
コード例 #4
0
    void Start()
    {
        mainCamera      = Camera.main;
        selectedOverlay = Instantiate(SelectedOverlayPrefab, Vector3.zero, Quaternion.identity);
        selectedOverlay.SetActive(false);

        inventoryController = GameObject.FindObjectOfType <InventoryController>();
        PlayerBase          = GameObject.FindObjectOfType <PlayerBase>();

        if (currencyDisplay == null)
        {
            currencyDisplay = GameObject.FindObjectOfType <CurrencyDisplay>();
        }
        currencyDisplay.UpdateText(CollectedCurrency);

        InGameUI = GameObject.FindGameObjectWithTag("InGameUI");
        InGameUI.SetActive(true);
        GameOverUI = GameObject.FindGameObjectWithTag("GameOverUI");
        GameOverUI.SetActive(false);
    }
コード例 #5
0
 static void CurrencyDisplay_UpdateQuantityDisplay_Post(CurrencyDisplay __instance)
 => TryDisplayStashAmount(__instance);
コード例 #6
0
 void Start()
 {
     currencyDisplay = GameObject.FindObjectOfType <CurrencyDisplay>();
 }