-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElMatadorComponent.cs
98 lines (78 loc) · 2.69 KB
/
ElMatadorComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using LiveSplit.Model;
using LiveSplit.TimeFormatters;
using LiveSplit.UI.Components;
using LiveSplit.UI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml;
using System.Windows.Forms;
using System.Diagnostics;
namespace LiveSplit.ElMatador
{
class ElMatadorComponent : LogicComponent
{
public override string ComponentName
{
get { return "El Matador"; }
}
public ElMatadorSettings Settings { get; set; }
public bool Disposed { get; private set; }
public bool IsLayoutComponent { get; private set; }
private TimerModel _timer;
private GameMemory _gameMemory;
private LiveSplitState _state;
public ElMatadorComponent(LiveSplitState state, bool isLayoutComponent)
{
_state = state;
this.IsLayoutComponent = isLayoutComponent;
this.Settings = new ElMatadorSettings();
_timer = new TimerModel { CurrentState = state };
_timer.CurrentState.OnStart += timer_OnStart;
_gameMemory = new GameMemory(this.Settings);
_gameMemory.OnLoadStarted += gameMemory_OnLoadStarted;
_gameMemory.OnLoadFinished += gameMemory_OnLoadFinished;
state.OnStart += State_OnStart;
_gameMemory.StartMonitoring();
}
public override void Dispose()
{
this.Disposed = true;
_state.OnStart -= State_OnStart;
_timer.CurrentState.OnStart -= timer_OnStart;
if (_gameMemory != null)
{
_gameMemory.Stop();
}
}
void State_OnStart(object sender, EventArgs e)
{
}
void timer_OnStart(object sender, EventArgs e)
{
_timer.InitializeGameTime();
}
void gameMemory_OnLoadStarted(object sender, EventArgs e)
{
_state.IsGameTimePaused = true;
}
void gameMemory_OnLoadFinished(object sender, EventArgs e)
{
_state.IsGameTimePaused = false;
}
public override XmlNode GetSettings(XmlDocument document)
{
return this.Settings.GetSettings(document);
}
public override Control GetSettingsControl(LayoutMode mode)
{
return this.Settings;
}
public override void SetSettings(XmlNode settings)
{
this.Settings.SetSettings(settings);
}
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { }
//public override void RenameComparison(string oldName, string newName) { }
}
}