示例#1
0
 public async Task RunAsync(IBattleEvent <TDomain> @event,
                            IPassiveProperty <TDomain> self,
                            TDomain context)
 {
     if (@event is TEvent ev)
     {
         await _processFunc.Invoke(ev, self, context);
     }
 }
 public async Task RunAsync(IBattleEvent <TDomain> @event, IPassiveProperty <TDomain> self, TDomain context)
 {
     if (@event is TEvent ev)
     {
         if (self is PassiveProperty <TDomain, TDataStore> property)
         {
             await _processHook.Invoke(ev, property, context);
         }
     }
 }
        public TSource Modify <TSource>(TSource source, IPassiveProperty <TDomain> self)
        {
            if (_selector is PassiveProcessModifier <TDomain, TSource, TDataStore> modifier &&
                self is PassiveProperty <TDomain, TDataStore> stateful)
            {
                return(modifier.Invoke(source, stateful));
            }

            return(source);
        }
        public TSource Modify <TSource>(TSource source, IPassiveProperty <TDomain> self)
        {
            if (source is TData data &&
                _selector.Invoke(data, self) is TSource result)
            {
                return(result);
            }

            return(source);
        }