Example #1
0
        public UnitViewModel(AppConfig config, MainViewModel mvm)
        {
            m_config = config;
            m_mvm = mvm;

            SendToSlotCommand = new DelegateCommand<string>(SendToSlot, x => SelectedIdol != null);
            SaveCommand = new DelegateCommand(Save, () => !string.IsNullOrEmpty(UnitName));
            DeleteCommand = new DelegateCommand(Delete, () => Units.Contains(SelectedUnit));
            MoveToSlotCommand = new DelegateCommand<string>(MoveToSlot, CanMoveToSlot);
            ResetSlotCommand = new DelegateCommand<string>(ResetSlot, CanResetSlot);
            HighlightCommand = new DelegateCommand<string>(Highlight, CanHighlight);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdol != null);
            SetGuestCenterCommand = new DelegateCommand(SetGuestCenter, () => SelectedIdol != null);
            CopyIidFromSlotCommand = new DelegateCommand<string>(CopyIidFromSlot);
            SetGuestCenterFromSlotCommand = new DelegateCommand<string>(SetGuestCenterFromSlot);

            Idols = new ListCollectionView(m_config.OwnedIdols);
            Filter = new IdolFilter(config, Idols, false);
            Filter.SetConfig(config.UnitIdolFilterConfig);

            Units = m_config.Units;

            TemporalUnit = new Unit();
            SelectedUnit = Units.FirstOrDefault();

            foreach (var option in config.UnitIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }
        }
Example #2
0
        public IdolFilter(AppConfig config, ICollectionView target, bool enableOwnedFilter=true,
            bool enableCategoryFilter=true, bool enableNameFilter=true, bool enableRarityFilter = true, 
            bool enableCenterEffectFilter = true, bool enableSkillFilter = true, bool enableOwnedOnlyFilter=false)
        {
            m_config = config;
            m_target = target;
            target.Filter = FilterIdols;
            EnableOwnedFilter = enableOwnedFilter;
            EnableRarityFilter = enableRarityFilter;
            EnableCenterEffectFilter = enableCenterEffectFilter;
            EnableSkillFilter = enableSkillFilter;
            EnableCategoryFilter = enableCategoryFilter;
            EnableNameFilter = enableNameFilter;
            EnableOwnedOnlyFilter = enableOwnedOnlyFilter;

            IdolTypes = new List<Tuple<IdolCategory, string>>
            {
                Tuple.Create(IdolCategory.All,"全部"),
                Tuple.Create(IdolCategory.Cute,"キュート"),
                Tuple.Create(IdolCategory.Cool,"クール"),
                Tuple.Create(IdolCategory.Passion,"パッション")
            };
            TypeFilter = IdolCategory.All;

            Rarities = typeof(Rarity).GetEnumValues().Cast<Rarity?>().Reverse().Select(x => Tuple.Create(x, x.Value.ToLocalizedString())).ToList();
            Rarities.Insert(0, Tuple.Create(new Rarity?(), "全部"));

            CenterEffects = new List<Tuple<Type, string>>
            {
                Tuple.Create((Type)null,"全部"),
                Tuple.Create(typeof(CenterEffect.AppealUp),"アピールアップ"),
                Tuple.Create(typeof(CenterEffect.SkillTriggerProbabilityUp),"スキル発動率アップ"),
                Tuple.Create(typeof(CenterEffect.LifeUp),"ライフアップ"),
                Tuple.Create(typeof(CenterEffect.ConditionalAppealUp),"条件付きアピールアップ"),
            };


            Skills = new List<Tuple<Type, string>>
            {
                Tuple.Create((Type)null,"全部"),
                Tuple.Create(typeof(Skill.ScoreBonus),"スコアボーナス"),
                Tuple.Create(typeof(Skill.ComboBonus),"コンボボーナス"),
                Tuple.Create(typeof(Skill.JudgeEnhancement),"判定強化"),
                Tuple.Create(typeof(Skill.ComboContinuation),"コンボ継続"),
                Tuple.Create(typeof(Skill.Revival),"ライフ回復"),
                Tuple.Create(typeof(Skill.DamageGuard),"ダメージガード"),
                Tuple.Create(typeof(Skill.Overload),"オーバーロード")
            };
        }
Example #3
0
        public OwnedIdolViewModel(AppConfig config, UnitViewModel uvm)
        {
            m_config = config;
            m_uvm = uvm;
            Idols = new ListCollectionView(config.OwnedIdols);
            Filter = new IdolFilter(config, Idols, false);
            Filter.SetConfig(config.OwnedIdolFilterConfig);

            foreach (var option in config.OwnedIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }

            DeleteCommand = new DelegateCommand(Delete, () => SelectedIdols.Count > 0);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdols != null && SelectedIdols.Count == 1);
        }
