-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace drawables in public with interfaces * Add service for tracking access to markers * Add separate listener for placing markers
- Loading branch information
Showing
23 changed files
with
411 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
|
||
namespace Jailbreak.Public.Mod.Draw; | ||
|
||
public class DrawableFactory : IDrawableFactory | ||
{ | ||
public ILine LineFor(CCSPlayerController? player, Vector from, Vector to) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public IMarker MarkerFor(CCSPlayerController? player, Vector position, float radius) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
|
||
using Jailbreak.Public.Mod.Draw; | ||
|
||
using NodaTime; | ||
|
||
namespace Jailbreak.Drawable.Markers; | ||
|
||
public class CurrentMarkerState : IDisposable | ||
{ | ||
public bool HasMarker { get; set; } = false; | ||
|
||
public IMarker? CurrentMarker { get; set; } = null; | ||
|
||
/// <summary> | ||
/// The time that the marker was placed. | ||
/// Used for resize operations, to avoid making every operation a resize. | ||
/// </summary> | ||
public Instant? PlacedOn { get; set; } = null; | ||
|
||
/// <summary> | ||
/// The position of the last ping, for resize purposes. | ||
/// </summary> | ||
public Vector? PlacedAt { get; set; } = null; | ||
|
||
/// <summary> | ||
/// Invoked when the player dies or leaves. | ||
/// </summary> | ||
public void Dispose() | ||
{ | ||
if (CurrentMarker != null) | ||
{ | ||
CurrentMarker.Remove(); | ||
CurrentMarker.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using CounterStrikeSharp.API.Core; | ||
|
||
using Jailbreak.Public.Behaviors; | ||
using Jailbreak.Public.Generic; | ||
using Jailbreak.Public.Mod.Draw; | ||
|
||
namespace Jailbreak.Drawable.Markers; | ||
|
||
public class MarkerBehavior : IPluginBehavior, IMarkerService | ||
{ | ||
private IPlayerState<MarkerState> _state; | ||
|
||
public MarkerBehavior(IPlayerStateFactory playerStateFactory) | ||
{ | ||
_state = playerStateFactory.Global<MarkerState>(); | ||
} | ||
|
||
public bool TryEnable(CCSPlayerController player) | ||
{ | ||
_state.Get(player) | ||
.Enabled = true; | ||
|
||
return true; | ||
} | ||
|
||
public bool TryDisable(CCSPlayerController player) | ||
{ | ||
_state.Get(player) | ||
.Enabled = false; | ||
|
||
return true; | ||
} | ||
|
||
public bool IsEnabled(CCSPlayerController player) | ||
{ | ||
return _state.Get(player) | ||
.Enabled; | ||
} | ||
} |
Oops, something went wrong.