Esempio n. 1
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (Model == null)
            {
                Model = new TimerModel()
                {
                    CurrentState = state
                };
                state.OnReset     += OnReset;
                state.OnPause     += OnPause;
                state.OnResume    += OnResume;
                state.OnStart     += OnStart;
                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
            }

            oriState.Loop();
            oriState.oriTriggers.timerRunning = (Model.CurrentState.CurrentPhase == TimerPhase.Running);

            if (Settings.showMapDisplay)
            {
                textInfo.InformationName  = "Total Map: " + oriState.sMapCompletion.ToString("0.00") + "%";
                textInfo.InformationValue = oriState.sCurrentArea.ToString();
                textInfo.LongestString    = "Valley Of The Wind - 100.00%";
                textInfo.Update(invalidator, state, width, height, mode);
                if (invalidator != null)
                {
                    invalidator.Invalidate(0, 0, width, height);
                }
            }
        }
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            List <Area> areas       = memory.GetMapCompletion();
            decimal     total       = 0;
            Area        currentArea = default(Area);

            for (int i = 0; i < areas.Count; i++)
            {
                Area area = areas[i];
                total += area.Progress;
                if (area.Current)
                {
                    currentArea = area;
                }
            }
            if (areas.Count > 0)
            {
                total /= areas.Count;
            }
            textInfo.InformationName  = "Total Map: " + total.ToString("0.00") + "%";
            textInfo.InformationValue = currentArea.Name + " - " + currentArea.Progress.ToString("0.00") + "%";
            textInfo.LongestString    = "Valley Of The Wind - 100.00%";

            textInfo.Update(invalidator, state, width, height, mode);
            if (invalidator != null)
            {
                invalidator.Invalidate(0, 0, width, height);
            }
        }
Esempio n. 3
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();

            if (settings.ShowMapDisplay)
            {
                List <Area> areas       = mem.GetMapCompletion();
                decimal     total       = 0;
                Area        currentArea = default(Area);
                for (int i = 0; i < areas.Count; i++)
                {
                    Area area = areas[i];
                    total += area.Progress;
                    if (area.Current)
                    {
                        currentArea = area;
                    }
                }
                if (areas.Count > 0)
                {
                    total /= areas.Count;
                }
                textInfo.InformationName  = "Total Map: " + total.ToString("0.00") + "%";
                textInfo.InformationValue = currentArea.Name + " - " + currentArea.Progress.ToString("0.00") + "%";
                textInfo.LongestString    = "Valley Of The Wind - 100.00%";
                textInfo.Update(invalidator, lvstate, width, height, mode);
                if (invalidator != null)
                {
                    invalidator.Invalidate(0, 0, width, height);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Updates the component. This is where most of the actual autosplitting work is done.
        /// </summary>
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (timer == null)
            {
                timer = new TimerModel
                {
                    CurrentState = state
                };

                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
                state.OnReset     += OnReset;
            }

            bool processPreviouslyHooked = processHooked;

            Autosplit();

            if (processHooked)
            {
                // If someone keeps the timer running after exiting to the menu, it's probably also useful to keep display death count for
                // that run until the timer is reset.
                deathCount = memory.CheckInGame() || timer.CurrentState.CurrentPhase == TimerPhase.Running
                                        ? Math.Max(deathCount, memory.GetDeathCount())
                                        : 0;
            }

            // The death count should reset to zero when the game exits.
            if (!processHooked && processPreviouslyHooked)
            {
                deathCount = 0;
            }

            if (processHooked || processPreviouslyHooked)
            {
                textComponent.InformationValue = deathCount.ToString();
                textComponent.Update(invalidator, state, width, height, mode);

                invalidator?.Invalidate(0, 0, width, height);
            }
        }
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (this.EngineHook.IsLoaded)
            {
                string lives;
                if (Settings.ValueLocation == ASLVarViewerSettings.ValueBucket.CurrentState)
                {
                    lives = this.EngineHook.GetStateValue(Settings.ValueSource);
                }
                else
                {
                    lives = this.EngineHook.GetVariableValue(Settings.ValueSource);
                }

                if (invalidator != null && this.InternalComponent.InformationValue != lives)
                {
                    this.InternalComponent.InformationValue = lives;
                    InternalComponent.Update(invalidator, state, width, height, mode);
                }
            }
        }
Esempio n. 6
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);
            }
        }