internal static void OnLoad() { if (Player.ChampionName != "Jhin") { return; } LoadSpell(); LoadMenu(); LoadEvents(); LastPosition.Load(); //初始化ping时间 foreach (var enemy in HeroManager.Enemies) { PingList.Add(enemy.NetworkId, 0); } //DamageIndicator.DamageToUnit = GetRDmg; if (IsChinese) { Chat.Print("戏命师—烬 ".ToHtml(25) + "此刻,大美将致!".ToHtml(Color.PowderBlue, FontStlye.Cite)); } else { Chat.Print("Jhin As The Virtuoso ".ToHtml(25) + "Art requires a certain cruelty!".ToHtml(Color.Purple, FontStlye.Cite)); } }
internal static void OnLoad(EventArgs args) { if (Player.ChampionName != "Jhin") { return; } CNLib.MultiLanguage.Load(new Dictionary <string, Dictionary <string, string> >() { { "English", MultiLanguage.EnglishDictionary } }); LoadSpell(); LoadMenu(); LoadEvents(); LastPosition.Load(); //初始化ping时间 foreach (var enemy in HeroManager.Enemies) { PingList.Add(enemy.NetworkId, 0); } DamageIndicator.DamageToUnit = GetRDmg; if (IsChinese) { Game.PrintChat("戏命师—烬 ".ToHtml(25) + "此刻,大美将致!".ToHtml(Color.PowderBlue, FontStlye.Cite)); } else { Game.PrintChat("Jhin As The Virtuoso ".ToHtml(25) + "Art requires a certain cruelty!".ToHtml(Color.Purple, FontStlye.Cite)); } }
public override void Use(Player p, string message, CommandData data) { if (!message.CaselessEq("all")) { if (message.Length == 0) { message = p.name; } Player who = PlayerInfo.FindMatches(p, message); if (who == null) { return; } if (p != who && !CheckExtraPerm(p, data, 1)) { return; } PingList ping = who.Session.Ping; if (!who.Supports(CpeExt.TwoWayPing)) { p.Message("{0} client does not support measuring ping", p == who ? "Your" : p.FormatNick(who) + "&S's"); } else if (ping.Measures() == 0) { p.Message("No ping measurements yet. Try again in a bit."); } else { p.Message(p.FormatNick(who) + " &S- " + ping.Format()); } } else { if (!CheckExtraPerm(p, data, 1)) { return; } Player[] players = PlayerInfo.Online.Items; p.Message("Ping/latency list of online players: (&aLo&S:&7Avg&S:&cHi&S)ms"); foreach (Player target in players) { if (!p.CanSee(target, data.Rank)) { continue; } PingList ping = target.Session.Ping; if (ping.Measures() == 0) { continue; } p.Message(ping.FormatAll() + " &S- " + p.FormatNick(target)); } } }
void HandleTwoWayPing() { bool serverToClient = reader.ReadUInt8() != 0; ushort data = reader.ReadUInt16(); if (!serverToClient) { PingList.Update(data); return; } WriteTwoWayPing(true, data); // server to client reply net.SendPacket(); }
public override void Tick() { pingTicks++; if (pingTicks >= 20 && net.cpeData.twoWayPing) { WriteTwoWayPing(false, PingList.NextTwoWayPingData()); pingTicks = 0; } }
private void OnTimedEvent(Object sender, EventArgs e) { foreach (XenaxDeviceConnection con in xenaxDeviceConnections) { if (!con.pingPending) { PingList.Add(PingConnectionAsync(con)); } } }
void UpdateStatus(double delta) { frames++; accumulator += delta; if (accumulator < 1) { return; } int index = 0; totalSeconds++; int fps = (int)(frames / accumulator); statusBuffer.Clear() .AppendNum(ref index, fps).Append(ref index, " fps, "); if (game.ClassicMode) { statusBuffer.AppendNum(ref index, game.ChunkUpdates).Append(ref index, " chunk updates"); } else { if (game.ChunkUpdates > 0) { statusBuffer.AppendNum(ref index, game.ChunkUpdates).Append(ref index, " chunks/s, "); } int indices = (game.Vertices >> 2) * 6; statusBuffer.AppendNum(ref index, indices).Append(ref index, " vertices"); int ping = PingList.AveragePingMilliseconds(); if (ping != 0) { statusBuffer.Append(ref index, ", ping ").AppendNum(ref index, ping).Append(ref index, " ms"); } } status.SetText(statusBuffer.ToString()); accumulator = 0; frames = 0; game.ChunkUpdates = 0; }
void UpdateStatus(double delta) { frames++; accumulator += delta; if (accumulator < 1) { return; } int fps = (int)(frames / accumulator); statusBuffer.Clear().AppendNum(fps).Append(" fps, "); if (game.ClassicMode) { statusBuffer.AppendNum(game.ChunkUpdates).Append(" chunk updates"); } else { if (game.ChunkUpdates > 0) { statusBuffer.AppendNum(game.ChunkUpdates).Append(" chunks/s, "); } int indices = (game.Vertices >> 2) * 6; statusBuffer.AppendNum(indices).Append(" vertices"); int ping = PingList.AveragePingMilliseconds(); if (ping != 0) { statusBuffer.Append(", ping ").AppendNum(ping).Append(" ms"); } } line1.Set(statusBuffer.ToString(), font); accumulator = 0; frames = 0; game.ChunkUpdates = 0; }
private async void Sort_Click(object sender, RoutedEventArgs e) { if (PingDataList.Count < 1) { return; } var column = e.OriginalSource as GridViewColumnHeader; if (column == null || column.Column == null) { return; } var newPingDataList = new ObservableCollection <PingData>(); var pingDataListSort = PingDataList.ToList(); switch (column.Column.Header) { case "响应时间": pingDataListSort.Sort((x, y) => { var xMatch = string.IsNullOrEmpty(x.AnswerTime) ? Regex.Match("", "\\d+") : Regex.Match(x.AnswerTime, "\\d+"); var yMatch = string.IsNullOrEmpty(y.AnswerTime) ? Regex.Match("", "\\d+") : Regex.Match(y.AnswerTime, "\\d+"); if (xMatch.Success && yMatch.Success) { return((x.AnswerTime.StartsWith("<")?0: Convert.ToInt32(xMatch.Value)) - (y.AnswerTime.StartsWith("<") ? 0 : Convert.ToInt32(yMatch.Value))); } return(Convert.ToInt32(yMatch.Success) - Convert.ToInt32(xMatch.Success)); }); PingDataList.Clear(); foreach (var data in pingDataListSort) { PingDataList.Add(data); } PingList.ScrollIntoView(PingDataList[0]); break; case "本地响应时间": pingDataListSort.Sort((x, y) => { var xMatch = string.IsNullOrEmpty(x.LocalAnswerTime) ? Regex.Match("", "\\d+") : Regex.Match(x.LocalAnswerTime, "\\d+"); var yMatch = string.IsNullOrEmpty(y.LocalAnswerTime) ? Regex.Match("", "\\d+") : Regex.Match(y.LocalAnswerTime, "\\d+"); if (xMatch.Success && yMatch.Success) { return(Convert.ToInt32(xMatch.Value) - Convert.ToInt32(yMatch.Value)); } return(Convert.ToInt32(yMatch.Success) - Convert.ToInt32(xMatch.Success)); }); PingDataList.Clear(); foreach (var data in pingDataListSort) { PingDataList.Add(data); } PingList.ScrollIntoView(PingDataList[0]); break; case "TTL": pingDataListSort.Sort((x, y) => { var xMatch = string.IsNullOrEmpty(x.AnswerTtl) ? Regex.Match("", "\\d+") : Regex.Match(x.AnswerTtl, "\\d+"); var yMatch = string.IsNullOrEmpty(y.AnswerTtl) ? Regex.Match("", "\\d+") : Regex.Match(y.AnswerTtl, "\\d+"); if (xMatch.Success && yMatch.Success) { return(Convert.ToInt32(xMatch.Value) - Convert.ToInt32(yMatch.Value)); } return(Convert.ToInt32(yMatch.Success) - Convert.ToInt32(xMatch.Success)); }); PingDataList.Clear(); foreach (var data in pingDataListSort) { PingDataList.Add(data); } PingList.ScrollIntoView(PingDataList[0]); break; } }