本文整理汇总了C#中IDataSource.GetDataAt方法的典型用法代码示例。如果您正苦于以下问题:C# IDataSource.GetDataAt方法的具体用法?C# IDataSource.GetDataAt怎么用?C# IDataSource.GetDataAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataSource
的用法示例。
在下文中一共展示了IDataSource.GetDataAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateCurrentEffects
/// <summary>
/// Updates the collection of current effects, returning the ids of the affected elements.
/// </summary>
/// <returns>Ids of the affected elements.</returns>
public Guid[] UpdateCurrentEffects(IDataSource dataSource, TimeSpan currentTime)
{
// Get the effects that are newly qualified.
IEnumerable<IEffectNode> newQualifiedEffects = dataSource.GetDataAt(currentTime);
// Add them to the current effect list.
_currentEffects.AddRange(newQualifiedEffects);
// Get the distinct list of all elements affected by all effects in the list.
// List has current effects as well as effects that may be expiring.
// Current and expired effects affect state.
Guid[] affectedElements = _GetElementsAffected(_currentEffects);
_RemoveExpiredEffects(currentTime);
return affectedElements;
}
示例2: UpdateCurrentEffects
/// <summary>
/// Updates the collection of current affects, returning the ids of the affected elements.
/// </summary>
/// <returns>Ids of the affected elements.</returns>
public Guid[] UpdateCurrentEffects(IDataSource dataSource, TimeSpan currentTime)
{
// Get the entirety of the new state.
IEffectNode[] newState = dataSource.GetDataAt(currentTime).ToArray();
// Get the elements affected by this new state.
Guid[] nowAffectedElements = _GetAffectedElements(newState).ToArray();
// New and expiring effects affect the state, so get the union of
// the previous state and the current state.
//HashSet<Guid> allAffectedElements = new HashSet<Guid>(_currentAffectedElements.Concat(newAffectedElements));
IEnumerable<Guid> allAffectedElements = _currentAffectedElements.Concat(nowAffectedElements).Distinct();
// Set the new state.
_currentEffects = new List<IEffectNode>(newState);
_currentAffectedElements = new HashSet<Guid>(nowAffectedElements);
return allAffectedElements.ToArray();
}
示例3: UpdateCurrentEffects
/// <summary>
/// Updates the collection of current effects, returning the ids of the affected elements.
/// </summary>
/// <returns>Ids of the affected elements.</returns>
public HashSet<Guid> UpdateCurrentEffects(IDataSource dataSource, TimeSpan currentTime)
{
if (_lastUpdateTime > currentTime)
{
//Make sure the current effects are cleared if we go back to a earlier time.
_currentEffects.Clear();
}
_lastUpdateTime = currentTime;
// Get the effects that are newly qualified.
IEnumerable<IEffectNode> newQualifiedEffects = dataSource.GetDataAt(currentTime);
// Add them to the current effect list.
_currentEffects.AddRange(newQualifiedEffects);
// Get the distinct list of all elements affected by all effects in the list.
// List has current effects as well as effects that may be expiring.
// Current and expired effects affect state.
_GetElementsAffected(_currentEffects);
_RemoveExpiredEffects(currentTime);
return _affectedElements;
}