public static void InitDelegate()
 {
     if (GetIncomingTransferReason != null)
     {
         return;
     }
     if (GetOutgoingTransferReason != null)
     {
         return;
     }
     if (GetSecondaryIncomingTransferReason != null)
     {
         return;
     }
     if (MaxIncomingLoadSize != null)
     {
         return;
     }
     if (GetConsumptionDivider != null)
     {
         return;
     }
     GetIncomingTransferReason          = FastDelegateFactory.Create <IndustrialBuildingAIGetIncomingTransferReason>(typeof(IndustrialBuildingAI), "GetIncomingTransferReason", instanceMethod: true);
     GetOutgoingTransferReason          = FastDelegateFactory.Create <IndustrialBuildingAIGetOutgoingTransferReason>(typeof(IndustrialBuildingAI), "GetOutgoingTransferReason", instanceMethod: true);
     GetSecondaryIncomingTransferReason = FastDelegateFactory.Create <IndustrialBuildingAIGetSecondaryIncomingTransferReason>(typeof(IndustrialBuildingAI), "GetSecondaryIncomingTransferReason", instanceMethod: true);
     MaxIncomingLoadSize   = FastDelegateFactory.Create <IndustrialBuildingAIMaxIncomingLoadSize>(typeof(IndustrialBuildingAI), "MaxIncomingLoadSize", instanceMethod: true);
     GetConsumptionDivider = FastDelegateFactory.Create <IndustrialBuildingAIGetConsumptionDivider>(typeof(IndustrialBuildingAI), "GetConsumptionDivider", instanceMethod: true);
 }
Example #2
0
 public static void InitDelegate()
 {
     if (GetVisitBehaviour != null)
     {
         return;
     }
     GetVisitBehaviour = FastDelegateFactory.Create <MarketAIGetVisitBehaviour>(typeof(MarketAI), "GetVisitBehaviour", instanceMethod: true);
 }
 public static void InitDelegate()
 {
     if (GetOutgoingTransferReason != null)
     {
         return;
     }
     GetOutgoingTransferReason = FastDelegateFactory.Create <IndustrialExtractorAIGetOutgoingTransferReason>(typeof(IndustrialExtractorAI), "GetOutgoingTransferReason", instanceMethod: true);
 }
 public static void InitDelegate()
 {
     if (CalculateOwnVehicles != null)
     {
         return;
     }
     CalculateOwnVehicles = FastDelegateFactory.Create <CommonBuildingAICalculateOwnVehicles>(typeof(CommonBuildingAI), "CalculateOwnVehicles", instanceMethod: true);
 }
        public static void InitDelegate()
        {
            if (CargoTruckAIStartPathFindDG != null)
            {
                return;
            }

            CargoTruckAIStartPathFindDG = FastDelegateFactory.Create <CargoTruckAIStartPathFind>(typeof(CargoTruckAI), "StartPathFind", instanceMethod: true);
        }
Example #6
0
        public static void InitDelegate()
        {
            if (GetVisitBehaviour != null)
            {
                return;
            }

            DebugLog.LogToFileOnly("Try to InitDelegate in RealCityMarketAI");
            GetVisitBehaviour = FastDelegateFactory.Create <MarketAIGetVisitBehaviour>(typeof(MarketAI), "GetVisitBehaviour", instanceMethod: true);
        }
Example #7
0
        public static void InitDelegate()
        {
            if (GetOutgoingTransferReason != null)
            {
                return;
            }

            DebugLog.LogToFileOnly("Try to InitDelegate in RealCityIndustrialExtractorAI");
            GetOutgoingTransferReason = FastDelegateFactory.Create <IndustrialExtractorAIGetOutgoingTransferReason>(typeof(IndustrialExtractorAI), "GetOutgoingTransferReason", instanceMethod: true);
        }
Example #8
0
 public UIGraph_BuildLabels()
 {
     try
     {
         pixelsToUnits = FastDelegateFactory.Create <PixelsToUnitsDelegate>(typeof(UIComponent), "PixelsToUnits", instanceMethod: true);
         addSolidQuad  = FastDelegateFactory.Create <AddSolidQuadDelegate>(typeof(UIGraph), "AddSolidQuad", instanceMethod: true);
     }
     catch (Exception ex)
     {
         Log.Error("The 'Real Time' mod failed to create delegates for the UIGraph. Error message: " + ex);
     }
 }
