public void FadeInTopSpeeds() { if (Active) { return; } module = (LiveStandingsModule)API.Instance.FindModule("LiveStandings"); Mode = SideBarMode.TopSpeed; SideBarTitle title = new SideBarTitle(ParentWindow); title.VerticalAlignment = VerticalAlignment.Top; LayoutRoot.Children.Add(title); elements.Add(title); title.FadeIn("TOP SPEEDS kph"); List <LiveStandingsItem> query = module.OrderByTopSpeed(); for (int i = 0; i < 10; i++) { LiveStandingsItem item = query[i]; if (item.TopSpeed > 0) { SpeedElement se = new SpeedElement(ParentWindow, SpeedElement.SpeedElementMode.TopSpeed); se.VerticalAlignment = VerticalAlignment.Top; se.Margin = new Thickness(0, (i + 1) * 36, 0, 0); LayoutRoot.Children.Add(se); elements.Add(se); se.FadeIn(i + 1, item, (i + 1) * 25); } } Active = true; }
public void Tick() { if (Mode == SideBarMode.BattleForPosition) { int j = 1; for (int i = FirstPos; i < FirstPos + Count; i++) { BattleElement e = elements[j++] as BattleElement; if (e != null && module != null) { e.Driver = module.FindDriverByPos(i); } } } if (Mode == SideBarMode.TopSpeed) { int k = 1; List <LiveStandingsItem> query = module.OrderByTopSpeed(); for (int i = 0; i < 10; i++) { if (elements.Count <= k) { break; } SpeedElement se = elements[k++] as SpeedElement; if (se != null) { se.Driver = query[i]; se.TopSpeedPosition = i + 1; } } } if (Mode == SideBarMode.iRating) { int k = 1; for (int i = 0; i < 10; i++) { if (elements.Count <= k) { break; } SpeedElement se = elements[k++] as SpeedElement; if (se != null) { se.Driver = module.FindDriverByPos(i + 1); se.TopSpeedPosition = i + 1; } } } foreach (ISideBarElement e in elements) { e.Tick(); } }