示例#1
0
        public override void Update(IInvalidator invalidator, Model.LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (state.CurrentPhase == TimerPhase.NotRunning)
            {
                if (AutoSplitter.ShouldStart(state))
                {
                    Model.Start();
                }
            }
            else if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused)
            {
                if (AutoSplitter.ShouldReset(state))
                {
                    Model.Reset();
                    return;
                }
                else if (AutoSplitter.ShouldSplit(state))
                {
                    Model.Split();
                }

                state.IsGameTimePaused = AutoSplitter.IsGameTimePaused(state);

                var gameTime = AutoSplitter.GetGameTime(state);
                if (gameTime != null)
                    state.SetGameTime(gameTime);
            }
        }
示例#2
0
        private void PrepareDraw(LiveSplitState state, LayoutMode mode)
        {
            InternalComponent.DisplayTwoRows = Settings.Display2Rows;

            InternalComponent.NameLabel.HasShadow 
                = InternalComponent.ValueLabel.HasShadow
                = state.LayoutSettings.DropShadows;

            if (String.IsNullOrEmpty(Settings.Text1) || String.IsNullOrEmpty(Settings.Text2))
            {
                InternalComponent.NameLabel.HorizontalAlignment = StringAlignment.Center;
                InternalComponent.ValueLabel.HorizontalAlignment = StringAlignment.Center;
                InternalComponent.NameLabel.VerticalAlignment = StringAlignment.Center;
                InternalComponent.ValueLabel.VerticalAlignment = StringAlignment.Center;
            }
            else
            {
                InternalComponent.NameLabel.HorizontalAlignment = StringAlignment.Near;
                InternalComponent.ValueLabel.HorizontalAlignment = StringAlignment.Far;
                InternalComponent.NameLabel.VerticalAlignment = 
                    mode == LayoutMode.Horizontal || Settings.Display2Rows ? StringAlignment.Near : StringAlignment.Center;
                InternalComponent.ValueLabel.VerticalAlignment =
                    mode == LayoutMode.Horizontal || Settings.Display2Rows ? StringAlignment.Far : StringAlignment.Center;
            }

            InternalComponent.NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor;
            InternalComponent.ValueLabel.ForeColor = Settings.OverrideTimeColor ? Settings.TimeColor : state.LayoutSettings.TextColor;
        }
        private void PrepareDraw(LiveSplitState state, LayoutMode mode) {
            textInfo.DisplayTwoRows = true;

            textInfo.NameLabel.HasShadow = textInfo.ValueLabel.HasShadow = state.LayoutSettings.DropShadows;
            textInfo.NameLabel.HorizontalAlignment = StringAlignment.Far;
            textInfo.ValueLabel.HorizontalAlignment = StringAlignment.Far;
            textInfo.NameLabel.VerticalAlignment = StringAlignment.Near;
            textInfo.ValueLabel.VerticalAlignment = StringAlignment.Near;
            textInfo.NameLabel.ForeColor = state.LayoutSettings.TextColor;
            textInfo.ValueLabel.ForeColor = state.LayoutSettings.TextColor;
        }
        private void PrepareDraw(LiveSplitState state, LayoutMode mode)
        {
            InternalComponent.DisplayTwoRows = Settings.Display2Rows;

            InternalComponent.NameLabel.HasShadow 
                = InternalComponent.ValueLabel.HasShadow
                = state.LayoutSettings.DropShadows;

            InternalComponent.ValueLabel.Font = state.LayoutSettings.TextFont;
            InternalComponent.NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor;
            InternalComponent.ValueLabel.ForeColor = Settings.OverrideTimeColor ? Settings.TimeColor : state.LayoutSettings.TextColor;
        }
示例#5
0
 public AudioMixerWindow()
 {
     SectionType[] typeArray1 = new SectionType[4];
     typeArray1[1] = SectionType.SnapshotList;
     typeArray1[2] = SectionType.GroupTree;
     typeArray1[3] = SectionType.ViewList;
     this.m_SectionOrder = typeArray1;
     this.m_LayoutMode = LayoutMode.Vertical;
     this.m_ShowReferencedBuses = true;
     this.m_SectionsScrollPosition = Vector2.zero;
     this.m_RepaintCounter = 2;
     this.m_GroupsRenderedAboveSections = true;
     this.m_Ticker = new TickTimerHelper(0.05);
 }
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if ((Settings.ScriptPath != OldScriptPath && !String.IsNullOrEmpty(Settings.ScriptPath)) || DoReload)
            {
                Script = ASLParser.Parse(File.ReadAllText(Settings.ScriptPath));
                OldScriptPath = Settings.ScriptPath;
                FSWatcher.Path = Path.GetDirectoryName(Settings.ScriptPath);
                FSWatcher.Filter = Path.GetFileName(Settings.ScriptPath);
                FSWatcher.EnableRaisingEvents = true;
                DoReload = false;
            }

            if (Script != null)
                Script.Update(state);
        }
