Beispiel #1
0
 public IComponent Create(LiveSplitState state)
 {
     return(new Component(state));
 }
Beispiel #2
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
 {
 }
Beispiel #3
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
 {
 }
Beispiel #4
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;
                }
            }

            if (DateTime.Now > lastInfoCheck)
            {
                infoComponent = 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)
                    {
                        TextComponent text = (TextComponent)component.Component;
                        if (text.Settings.Text1.IndexOf("Deaths", StringComparison.OrdinalIgnoreCase) >= 0 ||
                            text.Settings.Text1.IndexOf("Kills", StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            infoComponent = text;
                            break;
                        }
                    }
                }
                lastInfoCheck = DateTime.Now.AddSeconds(3);
            }

            if (infoComponent != null)
            {
                int killIndex  = infoComponent.Settings.Text1.IndexOf("Kills", StringComparison.OrdinalIgnoreCase);
                int deathIndex = infoComponent.Settings.Text1.IndexOf("Deaths", StringComparison.OrdinalIgnoreCase);

                string info1 = string.Empty;
                string info2 = string.Empty;
                if (killIndex >= 0 && (deathIndex < 0 || killIndex < deathIndex))
                {
                    info1 = logic.Kills.ToString();
                    if (deathIndex >= 0)
                    {
                        info2 = logic.Deaths.ToString();
                    }
                }
                else if (deathIndex >= 0 && (killIndex < 0 || deathIndex < killIndex))
                {
                    info1 = logic.Deaths.ToString();
                    if (killIndex >= 0)
                    {
                        info2 = logic.Kills.ToString();
                    }
                }

                string info = string.Concat(info1, string.IsNullOrEmpty(info2) ? string.Empty : " / ", info2);
                if (infoComponent.Settings.Text2 != info)
                {
                    infoComponent.Settings.Text2 = info;
                }
            }
        }