QueryWith and QueryWithout implicitly Read
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

pull/8/head
Evan Hemsley 2020-07-12 15:15:33 -07:00
parent e76161c8af
commit 36e60be5f6
7 changed files with 11 additions and 14 deletions

View File

@ -1,7 +1,6 @@
using Encompass.Exceptions; using Encompass.Exceptions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Encompass namespace Encompass
{ {

View File

@ -1,7 +1,5 @@
using Encompass.Exceptions; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Encompass namespace Encompass
{ {

View File

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Encompass.Exceptions;
namespace Encompass namespace Encompass
{ {

View File

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Encompass.Exceptions;
namespace Encompass namespace Encompass
{ {

View File

@ -108,11 +108,21 @@ namespace Encompass
QueryWithTypes = queryWithAttribute.QueryWithTypes; QueryWithTypes = queryWithAttribute.QueryWithTypes;
} }
foreach (var queryType in QueryWithTypes)
{
ReadTypes.Add(queryType);
}
var queryWithoutAttribute = GetType().GetCustomAttribute<QueryWithout>(false); var queryWithoutAttribute = GetType().GetCustomAttribute<QueryWithout>(false);
if (queryWithoutAttribute != null) if (queryWithoutAttribute != null)
{ {
QueryWithoutTypes = queryWithoutAttribute.QueryWithoutTypes; QueryWithoutTypes = queryWithoutAttribute.QueryWithoutTypes;
} }
foreach (var queryType in QueryWithoutTypes)
{
ReadTypes.Add(queryType);
}
} }
public override bool Equals(object obj) public override bool Equals(object obj)

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
namespace Encompass namespace Encompass
{ {

View File

@ -1411,7 +1411,6 @@ namespace Tests
struct MockComponentC : IComponent { } struct MockComponentC : IComponent { }
struct MockComponentD : IComponent { } struct MockComponentD : IComponent { }
[Reads(typeof(MockComponent), typeof(MockComponentB))]
[Writes(typeof(MockComponentB))] [Writes(typeof(MockComponentB))]
[QueryWith(typeof(MockComponent), typeof(MockComponentB))] [QueryWith(typeof(MockComponent), typeof(MockComponentB))]
class EntityQueryWithComponentsEngine : Engine class EntityQueryWithComponentsEngine : Engine
@ -1465,7 +1464,6 @@ namespace Tests
queriedEntities.Should().BeEmpty(); queriedEntities.Should().BeEmpty();
} }
[Reads(typeof(MockComponent))]
[Writes(typeof(MockComponent))] [Writes(typeof(MockComponent))]
[QueryWithout(typeof(MockComponent))] [QueryWithout(typeof(MockComponent))]
class EntityQueryWithoutComponentsEngine : Engine class EntityQueryWithoutComponentsEngine : Engine
@ -1519,7 +1517,6 @@ namespace Tests
queriedEntities.Should().BeEmpty(); queriedEntities.Should().BeEmpty();
} }
[Reads(typeof(MockComponent), typeof(MockComponentB), typeof(MockComponentD))]
[QueryWith(typeof(MockComponent), typeof(MockComponentB))] [QueryWith(typeof(MockComponent), typeof(MockComponentB))]
[QueryWithout(typeof(MockComponentD))] [QueryWithout(typeof(MockComponentD))]
class EntityQueryWithandWithoutComponentsEngine : Engine class EntityQueryWithandWithoutComponentsEngine : Engine
@ -1745,7 +1742,6 @@ namespace Tests
} }
[ReadsImmediate(typeof(MockComponentB))] [ReadsImmediate(typeof(MockComponentB))]
[Reads(typeof(MockComponent))]
[QueryWith(typeof(MockComponent), typeof(MockComponentB))] [QueryWith(typeof(MockComponent), typeof(MockComponentB))]
class EntityQueryWithImmediateAndNonImmediateComponents : Engine class EntityQueryWithImmediateAndNonImmediateComponents : Engine
{ {