Example #9
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
                    = FastDelegateFactory.Create<GetRandomTargetTypeDelegate>(typeof(TouristAI), "GetRandomTargetType", instanceMethod: true);

                GetLeavingReasonDelegate getLeavingReason
                    = FastDelegateFactory.Create<GetLeavingReasonDelegate>(typeof(TouristAI), "GetLeavingReason", instanceMethod: true);

                AddTouristVisitDelegate addTouristVisit
                    = FastDelegateFactory.Create<AddTouristVisitDelegate>(typeof(TouristAI), "AddTouristVisit", instanceMethod: true);

                DoRandomMoveDelegate doRandomMove
                    = FastDelegateFactory.Create<DoRandomMoveDelegate>(typeof(TouristAI), "DoRandomMove", instanceMethod: true);

                FindEvacuationPlaceDelegate findEvacuationPlace
                    = FastDelegateFactory.Create<FindEvacuationPlaceDelegate>(typeof(TouristAI), "FindEvacuationPlace", instanceMethod: true);

                FindVisitPlaceDelegate findVisitPlace
                    = FastDelegateFactory.Create<FindVisitPlaceDelegate>(typeof(TouristAI), "FindVisitPlace", instanceMethod: true);

                GetEntertainmentReasonDelegate getEntertainmentReason
                    = FastDelegateFactory.Create<GetEntertainmentReasonDelegate>(typeof(TouristAI), "GetEntertainmentReason", instanceMethod: true);

                GetEvacuationReasonDelegate getEvacuationReason
                    = FastDelegateFactory.Create<GetEvacuationReasonDelegate>(typeof(TouristAI), "GetEvacuationReason", instanceMethod: true);

                GetShoppingReasonDelegate getShoppingReason
                    = FastDelegateFactory.Create<GetShoppingReasonDelegate>(typeof(TouristAI), "GetShoppingReason", instanceMethod: true);

                StartMovingDelegate startMoving
                    = FastDelegateFactory.Create<StartMovingDelegate>(typeof(TouristAI), "StartMoving", instanceMethod: true);

                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;
            }
        }
Example #10
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
                    = FastDelegateFactory.Create <DoRandomMoveDelegate>(typeof(ResidentAI), "DoRandomMove", instanceMethod: true);

                FindEvacuationPlaceDelegate findEvacuationPlace
                    = FastDelegateFactory.Create <FindEvacuationPlaceDelegate>(typeof(ResidentAI), "FindEvacuationPlace", instanceMethod: true);

                FindHospitalDelegate findHospital
                    = FastDelegateFactory.Create <FindHospitalDelegate>(typeof(ResidentAI), "FindHospital", instanceMethod: true);

                FindVisitPlaceDelegate findVisitPlace
                    = FastDelegateFactory.Create <FindVisitPlaceDelegate>(typeof(ResidentAI), "FindVisitPlace", instanceMethod: true);

                GetEntertainmentReasonDelegate getEntertainmentReason
                    = FastDelegateFactory.Create <GetEntertainmentReasonDelegate>(typeof(ResidentAI), "GetEntertainmentReason", instanceMethod: true);

                GetEvacuationReasonDelegate getEvacuationReason
                    = FastDelegateFactory.Create <GetEvacuationReasonDelegate>(typeof(ResidentAI), "GetEvacuationReason", instanceMethod: true);

                GetShoppingReasonDelegate getShoppingReason
                    = FastDelegateFactory.Create <GetShoppingReasonDelegate>(typeof(ResidentAI), "GetShoppingReason", instanceMethod: true);

                StartMovingDelegate startMoving
                    = FastDelegateFactory.Create <StartMovingDelegate>(typeof(ResidentAI), "StartMoving", instanceMethod: true);

                StartMovingWithOfferDelegate startMovingWithOffer
                    = FastDelegateFactory.Create <StartMovingWithOfferDelegate>(typeof(ResidentAI), "StartMoving", instanceMethod: true);

                AttemptAutodidactDelegate attemptAutodidact
                    = FastDelegateFactory.Create <AttemptAutodidactDelegate>(typeof(ResidentAI), "AttemptAutodidact", instanceMethod: true);

                return(new ResidentAIConnection <ResidentAI, Citizen>(
                           doRandomMove,
                           findEvacuationPlace,
                           findHospital,
                           findVisitPlace,
                           getEntertainmentReason,
                           getEvacuationReason,
                           getShoppingReason,
                           startMoving,
                           startMovingWithOffer,
                           attemptAutodidact));
            }
            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);
            }
        }
Example #11
0
 public static void InitDelegate()
 {
     if (GetIncomingTransferReason != null)
     {
         return;
     }
     if (MaxIncomingLoadSize != null)
     {
         return;
     }
     if (GetVisitBehaviour != null)
     {
         return;
     }
     GetVisitBehaviour         = FastDelegateFactory.Create <CommercialBuildingAIGetVisitBehaviour>(typeof(CommercialBuildingAI), "GetVisitBehaviour", instanceMethod: true);
     GetIncomingTransferReason = FastDelegateFactory.Create <CommercialBuildingAIGetIncomingTransferReason>(typeof(CommercialBuildingAI), "GetIncomingTransferReason", instanceMethod: true);
     MaxIncomingLoadSize       = FastDelegateFactory.Create <CommercialBuildingAIMaxIncomingLoadSize>(typeof(CommercialBuildingAI), "MaxIncomingLoadSize", instanceMethod: true);
 }
