本文整理汇总了C#中LiveSplit.Model.LiveSplitState类的典型用法代码示例。如果您正苦于以下问题:C# LiveSplitState类的具体用法?C# LiveSplitState怎么用?C# LiveSplitState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LiveSplitState类属于LiveSplit.Model命名空间,在下文中一共展示了LiveSplitState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawVertical
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
{
using (var solidBrush = new SolidBrush(LineColor))
{
g.FillRectangle(solidBrush, 0.0f, 0.0f, width, VerticalHeight);
}
}
示例2: GetSegmentTimeOrSegmentDelta
private static TimeSpan? GetSegmentTimeOrSegmentDelta(LiveSplitState state, int splitNumber, bool useCurrentTime, bool segmentTime, string comparison, TimingMethod method)
{
TimeSpan? currentTime;
if (useCurrentTime)
currentTime = state.CurrentTime[method];
else
currentTime = state.Run[splitNumber].SplitTime[method];
if (currentTime == null)
return null;
for (int x = splitNumber - 1; x >= 0; x--)
{
var splitTime = state.Run[x].SplitTime[method];
if (splitTime != null)
{
if (segmentTime)
return currentTime - splitTime;
else if (state.Run[x].Comparisons[comparison][method] != null)
return (currentTime - state.Run[splitNumber].Comparisons[comparison][method]) - (splitTime - state.Run[x].Comparisons[comparison][method]);
}
}
if (segmentTime)
return currentTime;
else
return currentTime - state.Run[splitNumber].Comparisons[comparison][method];
}
示例3: DrawHorizontal
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
{
using (var solidBrush = new SolidBrush(LineColor))
{
g.FillRectangle(solidBrush, 0.0f, 0.0f, HorizontalWidth, height);
}
}
示例4: Activate
public void Activate(LiveSplitState state)
{
if (!IsActivated)
{
try
{
if (!IsDownloaded || Type == AutoSplitterType.Script)
DownloadFiles();
if (Type == AutoSplitterType.Component)
{
Factory = ComponentManager.ComponentFactories[FileName];
Component = Factory.Create(state);
}
else
{
Factory = ComponentManager.ComponentFactories["LiveSplit.ScriptableAutoSplit.dll"];
Component = ((dynamic)Factory).Create(state, LocalPath);
}
}
catch (Exception ex)
{
Log.Error(ex);
MessageBox.Show(state.Form, "The Auto Splitter could not be activated. (" + ex.Message + ")", "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
示例5: Update
public override void Update(IInvalidator invalidator, 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);
}
}
示例6: Create
public IComponent Create(LiveSplitState state)
{
// workaround for livesplit 1.4 oversight where components can be loaded from two places at once
// remove all this junk when they fix it
string caller = new StackFrame(1).GetMethod().Name;
string callercaller = new StackFrame(2).GetMethod().Name;
bool createAsLayoutComponent = (caller == "LoadLayoutComponent" || caller == "AddComponent");
// if component is already loaded somewhere else
if (_instance != null && !_instance.Disposed)
{
// "autosplit components" can't throw exceptions for some reason, so return a dummy component
if (callercaller == "CreateAutoSplitter")
{
return new DummyComponent();
}
MessageBox.Show(
"LiveSplit.RedFaction is already loaded in the " +
(_instance.IsLayoutComponent ? "Layout Editor" : "Splits Editor") + "!",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
throw new Exception("Component already loaded.");
}
return (_instance = new RedFactionComponent(state, createAsLayoutComponent));
}
示例7: RunHighlighterComponent
public RunHighlighterComponent(LiveSplitState state)
{
this._state = state;
this.Settings = new RunHighlighterSettings();
this.ContextMenuControls = new Dictionary<string, Action>();
this.ContextMenuControls.Add("Run Highlighter...", new Action(() =>
{
MessageBox.Show(_state.Form, "This component is now obsolete and has been replaced by this website:\nhttps://dalet.github.io/run-highlighter/"
+ "\n\nThe website has new features such as individual segment highlighting and multi-part detection."
+ "\n\nThe URL will be opened after you close this message.", "Run Highlighter",
MessageBoxButtons.OK, MessageBoxIcon.Information);
System.Diagnostics.Process.Start("https://dalet.github.io/run-highlighter/");
/*if (_state.CurrentPhase == TimerPhase.Ended)
{
MessageBox.Show(_state.Form, "The timer needs to be resetted in order to update the Attempt History.", "Run Highlighter");
return;
}
var originalTopMost = _state.Form.TopMost;
_state.Form.TopMost = false; //to ensure our Internet Explorer window isn't covered
using (var form = new RunHighlighterForm(state.Run, Settings))
form.ShowDialog(state.Form);
_state.Form.TopMost = originalTopMost;*/
}));
}
示例8: PrepareDraw
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;
}
示例9: DrawHorizontal
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
{
var component = queuedComponents.FirstOrDefault();
if (component != null)
{
component.DrawHorizontal(g, state, height, clipRegion);
}
}
示例10: ManualGameTimeComponent
public ManualGameTimeComponent(LiveSplitState state)
{
Settings = new ManualGameTimeSettings();
GameTimeForm = new ShitSplitter(state, Settings);
state.OnStart += state_OnStart;
state.OnReset += state_OnReset;
CurrentState = state;
}
示例11: Component
public Component(LiveSplitState state)
{
model = new TimerModel() { CurrentState = state };
model.CurrentState.OnStart += State_OnStart;
eventList = settings.GetEventList();
settings.EventsChanged += settings_EventsChanged;
}
示例12: DrawVertical
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
{
var component = queuedComponents.FirstOrDefault();
if (component != null)
{
component.DrawVertical(g, state, width, clipRegion);
}
}
示例13: Component
public Component(LiveSplitState state, string scriptPath)
: this(state)
{
Settings = new ComponentSettings()
{
ScriptPath = scriptPath
};
}
示例14: TextComponent
public TextComponent(LiveSplitState state)
{
Settings = new TextComponentSettings()
{
CurrentState = state
};
InternalComponent = new TextTextComponent(Settings);
}
示例15: PrepareDraw
private void PrepareDraw(LiveSplitState state)
{
InternalComponent.DisplayTwoRows = Settings.Display2Rows;
InternalComponent.NameLabel.HasShadow
= InternalComponent.ValueLabel.HasShadow
= state.LayoutSettings.DropShadows;
InternalComponent.NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor;
}