示例#1
0
        /// <summary>
        /// No need to call this manually if you're calling Update
        /// </summary>
        public void Update()
        {
            if (Definitions == null)
            {
                //
                // Don't try every frame, just try every 10 seconds.
                //
                {
                    if (fetchRetryTimer != null && fetchRetryTimer.Elapsed.TotalSeconds < 10.0f)
                    {
                        return;
                    }

                    if (fetchRetryTimer == null)
                    {
                        fetchRetryTimer = Stopwatch.StartNew();
                    }

                    fetchRetryTimer.Reset();
                    fetchRetryTimer.Start();
                }

                FetchItemDefinitions();
                inventory.LoadItemDefinitions();
            }
        }
示例#2
0
        internal Inventory(BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server)
        {
            IsServer  = server;
            inventory = c;

            Result.Pending = new Dictionary <int, Result>();

            inventory.LoadItemDefinitions();
            FetchItemDefinitions();

            if (!server)
            {
                SteamNative.SteamInventoryResultReady_t.RegisterCallback(steamworks, onResultReady);
                SteamNative.SteamInventoryFullUpdate_t.RegisterCallback(steamworks, onFullUpdate);

                //
                // Get a list of our items immediately
                //
                Refresh();
            }
        }
示例#3
0
 /// <summary>
 /// Fetch item definitions in case new ones have been added since we've initialized
 /// </summary>
 public void FetchItemDefinitions()
 {
     inventory.LoadItemDefinitions();
 }