Skip to content

Commit

Permalink
Reworked event structure to optimize performance.
Browse files Browse the repository at this point in the history
Incremented version from 0.7.0 to 0.7.1 for release.
  • Loading branch information
trippsc2 committed Apr 5, 2020
1 parent aa31ec9 commit 057f385
Show file tree
Hide file tree
Showing 15 changed files with 4,070 additions and 2,535 deletions.
204 changes: 125 additions & 79 deletions OpenTracker.Models/Boss.cs

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions OpenTracker.Models/BossDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace OpenTracker.Models
{
public class BossDictionary : Dictionary<BossType, Boss>, INotifyPropertyChanged
{
private readonly Game _game;

public event PropertyChangedEventHandler PropertyChanged;

private AccessibilityLevel _unknownBossAccessibility;
Expand All @@ -24,9 +22,8 @@ private set
}
}

public BossDictionary(Game game, int capacity) : base(capacity)
public BossDictionary(int capacity) : base(capacity)
{
_game = game;
}

private void OnPropertyChanged(string propertyName)
Expand Down
625 changes: 431 additions & 194 deletions OpenTracker.Models/BossSection.cs

Large diffs are not rendered by default.

1,424 changes: 787 additions & 637 deletions OpenTracker.Models/EntranceSection.cs

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions OpenTracker.Models/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Game()
EnemyShuffle = false
};

Bosses = new BossDictionary(this, Enum.GetValues(typeof(BossType)).Length);
Bosses = new BossDictionary(Enum.GetValues(typeof(BossType)).Length);
Items = new ItemDictionary(Mode, Enum.GetValues(typeof(ItemType)).Length);
Regions = new Dictionary<RegionID, Region>(Enum.GetValues(typeof(RegionID)).Length);
Locations = new LocationDictionary(Enum.GetValues(typeof(LocationID)).Length);
Expand All @@ -41,11 +41,13 @@ public Game()
Regions.Add(iD, new Region(this, iD));

foreach (Region region in Regions.Values)
region.SubscribeToRegions();
{
region.UpdateRegionSubscriptions();
region.UpdateAccessibility();
}

foreach (LocationID iD in Enum.GetValues(typeof(LocationID)))
Locations.Add(iD, new Location(this, iD));

}

public void Reset()
Expand Down
3,288 changes: 2,190 additions & 1,098 deletions OpenTracker.Models/ItemSection.cs

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions OpenTracker.Models/Location.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public Location(Game game, LocationID iD)
int itemSections = 0;
bool entranceSection = false;

List<Item> itemRequirements = new List<Item>();

switch (iD)
{
case LocationID.Pedestal:
Expand Down
1 change: 0 additions & 1 deletion OpenTracker.Models/MapLocation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using OpenTracker.Models.Enums;
using System.ComponentModel;

namespace OpenTracker.Models
{
Expand Down
3 changes: 3 additions & 0 deletions OpenTracker.Models/Mode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));

if (propertyName == nameof(WorldState) && WorldState == Enums.WorldState.Inverted)
ItemPlacement = Enums.ItemPlacement.Advanced;
}

public bool Validate(Mode gameMode)
Expand Down
1 change: 1 addition & 0 deletions OpenTracker.Models/OpenTracker.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>0.7.1</Version>
</PropertyGroup>

</Project>
1,024 changes: 517 additions & 507 deletions OpenTracker.Models/Region.cs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions OpenTracker.Setup/OpenTracker.Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:OpenTracker"
"ProductCode" = "8:{8560B543-CDC5-4378-A016-E7442882BFE7}"
"PackageCode" = "8:{6477EB62-4D47-47D0-A7B6-FC12ED9C33DB}"
"ProductCode" = "8:{2D8F6709-1B8C-40AC-8BF6-F5138CFB5B7B}"
"PackageCode" = "8:{4B1C3BF1-9E05-452F-9432-946482E80785}"
"UpgradeCode" = "8:{C98C2121-B4C5-473A-9B86-5407FEFFE8F1}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:0.7.0"
"ProductVersion" = "8:0.7.1"
"Manufacturer" = "8:OpenTracker"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down Expand Up @@ -824,7 +824,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_8BEB0D6860DB4F80B56A45FAD1BDE151"
{
"SourcePath" = "8:..\\OpenTracker\\obj\\Debug\\netcoreapp3.1\\OpenTracker.exe"
"SourcePath" = "8:..\\OpenTracker\\obj\\Release\\netcoreapp3.1\\OpenTracker.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D"
Expand Down
6 changes: 3 additions & 3 deletions OpenTracker/OpenTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<ApplicationIcon>triforce.ico</ApplicationIcon>
<Win32Resource />
<Version>0.7.0</Version>
<Version>0.7.1</Version>
<Authors>Tripp</Authors>
<AssemblyVersion>0.7.0.0</AssemblyVersion>
<FileVersion>0.7.0.0</FileVersion>
<AssemblyVersion>0.7.1.0</AssemblyVersion>
<FileVersion>0.7.1.0</FileVersion>
<RuntimeIdentifiers>osx-x64;linux-x64;debian-x64;rhel-x64;win-x64;win-x86;win7-x64;win7-x86</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion OpenTracker/ViewModels/MainWindowVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public MainWindowVM()
UndoCommand = ReactiveCommand.Create(Undo, this.WhenAnyValue(x => x.CanUndo));
RedoCommand = ReactiveCommand.Create(Redo, this.WhenAnyValue(x => x.CanRedo));
ToggleDisplayAllLocationsCommand = ReactiveCommand.Create(ToggleDisplayAllLocations);
ItemPlacementCommand = ReactiveCommand.Create<string>(SetItemPlacement);
ItemPlacementCommand = ReactiveCommand.Create<string>(SetItemPlacement, this.WhenAnyValue(x => x.WorldStateStandardOpen));
DungeonItemShuffleCommand = ReactiveCommand.Create<string>(SetDungeonItemShuffle);
WorldStateCommand = ReactiveCommand.Create<string>(SetWorldState);
EntranceShuffleCommand = ReactiveCommand.Create(ToggleEntranceShuffle);
Expand Down
4 changes: 2 additions & 2 deletions OpenTracker/ViewModels/MapLocationControlVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public MapLocationControlVM(UndoRedoManager undoRedoManager, AppSettingsVM appSe
appSettings.PropertyChanged += OnAppSettingsChanged;
game.Mode.PropertyChanged += OnModeChanged;

mapLocation.Location.RequirementChanged += OnItemRequirementChanged;
mapLocation.Location.RequirementChanged += OnRequirementChanged;

foreach (ISection section in mapLocation.Location.Sections)
section.PropertyChanged += OnSectionChanged;
Expand Down Expand Up @@ -342,7 +342,7 @@ private void OnModeChanged(object sender, PropertyChangedEventArgs e)
SetVisibility();
}

private void OnItemRequirementChanged(object sender, EventArgs e)
private void OnRequirementChanged(object sender, EventArgs e)
{
SetColor();
SetVisibility();
Expand Down

0 comments on commit 057f385

Please sign in to comment.