目录

QueryFilter

Class/Struct Info

public class QueryFilter

查询的条件过滤器,查询设置的组件和标签条件都会存储在过滤器中。

Constructor Summary

Constructor Name And Description

QueryFilter()

创建默认QueryFilter。

Property Summary

Name

Type

Description

WithAllTagsCondition

ITags

标签的WithAll条件。

WithAnyTagsCondition

ITags

标签的WithAny条件。

WithoutAllTagsCondition

ITags

标签的WithoutAll条件。

WithoutAnyTagsCondition

ITags

标签的WithoutAny条件。

WithAllComponentsCondition

IComponents

组件的WithAll条件。

WithAnyComponentsCondition

IComponents

组件的WithAny条件。

WithoutAllComponentsCondition

IComponents

组件的WithoutAll条件。

WithoutAnyComponentsCondition

IComponents

组件的WithoutAny条件。

WithAllSharedComponentsCondition

IComponents

共享组件的WithAll条件。

WithAnySharedComponentsCondition

IComponents

共享组件的WithAny条件。

WithoutAllSharedComponentsCondition

IComponents

共享组件的WithoutAll条件。

WithoutAnySharedComponentsCondition

IComponents

共享组件的WithoutAny条件。

Method Summary

Qualifier and Type

Method Name and Description

QueryFilter

FreezeFilter()

冻结查询过滤器,冻结后禁止修改查询过滤条件。

QueryFilter

WithAllTags(in ITags iTags)

设置WithAll标签条件。

QueryFilter

WithAnyTags(in ITags iTags)

设置WithAny标签条件。

QueryFilter

WithoutAllTags(in ITags iTags)

设置WithoutAll标签条件。

QueryFilter

WithoutAnyTags(in ITags iTags)

设置WithoutAny标签条件。

QueryFilter

WithInactive()

设置查询包含非活跃标签实体的条件。

QueryFilter

WithAllComponents(in IComponents helper)

设置WithoutAll组件条件。

QueryFilter

WithAnyComponents(in IComponents helper)

设置WithoutAny组件条件。

QueryFilter

WithoutAllComponents(in IComponents helper)

设置WithoutAll组件条件。

QueryFilter

WithoutAnyComponents(in IComponents helper)

设置WithoutAny组件条件。

QueryFilter

HasValue<TComponent, TValue>(TValue value)

设置值查询Lookup组件条件。

QueryFilter

ValueInRange<TComponent, TValue>(TValue min, TValue max)

设置值范围查询Lookup组件条件。

QueryFilter

WithAllSharedComponents(in IComponents sharedComponents)

设置WithAll共享组件条件。

QueryFilter

WithAnySharedComponents(in IComponents sharedComponents)

设置WithAny共享组件条件。

QueryFilter

WithoutAllSharedComponents(in IComponents sharedComponents)

设置WithoutAll共享组件条件。

QueryFilter

WithoutAnySharedComponents(in IComponents sharedComponents)

设置WithoutAny共享组件条件。

Constructors

[h2]QueryFilter

Constructor Name And Description

void QueryFilter()

创建默认QueryFilter。

Sample Code

// 创建查询过滤器
var filter = new QueryFilter();

Methods

[h2]FreezeFilter

Method

QueryFilter FreezeFilter()

冻结查询过滤器,冻结后禁止修改查询过滤条件。

Return

Type

Description

QueryFilter

返回冻结的查询过滤器。

Sample Code

// 创建并冻结查询过滤器,冻结后不能再修改过滤条件
var filter = new QueryFilter().FreezeFilter();

[h2]WithAllTags

Method

QueryFilter WithAllTags(in ITags iTags)

设置WithAll标签条件。

Parameters

Name

Type

Description

iTags

ITags

标签类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置标签过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithAllTags(ITags.Get<TestTag1>());
// 通过WithAllTagsCondition可以查看过滤器设置的对应条件
filter.WithAllTagsCondition; // 等于ITags.Get<TestTag1>()

[h2]WithAnyTags

Method

QueryFilter WithAnyTags(in ITags iTags)

设置WithAny标签条件。

Parameters

Name

Type

Description

iTags

ITags

标签类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置标签过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithAnyTags(ITags.Get<TestTag1>());
// 通过WithAnyTagsCondition可以查看过滤器设置的对应条件
filter.WithAnyTagsCondition; // 等于ITags.Get<TestTag1>()

[h2]WithoutAllTags

Method

QueryFilter WithoutAllTags(in ITags iTags)

设置WithoutAll标签条件。

Parameters

Name

Type

Description

iTags

ITags

标签类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置标签过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithoutAllTags(ITags.Get<TestTag1>());
// 通过WithoutAllTagsCondition可以查看过滤器设置的对应条件
filter.WithoutAllTagsCondition; // 等于ITags.Get<TestTag1>()

[h2]WithoutAnyTags

Method

QueryFilter WithoutAnyTags(in ITags iTags)

设置WithoutAny标签条件。

Parameters

Name

Type

Description

iTags

ITags

标签类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置标签过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithoutAnyTags(ITags.Get<TestTag1>());
// WithoutAnyTagsCondition会默认添加Inactive条件,保证查询过滤器默认过滤被禁用实体
filter.WithoutAnyTagsCondition; // 等于ITags.Get<TestTag1, Inactive>()

[h2]WithInactive

Method

QueryFilter WithInactive()

