public override void OnLevelUnloading()
        {
            // do base processing
            base.OnLevelUnloading();

            try
            {
                try
                {
                    // remove Harmony patches
                    HarmonyPatcher.RemovePatches();
                }
                catch (System.IO.FileNotFoundException ex)
                {
                    // ignore missing Harmony, rethrow all others
                    if (!ex.FileName.ToUpper().Contains("HARMONY"))
                    {
                        throw ex;
                    }
                }

                // deinitialize user interface
                EOCVUserInterface.Deinitialize();
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
        public override void OnLevelLoaded(LoadMode mode)
        {
            // do base processing
            base.OnLevelLoaded(mode);

            try
            {
                // check for new or loaded game
                if (mode == LoadMode.NewGame || mode == LoadMode.NewGameFromScenario || mode == LoadMode.LoadGame)
                {
                    // determine if Exclude Mail mod is enabled
                    foreach (PluginManager.PluginInfo mod in PluginManager.instance.GetPluginsInfo())
                    {
                        // ignore builtin mods and camera script
                        if (!mod.isBuiltin && !mod.isCameraScript)
                        {
                            // check against the Exclude Mail workshop ID
                            if (mod.publishedFileID.AsUInt64 == 2093019121)
                            {
                                if (mod.isEnabled)
                                {
                                    // create dialog panel
                                    ExceptionPanel panel = UIView.library.ShowModal <ExceptionPanel>("ExceptionPanel");
                                    panel.SetMessage(
                                        "Enhanced Outside Connections View",
                                        "The Enhanced Outside Connections View mod supersedes the Exclude Mail mod.  \n\n" +
                                        "Please unsubscribe from the Exclude Mail mod.",
                                        false);

                                    // do not initialize this mod
                                    return;
                                }

                                // found it, but not enabled
                                break;
                            }
                        }
                    }

                    // initialize user interface
                    if (!EOCVUserInterface.Initialize())
                    {
                        return;
                    }

                    // create the Harmony patches
                    if (!HarmonyPatcher.CreatePatches())
                    {
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
示例#3
0
        /// <summary>
        /// return the color of the vehicle
        /// same Prefix routine is used for all vehicle AI types
        /// </summary>
        /// <returns>whether or not to do base processing</returns>
        public static bool VehicleAIGetColor(ushort vehicleID, ref Vehicle data, InfoManager.InfoMode infoMode, ref Color __result)
        {
            // do processing for this mod only for Outside Connections info view
            if (infoMode == InfoManager.InfoMode.Connections)
            {
                return(EOCVUserInterface.GetVehicleColor(vehicleID, ref data, ref __result));
            }

            // do base processing
            return(true);
        }
示例#4
0
 /// <summary>
 /// update everything after base processing
 /// base processing is always allowed to execute because it does a few other things that are needed
 /// </summary>
 public static void OutsideConnectionsInfoViewPanelUpdatePanel()
 {
     // update the panel
     EOCVUserInterface.UpdatePanel();
 }