コード例 #1
0
 // Initialize stuff, display the window, empty out category, quest and start count and set the source of quest dropdown to the ObservableCollection
 public QuestSelection(QuestTracker _tracker)
 {
     InitializeComponent();
     this.tracker = _tracker;
     this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
     this.Visibility            = Visibility.Visible;
     this.category     = "";
     this.quest        = "";
     this.start_number = 0;
     this.quest_list   = new ObservableCollection <ComboBoxItem>();
     // The second comboBox source is set to the ObservableCollection so that it is dynamic and any changes are reflected
     comboQuest.ItemsSource = quest_list;
 }
コード例 #2
0
        public void OnLoad()
        {
            // When it's loaded upon each restart/turned on by the user
            Log.Info("Hello from quest this is load");

            // Overlay created and added on plugin load
            overlay = new QuestOverlay();
            CoreAPI.OverlayCanvas.Children.Add(overlay);

            // Overlay added to tracker object on initialization so that it could be modified
            QuestTracker tracker = new QuestTracker(overlay);

            // Mapping GameEvents from API.GameEvents
            GameEvents.OnGameStart.Add(tracker.GameStart);
            GameEvents.OnTurnStart.Add(tracker.TurnStart);
            GameEvents.OnPlayerPlay.Add(tracker.CardPlay);
            GameEvents.OnGameEnd.Add(tracker.GameEnd);
            GameEvents.OnPlayerHeroPower.Add(tracker.HeroPower);
            GameEvents.OnPlayerDraw.Add(tracker.PlayerDraw);

            // Adding Choose Quest menu label
            this.menuItem = new MenuItem()
            {
                Header = "Choose Quests"
            };
            // Adding Click event to menuitem which just initializes the QuestSelection overlay
            this.menuItem.Click += (sender, e) => {
                var x = new QuestSelection(tracker);
            };

            /*var chooseclass = new MenuItem() {Header = "Class"};
             * var warrior = new MenuItem() {Header = "Warrior"};
             * warrior.Click += (sender, e) => tracker.SetQuest("Warrior");
             * var shaman = new MenuItem() {Header = "Shaman"};
             * shaman.Click += (sender, e) => tracker.SetQuest("Shaman");
             * var rogue = new MenuItem() {Header = "Rogue"};
             * rogue.Click += (sender, e) => tracker.SetQuest("Rogue");
             * var paladin = new MenuItem() {Header = "Paladin"};
             * paladin.Click += (sender, e) => tracker.SetQuest("Paladin");
             * var hunter = new MenuItem() {Header = "Hunter"};
             * hunter.Click += (sender, e) => tracker.SetQuest("Hunter");
             * var druid = new MenuItem() {Header = "Druid"};
             * druid.Click += (sender, e) => tracker.SetQuest("Druid");
             * var warlock = new MenuItem() {Header = "Warlock"};
             * warlock.Click += (sender, e) => tracker.SetQuest("Warlock");
             * var mage = new MenuItem() {Header = "Mage"};
             * mage.Click += (sender, e) => tracker.SetQuest("Mage");
             * var priest = new MenuItem() {Header = "Priest"};
             * priest.Click += (sender, e) => tracker.SetQuest("Priest");
             * chooseclass.Items.Add(warrior);
             * chooseclass.Items.Add(shaman);
             * chooseclass.Items.Add(rogue);
             * chooseclass.Items.Add(paladin);
             * chooseclass.Items.Add(hunter);
             * chooseclass.Items.Add(druid);
             * chooseclass.Items.Add(warlock);
             * chooseclass.Items.Add(mage);
             * chooseclass.Items.Add(priest);
             * menuItem.Items.Add(chooseclass);
             */
        }