コード例 #1
0
ファイル: SideBarWidget.xaml.cs プロジェクト: TheSmoun/TMTVO
        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();
            }
        }
コード例 #2
0
ファイル: SideBarWidget.xaml.cs プロジェクト: TheSmoun/TMTVO
        public void FadeInBattleForPos(int pos, int count)
        {
            this.FirstPos = pos;
            this.Count    = count;

            module = (LiveStandingsModule)API.Instance.FindModule("LiveStandings");
            foreach (LiveStandingsItem item in module.Items)
            {
                item.PositionImprovedBattleFor = item.PositionLostBattleFor = false;
            }

            Mode   = SideBarMode.BattleForPosition;
            Active = true;
            SideBarTitle title = new SideBarTitle(ParentWindow);
            string       t     = "BATTLE FOR ";

            if (pos == 1)
            {
                t += "1st";
            }
            else if (pos == 2)
            {
                t += " 2nd";
            }
            else if (pos == 3)
            {
                t += " 3rd";
            }
            else
            {
                t += pos.ToString("0") + "th";
            }

            title.VerticalAlignment = VerticalAlignment.Top;
            LayoutRoot.Children.Add(title);
            elements.Add(title);
            title.FadeIn(t);

            int j = 1;

            for (int i = pos; i < pos + count; i++)
            {
                LiveStandingsItem item = module.FindDriverByPos(i);
                if (item == null)
                {
                    break;
                }

                BattleElement e = new BattleElement(ParentWindow, this, module);
                e.VerticalAlignment = VerticalAlignment.Top;
                elements.Add(e);
                LayoutRoot.Children.Add(e);
                e.Margin = new Thickness(0, j * 36, 0, 0);
                e.FadeIn(item, j * 25);

                j++;
            }
        }