// default constructor
        public BetterLoadMod()
        {
            try
            {
                if (PluginManager.instance == null || PluginManager.instance.GetPluginsInfo() == null)
                {
                    //DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "BetterLoadPanel quitting, PluginManager.instance is null");
                    return;
                }

                DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "BetterLoadPanel initializing");

                // the very first thing we need to do is check if we're enabled.  This constructor
                // is called even if we're marked as not to be loaded, so if not enabled, don't do anything
                PluginManager.PluginInfo myPluginInfo = null;
                foreach (PluginManager.PluginInfo info in PluginManager.instance.GetPluginsInfo())
                {
                    //DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "pugins: " + info.name + ", id: " + info.publishedFileID.ToString());

                    if (info.name == "BetterLoadPanel" || info.publishedFileID.AsUInt64 == 413584409)
                    {
                        myPluginInfo = info;
                        break;
                    }
                }

                if (myPluginInfo == null)
                {
                    DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "BetterLoadPanel plugin not found");

                    return;
                }

                // we need to be notified if our mod is disabled, so we can remove our added buttons
                // this also handles being enabled, and re-adding buttons
                PluginManager.instance.eventPluginsChanged      += () => { this.EvaluateStatus(); };
                PluginManager.instance.eventPluginsStateChanged += () => { this.EvaluateStatus(); };

                // register for locale changes so we can updat button
                LocaleManager.eventLocaleChanged += () => { this.LocaleHasChanged(); };

                // create our panel now
                PanelWrapper = (BetterLoadPanelWrapper)UIView.GetAView().AddUIComponent(typeof(BetterLoadPanelWrapper));

                PanelWrapper.isVisible = false;
                PanelWrapper.Initialize();

                if (!myPluginInfo.isEnabled)
                {
                    DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "BetterLoadPanel disabled");
                    return;
                }

                DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "BetterLoadPanel enabled");

                if (!IsMainMenuUpdated())
                {
                    AddMainMenuButton();
                }
            }
            catch (Exception ex)
            {
                DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Error, "BetterLoadPanel exception thrown in constructor: " + ex.Message);
            }
        }
        public void AddPauseMenuButton()
        {
            // find library pause menu
            //UIDynamicPanels.DynamicPanelInfo[] libpanels = UIView.library.m_DynamicPanels;

            //foreach (UIDynamicPanels.DynamicPanelInfo dpi in libpanels)
            //{
            //   DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "panel: " + dpi.name);
            //}

            // create our panel now
            if (PanelWrapperForPauseMenu == null)
            {
                PanelWrapperForPauseMenu = (BetterLoadPanelWrapper)UIView.GetAView().AddUIComponent(typeof(BetterLoadPanelWrapper));

                PanelWrapperForPauseMenu.isVisible = false;
                PanelWrapperForPauseMenu.Initialize();
            }

            UIComponent pMenu = UIView.GetAView().FindUIComponent("Menu");

            //DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "uiview instanceid: " + pMenu.GetUIView().GetInstanceID().ToString());
            if (pMenu != null)
            {
                //DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, string.Format("found pause menu UIComponent {0}", pMenu.GetType().FullName));

                UIButton loadGameButton = pMenu.Find <UIButton>("LoadGame");

                if (loadGameButton != null)
                {
                    // we don't want to clone or copy existing button, as it has event handlers we can't get rid of
                    UIButton newButton = UnityEngine.Object.Instantiate <UIButton>(loadGameButton);//mmUIComp.AddUIComponent<UIButton>(); //UnityEngine.Object.Instantiate<UIButton>(loadGameButton);
                    newButton.height      = loadGameButton.height / 2;
                    newButton.width       = loadGameButton.width;
                    loadGameButton.height = loadGameButton.height / 2;
                    newButton.autoSize    = true;
                    //newButton.useGUILayout = true;

                    newButton.name           = "BetterLoadPanel2";
                    newButton.cachedName     = "BetterLoadPanel2";
                    newButton.stringUserData = "BetterLoadPanel2";

                    //pMenu.AttachUIComponent(newButton.gameObject);
                    newButton.transform.parent = loadGameButton.transform.parent.transform;

                    newButton.text                    = string.Format("{0}++", Locale.Get(LocaleID.LOADGAME_TITLE)); // locale is subtly different than what game uses...//loadGameButton.text);//
                    newButton.textColor               = new Color32(0xFF, 0, 0, 0xFF);
                    newButton.relativePosition        = Vector3.zero;
                    newButton.horizontalAlignment     = UIHorizontalAlignment.Center;
                    newButton.textHorizontalAlignment = UIHorizontalAlignment.Center;
                    newButton.verticalAlignment       = UIVerticalAlignment.Middle;
                    newButton.textVerticalAlignment   = UIVerticalAlignment.Middle;

                    newButton.transform.SetSiblingIndex(loadGameButton.transform.GetSiblingIndex());

                    // get rid of click handler that is hooked up as a result of cloning.  Note - probably not necessary, the issue was in the name and cachedname of the new button...
                    RemoveClickEvent(newButton);


                    // when hiding, pop modal that we pushed in eventClick handler
                    PanelWrapperForPauseMenu.eventVisibilityChanged += (component, visible) =>
                    {
                        if (visible)
                        {
                            PanelWrapperForPauseMenu.Refresh(); //need to ensure up to date
                            PanelWrapperForPauseMenu.Focus();
                        }
                    };

                    // hook up our click handler
                    newButton.eventClick += (component, param) =>
                    {
                        UIView.library.Hide(typeof(PauseMenu).Name);
                        PanelWrapperForPauseMenu.Show(true);
                    };
                }
            }
        }