Example #4
0
        public MainViewModel()
        {
            try
            {
                m_config = AppConfig.Load();
            }
            catch(Exception e)
            {
                MessageBox.Show($"app.configを読み込めませんでした:{e.Message}");
                Application.Current.Shutdown();
            }

            Units = new UnitViewModel(m_config);
            OwnedIdol = new OwnedIdolViewModel(m_config,Units);
            ImplementedIdol = new ImplementedIdolViewModel(m_config, OwnedIdol);
            Simulation = new SimulationViewModel(m_config);
        }
Example #5
0
        public ImplementedIdolViewModel(AppConfig config, OwnedIdolViewModel ovm)
        {
            m_config = config;
            m_ovm = ovm;

            Idols = new ListCollectionView(m_config.ImplementedIdols);
            Filter = new IdolFilter(config, Idols, true);
            Filter.SetConfig(config.ImplementedIdolFilterConfig);

            foreach(var option in m_config.ImplementedIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }

            ReloadDataCommand = new AwaitableDelegateCommand(ReloadData);
            AddToOwnedCommand = new DelegateCommand(AddToOwned, () => SelectedIdols!=null && SelectedIdols.Count > 0);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdols != null && SelectedIdols.Count ==1);
        }
Example #6
0
        public PotentialViewModel(AppConfig config)
        {
            m_config = config;
            PotentialData = new ListCollectionView(config.PotentialData);
            Filter = new IdolFilter(config, PotentialData,
                enableCenterEffectFilter: false,
                enableOwnedFilter: false,
                enableRarityFilter: false,
                enableSkillFilter: false,
                enableOwnedOnlyFilter: true
            );
            Filter.SetConfig(config.PotentialFilterConfig);

            foreach (var option in config.PotentialSortOptions)
            {
                PotentialData.SortDescriptions.Add(option.ToSortDescription());
            }
        }
Example #7
0
        public SimulationViewModel(AppConfig config)
        {
            m_config = config;

            if(config.Songs==null)
            {
                config.Songs = new List<Song>();
            }

            Songs = config.Songs;
            LoadSongsCommand = new AwaitableDelegateCommand(LoadSongs);

            Simulator = new Simulator(config);

            GrooveBursts = new List<Tuple<AppealType?, string>>
            {
               Tuple.Create(new AppealType?(),"なし" ),
               Tuple.Create((AppealType?)AppealType.Vocal,"Vo 150%"),
               Tuple.Create((AppealType?)AppealType.Dance,"Da 150%"),
               Tuple.Create((AppealType?)AppealType.Visual,"Vi 150%")
            };

            GrooveTypes = new List<Tuple<IdolCategory, string>>
            {
               Tuple.Create(IdolCategory.Cute, "Cu 30%"),
               Tuple.Create(IdolCategory.Cool, "Co 30%"),
               Tuple.Create(IdolCategory.Passion, "Pa 30%")
            };

            SkillControls = new List<Tuple<SkillTriggerControl, string>>
            {
                Tuple.Create(SkillTriggerControl.Auto, "制御しない"),
                Tuple.Create(SkillTriggerControl.AlwaysTrigger, "100%発動する"),
                Tuple.Create(SkillTriggerControl.NeverTrigger, "発動しない"),
            };

            StartSimulationCommand = new AwaitableDelegateCommand(StartSimulation);

            Simulator.Song = Songs.FirstOrDefault();
            Simulator.Unit = Units.FirstOrDefault();
        }
Example #8
0
 public Simulator(AppConfig config)
 {
     m_config = config;
     GrooveType = IdolCategory.Cute;
 }
