本文整理汇总了C#中EventContext.GetScopedObjectByName方法的典型用法代码示例。如果您正苦于以下问题:C# EventContext.GetScopedObjectByName方法的具体用法?C# EventContext.GetScopedObjectByName怎么用?C# EventContext.GetScopedObjectByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventContext
的用法示例。
在下文中一共展示了EventContext.GetScopedObjectByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public bool Evaluate(EventContext context, Game game)
{
Event e = game.GetEventById(eventId);
if (e == null)
return false;
Dictionary<string, object> computedParameters = new Dictionary<string, object>();
foreach (var pair in parameters)
{
computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
}
EventContext newContext = new EventContext(context.CurrentCharacter, computedParameters);
return e.GetAvailableOptions(newContext, game).Length > 0;
}
示例2: Evaluate
public double Evaluate(Game game, EventContext context, Weights weights)
{
Dictionary<string, object> computedParameters = new Dictionary<string, object>();
foreach (var pair in parameters)
{
computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
}
EventContext newContext = new EventContext(context.CurrentCharacter, computedParameters);
return game.GetEventById(eventid).Evaluate(game, newContext, weights);
}
示例3: Execute
public void Execute(EventResults result, Game game, EventContext context)
{
Dictionary<string, object> computedParameters = new Dictionary<string, object>();
foreach (var pair in parameters)
{
computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
}
EventContext newContext = new EventContext(context.CurrentCharacter, computedParameters);
game.GetEventById(eventid).Execute(result, game, newContext);
//We need to commit any changes that were performed on the new context to our old one.
newContext.CommitTo(context);
}