/// <summary> /// Updates the screen if it is currently the active screen. /// </summary> /// <param name="gameTime">The current game time.</param> public override void Update(TickCount gameTime) { ThreadAsserts.IsMainThread(); // Get the current time _currentTime = gameTime; if (UserChar == null) { _userLight.IsEnabled = false; return; } ScreenManager.AudioManager.ListenerPosition = UserChar.Center; // HACK: What a stupid way to make sure the correct inventory and equipped is used... _inventoryForm.Inventory = UserInfo.Inventory; _equippedForm.UserEquipped = UserInfo.Equipped; // Check to hide the shopping form from the user going out of range of the shop owner var shopInfo = ShopForm.ShopInfo; if (shopInfo != null && shopInfo.ShopOwner != null && !GameData.IsValidDistanceToShop(UserChar, shopInfo.ShopOwner)) { ShopForm.HideShop(); } // If the window is shown if (AvailableQuestsForm.IsVisible) { // Get the quest provider var owner = World.Map.GetDynamicEntity(AvailableQuestsForm.QuestProviderIndex); // Shopping distance is equal to quest turn in distance if (owner != null && !GameData.IsValidDistanceToShop(UserChar, owner)) { AvailableQuestsForm.IsVisible = false; } } // Update some other goodies World.Update(); _damageTextPool.Update(_currentTime); _guiStatePersister.Update(_currentTime); _emoticonDisplayManager.Update(_currentTime); // Update targeting _characterTargeter.Update(GUIManager); _gameControls.TargetIndex = _characterTargeter.TargetEntityIndex; // Update controls if focus is active if (ScreenManager.WindowFocused) { _gameControls.Update(GUIManager, _currentTime); } var sock = _socket.RemoteSocket; if (_latencyLabel != null && sock != null && sock.IsConnected) { _latencyLabel.Text = string.Format(_latencyString, sock.AverageLatency < 1 ? "<1" : Math.Round(sock.AverageLatency).ToString()); } _userLight.IsEnabled = true; _userLight.SetCenter(UserChar.Center); // Periodically synchronize the game time if (Socket != null && _nextSyncGameTime < gameTime) { _nextSyncGameTime = gameTime + ClientSettings.Default.Network_SyncGameTimeFrequency; using (var pw = ClientPacket.SynchronizeGameTime()) { Socket.Send(pw, ClientMessageType.System); } } base.Update(gameTime); }
/// <summary> /// When overridden in the derived class, gets the <see cref="BitStream"/> containing the data /// needed to make a request for the given slot's <see cref="IItemTable"/>. /// </summary> /// <param name="slotToRequest">The slot to request the <see cref="IItemTable"/> for.</param> /// <returns>The <see cref="BitStream"/> containing the data needed to make a request for /// the given slot's <see cref="IItemTable"/>.</returns> protected override BitStream GetRequest(InventorySlot slotToRequest) { return(ClientPacket.GetInventoryItemInfo(slotToRequest)); }
/// <summary> /// When overridden in the derived class, gets the <see cref="BitStream"/> containing the data /// needed to make a request for the given slot's <see cref="IItemTable"/>. /// </summary> /// <param name="slotToRequest">The slot to request the <see cref="IItemTable"/> for.</param> /// <returns>The <see cref="BitStream"/> containing the data needed to make a request for /// the given slot's <see cref="IItemTable"/>.</returns> protected override BitStream GetRequest(EquipmentSlot slotToRequest) { return(ClientPacket.GetEquipmentItemInfo(slotToRequest)); }