示例#7
0
 public virtual void PrepareDraw(LiveSplitState state, LayoutMode mode)
 {
     NameMeasureLabel.Font = state.LayoutSettings.TextFont;
     ValueLabel.Font = state.LayoutSettings.TextFont;
     NameLabel.Font = state.LayoutSettings.TextFont;
     if (mode == LayoutMode.Vertical)
     {
         NameLabel.VerticalAlignment = StringAlignment.Center;
         ValueLabel.VerticalAlignment = StringAlignment.Center;
     }
     else
     {
         NameLabel.VerticalAlignment = StringAlignment.Near;
         ValueLabel.VerticalAlignment = StringAlignment.Far;
     }
 }
 public override void PrepareDraw(Model.LiveSplitState state, LayoutMode mode)
 {
     ValueLabel.IsMonospaced = true;
     ValueLabel.Font = state.LayoutSettings.TimesFont;
     NameMeasureLabel.Font = state.LayoutSettings.TextFont;
     NameLabel.Font = state.LayoutSettings.TextFont;
     if (mode == LayoutMode.Vertical)
     {
         NameLabel.VerticalAlignment = StringAlignment.Center;
         ValueLabel.VerticalAlignment = StringAlignment.Center;
     }
     else
     {
         NameLabel.VerticalAlignment = StringAlignment.Near;
         ValueLabel.VerticalAlignment = StringAlignment.Far;
     }
 }
示例#9
0
        public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            if (DateTime.Now > lastInfoCheck)
            {
                deathComponent = null;
                roomComponent  = 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("Death", StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            deathComponent = text;
                        }
                        else if (text.Settings.Text1.IndexOf("Room", StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            roomComponent = text;
                        }
                    }
                }
                lastInfoCheck = DateTime.Now.AddSeconds(3);
            }

            string deaths = deathComponent != null ? $"{logic.Memory.TotalDeaths()} / {logic.DeathTimeLost}" : string.Empty;

            if (!string.IsNullOrEmpty(deaths) && deathComponent.Settings.Text2 != deaths)
            {
                deathComponent.Settings.Text2 = deaths;
            }
            string timer = $"{logic.RoomTimer}";

            if (roomComponent != null && roomComponent.Settings.Text2 != timer)
            {
                roomComponent.Settings.Text2 = timer;
            }
        }
示例#10
0
 public Control GetSettingsControl(LayoutMode mode)
 {
     return(Settings);
 }
示例#11
0
        public void Render(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode, Region clipRegion)
        {
            if (!errorInComponent)
            {
                try
                {
                    var clip              = g.Clip;
                    var transform         = g.Transform;
                    var crashedComponents = new List <IComponent>();
                    var index             = 0;
                    foreach (var component in VisibleComponents)
                    {
                        try
                        {
                            g.Clip = clip;
                            if (mode == LayoutMode.Vertical)
                            {
                                DrawVerticalComponent(index, g, state, width, height, clipRegion);
                            }
                            else
                            {
                                DrawHorizontalComponent(index, g, state, width, height, clipRegion);
                            }
                        }
                        catch (Exception e)
                        {
                            Log.Error(e);
                            crashedComponents.Add(component);
                            errorInComponent = true;
                        }
                        index++;
                    }

                    if (crashedComponents.Count > 0)
                    {
                        var remainingComponents = VisibleComponents.ToList();
                        crashedComponents.ForEach(x =>
                        {
                            remainingComponents.Remove(x);
                            state.Layout.LayoutComponents = state.Layout.LayoutComponents.Where(y => y.Component != x).ToList();
                        });
                        VisibleComponents = remainingComponents;
                    }
                    g.Transform = transform;
                    g.Clip      = clip;
                }
                finally
                {
                    errorInComponent = false;
                }
            }
        }
示例#12
0
 void PrepareDraw(LiveSplitState state, LayoutMode mode)
 {
     InternalComponent.NameLabel.ForeColor  = state.LayoutSettings.TextColor;
     InternalComponent.ValueLabel.ForeColor = state.LayoutSettings.TextColor;
     InternalComponent.PrepareDraw(state, mode);
 }
示例#13
0
 Control IComponent.GetSettingsControl(LayoutMode mode)
 {
     Settings.Mode = mode;
     return(Settings);
 }
示例#14
0
 public Control GetSettingsControl(LayoutMode mode)
 {
     throw new NotImplementedException();
 }
