Esempio n. 1
0
        /// <summary>
        /// Called when a game level is loaded. If applicable, activates the Snooper mod
        /// for the loaded level.
        /// </summary>
        ///
        /// <param name="mode">The <see cref="LoadMode"/> a game level is loaded in.</param>
        public override void OnLevelLoaded(LoadMode mode)
        {
            switch (mode)
            {
            case LoadMode.LoadGame:
            case LoadMode.NewGame:
            case LoadMode.LoadScenario:
            case LoadMode.NewGameFromScenario:
                break;

            default:
                return;
            }

            try
            {
                patcher.Apply();
            }
            catch (Exception ex)
            {
                Debug.LogError("The 'Snooper' mod failed to perform method redirections: " + ex);
                SafeRevertPatches();
                return;
            }

            WorldInfoPanelPatches.CitizenInfoPanel = CustomCitizenInfoPanel.Enable();
            WorldInfoPanelPatches.VehicleInfoPanel = CustomVehicleInfoPanel.Enable();
        }
Esempio n. 2
0
        /// <summary>Enables the vehicle info panel customization. Can return null on failure.</summary>
        /// <returns>An instance of the <see cref="CustomVehicleInfoPanel"/> object that can be used for disabling
        /// the customization, or null when the customization fails.</returns>
        public static CustomVehicleInfoPanel Enable()
        {
            var result = new CustomVehicleInfoPanel(GameInfoPanelName);

            return(result.IsValid ? result : null);
        }