コード例 #1
0
 public LiveSplitController(LiveSplitState state)
 {
     this.state = state;
 }
コード例 #2
0
 private void PrepareDraw(LiveSplitState state, LayoutMode mode)
 {
 }
コード例 #3
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, System.Drawing.Region clipRegion)
 {
 }
コード例 #4
0
        public override void Update(LiveSplitState state)
        {
            base.Update(state);

            if (IsRunning() && settings.AutoSplitter)
            {
                if (state.CurrentPhase == TimerPhase.NotRunning)
                {
                    if (randomized)
                    {
                        while (state.Run.Count > 8)
                        {
                            state.Run.RemoveAt(8);
                        }

                        for (int i = 0; i < 7; ++i)
                        {
                            if (state.Run.Count <= i)
                            {
                                state.Run.AddSegment("Crystal " + (i + 1), icon: icons["Crystal"][0]);
                            }

                            else
                            {
                                state.Run[i].Name = "Crystal " + (i + 1);
                                state.Run[i].Icon = icons["Crystal"][0];
                            }
                        }

                        if (state.Run.Count <= 7)
                        {
                            state.Run.AddSegment("Triforce");
                        }

                        else
                        {
                            state.Run[7].Name = "Triforce";
                        }
                    }

                    if (state.Run.Count < 2)
                    {
                        state.Run[0].Name = "Start";
                        state.Run.AddSegment("Triforce");
                    }

                    timer.Start();
                }

                Crystals newCrystal = (Crystals)((byte)Get <Crystals>("Crystals") - (byte)Previous <Crystals>("Crystals"));

                if (newCrystal != Crystals.NONE)
                {
                    switch (newCrystal)
                    {
                    case Crystals.CRYSTAL1:
                        state.CurrentSplit.Icon = icons["Crystal"][1];
                        break;

                    case Crystals.CRYSTAL2:
                        state.CurrentSplit.Icon = icons["Crystal"][2];
                        break;

                    case Crystals.CRYSTAL3:
                        state.CurrentSplit.Icon = icons["Crystal"][3];
                        break;

                    case Crystals.CRYSTAL4:
                        state.CurrentSplit.Icon = icons["Crystal"][4];
                        break;

                    case Crystals.CRYSTAL5:
                        state.CurrentSplit.Icon = icons["Crystal"][5];
                        break;

                    case Crystals.CRYSTAL6:
                        state.CurrentSplit.Icon = icons["Crystal"][6];
                        break;

                    case Crystals.CRYSTAL7:
                        state.CurrentSplit.Icon = icons["Crystal"][7];
                        break;

                    default:
                        break;
                    }

                    switch (Get <Dungeon>("Current Dungeon"))
                    {
                    case Dungeon.DARKPALACE:
                        state.CurrentSplit.Name = "Palace of Darkness";
                        break;

                    case Dungeon.DESERTPALACE:
                        state.CurrentSplit.Name = "Desert Palace";
                        break;

                    case Dungeon.EASTERNPALACE:
                        state.CurrentSplit.Name = "Eastern Palace";
                        break;

                    case Dungeon.ICEPALACE:
                        state.CurrentSplit.Name = "Ice Palace";
                        break;

                    case Dungeon.MISERYMIRE:
                        state.CurrentSplit.Name = "Misery Mire";
                        break;

                    case Dungeon.SKULLWOODS:
                        state.CurrentSplit.Name = "Skull Woods";
                        break;

                    case Dungeon.SWAMPPALACE:
                        state.CurrentSplit.Name = "Swamp Palace";
                        break;

                    case Dungeon.THIEVESTOWN:
                        state.CurrentSplit.Name = "Thieves' Town";
                        break;

                    case Dungeon.TOWEROFHERA:
                        state.CurrentSplit.Name = "Tower of Hera";
                        break;

                    case Dungeon.TURTLEROCK:
                        state.CurrentSplit.Name = "Turtle Rock";
                        break;

                    default:
                        state.CurrentSplit.Name = Get <Dungeon>("Current Dungeon").ToString();
                        break;
                    }

                    if (state.CurrentSplitIndex == state.Run.Count)
                    {
                        state.Run.AddSegment("Crystal " + state.CurrentSplitIndex + 2, icon: icons["Crystal"][0]);
                    }

                    timer.Split();
                }

                if (Get <ushort>("RoomID") == 0x0189)
                {
                    timer.Split();
                }
            }
        }
