Exemplo n.º 1
0
 public AggregateExpression(string name, LambdaExpression expression, FastDelegate <Func <object[], object> > compiledExpression, IndexMap factMap)
 {
     _expression         = expression;
     _factMap            = factMap;
     _compiledExpression = compiledExpression;
     Name = name;
 }
Exemplo n.º 2
0
 public RuleAction(LambdaExpression expression, FastDelegate <Action <IContext, object[]> > compiledExpression, IndexMap factIndexMap, IndexMap dependencyIndexMap)
 {
     _expression         = expression;
     _factIndexMap       = factIndexMap;
     _dependencyIndexMap = dependencyIndexMap;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 3
0
 public RuleAction(LambdaExpression expression, IndexMap factIndexMap, IndexMap dependencyIndexMap)
 {
     _expression = expression;
     _factIndexMap = factIndexMap;
     _dependencyIndexMap = dependencyIndexMap;
     _compiledAction = FastDelegate.Create<Action<object[]>>(expression);
 }
Exemplo n.º 4
0
 public RuleAction(LambdaExpression expression, IndexMap factIndexMap, IndexMap dependencyIndexMap)
 {
     _expression         = expression;
     _factIndexMap       = factIndexMap;
     _dependencyIndexMap = dependencyIndexMap;
     _compiledAction     = FastDelegate.Create <Action <object[]> >(expression);
 }
Exemplo n.º 5
0
 public RuleAction(LambdaExpression expression, FastDelegate <Action <IContext, object[]> > compiledExpression,
                   IndexMap tupleFactMap, IndexMap dependencyFactMap, ActionTrigger actionTrigger)
 {
     _expression         = expression;
     _tupleFactMap       = tupleFactMap;
     _dependencyFactMap  = dependencyFactMap;
     _actionTrigger      = actionTrigger;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 6
0
 public UIGraph_BuildLabels()
 {
     try
     {
         pixelsToUnits = FastDelegate.Create <UIComponent, PixelsToUnitsDelegate>("PixelsToUnits");
         addSolidQuad  = FastDelegate.Create <UIGraph, AddSolidQuadDelegate>("AddSolidQuad");
     }
     catch (Exception ex)
     {
         Log.Error("The 'Real Time' mod failed to create delegates for the UIGraph. Error message: " + ex);
     }
 }
Exemplo n.º 7
0
        /// <summary>Creates a game connection object for the tourist AI class.</summary>
        /// <returns>A new <see cref="TouristAIConnection{TouristAI, Citizen}"/> object.</returns>
        public static TouristAIConnection <TouristAI, Citizen> GetTouristAIConnection()
        {
            try
            {
                GetRandomTargetTypeDelegate getRandomTargetType
                    = FastDelegate.Create <TouristAI, GetRandomTargetTypeDelegate>("GetRandomTargetType");

                GetLeavingReasonDelegate getLeavingReason
                    = FastDelegate.Create <TouristAI, GetLeavingReasonDelegate>("GetLeavingReason");

                AddTouristVisitDelegate addTouristVisit
                    = FastDelegate.Create <TouristAI, AddTouristVisitDelegate>("AddTouristVisit");

                DoRandomMoveDelegate doRandomMove
                    = FastDelegate.Create <TouristAI, DoRandomMoveDelegate>("DoRandomMove");

                FindEvacuationPlaceDelegate findEvacuationPlace
                    = FastDelegate.Create <TouristAI, FindEvacuationPlaceDelegate>("FindEvacuationPlace");

                FindVisitPlaceDelegate findVisitPlace
                    = FastDelegate.Create <TouristAI, FindVisitPlaceDelegate>("FindVisitPlace");

                GetEntertainmentReasonDelegate getEntertainmentReason
                    = FastDelegate.Create <TouristAI, GetEntertainmentReasonDelegate>("GetEntertainmentReason");

                GetEvacuationReasonDelegate getEvacuationReason
                    = FastDelegate.Create <TouristAI, GetEvacuationReasonDelegate>("GetEvacuationReason");

                GetShoppingReasonDelegate getShoppingReason
                    = FastDelegate.Create <TouristAI, GetShoppingReasonDelegate>("GetShoppingReason");

                StartMovingDelegate startMoving
                    = FastDelegate.Create <TouristAI, StartMovingDelegate>("StartMoving");

                return(new TouristAIConnection <TouristAI, Citizen>(
                           getRandomTargetType,
                           getLeavingReason,
                           addTouristVisit,
                           doRandomMove,
                           findEvacuationPlace,
                           findVisitPlace,
                           getEntertainmentReason,
                           getEvacuationReason,
                           getShoppingReason,
                           startMoving));
            }
            catch (Exception e)
            {
                Log.Error("The 'Real Time' mod failed to create a delegate for type 'TouristAI', no method patching for the class: " + e);
                return(null);
            }
        }
Exemplo n.º 8
0
        /// <summary>Creates a game connection object for the resident AI class.</summary>
        /// <returns>A new <see cref="ResidentAIConnection{ResidentAI, Citizen}"/> object.</returns>
        public static ResidentAIConnection <ResidentAI, Citizen> GetResidentAIConnection()
        {
            try
            {
                DoRandomMoveDelegate doRandomMove
                    = FastDelegate.Create <ResidentAI, DoRandomMoveDelegate>("DoRandomMove");

                FindEvacuationPlaceDelegate findEvacuationPlace
                    = FastDelegate.Create <ResidentAI, FindEvacuationPlaceDelegate>("FindEvacuationPlace");

                FindHospitalDelegate findHospital
                    = FastDelegate.Create <ResidentAI, FindHospitalDelegate>("FindHospital");

                FindVisitPlaceDelegate findVisitPlace
                    = FastDelegate.Create <ResidentAI, FindVisitPlaceDelegate>("FindVisitPlace");

                GetEntertainmentReasonDelegate getEntertainmentReason
                    = FastDelegate.Create <ResidentAI, GetEntertainmentReasonDelegate>("GetEntertainmentReason");

                GetEvacuationReasonDelegate getEvacuationReason
                    = FastDelegate.Create <ResidentAI, GetEvacuationReasonDelegate>("GetEvacuationReason");

                GetShoppingReasonDelegate getShoppingReason
                    = FastDelegate.Create <ResidentAI, GetShoppingReasonDelegate>("GetShoppingReason");

                StartMovingDelegate startMoving
                    = FastDelegate.Create <ResidentAI, StartMovingDelegate>("StartMoving");

                StartMovingWithOfferDelegate startMovingWithOffer
                    = FastDelegate.Create <ResidentAI, StartMovingWithOfferDelegate>("StartMoving");

                return(new ResidentAIConnection <ResidentAI, Citizen>(
                           doRandomMove,
                           findEvacuationPlace,
                           findHospital,
                           findVisitPlace,
                           getEntertainmentReason,
                           getEvacuationReason,
                           getShoppingReason,
                           startMoving,
                           startMovingWithOffer));
            }
            catch (Exception e)
            {
                Log.Error("The 'Real Time' mod failed to create a delegate for type 'ResidentAI', no method patching for the class: " + e);
                return(null);
            }
        }
Exemplo n.º 9
0
 public AggregateExpression(LambdaExpression expression, FastDelegate <Func <object[], object> > compiledExpression, IndexMap factIndexMap)
 {
     _expression         = expression;
     _factIndexMap       = factIndexMap;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 10
0
 public AggregateFactExpression(LambdaExpression expression, FastDelegate <Func <object, object> > compiledExpression)
 {
     _expression         = expression;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 11
0
 public ActivationExpression(LambdaExpression expression, FastDelegate <Func <object[], object> > compiledExpression, IndexMap tupleFactMap)
 {
     _expression         = expression;
     _compiledExpression = compiledExpression;
     _tupleFactMap       = tupleFactMap;
 }
Exemplo n.º 12
0
 public AlphaCondition(LambdaExpression expression)
 {
     _expression         = expression;
     _compiledExpression = FastDelegate.Create <Func <object[], bool> >(expression);
 }
Exemplo n.º 13
0
 public BetaCondition(LambdaExpression expression, FactIndexMap conditionFactMap)
 {
     _expression         = expression;
     _conditionFactMap   = conditionFactMap;
     _compiledExpression = FastDelegate.Create <Func <object[], bool> >(expression);
 }
Exemplo n.º 14
0
 public BetaCondition(LambdaExpression expression, FastDelegate <Func <object[], bool> > compiledExpression, IndexMap factIndexMap)
 {
     _expression         = expression;
     _factIndexMap       = factIndexMap;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 15
0
 public RuleAction(LambdaExpression expression, FactIndexMap actionFactMap)
 {
     _expression     = expression;
     _actionFactMap  = actionFactMap;
     _compiledAction = FastDelegate.Create <Action <object[]> >(expression);
 }
Exemplo n.º 16
0
 public BindingExpression(LambdaExpression expression, FastDelegate <Func <object[], object> > compiledExpression, IndexMap factMap)
 {
     Expression          = expression;
     _compiledExpression = compiledExpression;
     _factMap            = factMap;
 }
Exemplo n.º 17
0
 public AlphaCondition(LambdaExpression expression, FastDelegate <Func <object, bool> > compiledExpression)
 {
     _expression         = expression;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 18
0
 public AlphaCondition(LambdaExpression expression)
 {
     _expression         = expression;
     _compiledExpression = FastDelegate.AlphaCondition(expression);
 }
Exemplo n.º 19
0
 public AggregateFactExpression(string name, LambdaExpression expression, FastDelegate <Func <object, object> > compiledExpression)
 {
     Name                = name;
     _expression         = expression;
     _compiledExpression = compiledExpression;
 }
Exemplo n.º 20
0
 public BetaCondition(LambdaExpression expression, IndexMap factIndexMap)
 {
     _expression         = expression;
     _factIndexMap       = factIndexMap;
     _compiledExpression = FastDelegate.BetaCondition(expression);
 }