示例#15
0
        public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            if (Model == null)
            {
                Model = new TimerModel()
                {
                    CurrentState = lvstate
                };
                lvstate.OnReset     += OnReset;
                lvstate.OnPause     += OnPause;
                lvstate.OnResume    += OnResume;
                lvstate.OnStart     += OnStart;
                lvstate.OnSplit     += OnSplit;
                lvstate.OnUndoSplit += OnUndoSplit;
                lvstate.OnSkipSplit += OnSkipSplit;
            }

            GetValues(invalidator, lvstate, width, height, mode);
        }
示例#16
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;
         }
     }
 }
示例#17
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (Split != null)
            {
                UpdateAll(state);
                NeedUpdateAll = false;

                IsActive = (state.CurrentPhase == TimerPhase.Running
                            || state.CurrentPhase == TimerPhase.Paused) &&
                                                    state.CurrentSplit == Split;

                Cache.Restart();
                Cache["Icon"] = Split.Icon;
                if (Cache.HasChanged)
                {
                    if (Split.Icon == null)
                        FrameCount = 0;
                    else
                        FrameCount = Split.Icon.GetFrameCount(new FrameDimension(Split.Icon.FrameDimensionsList[0]));
                }
                Cache["DisplayIcon"] = DisplayIcon;
                Cache["SplitName"] = NameLabel.Text;
                Cache["IsActive"] = IsActive;
                Cache["NameColor"] = NameLabel.ForeColor.ToArgb();
                Cache["ColumnsCount"] = ColumnsList.Count();
                foreach (var label in LabelsList)
                {
                    Cache["Columns" + LabelsList.IndexOf(label) + "Text"] = label.Text;
                    Cache["Columns" + LabelsList.IndexOf(label) + "Color"] = label.ForeColor.ToArgb();
                }

                if (invalidator != null && Cache.HasChanged || FrameCount > 1)
                {
                    invalidator.Invalidate(0, 0, width, height);
                }
            }
        }
示例#18
0
 public void SetWidthMode(LayoutMode mode)
 {
     if (!layout.IsSetWMode())
     {
         layout.AddNewWMode();
     }
     layout.wMode.val = fromLayoutMode(mode);
 }
 public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
 {
     if (invalidator != null)
         InternalComponent.Update(invalidator, state, width, height, mode);
 }
示例#20
0
 public abstract Control GetSettingsControl(LayoutMode mode);
示例#21
0
 private void ChangeLayoutMode(LayoutMode m)
 {
     SaveLayoutMode(m);
     UpdateMenuItemCheckStatus();
     RedrawGraph();
 }
示例#22
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            GameLoader.game?.Update(state);

            if (invalidator != null)
            {
                InternalComponent.Update(invalidator, state, width, height, mode);
            }
        }
示例#23
0
 private void cmbLayout_SelectedIndexChanged(object sender, EventArgs e)
 {
     _layout = (LayoutMode)cmbLayout.SelectedIndex;
 }
示例#24
0
 public virtual void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
 {
     if (!HasInvalidated && invalidator != null)
     {
         invalidator.Invalidate(0, 0, width, height);
         HasInvalidated = true;
     }
 }
示例#25
0
 public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
 {
     invalidator.Invalidate(0, 0, width, height);
 }
示例#26
0
        public void CalculateOverallHeight(LayoutMode mode)
        {
            var totalSize = 0f;
            var index = 0;
            foreach (var component in VisibleComponents)
            {
                if (mode == LayoutMode.Vertical)
                    totalSize += GetHeightVertical(index);
                else
                    totalSize += GetWidthHorizontal(index);
                index++;
            }

            if (mode == LayoutMode.Vertical)
            {
                OverallHeight = totalSize;
                OverallWidth = VisibleComponents.Aggregate(0.0f, (x, y) => x + y.HorizontalWidth);
            }
            else
            {
                OverallWidth = totalSize;
                OverallHeight = VisibleComponents.Aggregate(0.0f, (x, y) => x + y.VerticalHeight);
            }
        }
示例#27
0
 private ST_LayoutMode fromLayoutMode(LayoutMode mode)
 {
     switch (mode)
     {
         case LayoutMode.Edge: return ST_LayoutMode.edge;
         case LayoutMode.Factor: return ST_LayoutMode.factor;
         default:
             throw new ArgumentException();
     }
 }
