Class FeatureSet<T>
Generic version of FeatureSet where the generic type is the type of the feature.
Inherited Members
Namespace: UnityEngine.Industrial.Configuring.Core
Syntax
[Serializable]
[ExecuteInEditMode]
public class FeatureSet<T> : FeatureSet, ISerializationCallbackReceiver where T : Feature
Type Parameters
Name | Description |
---|---|
T |
Fields
_defaultFeature
The default feature
Declaration
[HideInInspector]
[SerializeField]
protected T _defaultFeature
Field Value
Type | Description |
---|---|
T |
_featureForCode
The feature for code
Declaration
protected Dictionary<string, T> _featureForCode
Field Value
Type | Description |
---|---|
Dictionary<String, T> |
_features
The features
Declaration
[SerializeField]
protected List<T> _features
Field Value
Type | Description |
---|---|
List<T> |
_selectedFeature
The selected feature
Declaration
[SerializeField]
protected T _selectedFeature
Field Value
Type | Description |
---|---|
T |
Properties
codes
Read-only collection of codes of the features in this set.
Declaration
public override IReadOnlyList<string> codes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<String> | The codes. |
Overrides
defaultFeature
Gets the default feature.
Declaration
public T defaultFeature { get; }
Property Value
Type | Description |
---|---|
T | The default feature. |
featureForCode
Mapping from codes to features (read-only).
Declaration
public IReadOnlyDictionary<string, T> featureForCode { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<String, T> | The feature for code. |
features
List of features in this feature set (read-only).
Declaration
public IReadOnlyList<T> features { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<T> | The features. |
selectedFeature
Currently selected feature.
Declaration
public T selectedFeature { get; }
Property Value
Type | Description |
---|---|
T | The selected feature. |
Remarks
Use SelectFeature(T) for selecting a feature.
variantTable
Variant table containing this feature set.
Declaration
public VariantTable variantTable { get; }
Property Value
Type | Description |
---|---|
VariantTable | The variant table. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The feature set is not part of a variant table: it is not the child of a game object with a VariantTable component. |
Methods
AddFeature(String)
Adds a new feature of the given code to the feature set.
Declaration
public virtual T AddFeature(string featureCode)
Parameters
Type | Name | Description |
---|---|---|
String | featureCode | The feature code. |
Returns
Type | Description |
---|---|
T | T. |
Remarks
Throws ArgumentException if
code
is
null or only whitespaces, or if there is already a variant of the given
code in the set.
Exceptions
Type | Condition |
---|---|
ArgumentException | Code must not be null or contain only whitespaces. |
ArgumentException | Code already exists in variant set. |
ArgumentException | Code must not be null or contain only whitespaces. |
ArgumentException | Code already exists in variant set. |
DeselectFeature()
Deselects the feature.
Declaration
public override void DeselectFeature()
Overrides
featureIndexOf(Feature)
Index of feature in this feature set
Declaration
public override int featureIndexOf(Feature feature)
Parameters
Type | Name | Description |
---|---|---|
Feature | feature | The feature. |
Returns
Type | Description |
---|---|
Int32 | System.Int32. |
Overrides
GetFeatures()
Gets the features.
Declaration
protected override IReadOnlyList<Feature> GetFeatures()
Returns
Type | Description |
---|---|
IReadOnlyList<Feature> | IReadOnlyList<Feature>. |
Overrides
GetSelectedFeature()
Gets the selected feature.
Declaration
protected override Feature GetSelectedFeature()
Returns
Type | Description |
---|---|
Feature | Feature. |
Overrides
HandleFeatureCodeChange(Object, FeatureCodeChangedEventArgs)
Handles the feature code change.
Declaration
protected void HandleFeatureCodeChange(object sender, FeatureCodeChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | The sender. |
FeatureCodeChangedEventArgs | args | The FeatureCodeChangedEventArgs instance containing the event data. |
HasFeature(Feature)
Determines whether the specified feature has feature.
Declaration
public bool HasFeature(Feature feature)
Parameters
Type | Name | Description |
---|---|---|
Feature | feature | The feature. |
Returns
Type | Description |
---|---|
Boolean |
|
MoveFeature(T, Int32)
Move the feature to index of the feature set
Declaration
public void MoveFeature(T feature, int index)
Parameters
Type | Name | Description |
---|---|---|
T | feature | The feature. |
Int32 | index | The index. |
Remarks
Throws an ArgumentOutOfRangeException if input index is out of range.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Feature to move must not be null. |
ArgumentOutOfRangeException | Feature index to move must be in range. |
Exception | Wrong expectation |
OnDisable()
Called when [disable].
Declaration
protected void OnDisable()
OnEnable()
Called when [enable].
Declaration
protected void OnEnable()
RemoveFeature(T)
Removes the feature from the feature set (along with its assignments).
Declaration
public void RemoveFeature(T feature)
Parameters
Type | Name | Description |
---|---|---|
T | feature | The feature. |
Remarks
Throws an ArgumentException if the feature is not in the feature set.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Feature to remove must not be null. |
ArgumentException | Code {feature.code} does not exist in feature set. |
RemoveFeature(String)
Removes the feature of the given code from the feature set (along with its assignments).
Declaration
public void RemoveFeature(string code)
Parameters
Type | Name | Description |
---|---|---|
String | code | The code. |
Remarks
Throws an ArgumentException if no feature of the given code is in the feature set.
Exceptions
Type | Condition |
---|---|
ArgumentException | Code {code} does not exist in feature set. |
ResetSelection()
Selects the first feature in the feature set.
Declaration
public override void ResetSelection()
Overrides
SelectFeature(T)
Selects the passed feature, deselecting the previous feature.
Declaration
public void SelectFeature(T feature)
Parameters
Type | Name | Description |
---|---|---|
T | feature | The feature. |
Remarks
Throws an ArgumentException if the feature is
null
or not in the feature set.SelectFeatureInternal(T)
Selects the feature internal.
Declaration
public void SelectFeatureInternal(T feature)
Parameters
Type | Name | Description |
---|---|---|
T | feature | The feature. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The feature with code {feature.code} is not in the feature set. |
SetDefaultFeature()
Sets the default feature.
Declaration
public void SetDefaultFeature()
Explicit Interface Implementations
ISerializationCallbackReceiver.OnAfterDeserialize()
Called when [after deserialize].
Declaration
void ISerializationCallbackReceiver.OnAfterDeserialize()
Implements
ISerializationCallbackReceiver.OnBeforeSerialize()
Called when [before serialize].
Declaration
void ISerializationCallbackReceiver.OnBeforeSerialize()