Example #12
0
        private CustomVehicleInfoPanel(string panelName, RealTimeResidentAI <ResidentAI, Citizen> residentAI, ILocalizationProvider localizationProvider)
            : base(panelName, residentAI, localizationProvider)
        {
            try
            {
                passengerCarAIGetDriverInstance = FastDelegateFactory.Create <GetDriverInstanceDelegate <PassengerCarAI> >(
                    typeof(PassengerCarAI),
                    GetDriverInstanceMethodName,
                    true);

                bicycleAIGetDriverInstance = FastDelegateFactory.Create <GetDriverInstanceDelegate <BicycleAI> >(
                    typeof(BicycleAI),
                    GetDriverInstanceMethodName,
                    true);
            }
            catch (Exception ex)
            {
                Debug.LogError("The 'Real Time' mod failed to obtain at least one of the GetDriverInstance methods. Error message: " + ex);
            }
        }
Example #13
0
        private CustomCitizenVehicleInfoPanel(string panelName)
            : base(panelName)
        {
            try
            {
                passengerCarAIGetDriverInstance = FastDelegateFactory.Create <GetDriverInstanceDelegate <PassengerCarAI> >(
                    typeof(PassengerCarAI),
                    GetDriverInstanceMethodName,
                    true);

                bicycleAIGetDriverInstance = FastDelegateFactory.Create <GetDriverInstanceDelegate <BicycleAI> >(
                    typeof(BicycleAI),
                    GetDriverInstanceMethodName,
                    true);
            }
            catch (Exception ex)
            {
                Debug.LogError("The 'Snooper' mod failed to obtain at least one of the GetDriverInstance methods. Error message: " + ex);
            }
        }
Example #14
0
        public static void InitDelegate()
        {
            if (CalculateOwnVehicles != null)
            {
                if (GetWorkBehaviour != null)
                {
                    if (CalculateGuestVehicles != null)
                    {
                        if (CalculateGuestVehicles1 != null)
                        {
                            return;
                        }
                    }
                }
            }

            DebugLog.LogToFileOnly("Try to InitDelegate in RealCityCommonBuildingAI");
            CalculateOwnVehicles    = FastDelegateFactory.Create <CommonBuildingAICalculateOwnVehicles>(typeof(CommonBuildingAI), "CalculateOwnVehicles", instanceMethod: true);
            GetWorkBehaviour        = FastDelegateFactory.Create <CommonBuildingAIGetWorkBehaviour>(typeof(CommonBuildingAI), "GetWorkBehaviour", instanceMethod: true);
            CalculateGuestVehicles  = FastDelegateFactory.Create <CommonBuildingAICalculateGuestVehicles>(typeof(CommonBuildingAI), "CalculateGuestVehicles", instanceMethod: true);
            CalculateGuestVehicles1 = FastDelegateFactory.Create <CommonBuildingAICalculateGuestVehicles1>(typeof(CommonBuildingAI), "CalculateGuestVehicles", instanceMethod: true);
        }
Example #15
0
 public static void InitDelegate()
 {
     if (CalculateOwnVehicles != null)
     {
         return;
     }
     if (GetWorkBehaviour != null)
     {
         return;
     }
     if (CalculateGuestVehicles != null)
     {
         return;
     }
     if (CalculateGuestVehicles1 != null)
     {
         return;
     }
     CalculateOwnVehicles    = FastDelegateFactory.Create <CommonBuildingAICalculateOwnVehicles>(typeof(CommonBuildingAI), "CalculateOwnVehicles", instanceMethod: true);
     GetWorkBehaviour        = FastDelegateFactory.Create <CommonBuildingAIGetWorkBehaviour>(typeof(CommonBuildingAI), "GetWorkBehaviour", instanceMethod: true);
     CalculateGuestVehicles  = FastDelegateFactory.Create <CommonBuildingAICalculateGuestVehicles>(typeof(CommonBuildingAI), "CalculateGuestVehicles", instanceMethod: true);
     CalculateGuestVehicles1 = FastDelegateFactory.Create <CommonBuildingAICalculateGuestVehicles1>(typeof(CommonBuildingAI), "CalculateGuestVehicles", instanceMethod: true);
 }
 public static void InitDelegate()
 {
     TransferManagerStartTransferDG         = FastDelegateFactory.Create <TransferManagerStartTransfer>(typeof(TransferManager), "StartTransfer", instanceMethod: true);
     TransferManagerGetDistanceMultiplierDG = FastDelegateFactory.Create <TransferManagerGetDistanceMultiplier>(typeof(TransferManager), "GetDistanceMultiplier", instanceMethod: false);
 }