示例#28
0
        public void Render(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode, Region clipRegion)
        {
            if (!errorInComponent)
            {
                try
                {
                    var clip = g.Clip;
                    var transform = g.Transform;
                    var crashedComponents = new List<IComponent>();
                    var index = 0;
                    var totalSize = 0f;
                    foreach (var component in VisibleComponents)
                    {
                        try
                        {
                            g.Clip = clip;
                            if (mode == LayoutMode.Vertical)
                                DrawVerticalComponent(index, g, state, width, height, clipRegion);
                            else
                                DrawHorizontalComponent(index, g, state, width, height, clipRegion);
                        }
                        catch (Exception e)
                        {
                            Log.Error(e);
                            crashedComponents.Add(component);
                            errorInComponent = true;
                        }
                        index++;
                    }

                    if (crashedComponents.Count > 0)
                    {
                        var remainingComponents = VisibleComponents.ToList();
                        crashedComponents.ForEach(x => remainingComponents.Remove(x));
                        //crashedComponents.ForEach(x => MessageBox.Show(String.Format("The component {0} crashed.", x.ComponentName), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error));
                        VisibleComponents = remainingComponents;
                    }
                    g.Transform = transform;
                    g.Clip = clip;
                }
                finally
                {
                    errorInComponent = false;
                }
            }
            CalculateOverallHeight(mode);
        }
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {

        }
示例#30
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            var oldTransform = invalidator.Transform.Clone();
            var scaleFactor = mode == LayoutMode.Vertical
                    ? height / OverallHeight
                    : width / OverallWidth;

            for (var ind = 0; ind < VisibleComponents.Count(); ind++)
            {
                var component = VisibleComponents.ElementAt(ind);
                if (mode == LayoutMode.Vertical)
                    InvalidateVerticalComponent(ind, state, invalidator, width, height, scaleFactor);
                else
                    InvalidateHorizontalComponent(ind, state, invalidator, width, height, scaleFactor);
            }
            invalidator.Transform = oldTransform;
        }
 public void FlipLayout()
 {
     LayoutMode = LayoutMode == LayoutMode.Normal ? LayoutMode.Flipped : LayoutMode.Normal;
 }
 public override Control GetSettingsControl(LayoutMode mode) => Settings;
