public UpdatePacketWaiting ( int packetWaiting ) : void | ||
packetWaiting | int | |
Результат | void |
public void Update(StatsSummary nstatsSummary, Database.Structures.Skills nskills, List <NpcEntity> nentities, bool ntimedEncounter, AbnormalityStorage nabnormals, ConcurrentDictionary <string, NpcEntity> nbossHistory, List <ChatMessage> nchatbox, int npacketWaiting, NotifyFlashMessage nflash) { void ChangeUi(StatsSummary statsSummary, Database.Structures.Skills skills, List <NpcEntity> entities, bool timedEncounter, AbnormalityStorage abnormals, ConcurrentDictionary <string, NpcEntity> bossHistory, List <ChatMessage> chatbox, int packetWaiting, NotifyFlashMessage flash) { Scroller.MaxHeight = BasicTeraData.Instance.WindowData.NumberOfPlayersDisplayed * 30; UpdateComboboxEncounter(entities, statsSummary.EntityInformation.Entity); _entityStats.Update(statsSummary.EntityInformation, abnormals); _windowHistory.Update(bossHistory); _chatbox?.Update(chatbox); NotifyIcon.ShowBallon(flash); NotifyIcon.UpdatePacketWaiting(packetWaiting); PartyDps.Content = FormatHelpers.Instance.FormatValue(statsSummary.EntityInformation.Interval == 0 ? statsSummary.EntityInformation.TotalDamage : statsSummary.EntityInformation.TotalDamage * TimeSpan.TicksPerSecond / statsSummary.EntityInformation.Interval) + LP.PerSecond; var visiblePlayerStats = new HashSet <Player>(); var statsDamage = statsSummary.PlayerDamageDealt; var statsHeal = statsSummary.PlayerHealDealt; foreach (var playerStats in statsDamage) { PlayerStats playerStatsControl; Controls.TryGetValue(playerStats.Source, out playerStatsControl); if (playerStats.Amount == 0) { continue; } visiblePlayerStats.Add(playerStats.Source); if (playerStatsControl != null) { continue; } playerStatsControl = new PlayerStats(playerStats, statsHeal.FirstOrDefault(x => x.Source == playerStats.Source), statsSummary.EntityInformation, skills, abnormals.Get(playerStats.Source)); Controls.Add(playerStats.Source, playerStatsControl); } var invisibleControls = Controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList(); foreach (var invisibleControl in invisibleControls) { Controls[invisibleControl.Key].CloseSkills(); Controls.Remove(invisibleControl.Key); } TotalDamage.Content = FormatHelpers.Instance.FormatValue(statsSummary.EntityInformation.TotalDamage); if (BasicTeraData.Instance.WindowData.ShowTimeLeft && statsSummary.EntityInformation.TimeLeft > 0) { var interval = TimeSpan.FromSeconds(statsSummary.EntityInformation.TimeLeft / TimeSpan.TicksPerSecond); Timer.Content = interval.ToString(@"mm\:ss"); Timer.Foreground = Brushes.LightCoral; } else { var interval = TimeSpan.FromSeconds(statsSummary.EntityInformation.Interval / TimeSpan.TicksPerSecond); Timer.Content = interval.ToString(@"mm\:ss"); if (statsSummary.EntityInformation.Interval == 0 && BasicTeraData.Instance.WindowData.ShowTimeLeft) { Timer.Foreground = Brushes.LightCoral; } else { Timer.Foreground = Brushes.White; } } Players.Items.Clear(); foreach (var item in statsDamage) { if (!Controls.ContainsKey(item.Source)) { continue; } if (Players.Items.Contains(Controls[item.Source])) { BasicTeraData.LogError( "duplicate playerinfo: \r\n" + string.Join("\r\n ", statsDamage.Select(x => x.Source.ToString() + " -> " + x.Amount)), false, true); continue; } Players.Items.Add(Controls[item.Source]); Controls[item.Source].Repaint(item, statsHeal.FirstOrDefault(x => x.Source == item.Source), statsSummary.EntityInformation, skills, abnormals.Get(item.Source), timedEncounter); } if (BasicTeraData.Instance.WindowData.InvisibleUi) { if (Controls.Count > 0 && !ForceWindowVisibilityHidden) { Visibility = Visibility.Visible; } if (Controls.Count == 0) { Visibility = Visibility.Hidden; } } else { if (!ForceWindowVisibilityHidden) { Visibility = Visibility.Visible; } } if (ActualWidth != _oldWidth) // auto snap to right screen border on width change { var screen = Screen.FromHandle(new WindowInteropHelper(GetWindow(this)).Handle); // Transform screen point to WPF device independent point var source = PresentationSource.FromVisual(this); if (source?.CompositionTarget == null) { return; } var dx = source.CompositionTarget.TransformToDevice.M11; if (Math.Abs(screen.WorkingArea.X + screen.WorkingArea.Width - (Left + _oldWidth) * dx) < 50) //snap at 50 px { Left = Left + _oldWidth - ActualWidth; } _oldWidth = ActualWidth; } } Dispatcher.Invoke((NetworkController.UpdateUiHandler)ChangeUi, nstatsSummary, nskills, nentities, ntimedEncounter, nabnormals, nbossHistory, nchatbox, npacketWaiting, nflash); }
public void Update(StatsSummary nstatsSummary, Database.Structures.Skills nskills, List <NpcEntity> nentities, bool ntimedEncounter, AbnormalityStorage nabnormals, ConcurrentDictionary <string, NpcEntity> nbossHistory, List <ChatMessage> nchatbox, int npacketWaiting, Tuple <string, string> nflash) { NetworkController.UpdateUiHandler changeUi = delegate(StatsSummary statsSummary, Database.Structures.Skills skills, List <NpcEntity> entities, bool timedEncounter, AbnormalityStorage abnormals, ConcurrentDictionary <string, NpcEntity> bossHistory, List <ChatMessage> chatbox, int packetWaiting, Tuple <string, string> flash) { Scroller.MaxHeight = BasicTeraData.Instance.WindowData.NumberOfPlayersDisplayed * 30; UpdateComboboxEncounter(entities, statsSummary.EntityInformation.Entity); _entityStats.Update(statsSummary.EntityInformation, abnormals); _windowHistory.Update(bossHistory); _chatbox?.Update(chatbox); NotifyIcon.ShowBallon(flash); NotifyIcon.UpdatePacketWaiting(packetWaiting); PartyDps.Content = FormatHelpers.Instance.FormatValue(statsSummary.EntityInformation.Interval == 0 ? statsSummary.EntityInformation.TotalDamage : statsSummary.EntityInformation.TotalDamage * TimeSpan.TicksPerSecond / statsSummary.EntityInformation.Interval) + LP.PerSecond; var visiblePlayerStats = new HashSet <Player>(); var statsDamage = statsSummary.PlayerDamageDealt; var statsHeal = statsSummary.PlayerHealDealt; foreach (var playerStats in statsDamage) { PlayerStats playerStatsControl; Controls.TryGetValue(playerStats.Source, out playerStatsControl); if (playerStats.Amount == 0) { continue; } visiblePlayerStats.Add(playerStats.Source); if (playerStatsControl != null) { continue; } playerStatsControl = new PlayerStats(playerStats, statsHeal.FirstOrDefault(x => x.Source == playerStats.Source), statsSummary.EntityInformation, skills, abnormals.Get(playerStats.Source)); Controls.Add(playerStats.Source, playerStatsControl); } var invisibleControls = Controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList(); foreach (var invisibleControl in invisibleControls) { Controls[invisibleControl.Key].CloseSkills(); Controls.Remove(invisibleControl.Key); } TotalDamage.Content = FormatHelpers.Instance.FormatValue(statsSummary.EntityInformation.TotalDamage); var interval = TimeSpan.FromSeconds(statsSummary.EntityInformation.Interval / TimeSpan.TicksPerSecond); Timer.Content = interval.ToString(@"mm\:ss"); Players.Items.Clear(); foreach (var item in statsDamage) { if (!Controls.ContainsKey(item.Source)) { continue; } if (Players.Items.Contains(Controls[item.Source])) { BasicTeraData.LogError("duplicate playerinfo: \r\n" + String.Join("\r\n ", statsDamage.Select(x => x.Source.ToString() + " -> " + x.Amount)), false, true); continue; } Players.Items.Add(Controls[item.Source]); Controls[item.Source].Repaint(item, statsHeal.FirstOrDefault(x => x.Source == item.Source), statsSummary.EntityInformation, skills, abnormals.Get(item.Source), timedEncounter); } if (BasicTeraData.Instance.WindowData.InvisibleUi) { if (Controls.Count > 0 && !ForceWindowVisibilityHidden) { Visibility = Visibility.Visible; } if (Controls.Count == 0) { Visibility = Visibility.Hidden; } } else { if (!ForceWindowVisibilityHidden) { Visibility = Visibility.Visible; } } }; Dispatcher.Invoke(changeUi, nstatsSummary, nskills, nentities, ntimedEncounter, nabnormals, nbossHistory, nchatbox, npacketWaiting, nflash); }