public void OnLoad()
        {
            // create overlay and insert into HDT overlay
            _overlay            = new BgMatchOverlay();
            _view               = new View();
            BgMatchData.Overlay = _overlay;
            BgMatchData.View    = _view;
            Core.OverlayCanvas.Children.Add(_overlay);


            // Triggered upon startup and when the user ticks the plugin on
            GameEvents.OnGameStart.Add(BgMatchData.GameStart);
            GameEvents.OnTurnStart.Add(BgMatchData.TurnStart);
            GameEvents.OnGameEnd.Add(BgMatchData.GameEnd);
            GameEvents.OnGameEnd.Add(BgMatchData.InMenu);



            if (File.Exists(Config._configLocation))
            {
                // load config from file, if available
                config = JsonConvert.DeserializeObject <Config>(File.ReadAllText(Config._configLocation));
            }
            else
            { // create config file
                config = new Config();
                config.save();
            }


            BgMatchData.OnLoad(config);
            if (config.showStatsOverlay)
            {
                MountOverlay();
            }

            _settingsFlyout          = new Flyout();
            _settingsFlyout.Name     = "BgSettingsFlyout";
            _settingsFlyout.Position = Position.Left;
            Panel.SetZIndex(_settingsFlyout, 100);
            _settingsFlyout.Header  = "BoonwinsBattlegroundTracker Settings";
            _settingsControl        = new SettingsControl(config, MountOverlay, UnmountOverlay);
            _settingsFlyout.Content = _settingsControl;
            //_settingsFlyout.ClosingFinished += (sender, args) =>
            //{
            //    config.save();
            //};
            Core.MainWindow.Flyouts.Items.Add(_settingsFlyout);
        }
Пример #2
0
        public void OnLoad()
        {
            // create overlay and insert into HDT overlay
            AutoUpdate();
            CreateDateFileEnviroment();

            _overlay = new BgMatchOverlay();
            _view    = new View();
            _tribes  = new TribesOverlay();
            _inGameDisconectorOverlay = new InGameDisconectorOverlay();

            _console       = new ConsoleOverlay();
            _simpleOverlay = new SimpleOverlay();

            BgMatchData._overlay             = _overlay;
            BgMatchData._view                = _view;
            BgMatchData._tribes              = _tribes;
            BgMatchData._cheatButtonForNoobs = _inGameDisconectorOverlay;

            //BgMatchData._console = _console;
            BgMatchData._simpleOverlay = _simpleOverlay;

            // Triggered upon startup and when the user ticks the plugin on
            GameEvents.OnGameStart.Add(BgMatchData.GameStart);
            GameEvents.OnInMenu.Add(BgMatchData.InMenu);
            GameEvents.OnTurnStart.Add(BgMatchData.TurnStart);
            GameEvents.OnGameEnd.Add(BgMatchData.GameEnd);



            BgMatchData.OnLoad(_config);



            if (_config.showStatsOverlay)
            {
                MountOverlay();
            }
            _overlayManager      = new OverlayManager(_overlay, _config);
            _tribeOverlayManager = new TriverOverlayManager(_tribes, _config);

            BgMatchData._input      = _overlayManager;
            BgMatchData._tribeInput = _tribeOverlayManager;


            Canvas.SetTop(_overlay, _config.posTop);
            Canvas.SetLeft(_overlay, _config.posLeft);

            Canvas.SetTop(_inGameDisconectorOverlay, 50);
            Canvas.SetLeft(_inGameDisconectorOverlay, 300);

            Canvas.SetTop(_tribes, _config.tribePosTop);
            Canvas.SetLeft(_tribes, _config.tribePosLeft);



            _settingsFlyout          = new Flyout();
            _settingsFlyout.Name     = "BgSettingsFlyout";
            _settingsFlyout.Position = Position.Left;
            Panel.SetZIndex(_settingsFlyout, 100);
            _settingsFlyout.Header  = "BoonwinsBattlegroundTracker Settings";
            _settingsControl        = new SettingsControl(_config, MountOverlay, UnmountOverlay);
            _settingsFlyout.Content = _settingsControl;
            //_settingsFlyout.ClosingFinished += (sender, args) =>
            //{
            //    config.save();
            //};
            Core.MainWindow.Flyouts.Items.Add(_settingsFlyout);
        }