示例#33
0
        private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (NeedUpdateAll)
                UpdateAll(state);

            if (Settings.BackgroundGradient == ExtendedGradientType.Alternating)
                g.FillRectangle(new SolidBrush(
                    state.Run.IndexOf(Split) % 2 + (Settings.ShowColumnLabels ? 1 : 0) == 1
                    ? Settings.BackgroundColor2
                    : Settings.BackgroundColor
                    ), 0, 0, width, height);

            MeasureTimeLabel.Text = TimeFormatter.Format(new TimeSpan(24, 0, 0));
            MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0));

            MeasureTimeLabel.Font = state.LayoutSettings.TimesFont;
            MeasureTimeLabel.IsMonospaced = true;
            MeasureDeltaLabel.Font = state.LayoutSettings.TimesFont;
            MeasureDeltaLabel.IsMonospaced = true;

            MeasureTimeLabel.SetActualWidth(g);
            MeasureDeltaLabel.SetActualWidth(g);

            NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor;
            foreach (var label in LabelsList)
                label.ShadowColor = state.LayoutSettings.ShadowsColor;

            MinimumWidth = CalculateLabelsWidth() + IconWidth + 10;
            MinimumHeight = 0.85f * (g.MeasureString("A", state.LayoutSettings.TimesFont).Height + g.MeasureString("A", state.LayoutSettings.TextFont).Height);

            if (Settings.SplitTimesAccuracy != CurrentAccuracy)
            {
                TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy);
                CurrentAccuracy = Settings.SplitTimesAccuracy;
            }
            if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals)
            {
                DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals);
                CurrentDeltaAccuracy = Settings.DeltasAccuracy;
                CurrentDropDecimals = Settings.DropDecimals;
            }

            if (Split != null)
            {

                if (mode == LayoutMode.Vertical)
                {
                    NameLabel.VerticalAlignment = StringAlignment.Center;
                    NameLabel.Y = 0;
                    NameLabel.Height = height;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Center;
                        label.Y = 0;
                        label.Height = height;
                    }
                }
                else
                {
                    NameLabel.VerticalAlignment = StringAlignment.Near;
                    NameLabel.Y = 0;
                    NameLabel.Height = 50;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Far;
                        label.Y = height - 50;
                        label.Height = 50;
                    }
                }

                if (IsActive)
                {
                    var currentSplitBrush = new LinearGradientBrush(
                        new PointF(0, 0),
                        Settings.CurrentSplitGradient == GradientType.Horizontal
                        ? new PointF(width, 0)
                        : new PointF(0, height),
                        Settings.CurrentSplitTopColor,
                        Settings.CurrentSplitGradient == GradientType.Plain
                        ? Settings.CurrentSplitTopColor
                        : Settings.CurrentSplitBottomColor);
                    g.FillRectangle(currentSplitBrush, 0, 0, width, height);
                }

                var icon = Split.Icon;
                if (DisplayIcon && icon != null)
                {
                    var shadow = ShadowImage;

                    if (OldImage != icon)
                    {
                        ImageAnimator.Animate(icon, (s, o) => { });
                        ImageAnimator.Animate(shadow, (s, o) => { });
                        OldImage = icon;
                    }

                    var drawWidth = Settings.IconSize;
                    var drawHeight = Settings.IconSize;
                    var shadowWidth = Settings.IconSize * (5 / 4f);
                    var shadowHeight = Settings.IconSize * (5 / 4f);
                    if (icon.Width > icon.Height)
                    {
                        var ratio = icon.Height / (float)icon.Width;
                        drawHeight *= ratio;
                        shadowHeight *= ratio;
                    }
                    else
                    {
                        var ratio = icon.Width / (float)icon.Height;
                        drawWidth *= ratio;
                        shadowWidth *= ratio;
                    }

                    ImageAnimator.UpdateFrames(shadow);
                    if (Settings.IconShadows && shadow != null)
                    {
                        g.DrawImage(
                            shadow,
                            7 + (Settings.IconSize * (5 / 4f) - shadowWidth) / 2 - 0.7f,
                            (height - Settings.IconSize) / 2.0f + (Settings.IconSize * (5 / 4f) - shadowHeight) / 2 - 0.7f,
                            shadowWidth,
                            shadowHeight);
                    }

                    ImageAnimator.UpdateFrames(icon);

                    g.DrawImage(
                        icon,
                        7 + (Settings.IconSize - drawWidth) / 2,
                        (height - Settings.IconSize) / 2.0f + (Settings.IconSize - drawHeight) / 2,
                        drawWidth,
                        drawHeight);
                }

                NameLabel.Font = state.LayoutSettings.TextFont;
                NameLabel.X = 5 + IconWidth;
                NameLabel.HasShadow = state.LayoutSettings.DropShadows;

                if (ColumnsList.Count() == LabelsList.Count)
                {
                    var curX = width - 7;
                    var nameX = width - 7;
                    foreach (var label in LabelsList.Reverse())
                    {
                        var column = ColumnsList.ElementAt(LabelsList.IndexOf(label));

                        var labelWidth = 0f;
                        if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime)
                            labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth);
                        else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta)
                            labelWidth = MeasureDeltaLabel.ActualWidth;
                        else
                            labelWidth = MeasureTimeLabel.ActualWidth;
                        label.Width = labelWidth + 20;
                        curX -= labelWidth + 5;
                        label.X = curX - 15;

                        label.Font = state.LayoutSettings.TimesFont;
                        label.HasShadow = state.LayoutSettings.DropShadows;
                        label.IsMonospaced = true;
                        label.Draw(g);

                        if (!String.IsNullOrEmpty(label.Text))
                            nameX = curX + labelWidth + 5 - label.ActualWidth;

                    }
                    NameLabel.Width = (mode == LayoutMode.Horizontal ? width - 10 : nameX) - IconWidth;
                    NameLabel.Draw(g);
                }
            }
            else DisplayIcon = Settings.DisplayIcons;
        }
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            string text = $"<C0=00CC4B><C1=5CD689><C2=D65C5C><C3=CC0000><C4=FFD500><C5=999999><C6=666666><C7=4DA6FF><C8=4DA6FF><S0={Settings.FontSize}><S0>";

            foreach (string s in Settings.addedComponents)
            {
                switch (s)
                {
                case "Title":
                    text += titleComponent();
                    break;

                case "Splits":
                    text += splitsComponent();
                    break;

                case "Timer":
                    text += timerComponent();
                    break;

                case "Previous Segment":
                    text += previousSegmentComponent();
                    break;

                case "Sum Of Best":
                    text += sumOfBestComponent();
                    break;

                case "Possible Time Save":
                    text += possibleTimeSaveComponent();
                    break;

                case "Space":
                    text += "\n";
                    break;

                case "Alternate Timing Method":
                    text += alternateTiming();
                    break;

                default:
                    break;
                }
            }

            text += "<S>";
            updateRiva(text);
        }
示例#35
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            Cache.Restart();
            Cache["NameText"]       = InformationName;
            Cache["ValueText"]      = InformationValue;
            Cache["NameColor"]      = NameLabel.ForeColor.ToArgb();
            Cache["ValueColor"]     = ValueLabel.ForeColor.ToArgb();
            Cache["DisplayTwoRows"] = DisplayTwoRows;

            if (invalidator != null && Cache.HasChanged)
            {
                invalidator.Invalidate(0, 0, width, height);
            }
        }
