public ScenarioPokemonViewModel(
        IJumpService jumpService,
        IScenarioWarriorService scenarioWarriorService,
        IIdToNameService idToNameService)
    {
        _model = new ScenarioPokemon();;

        JumpToPokemonCommand      = new RelayCommand <int>(id => jumpService.JumpTo(PokemonSelectorEditorModule.Id, id));
        JumpToAbilityCommand      = new RelayCommand <int>(id => jumpService.JumpTo(AbilitySelectorEditorModule.Id, id));
        JumpToFirstWarriorCommand = new RelayCommand(() =>
        {
            int i = 0;
            foreach (var sw in scenarioWarriorService.Retrieve((int)_scenario).Enumerate())
            {
                if (!sw.ScenarioPokemonIsDefault(0) && sw.GetScenarioPokemon(0) == _id)
                {
                    jumpService.JumpToNested(ScenarioWarriorSelectorEditorModule.Id, (int)_scenario, i);
                    return;
                }
                i++;
            }
        });

        PokemonItems = idToNameService.GetComboBoxItemsExceptDefault <IPokemonService>();
        PokemonItems.Add(new SelectorComboBoxItem(511, "Default"));
        AbilityItems = idToNameService.GetComboBoxItemsPlusDefault <IAbilityService>();
    }
Esempio n. 2
0
    private static IEnumerable <ChangeInfo> GetScenarioWarriorChangelist(IScenarioWarriorService beforeService, IScenarioWarriorService afterService)
    {
        List <ChangeInfo> changelist = new();

        PropertyInfo[] props = typeof(ScenarioWarrior).GetProperties().Where(i => i.PropertyType.IsValueType).ToArray();

        foreach (var scenario in EnumUtil.GetValues <ScenarioId>())
        {
            foreach (int i in beforeService.Retrieve((int)scenario).ValidIds())
            {
                var beforeObj = beforeService.Retrieve((int)scenario).Retrieve(i);
                var afterObj  = afterService.Retrieve((int)scenario).Retrieve(i);

                foreach (var prop in props)
                {
                    var beforeVal = prop.GetValue(beforeObj);
                    var afterVal  = prop.GetValue(afterObj);
                    if (!beforeVal.Equals(afterVal))
                    {
                        changelist.Add(new("ScenarioWarrior", $"Scenario_{scenario}_Id_{i}", prop.Name, beforeVal.ToString(), afterVal.ToString()));
                    }
                }
            }
        }

        return(changelist);
    }
Esempio n. 3
0
    /// <summary>
    /// Load all the required stuff into memory
    /// </summary>
    private void Init(IServiceGetter services)
    {
        _moveService            = services.Get <IMoveService>();
        _moveRangeService       = services.Get <IMoveRangeService>();
        _pokemonService         = services.Get <IPokemonService>();
        _scenarioPokemonService = services.Get <IScenarioPokemonService>();
        _scenarioWarriorService = services.Get <IScenarioWarriorService>();

        _moveRangeService = services.Get <IMoveRangeService>();
    }