设置查询包含非活跃标签实体的条件。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置查询被禁用实体条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithInactive();
// 移除WithoutAnyTagsCondition默认添加的Inactive条件
AreEqual(default, filter.WithoutAnyTagsCondition);

[h2]WithAllComponents

Method

QueryFilter WithAllComponents(in IComponents helper)

设置WithAll组件条件。

Parameters

Name

Type

Description

helper

IComponents

组件类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithAllComponents(IComponents.Get<PgdPosition>());
// 通过WithAllComponentsCondition可以查看过滤器设置的对应条件
filter.WithAllComponentsCondition; // 等于IComponents.Get<PgdPosition>()

[h2]WithAnyComponents

Method

QueryFilter WithAnyComponents(in IComponents helper)

设置WithAny组件条件。

Parameters

Name

Type

Description

helper

IComponents

组件类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithAnyComponents(IComponents.Get<PgdPosition>());
// 通过WithAnyComponentsCondition可以查看过滤器设置的对应条件
filter.WithAnyComponentsCondition; // 等于IComponents.Get<PgdPosition>()

[h2]WithoutAllComponents

Method

QueryFilter WithoutAllComponents(in IComponents helper)

设置WithoutAll组件条件。

Parameters

Name

Type

Description

helper

IComponents

组件类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithoutAllComponents(IComponents.Get<PgdPosition>());
// 通过WithoutAllComponentsCondition可以查看过滤器设置的对应条件
filter.WithoutAllComponentsCondition; // 等于IComponents.Get<PgdPosition>()

[h2]WithoutAnyComponents

Method

QueryFilter WithoutAnyComponents(in IComponents helper)

设置WithoutAny组件条件。

Parameters

Name

Type

Description

helper

IComponents

组件类型集合。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithoutAnyComponents(IComponents.Get<PgdPosition>());
// 通过WithoutAnyComponentsCondition可以查看过滤器设置的对应条件
filter.WithoutAnyComponentsCondition; // 等于IComponents.Get<PgdPosition>()

[h2]HasValue<TComponent, TValue>

Method

QueryFilter HasValue<TComponent, TValue>(TValue value)

设置值查询Lookup组件条件。

TComponent为ILookup<TValue>。

Parameters

Name

Type

Description

value

TValue

Lookup组件值。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置Lookup过滤条件
var filter = new QueryFilter().HasValue<LookupName, string>("test");

[h2]ValueInRange<TComponent, TValue>

Method

QueryFilter ValueInRange<TComponent, TValue>(TValue min, TValue max)

设置值范围查询Lookup组件条件。

TComponent为ILookup<TValue>,TValue为IComparable<TValue>。

Parameters

Name

Type

Description

min

TValue

范围查询下界。

max

TValue

范围查询上界。

Return

Type

Description

QueryFilter

返回设置条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置Lookup过滤条件
var filter = new QueryFilter().ValueInRange<LookupInt, int>(3, 8);

[h2]WithAllSharedComponents

Method

QueryFilter WithAllSharedComponents(in IComponents sharedComponents)

设置WithAll共享组件条件。

Parameters

Name

Type

Description

sharedComponents

IComponents

共享组件类型集合。

Return

Type

Description

QueryFilter

返回设置共享组件条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置共享组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithAllSharedComponents(IComponents.GetSharedSet<SharedComponent1>());
// 通过WithAllSharedComponentsCondition可以查看过滤器设置的对应条件
filter.WithAllSharedComponentsCondition; // 等于IComponents.GetSharedSet<SharedComponent1>()

[h2]WithAnySharedComponents

Method

QueryFilter WithAnySharedComponents(in IComponents sharedComponents)

设置WithAny共享组件条件。

Parameters

Name

Type

Description

sharedComponents

IComponents

共享组件类型集合。

Return

Type

Description

QueryFilter

返回设置共享组件条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置共享组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithAnySharedComponents(IComponents.GetSharedSet<SharedComponent1>());
// 通过WithAnySharedComponentsCondition可以查看过滤器设置的对应条件
filter.WithAnySharedComponentsCondition; // 等于IComponents.GetSharedSet<SharedComponent1>()

[h2]WithoutAllSharedComponents

Method

QueryFilter WithoutAllSharedComponents(in IComponents sharedComponents)

设置WithoutAll共享组件条件。

Parameters

Name

Type

Description

sharedComponents

IComponents

共享组件类型集合。

Return

Type

Description

QueryFilter

返回设置共享组件条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置共享组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithoutAllSharedComponents(IComponents.GetSharedSet<SharedComponent1>());
// 通过WithoutAllSharedComponentsCondition可以查看过滤器设置的对应条件
filter.WithoutAllSharedComponentsCondition; // 等于IComponents.GetSharedSet<SharedComponent1>()

[h2]WithoutAnySharedComponents

Method

QueryFilter WithoutAnySharedComponents(in IComponents sharedComponents)

设置WithoutAny共享组件条件。

Parameters

Name

Type

Description

sharedComponents

IComponents

共享组件类型集合。

Return

Type

Description

QueryFilter

返回设置共享组件条件的查询过滤器。

Sample Code

// 创建查询过滤器,并设置共享组件过滤条件。过滤条件记录在对应的Condition字段中
var filter = new QueryFilter().WithoutAnySharedComponents(IComponents.GetSharedSet<SharedComponent1>());
// 通过WithoutAnySharedComponentsCondition可以查看过滤器设置的对应条件
filter.WithoutAnySharedComponentsCondition; // 等于IComponents.GetSharedSet<SharedComponent1>()