コード例 #5
0
        public void Update(LiveSplitState state)
        {
            // Hopefully get our process from the memory, as well as initialize our MemoryDefinition for reading
            if (gameProcess == null || gameProcess.HasExited || versionDefinition == null)
            {
                if (!this.TryGetGameProcess(state))
                {
                    return;
                }
            }

            // No need to evaluate anything if not running
            if (state.CurrentPhase != TimerPhase.Running)
            {
                return;
            }

            versionDefinition.UpdateAll(gameProcess);

            if ((versionDefinition.isLoadingState?.Changed ?? false) ||
                (versionDefinition.isMainMenuState?.Changed ?? false) ||
                (versionDefinition.levelSplitsState?.Changed ?? false) ||
                initalUpdate)
            {
                bool bPauseTimer = false;
                Debug.WriteLine("State changed...");

                if (versionDefinition.isLoadingState != null)
                {
                    bool pauses = versionDefinition.isLoadingInfo.ShouldPauseOnValue(versionDefinition.isLoadingState.Current);
                    bPauseTimer |= pauses;

                    int currentValue = versionDefinition.isLoadingState.Current;
                    int wantedValue  = versionDefinition.isLoadingInfo.value;
                    Debug.WriteLine(string.Format(
                                        "Loading: 0x{0:X} {1} 0x{2:X}, should{3} pause",
                                        currentValue,
                                        currentValue == wantedValue ? "==" : "!=",
                                        wantedValue,
                                        pauses ? "" : "n't"
                                        ));
                }

                if (versionDefinition.isMainMenuState != null)
                {
                    bool pauses = versionDefinition.isMainMenuInfo.ShouldPauseOnValue(versionDefinition.isMainMenuState.Current);
                    bPauseTimer |= pauses;

                    int currentValue = versionDefinition.isMainMenuState.Current;
                    int wantedValue  = versionDefinition.isMainMenuInfo.value;
                    Debug.WriteLine(string.Format(
                                        "Main Menu: 0x{0:X} {1} 0x{2:X}, should{3} pause",
                                        currentValue,
                                        currentValue == wantedValue ? "==" : "!=",
                                        wantedValue,
                                        pauses ? "" : "n't"
                                        ));
                }

                if (versionDefinition.levelSplitsState != null)
                {
                    int currentLevel = versionDefinition.levelSplitsState.Current;
                    // lastLevel will not update to the main menu, so this might be different
                    int oldLevel = versionDefinition.levelSplitsState.Old;
                    int mainMenu = versionDefinition.levelSplitsInfo.value;

                    if (initalUpdate)
                    {
                        lastLevel = currentLevel;
                    }
                    else if (currentLevel != 0 && currentLevel != oldLevel) // Filter out invalid pointers and unchanged values
                    {
                        // If you switched to the main menu, add a sq
                        if (currentLevel == mainMenu)
                        {
                            CounterHandler.Increment(state);
                        }
                        // If you switched to a different level than the stored last level, split
                        else if (currentLevel != lastLevel && settings.AllowLevelSplits)
                        {
                            Debug.WriteLine($"Level changed from 0x{lastLevel:X} to 0x{currentLevel:X}");
                            timerModel.Split();
                            lastLevel = currentLevel;
                        }
                    }
                }

                state.IsGameTimePaused = bPauseTimer;

                if (initalUpdate)
                {
                    if (bPauseTimer && !state.IsGameTimeInitialized)
                    {
                        state.SetGameTime(TimeSpan.Zero);
                    }
                    state.IsGameTimeInitialized = true;
                }
                initalUpdate = false;
            }
        }
コード例 #6
0
 void PrepareDraw(LiveSplitState state)
 {
     this.InternalComponent.NameLabel.ForeColor  = state.LayoutSettings.TextColor;
     this.InternalComponent.ValueLabel.ForeColor = state.LayoutSettings.TextColor;
     this.InternalComponent.NameLabel.HasShadow  = this.InternalComponent.ValueLabel.HasShadow = state.LayoutSettings.DropShadows;
 }
コード例 #7
0
 public IComponent Create(LiveSplitState state)
 {
     return(new OriComponent());
 }
コード例 #8
0
 public IComponent Create(LiveSplitState state) => new ManualGameTimeComponent(state);
コード例 #9
0
 public IComponent Create(LiveSplitState state) => new NotesComponent(this, state);
コード例 #10
0
 public TimeSpan?GetGameTime(LiveSplitState state)
 {
     return(null);
 }
コード例 #11
0
 public bool IsGameTimePaused(LiveSplitState state)
 {
     return(false);
 }
コード例 #12
0
 public IComponent Create(LiveSplitState state)
 {
     return(new SplitterComponent(state));
 }
コード例 #13
0
 public IComponent Create(LiveSplitState state) => new NotesViewer(state);
コード例 #14
0
 public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
 {
 }
コード例 #15
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, Region region)
 {
     this.PrepareDraw(state);
     this.InternalComponent.DrawVertical(g, state, width, region);
 }
コード例 #16
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, System.Drawing.Region clipRegion)
 {
     DrawBackground(g, state, HorizontalWidth, height);
     PrepareDraw(state, LayoutMode.Horizontal);
     InternalComponent.DrawHorizontal(g, state, height, clipRegion);
 }
コード例 #17
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region region)
 {
     this.PrepareDraw(state);
     this.InternalComponent.DrawHorizontal(g, state, height, region);
 }
コード例 #18
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, System.Drawing.Region clipRegion)
 {
     DrawBackground(g, state, width, VerticalHeight);
     PrepareDraw(state, LayoutMode.Vertical);
     InternalComponent.DrawVertical(g, state, width, clipRegion);
 }
コード例 #19
0
 public IComponent Create(LiveSplitState state)
 {
     return(new HaloSplitUIComponent(state));
 }
コード例 #20
0
 public IComponent Create(LiveSplitState state)
 {
     return(new EagleIslandComponent(state));
 }
コード例 #21
0
 public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
 {
     GetValues();
 }
コード例 #22
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
 {
     Draw(g, state, HorizontalWidth, height, clipRegion);
 }
コード例 #23
0
 public override void Update(IInvalidator i, LiveSplitState s, float w, float h, LayoutMode m)
 {
 }
コード例 #24
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
 {
     Draw(g, state, width, VerticalHeight, clipRegion);
 }
コード例 #25
0
 private void DrawBackground(Graphics g, LiveSplitState state, float width, float height)
 {
 }
コード例 #26
0
        private void DoSplit(object sender, EventArgs e)
        {
            LiveSplitState state = (LiveSplitState)sender;

            Do(state);
        }
コード例 #27
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, System.Drawing.Region clipRegion)
 {
 }
コード例 #28
0
        private void DoReset(object sender, TimerPhase value)
        {
            LiveSplitState state = (LiveSplitState)sender;

            CurrentNote = new Note("", ComponentName);
        }
コード例 #29
0
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            Memory.HookProcess();

            _autosplitter.Update();
        }
コード例 #30
0
 internal EHBComponent(LiveSplitState state) : base(new EHBSplitter(settings), state)
 {
 }