Skip to content

Commit

Permalink
Resolve code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpup committed Jan 18, 2024
1 parent e2aeb23 commit d160773
Show file tree
Hide file tree
Showing 46 changed files with 486 additions and 451 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static void OnTeamScoreChanged(TeamScoreChanged game_event)

private static void OnPauseStateChanged(PauseStateChanged game_event)
{
Console.WriteLine($"New pause state is {game_event.New}");
Console.WriteLine($"New pause state is {(game_event.New ? "paused" : "not paused")}");
}

private static void OnPlayerGameplayEvent(PlayerGameplayEvent game_event)
Expand Down
30 changes: 25 additions & 5 deletions Dota2GSI/Dota2EventsInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public class Dota2EventsInterface : EventsInterface<DotaGameEvent>

#endregion

#region EventsEvents
#region GameplayEvents

public delegate void EventsUpdatedHandler(EventsUpdated game_event);

Expand Down Expand Up @@ -361,11 +361,21 @@ public class Dota2EventsInterface : EventsInterface<DotaGameEvent>
/// <inheritdoc cref="Dota2GSI.EventMessages.MinimapUpdated" />
public event MinimapUpdatedHandler MinimapUpdated = delegate { };

public delegate void MinimapElementAddedHandler(MinimapElementAdded game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.MinimapElementAdded" />
public event MinimapElementAddedHandler MinimapElementAdded = delegate { };

public delegate void MinimapElementUpdatedHandler(MinimapElementUpdated game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.MinimapElementUpdated" />
public event MinimapElementUpdatedHandler MinimapElementUpdated = delegate { };

public delegate void MinimapElementRemovedHandler(MinimapElementRemoved game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.MinimapElementRemoved" />
public event MinimapElementRemovedHandler MinimapElementRemoved = delegate { };

public delegate void TeamMinimapElementUpdatedHandler(TeamMinimapElementUpdated game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.TeamMinimapElementUpdated" />
Expand All @@ -382,7 +392,7 @@ public class Dota2EventsInterface : EventsInterface<DotaGameEvent>

public delegate void TeamNeutralItemsUpdatedHandler(TeamNeutralItemsUpdated game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.NeutralItemsUpdated" />
/// <inheritdoc cref="Dota2GSI.EventMessages.TeamNeutralItemsUpdated" />
public event TeamNeutralItemsUpdatedHandler TeamNeutralItemsUpdated = delegate { };

#endregion
Expand Down Expand Up @@ -421,17 +431,17 @@ public class Dota2EventsInterface : EventsInterface<DotaGameEvent>

public delegate void PlayerDeniesChangedHandler(PlayerDeniesChanged game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.PlayerLastHitsChanged" />
/// <inheritdoc cref="Dota2GSI.EventMessages.PlayerDeniesChanged" />
public event PlayerDeniesChangedHandler PlayerDeniesChanged = delegate { };

public delegate void PlayerKillStreakChangedHandler(PlayerKillStreakChanged game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.PlayerLastHitsChanged" />
/// <inheritdoc cref="Dota2GSI.EventMessages.PlayerKillStreakChanged" />
public event PlayerKillStreakChangedHandler PlayerKillStreakChanged = delegate { };

public delegate void PlayerGoldChangedHandler(PlayerGoldChanged game_event);

/// <inheritdoc cref="Dota2GSI.EventMessages.PlayerLastHitsChanged" />
/// <inheritdoc cref="Dota2GSI.EventMessages.PlayerGoldChanged" />
public event PlayerGoldChangedHandler PlayerGoldChanged = delegate { };

public delegate void PlayerWardsPurchasedChangedHandler(PlayerWardsPurchasedChanged game_event);
Expand Down Expand Up @@ -816,11 +826,21 @@ public override void OnNewGameEvent(DotaGameEvent e)
RaiseEvent(MinimapUpdated, e);
}

if (e is MinimapElementAdded)
{
RaiseEvent(MinimapElementAdded, e);
}

if (e is MinimapElementUpdated)
{
RaiseEvent(MinimapElementUpdated, e);
}

if (e is MinimapElementRemoved)
{
RaiseEvent(MinimapElementRemoved, e);
}

if (e is TeamMinimapElementUpdated)
{
RaiseEvent(TeamMinimapElementUpdated, e);
Expand Down
2 changes: 0 additions & 2 deletions Dota2GSI/EventDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ private void RaiseOnGameEventHandler(T game_event)

public void RegisterPreProcessor<MessageType>(Func<T, T> callback) where MessageType : T
{

var event_type = typeof(MessageType);

lock (subscriptions_lock)
Expand All @@ -66,7 +65,6 @@ public void RegisterPreProcessor<MessageType>(Func<T, T> callback) where Message

public void UnregisterPreProcessor<MessageType>(Func<T, T> callback) where MessageType : T
{

var event_type = typeof(MessageType);

lock (subscriptions_lock)
Expand Down
8 changes: 4 additions & 4 deletions Dota2GSI/EventMessages/AbilitiesEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public AbilitiesUpdated(Abilities new_value, Abilities previous_value) : base(ne
}

/// <summary>
/// Event for specific Hero Ability Details change.
/// Event for specific player's Hero Ability Details change.
/// </summary>
public class AbilityDetailsChanged : PlayerUpdateEvent<AbilityDetails>
{
Expand All @@ -25,7 +25,7 @@ public AbilityDetailsChanged(AbilityDetails new_value, AbilityDetails previous_v
}

/// <summary>
/// Event for specific Hero Ability addition.
/// Event for specific player's Hero Ability addition.
/// </summary>
public class AbilityAdded : PlayerValueEvent<Ability>
{
Expand All @@ -35,7 +35,7 @@ public AbilityAdded(Ability value, FullPlayerDetails player) : base(value, playe
}

/// <summary>
/// Event for specific Hero Ability removal.
/// Event for specific player's Hero Ability removal.
/// </summary>
public class AbilityRemoved : PlayerValueEvent<Ability>
{
Expand All @@ -45,7 +45,7 @@ public AbilityRemoved(Ability value, FullPlayerDetails player) : base(value, pla
}

/// <summary>
/// Event for specific Hero Ability update.
/// Event for specific player's Hero Ability update.
/// </summary>
public class AbilityUpdated : PlayerUpdateEvent<Ability>
{
Expand Down
3 changes: 1 addition & 2 deletions Dota2GSI/EventMessages/BaseEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

namespace Dota2GSI.EventMessages
namespace Dota2GSI.EventMessages
{
public interface BaseEvent
{
Expand Down
18 changes: 9 additions & 9 deletions Dota2GSI/EventMessages/BuildingsEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public BuildingsUpdated(Buildings new_value, Buildings previous_value) : base(ne
}

/// <summary>
/// Event for specific team Building Layout update.
/// Event for specific team's Building Layout update.
/// </summary>
public class BuildingsLayoutUpdated : TeamUpdateEvent<BuildingLayout>
{
Expand Down Expand Up @@ -65,7 +65,7 @@ public BuildingUpdated(Building new_value, Building previous_value, string entit
}

/// <summary>
/// Event for specific team Building update.
/// Event for specific team's Building update.
/// </summary>
public class TeamBuildingUpdated : BuildingUpdated
{
Expand All @@ -84,7 +84,7 @@ public TeamBuildingUpdated(Building new_value, Building previous_value, string e
}

/// <summary>
/// Event for specific team Building destruction.
/// Event for specific team's Building destruction.
/// </summary>
public class TeamBuildingDestroyed : TeamBuildingUpdated
{
Expand All @@ -94,7 +94,7 @@ public TeamBuildingDestroyed(Building new_value, Building previous_value, string
}

/// <summary>
/// Event for specific team Tower update.
/// Event for specific team's Tower update.
/// </summary>
public class TowerUpdated : TeamBuildingUpdated
{
Expand All @@ -104,7 +104,7 @@ public TowerUpdated(Building new_value, Building previous_value, string entity_i
}

/// <summary>
/// Event for specific team Tower destruction.
/// Event for specific team's Tower destruction.
/// </summary>
public class TowerDestroyed : TeamBuildingDestroyed
{
Expand All @@ -114,7 +114,7 @@ public TowerDestroyed(Building new_value, Building previous_value, string entity
}

/// <summary>
/// Event for specific team Racks update.
/// Event for specific team's Racks update.
/// </summary>
public class RacksUpdated : TeamBuildingUpdated
{
Expand All @@ -130,7 +130,7 @@ public RacksUpdated(Building new_value, Building previous_value, RacksType racks
}

/// <summary>
/// Event for specific team Racks destruction.
/// Event for specific team's Racks destruction.
/// </summary>
public class RacksDestroyed : TeamBuildingDestroyed
{
Expand All @@ -146,7 +146,7 @@ public RacksDestroyed(Building new_value, Building previous_value, RacksType rac
}

/// <summary>
/// Event for specific team Ancient update.
/// Event for specific team's Ancient update.
/// </summary>
public class AncientUpdated : TeamBuildingUpdated
{
Expand All @@ -156,7 +156,7 @@ public AncientUpdated(Building new_value, Building previous_value, string entity
}

/// <summary>
/// Event for specific team Ancient destruction.
/// Event for specific team's Ancient destruction.
/// </summary>
public class AncientDestroyed : TeamBuildingDestroyed
{
Expand Down
1 change: 0 additions & 1 deletion Dota2GSI/EventMessages/CouriersEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public TeamCourierUpdated(Courier new_value, Courier previous_value, PlayerTeam
}
}


/// <summary>
/// Event for specific player's courier gaining an item in their inventory.
/// </summary>
Expand Down
3 changes: 1 addition & 2 deletions Dota2GSI/EventMessages/DotaGameEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

namespace Dota2GSI.EventMessages
namespace Dota2GSI.EventMessages
{
public class DotaGameEvent : BaseEvent
{
Expand Down
2 changes: 1 addition & 1 deletion Dota2GSI/EventMessages/DraftEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public DraftUpdated(Draft new_value, Draft previous_value) : base(new_value, pre
}

/// <summary>
/// Event for specific team Draft Details update.
/// Event for specific team's Draft Details update.
/// </summary>
public class TeamDraftDetailsUpdated : TeamUpdateEvent<DraftDetails>
{
Expand Down
4 changes: 2 additions & 2 deletions Dota2GSI/EventMessages/GameplayEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public GameplayEvent(Event value) : base(value)
}

/// <summary>
/// Event for specific team Gameplay Event.
/// Event for specific team's Gameplay Event.
/// </summary>
public class TeamGameplayEvent : TeamValueEvent<Event>
{
Expand All @@ -35,7 +35,7 @@ public TeamGameplayEvent(Event value, PlayerTeam team) : base(value, team)
}

/// <summary>
/// Event for specific player Event.
/// Event for specific player's Event.
/// </summary>
public class PlayerGameplayEvent : PlayerValueEvent<Event>
{
Expand Down
2 changes: 1 addition & 1 deletion Dota2GSI/EventMessages/HeroEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public HeroMuteStateChanged(bool new_value, bool previous_value, FullPlayerDetai
}

/// <summary>
/// Event for specific player's Hero selection.
/// Event for specific player's Hero selection update.
/// </summary>
public class HeroSelectedChanged : PlayerUpdateEvent<bool>
{
Expand Down
4 changes: 2 additions & 2 deletions Dota2GSI/EventMessages/MapEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public GameResumed() : base()
}

/// <summary>
/// Event for specific team Victory.
/// Event for specific team's Victory.
/// </summary>
public class TeamVictory : DotaGameEvent
{
Expand All @@ -101,7 +101,7 @@ public TeamVictory(PlayerTeam team) : base()
}

/// <summary>
/// Event for specific team Defeat.
/// Event for specific team's Defeat.
/// </summary>
public class TeamDefeat : DotaGameEvent
{
Expand Down
20 changes: 20 additions & 0 deletions Dota2GSI/EventMessages/MinimapEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ public MinimapUpdated(Minimap new_value, Minimap previous_value) : base(new_valu
}
}

/// <summary>
/// Event for a Minimap Element addition.
/// </summary>
public class MinimapElementAdded : EntityValueEvent<MinimapElement>
{
public MinimapElementAdded(MinimapElement value, string entity_id) : base(value, entity_id)
{
}
}

/// <summary>
/// Event for a Minimap Element update.
/// </summary>
Expand All @@ -23,6 +33,16 @@ public MinimapElementUpdated(MinimapElement new_value, MinimapElement previous_v
}
}

/// <summary>
/// Event for a Minimap Element removal.
/// </summary>
public class MinimapElementRemoved : EntityValueEvent<MinimapElement>
{
public MinimapElementRemoved(MinimapElement value, string entity_id) : base(value, entity_id)
{
}
}

/// <summary>
/// Event for specific team's Minimap Element update.
/// </summary>
Expand Down
Loading

0 comments on commit d160773

Please sign in to comment.