Skip to content

Commit

Permalink
Update Commons, add Comparers, version 0.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Anatoly Brizhan committed May 26, 2024
1 parent 5d96c71 commit 7c56294
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"versionDefines": [
{
"name": "com.tdw.better.services",
"expression": "0.1.0",
"expression": "0.1.1",
"define": "BETTER_SERVICES"
}
],
Expand Down
15 changes: 10 additions & 5 deletions Assets/BetterLocators/Runtime/Implementations/Locator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Better.Commons.Runtime.Extensions;
using Better.Commons.Runtime.Utility;

namespace Better.Locators.Runtime
Expand All @@ -15,9 +16,13 @@ public class Locator<TKey, TElement> : ILocator<TKey, TElement>

public int Count => _sourceMap.Count;

public Locator()
public Locator(IEqualityComparer<TKey> comparer)
{
_sourceMap = new(comparer);
}

public Locator() : this(EqualityComparer<TKey>.Default)
{
_sourceMap = new();
}

public delegate void OnElementChanged(TKey key, TElement element);
Expand Down Expand Up @@ -114,13 +119,13 @@ public bool Remove(TElement element)
return false;
}

var removed = true; TKey key = default; //_sourceMap.Remove(element, out var key); TODO: Commons DictionaryExtensions dependency
if (removed)
if (_sourceMap.Remove(element, out var key))
{
OnRemoved(key, element);
return true;
}

return removed;
return false;
}

protected virtual void OnRemoved(TKey key, TElement element)
Expand Down
4 changes: 2 additions & 2 deletions Assets/BetterLocators/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "com.tdw.better.locators",
"displayName": "Better Locators",
"version": "0.1.8",
"version": "0.1.9",
"unity": "2021.3",
"description": " ",
"dependencies": {
"com.tdw.better.internal.core": "0.0.2",
"com.tdw.better.commons": "0.0.4",
"com.tdw.better.commons": "0.0.7",
"com.uurha.betterattributes": "3.1.3"
},
"author": {
Expand Down
3 changes: 2 additions & 1 deletion Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"dependencies": {
"com.tdw.better.commons": "0.0.7",
"com.tdw.better.internal.core": "0.0.2",
"com.tdw.better.services": "0.1.0",
"com.tdw.better.services": "0.1.1",
"com.unity.collab-proxy": "2.0.1",
"com.unity.feature.development": "1.0.1",
"com.unity.ide.rider": "3.0.18",
Expand Down
6 changes: 3 additions & 3 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dependencies": {
"com.tdw.better.commons": {
"version": "0.0.4",
"depth": 1,
"version": "0.0.7",
"depth": 0,
"source": "registry",
"dependencies": {
"com.tdw.better.internal.core": "0.0.2"
Expand All @@ -17,7 +17,7 @@
"url": "https://package.openupm.com"
},
"com.tdw.better.services": {
"version": "0.1.0",
"version": "0.1.1",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down

0 comments on commit 7c56294

Please sign in to comment.