public TaskQueueItemViewModel(IGameTask task, ITaskExecutioner executioner)
 {
     _task        = task;
     Cancel       = new DelegateCommand(CancelTask);
     _executioner = executioner;
     Name         = task.GetType().Name;
 }
Пример #2
0
 public AllianceBattleSettingsViewModel(IGame game,
                                        IUiRepository repo,
                                        ITaskExecutioner executioner,
                                        ISettings settings) : base()
 {
     _settings = settings;
 }
 public TimelineBattleSettingsViewModel(
     IGame game,
     IUiRepository repo,
     ITaskExecutioner taskExecutioner,
     ISettings settings) : base()
 {
     _settings = settings;
 }
Пример #4
0
 public LegendaryBattleSettingsViewModel(
     IGame game,
     IUiRepository repo,
     ITaskExecutioner taskExecutioner,
     ISettings settings) : base()
 {
     Settings = settings.LegendaryBattle;
 }
 public DimensionMissionSettingsViewModel(
     IGame game,
     IUiRepository repo,
     ITaskExecutioner taskExecutioner,
     ISettings settings) : base()
 {
     Settings = settings.DimensionMission;
 }
Пример #6
0
 public RoutineViewModel(Type taskType, IGame game, IUiRepository repo,
                         ITaskExecutioner taskExecutioner, ISettings settings, ITaskQueue queue)
 {
     TaskType                = taskType;
     _game                   = game;
     _repo                   = repo;
     _taskExecutioner        = taskExecutioner;
     _settings               = settings;
     _queue                  = queue;
     _queue.PropertyChanged += QueueOnPropertyChanged;
 }
Пример #7
0
        public TasksViewModel(ITaskQueue queue, IGame game, IUiRepository repo, ITaskExecutioner executioner, ISettings settings)
        {
            _queue                  = queue;
            _game                   = game;
            _repo                   = repo;
            _executioner            = executioner;
            _settings               = settings;
            AddAllToQueue           = new DelegateCommand(AddAll, CanExecuteRunRoutine);
            CancelCommand           = new DelegateCommand(CancelAll, CanExecuteCancel);
            Add                     = new DelegateCommand <Type>(AddToRoutine, CanAddToRoutine);
            Remove                  = new DelegateCommand <RoutineViewModel>(RemoveFromRoutine, CanRemoveFromRoutine);
            _queue.PropertyChanged += (_, _) => OnQueueChanged();
            OnQueueChanged();

            var types = new List <Type>();

            var entryAssembly        = Assembly.GetEntryAssembly();
            var referencedAssemblies = entryAssembly?.GetReferencedAssemblies();

            if (referencedAssemblies == null)
            {
                throw new Exception();
            }

            foreach (var referencedAssembly in referencedAssemblies)
            {
                var assembly = Assembly.Load(referencedAssembly);
                types.AddRange(assembly.GetTypes()
                               .Where(x => x.IsAssignableTo(typeof(IGameTask)) &&
                                      !x.IsAbstract &&
                                      x.IsPublic));
            }

            foreach (var type in types)
            {
                Tasks.Add(type);
            }

            if (settings.RoutineItems != null)
            {
                foreach (var routineViewModel in settings.RoutineItems.Where(x => types.Any(t => t.Name == x))
                         .Select((x, idx) =>
                {
                    var vm = new RoutineViewModel(types.FirstOrDefault(t => t.Name == x), game, repo, executioner,
                                                  settings, queue);
                    var state = settings.RoutineItemsState?.ElementAtOrDefault(idx);
                    bool.TryParse(state, out var isChecked);
                    vm.IsChecked = isChecked;
                    return(vm);
                }))
                {
                    routineViewModel.PropertyChanged += RoutineViewModelOnPropertyChanged;
                    RoutineItems.Add(routineViewModel);
                }
            }

            RoutineItems.CollectionChanged += RoutineItems_CollectionChanged;

            if (!RoutineItems.Any())
            {
                foreach (var routineViewModel in types.Where(x => x != typeof(AutoFight))
                         .Select(t => new RoutineViewModel(t, game, repo, executioner, settings, queue)))
                {
                    routineViewModel.PropertyChanged += RoutineViewModelOnPropertyChanged;
                    RoutineItems.Add(routineViewModel);
                }
            }

            AddAllToQueue.RaiseCanExecuteChanged();
        }
 public DangerRoomSettingsViewModel(IGame game, IUiRepository repo, ITaskExecutioner taskExecutioner, ISettings settings)
     : base()
 {
 }
Пример #9
0
 public WorldBossSettingsViewModel(IGame game, IUiRepository repo, ITaskExecutioner taskExecutioner, ISettings settings) : base()
 {
 }
 public CoopMissionSettingsViewModel(IGame game, IUiRepository repo, ITaskExecutioner taskExecutioner, ISettings settings)
     : base()
 {
 }
 public HeroicQuestSettingsViewModel(IGame game, IUiRepository repo, ITaskExecutioner taskExecutioner, ISettings settings)
     : base()
 {
 }
 public SquadBattleSettingsViewModel(IGame game, IUiRepository repo, ITaskExecutioner taskExecutioner, ISettings settings)
     : base()
 {
 }