Example #9
0
        public SimulationViewModel(AppConfig config)
        {
            m_config = config;

            if (config.Songs == null)
            {
                config.Songs = new List<Song>();
            }

            Songs = config.Songs;
            LoadSongsCommand = new AwaitableDelegateCommand(LoadSongs);

            Simulator = new Simulator(config);

            GrooveBursts = new List<Tuple<AppealType?, string>>
            {
               Tuple.Create(new AppealType?(),"なし" ),
               Tuple.Create((AppealType?)AppealType.Vocal,"Vo 150%"),
               Tuple.Create((AppealType?)AppealType.Dance,"Da 150%"),
               Tuple.Create((AppealType?)AppealType.Visual,"Vi 150%")
            };

            GrooveTypes = new List<Tuple<IdolCategory, string>>
            {
               Tuple.Create(IdolCategory.Cute, "Cu 30%"),
               Tuple.Create(IdolCategory.Cool, "Co 30%"),
               Tuple.Create(IdolCategory.Passion, "Pa 30%")
            };

            SkillControls = new List<Tuple<SkillTriggerControl, string>>
            {
                Tuple.Create(SkillTriggerControl.Auto, "制御しない"),
                Tuple.Create(SkillTriggerControl.AlwaysTrigger, "100%発動する"),
                Tuple.Create(SkillTriggerControl.NeverTrigger, "発動しない"),
            };

            StartSimulationCommand = new AwaitableDelegateCommand(StartSimulation);

            Runs = config.SimulatorConfig.Runs;
            EnableGuest = config.SimulatorConfig.EnableGuest;
            Simulator.EnableRoomEffect = config.SimulatorConfig.EnableRoomEffect;
            Simulator.EnableSupportMembers = config.SimulatorConfig.EnableSupportMembers;
            Simulator.SkillControl = config.SimulatorConfig.SkillControl;

            var song = Songs.FirstOrDefault(x => x.Title == config.SimulatorConfig.SongTitle);
            if (song != null)
            {
                Simulator.Song = song;
                var data = Simulator.SongDataList.FirstOrDefault(x => x.Difficulty == config.SimulatorConfig.SongDifficulty);
                if (data != null)
                {
                    Simulator.SongData = data;
                }
            }
            else
            {
                Simulator.Song = Songs.FirstOrDefault();
            }

            var unit = Units.FirstOrDefault(x => x.Name == config.SimulatorConfig.UnitName);
            if (unit != null)
            {
                Simulator.Unit = unit;
            }
            else
            {
                Simulator.Unit = Units.FirstOrDefault();
            }

            Simulator.GrooveBurst = config.SimulatorConfig.GrooveBurst;
            if(Simulator.GrooveBurst!=null)
            {
                Simulator.GrooveType = config.SimulatorConfig.GrooveType;
            }

            GuestIid = config.SimulatorConfig.GuestIid;
            Simulator.GuestPotential = config.SimulatorConfig.GuestPotential;

            UtilizeActualPattern = config.SimulatorConfig.UtilizeActualPattern.GetValueOrDefault(true);

            CopyIidCommand = new DelegateCommand<int?>(CopyIid);
            SetGuestCenterCommand = new DelegateCommand<int?>(SetGuestCenter);
        }
Example #10
0
        public static AppConfig Load()
        {
            AppConfig config = null;
            if(!File.Exists("app.config"))
            {
                config = new AppConfig();
            }
            else
            {
                using (var fs = File.OpenRead("app.config"))
                {
                    config = (AppConfig)m_serializer.ReadObject(fs);
                }
            }

            if (config.PotentialData == null)
            {
                config.PotentialData = new ObservableCollection<Potential>();
            }

            if (config.ImplementedIdols.Count > 0 && config.PotentialData.Count == 0)
            {
                var idolList = config.ImplementedIdols.GroupBy(x => x.Name)
                    .Select(x => new Potential { Category = x.First().Category, Name = x.Key });

                foreach (var x in idolList)
                {
                    config.PotentialData.Add(x);
                }
            }

            config.ImplementedIdols.CollectionChanged += (sender, e) =>
            {
                if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                {
                    foreach (var idol in e.NewItems.OfType<Idol>())
                    {
                        if (!config.PotentialData.Any(x => x.Name == idol.Name))
                        {
                            config.PotentialData.Add(new Potential { Category = idol.Category, Name = idol.Name });
                        }
                    }
                }
            };

            if(config.PotentialSortOptions==null)
            {
                config.PotentialSortOptions = new List<SortOption>()
                {
                     new SortOption { Column=nameof(IIdol.Name), Direction=ListSortDirection.Ascending }
                };
            }

            if(config.SimulatorConfig==null)
            {
                config.SimulatorConfig = new Core.SimulatorConfig
                {
                    EnableGuest=true,
                    EnableRoomEffect=true,
                    EnableSupportMembers=true,
                    GrooveType=IdolCategory.Cute,
                    UtilizeActualPattern=true,
                    GuestPotential = new Potential { Category = IdolCategory.All },
                    Runs=1000
                };
            }

            if(config.SimulatorConfig.Runs<=0)
            {
                config.SimulatorConfig.Runs = 1000;
            }

            return m_current = config;
        }
Example #11
0
 public Simulator(AppConfig config)
 {
     m_config   = config;
     GrooveType = IdolCategory.Cute;
 }