示例#36
0
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (game != null && !game.HasExited)
            {
                if (state.CurrentPhase == TimerPhase.NotRunning)
                {
                    if (settings.AutoStartTimer)
                    {
                        if (memory.doStart(game))
                        {
                            timer.Start();
                        }
                    }
                }
                else
                {
                    if (settings.AutoReset)
                    {
                        if (memory.doReset(game))
                        {
                            timer.Reset();
                        }
                    }
                }

                if (state.CurrentPhase == TimerPhase.Running)
                {
                    if (memory.doSplit(game))
                    {
                        timer.Split();
                    }
                }
            }
            else if (!processTimer.Enabled)
            {
                processTimer.Enabled = true;
            }
        }
示例#37
0
        private void GetValues(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            if (!GetKTANE())
            {
                return;
            }

            if (Model != null && Model.CurrentState != null)
            {
                ReadData();
                foreach (LogLine line in logLines)
                {
                    if (Model.CurrentState.CurrentPhase != TimerPhase.Running && line.Message.Equals("[BombGenerator] Generator settings: Time: 300, NumStrikes: 3, FrontFaceOnly: True\r3 Pools:\r[Wires] Count: 1\r[BigButton] Count: 1\r[Keypad] Count: 1"))
                    {
                        Model.Start();
                        continue;
                    }
                    if (currentSplit <= 0 || currentSplit >= 33 || Model.CurrentState.CurrentPhase != TimerPhase.Running || line.Time < DateTime.Now - Model.CurrentState.CurrentTime.RealTime.Value)
                    {
                        continue;
                    }

                    if (line.Message.IndexOf("[Bomb] A winner is you!!") >= 0)
                    {
                        if (Model.CurrentState.Run.Count < 8)
                        {
                            switch (currentSplit)
                            {
                            case 1:
                            case 5:
                            case 12:
                            case 16:
                            case 22:
                            case 26:
                            case 32:
                                Model.Split();
                                break;

                            default:
                                currentSplit++;
                                break;
                            }
                        }
                        else
                        {
                            Model.Split();
                        }
                        endOfBomb = line.Time;
                    }
                    else if (line.Message.IndexOf("[BombGenerator] Generator settings: Time: ") >= 0)
                    {
                        int index = line.Message.IndexOf("Time: ") + 6;
                        bestTime = decimal.Parse(line.Message.Substring(index, line.Message.IndexOf(",", index) - index));
                    }
                    else if (line.Message.IndexOf("[BombGenerator] Generating Widgets") >= 0)
                    {
                        startOfBomb = line.Time;
                        endOfBomb   = DateTime.MinValue;

                        XDocument x       = XDocument.Load(BestTimes);
                        var       xmlList = x.Descendants("dictionary").Elements().ToList();
                        if (xmlList.Count >= currentSplit)
                        {
                            foreach (XElement ele in xmlList)
                            {
                                if (ele.Element("key").Element("string").Value == missions[currentSplit - 1])
                                {
                                    bestTimeRTA = decimal.Parse(ele.Element("value").Element("GameRecord").Element("RealTimeElapsed").Value);
                                    bestTime   -= decimal.Parse(ele.Element("value").Element("GameRecord").Element("TimeElapsed").Value);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            bestTimeRTA = 0;
                        }
                    }
                    else if (line.Message.IndexOf("[Bomb] Boom") >= 0)
                    {
                        startOfBomb = DateTime.MinValue;
                        endOfBomb   = DateTime.MinValue;
                    }
                }
            }

            //textInfo.InformationName = "Best Time" + (bestTime > 0 ? " (" + TimeSpan.FromSeconds((double)bestTime).ToString(@"m\:") + (bestTime % 60).ToString("00.000") + ")" : "");
            textInfo.InformationName  = "Best Time";
            textInfo.InformationValue = (startOfBomb > DateTime.MinValue ? ((endOfBomb > DateTime.MinValue ? endOfBomb : DateTime.Now) - startOfBomb).TotalSeconds.ToString("0.000") : "0.000") + " / " + bestTimeRTA.ToString("0.000");
            textInfo.Update(invalidator, lvstate, width, height, mode);
            if (invalidator != null)
            {
                invalidator.Invalidate(0, 0, width, height);
            }
        }
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            var gt = (ShitSplitter)GameTimeForm;

            if (gt.PauseInProgress && (state.PauseTime >= gt.PauseDuration))
            {
                gt.PauseInProgress = false;
                gt.Model.Pause();
            }
        }
示例#39
0
        void IComponent.Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            string newCategory = State.Run.GameName + State.Run.CategoryName;

            if (newCategory != category)
            {
                Recalculate();
                category = newCategory;
            }

            InternalComponent.Update(invalidator, state, width, height, mode);
        }
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (LastAttemptCount != state.Run.AttemptHistory.Count 
                || LastPhase != state.CurrentPhase
                || LastRun != state.Run
                || state.CurrentPhase == TimerPhase.Running 
                || state.CurrentPhase == TimerPhase.Paused)
            {
                InternalComponent.TimeValue = CalculateTotalPlaytime(state);

                LastAttemptCount = state.Run.AttemptHistory.Count;
                LastPhase = state.CurrentPhase;
                LastRun = state.Run;
            }

            InternalComponent.Update(invalidator, state, width, height, mode);
        }
