Exemplo n.º 1
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
 {
 }
Exemplo n.º 2
0
        public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            if (editorDialog == null && Form.ActiveForm is RunEditorDialog runEditor)
            {
                PropertyInfo info = typeof(RunEditorDialog).GetProperty("SegmentList", BindingFlags.Instance | BindingFlags.NonPublic);
                segmentList = info.GetValue(runEditor) as System.ComponentModel.BindingList <ISegment>;
                if (segmentList != null)
                {
                    editorDialog             = runEditor;
                    segmentList.ListChanged += SegmentList_ListChanged;
                    runEditor.FormClosed    += RunEditor_FormClosed;
                }
            }

            DateTime dateTime = DateTime.Now;

            if (dateTime > lastInfoCheck)
            {
                fpsComponent  = null;
                raceComponent = null;

                IList <ILayoutComponent> components = Model.CurrentState.Layout.LayoutComponents;
                for (int i = components.Count - 1; i >= 0; i--)
                {
                    ILayoutComponent component = components[i];
                    if (component.Component is TextComponent text)
                    {
                        if (text.Settings.Text1.IndexOf("FPS", StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            fpsComponent = text;
                        }
                        else if (text.Settings.Text1.IndexOf("Trial Time", StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            raceComponent = text;
                        }
                    }
                }
                lastInfoCheck = dateTime.AddSeconds(3);
            }

            if (fpsComponent != null)
            {
                string fps = logic.Memory.FPS().ToString("0.0");
                if (fps != fpsComponent.Settings.Text2)
                {
                    fpsComponent.Settings.Text2 = fps;
                }
            }

            if (raceComponent != null && dateTime > lastTimerCheck)
            {
                lastTimerCheck = dateTime.AddMilliseconds(200);
                float  raceTime = logic.Memory.RaceTime();
                string display  = null;
                if (raceTime == 0)
                {
                    raceTime = logic.Memory.LastRaceTime();
                    display  = $"{raceTime:0.000}";
                }
                else
                {
                    display = $"{raceTime:0.000}";
                }
                if (display != raceComponent.Settings.Text2)
                {
                    raceComponent.Settings.Text2 = display;
                }
            }
        }
Exemplo n.º 3
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
 {
 }
Exemplo n.º 4
0
 public IComponent Create(LiveSplitState state)
 {
     return(new Component(state));
 }