コード例 #1
0
 private Behavior GetOrAdd(
     Func <IStat> lazyAffectedStat, NodeType affectNodeType, IBehaviorPathRule affectedPaths,
     Func <IValue, IValue> valueTransformation, CacheKey cacheKey)
 {
     return(GetOrAdd(new LazyStatList(lazyAffectedStat), affectNodeType, affectedPaths,
                     valueTransformation, cacheKey));
 }
コード例 #2
0
ファイル: Behavior.cs プロジェクト: zsmj007/PoESkillTree
        /*
         * Rounding:
         * - Each stat can have different rounding behaviors
         * - This can affect nodes of all NodeTypes
         * - Modifies the output of affected nodes by rounding it.
         * - Affects all paths
         */

        public Behavior(IReadOnlyList<IStat> affectedStats, IReadOnlyList<NodeType> affectedNodeTypes,
            IBehaviorPathRule affectedPathsRule, IValueTransformation transformation)
            : base(true)
        {
            AffectedStats = affectedStats;
            AffectedNodeTypes = affectedNodeTypes;
            AffectedPathsRule = affectedPathsRule;
            Transformation = transformation;
        }
コード例 #3
0
 private Behavior GetOrAdd(
     IReadOnlyList <IStat> affectedStats,
     IReadOnlyList <NodeType> affectNodeTypes, IBehaviorPathRule affectedPathsRule,
     Func <IValue, IValue> valueTransformation, CacheKey cacheKey)
 {
     return(_cache.GetOrAdd(cacheKey, _ =>
                            new Behavior(affectedStats, affectNodeTypes, affectedPathsRule,
                                         new ValueTransformation(valueTransformation))));
 }
コード例 #4
0
 public Transformation(IBehaviorPathRule pathRule, IValueTransformation transformation)
 {
     _pathRule       = pathRule;
     _transformation = transformation;
 }
コード例 #5
0
 private Behavior GetOrAdd(
     IReadOnlyList <IStat> affectedStats, NodeType affectNodeType, IBehaviorPathRule affectedPaths,
     Func <IValue, IValue> valueTransformation, CacheKey cacheKey)
 {
     return(GetOrAdd(affectedStats, new[] { affectNodeType }, affectedPaths, valueTransformation, cacheKey));
 }
コード例 #6
0
 private Behavior GetOrAdd(
     IStat affectedStat, NodeType affectNodeType, IBehaviorPathRule affectedPaths,
     Func <IValue, IValue> valueTransformation, CacheKey cacheKey)
 {
     return(GetOrAdd(new[] { affectedStat }, affectNodeType, affectedPaths, valueTransformation, cacheKey));
 }