示例#41
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (Game == null)
            {
                isHooked = false;
            }
            else if (Game.HasExited)
            {
                Game     = null;
                isHooked = false;
            }
            else
            {
                isHooked = xVelocityDP.Deref <float>(Game, out var ignore);
            }

            if (!isHooked)
            {
                List <Process> GameProcesses = Process.GetProcesses().ToList().FindAll(x => x.ProcessName.StartsWith("bms"));
                if (GameProcesses.Count > 0)
                {
                    Game = GameProcesses.First();
                    velocityTextDP.DerefOffsets(Game, out velocityTextPTR);
                    Game.VirtualProtect(velocityTextPTR, 32, MemPageProtect.PAGE_EXECUTE_READWRITE);
                    isHooked = xVelocityDP.Deref <float>(Game, out var ignore);
                }
            }
            else
            {
                float  xVel = xVelocityDP.Deref <float>(Game);
                float  yVel = yVelocityDP.Deref <float>(Game);
                float  zVel = zVelocityDP.Deref <float>(Game);
                double horizontalVelocity = Math.Sqrt(Math.Pow(xVel, 2) + Math.Pow(yVel, 2));

                byte[] velocityArray = Encoding.ASCII.GetBytes("hvel: " + horizontalVelocity.ToString("0.00") + "  zvel:  " + zVel.ToString("0.00"));
                byte[] outputArray   = new byte[32];
                for (int i = 0; i < velocityArray.Length; i++)
                {
                    outputArray[i] = velocityArray[i];
                }

                Game.WriteBytes(velocityTextPTR, outputArray);
            }
        }
示例#42
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            frame_count++;

            if (SplitsAreDifferent(state))
            {
                settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory);

                ReloadLogFile();
            }

            if (settings.RecordImages && (frame_count % 3) == 0)
            {
                settings.StoreCaptureImage(GameName, GameCategory);
            }

            liveSplitState = state;

            /*
             *                liveSplitState = state;
             *                if (GameName != state.Run.GameName || GameCategory != state.Run.CategoryName)
             *                {
             *                        //Reload settings for different game or category
             *                        GameName = state.Run.GameName;
             *                        GameCategory = state.Run.CategoryName;
             *
             *                        settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory);
             *                }
             */



            CaptureLoads();
        }
示例#43
0
 public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
 {
 }
示例#44
0
        public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            if (Model.CurrentState.Run.Count == 1 && string.IsNullOrEmpty(Model.CurrentState.Run[0].Name))
            {
                Model.CurrentState.Run[0].Name = "Red";
                Model.CurrentState.Run.AddSegment("Green");
                Model.CurrentState.Run.AddSegment("Yellow");
                Model.CurrentState.Run.AddSegment("Blue");
                Model.CurrentState.Run.AddSegment("Purple");
                Model.CurrentState.Run.AddSegment("End");
            }

            GetValues();
        }
示例#45
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            var oldTransform = invalidator.Transform.Clone();
            var scaleFactor  = mode == LayoutMode.Vertical
                    ? height / OverallSize
                    : width / OverallSize;

            for (var ind = 0; ind < VisibleComponents.Count(); ind++)
            {
                var component = VisibleComponents.ElementAt(ind);
                if (mode == LayoutMode.Vertical)
                {
                    InvalidateVerticalComponent(ind, state, invalidator, width, height, scaleFactor);
                }
                else
                {
                    InvalidateHorizontalComponent(ind, state, invalidator, width, height, scaleFactor);
                }
            }
            invalidator.Transform = oldTransform;
        }
示例#46
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            Calculate(state);

            Cache.Restart();
            Cache["FinalSplit"] = FinalSplit.ToString();
            Cache["IsBestSegment"] = IsBestSegment;
            Cache["DeltasCount"] = Deltas.Count;
            for (var ind = 0; ind < Deltas.Count; ind++)
            {
                Cache["Deltas" + ind] = Deltas[ind] == null ? "null" : Deltas[ind].ToString();
            }

            if (invalidator != null && Cache.HasChanged)
            {
                invalidator.Invalidate(0, 0, width, height);
            }
        }
