예제 #1
0
 public void OnUnload()
 {
     _MetaDetector.saveConfig();
     _MainWindow.Close();
     _MetaDetector = null;
     _MainWindow   = null;
     MetaLog.Info("Plugin Unload Successful");
 }
        public void OnLoad()
        {
            _MainWindow = new OpDeckWindow();

            _MetaDetectorMenuItem = new PluginMenu(_MainWindow);

            _MetaDetector = new MetaDetector(_MainWindow);

            _MainWindow.updateVersion(Version);

            GameEvents.OnTurnStart.Add(_MetaDetector.TurnStart);
            GameEvents.OnOpponentPlay.Add(_MetaDetector.OpponentPlay);
            GameEvents.OnGameStart.Add(_MetaDetector.GameStart);
            GameEvents.OnGameEnd.Add(_MetaDetector.GameEnd);

            //_MainWindow.Show();
            //_MainWindow.Visibility = System.Windows.Visibility.Hidden;
        }
        public MetaDetector(OpDeckWindow mainWindow)
        {
            _mainWindow    = new OpDeckWindow();
            _mainWindow    = mainWindow;
            _lastGuessDeck = new Deck();

            _metaDecks    = new List <Deck>();
            _matchedDecks = new List <Deck>();
            _statsUpdated = false;

            _opponentCardsPlayed = new List <Card>();

            _appConfig = MyConfig.Load();
            _appConfig.Save();
            MetaLog.Initialize();

            LoadMetaDecks();

            MetaLog.Info("Meta Detector Initialized");
        }
예제 #4
0
        public void OnLoad()
        {
            var xml = XDocument.Load(Config.Instance.DataDir + @"\plugins.xml");

            // Query the data and write out a subset of contacts

            /*var query = from c in xml.Root.Descendants("ArrayOfPluginSettings")
             *          where c.Element("FileName").Value.ToString() == "Plugins/MetaStats/MetaStats.dll"
             *          select c.Element("IsEnabled");*/

            var allPlugins = xml.Root.Descendants("PluginSettings").Where(x => x.Element("IsEnabled").Value == "true");

            //MetaLog.Info("Testing XML: " + allPlugins);

            foreach (var enabledPluging in allPlugins)
            {
                if (enabledPluging.Element("Name").Value.Trim() == "Meta Stats")
                {
                    VersionWindow _ver = new VersionWindow();
                    _ver.Show();
                    //throw new Exception("MetaStats Plugin already Enabled. Please Disable that first.");
                }
            }

            try
            {
                _MainWindow = new OpDeckWindow();

                _MetaDetectorMenuItem = new PluginMenu(_MainWindow);

                _MetaDetector = new MetaDetector(_MainWindow);

                _MainWindow.updateVersion(Version);

                GameEvents.OnGameStart.Add(_MetaDetector.GameStart);
                GameEvents.OnGameEnd.Add(_MetaDetector.GameEnd);

                GameEvents.OnTurnStart.Add(_MetaDetector.TurnStart);

                GameEvents.OnOpponentPlay.Add(_MetaDetector.OpponentPlay);
                GameEvents.OnOpponentDraw.Add(_MetaDetector.OpponentDraw);

                GameEvents.OnOpponentCreateInPlay.Add(_MetaDetector.OpponentCreateInPlay);
                GameEvents.OnOpponentCreateInDeck.Add(_MetaDetector.OpponentCreateInDeck);
                GameEvents.OnOpponentHeroPower.Add(_MetaDetector.OpponentHeroPower);
                GameEvents.OnOpponentSecretTriggered.Add(_MetaDetector.OpponentSecretTriggered);
                GameEvents.OnOpponentPlayToGraveyard.Add(_MetaDetector.OpponentPlayToGraveyard);
                GameEvents.OnOpponentMulligan.Add(_MetaDetector.OpponentMulligan);

                GameEvents.OnPlayerDraw.Add(_MetaDetector.PlayerDraw);
                GameEvents.OnPlayerPlay.Add(_MetaDetector.PlayerPlay);
                GameEvents.OnPlayerCreateInPlay.Add(_MetaDetector.PlayerCreateInPlay);
                GameEvents.OnPlayerCreateInDeck.Add(_MetaDetector.PlayerCreateInDeck);
                GameEvents.OnPlayerHeroPower.Add(_MetaDetector.PlayerHeroPower);
                GameEvents.OnPlayerMulligan.Add(_MetaDetector.PlayerMulligan);

                CheckForUpdate();

                //_MainWindow.Show();
                //_MainWindow.Visibility = System.Windows.Visibility.Hidden;
                MetaLog.Info("Plugin Load Successful");
            }
            catch (Exception ex)
            {
                MetaLog.Error(ex);
                MetaLog.Info("Plugin Load Unsuccessful");
            }
        }