示例#47
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            InternalComponent.InformationName = Settings.Text1;
            InternalComponent.InformationValue = Settings.Text2;
            InternalComponent.LongestString = Settings.Text1.Length > Settings.Text2.Length
                ? Settings.Text1
                : Settings.Text2;

            InternalComponent.Update(invalidator, state, width, height, mode);
        }
示例#48
0
 public override Control GetSettingsControl(LayoutMode mode)
 {
     return(this.Settings);
 }
示例#49
0
 public Control GetSettingsControl(LayoutMode mode)
 {
     throw new NotImplementedException();
 }
示例#50
0
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (state.CurrentPhase != _prevPhase && state.CurrentPhase == TimerPhase.Ended)
            {
                UpdateBearCartPB(true);
            }

            _prevPhase = state.CurrentPhase;
        }
示例#51
0
 public void SetYMode(LayoutMode mode)
 {
     if (!layout.IsSetYMode())
     {
         layout.AddNewYMode();
     }
     layout.yMode.val = fromLayoutMode(mode);
 }
示例#52
0
 public Control GetSettingsControl(LayoutMode mode)
 {
     return this.Settings;
 }
示例#53
0
 public void SetHeightMode(LayoutMode mode)
 {
     if (!layout.IsSetHMode())
     {
         layout.AddNewHMode();
     }
     layout.hMode.val = fromLayoutMode(mode);
 }
示例#54
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            // hack to prevent flicker, doesn't actually pause anything
            state.IsGameTimePaused = true;

            // Update is called every 25ms, so up to 25ms IGT can be lost if using delay and no auto-start
            if (_waitingForDelay)
            {
                if (state.CurrentTime.RealTime >= TimeSpan.Zero)
                {
                    _sessionTimeOffset = _sessionTime;
                    _waitingForDelay = false;
                }
                else
                {
                    state.SetGameTime(state.CurrentTime.RealTime);
                }
            }

            if (!_waitingForDelay)
                // update game time, don't show negative time due to tick adjusting
                state.SetGameTime(this.GameTime >= TimeSpan.Zero ? this.GameTime : TimeSpan.Zero);

            if (!this.Settings.ShowGameTime)
                return;

            this.InternalComponent.TimeValue =
                state.CurrentTime[state.CurrentTimingMethod == TimingMethod.GameTime
                    ? TimingMethod.RealTime : TimingMethod.GameTime];
            this.InternalComponent.InformationName = state.CurrentTimingMethod == TimingMethod.GameTime
                ? "Real Time" : "Game Time";

            _cache.Restart();
            _cache["TimeValue"] = this.InternalComponent.ValueLabel.Text;
            _cache["TimingMethod"] = state.CurrentTimingMethod;
            if (invalidator != null && _cache.HasChanged)
                invalidator.Invalidate(0f, 0f, width, height);
        }
 public Control GetSettingsControl(LayoutMode mode)
 {
     throw new NotSupportedException();
 }
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            Cache.Restart();
            Cache["LockToBottom"] = LockToBottom;

            if (invalidator != null && Cache.HasChanged)
                invalidator.Invalidate(0, 0, width, height);
        }
 public Control GetSettingsControl(LayoutMode mode)
 {
     Settings.Mode = mode;
     return Settings;
 }
 public LayoutContext(TGraph graph, IDictionary <TVertex, Point> positions, IDictionary <TVertex, Size> sizes, LayoutMode mode)
 {
     Graph     = graph;
     Positions = positions;
     Sizes     = sizes;
     Mode      = mode;
 }
 public override Control GetSettingsControl(LayoutMode mode)
 {
     return Settings;
 }
示例#60
0
        public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            try {
                IList <ILayoutComponent> components = lvstate.Layout.LayoutComponents;
                bool hasMapDisplay = false;
                for (int i = components.Count - 1; i >= 0; i--)
                {
                    ILayoutComponent component = components[i];
                    if (component.Component is OriMapDisplayComponent)
                    {
                        if (!settings.ShowMapDisplay || hasMapDisplay)
                        {
                            components.Remove(component);
                        }
                        hasMapDisplay = true;
                    }
                    else if (component.Component is OriComponent && invalidator == null && width == 0 && height == 0)
                    {
                        components.Remove(component);

                        if (!hasMapDisplay && settings.ShowMapDisplay)
                        {
                            components.Insert(i, mapDisplay);
                            hasMapDisplay = true;
                        }
                    }
                }

                if (settings.ShowMapDisplay && !hasMapDisplay)
                {
                    components.Add(mapDisplay);
                }

                GetValues();
            } catch (Exception ex) {
                WriteLog(ex.ToString());
            }
        }