예제 #1
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            SendLoadingStatus("Database downloading...");

            string html = GET(DataEndPoint);

            idols = Parser.ParseHtml(html, this);

            bool success = true;

            for (int i = 0; i < idols.Count; i++)
            {
                Idol   idol   = idols[i];
                Status status = DownloadImage(idol.ImageUrl, idol.Id);
                if (DownloadImage(idol.ImageUrl, idol.Id) == Status.Error)
                {
                    success = false;
                    break;
                }

                SendLoadingStatus(string.Format("Image downloading... {0} / {1}", i + 1, idols.Count));

                if (status == Status.OK)
                {
                    Thread.Sleep(Delay);
                }
            }

            if (!success)
            {
                idols = null;
            }
        }
예제 #2
0
        private static IdolSummary applyBonus2(Idol idol, Bonus bonus, bool isSupporter)
        {
            IdolSummary idolSummary = new IdolSummary();

            if (idol.Id < 0)
            {
                return(idolSummary);
            }

            int vocal  = bonus.GetAppeal(idol.Type, AppealType.Vocal);
            int dance  = bonus.GetAppeal(idol.Type, AppealType.Dance);
            int visual = bonus.GetAppeal(idol.Type, AppealType.Visual);

            vocal  = roundUp(idol.Vocal * vocal, 100);
            dance  = roundUp(idol.Dance * dance, 100);
            visual = roundUp(idol.Visual * visual, 100);

            if (isSupporter)
            {
                vocal  = roundUp(vocal * 5, 10);
                dance  = roundUp(dance * 5, 10);
                visual = roundUp(visual * 5, 10);
            }

            idolSummary.Id     = idol.Id;
            idolSummary.Skill  = idol.Skill;
            idolSummary.Appeal = vocal + dance + visual;
            idolSummary.Type   = idol.Type;

            return(idolSummary);
        }
        public void SetIdol(Idol idol, bool showSkill = true)
        {
            gridContent.Visibility = Visibility.Visible;
            ToolTip = Info.GetInfo(idol.Id);
            //ToolTip = Data.GetInfo(idol);

            try { image.Source = new BitmapImage(new Uri(FileSystem.GetImagePath(idol.Id))); }
            catch { }

            if (!showSkill)
            {
                gridSkill.Visibility = Visibility.Collapsed;
            }
            else
            {
                gridSkill.Visibility = Visibility.Visible;
                circle.Fill          = FindResource(string.Format("{0}Brush", idol.Skill)) as SolidColorBrush;

                string imageName = "";
                switch (idol.Skill)
                {
                case Skill.Score:
                case Skill.Combo:
                    imageName = "bonus.png";
                    break;

                case Skill.PerfectSupport:
                case Skill.ComboSupport:
                    imageName = "support.png";
                    break;

                case Skill.Heal:
                    imageName = "heal.png";
                    break;

                case Skill.Guard:
                    imageName = "guard.png";
                    break;

                case Skill.Overload:
                    imageName = "overload.png";
                    break;

                default:
                    gridSkill.Visibility = Visibility.Collapsed;
                    return;
                }

                string uri = string.Format("pack://application:,,,/StarlightStageProducer;component/Resources/{0}", imageName, UriKind.Absolute);
                skillImage.Source = new BitmapImage(new Uri(uri));
            }
        }
예제 #4
0
        public IdolView(Idol idol, int count)
        {
            InitializeComponent();

            this.idol = idol;
            setSelection(count);

            string path = FileSystem.GetImagePath(idol.Id);

            try { image.Source = new BitmapImage(new Uri(path)); }
            catch { }

            circle.Fill = FindResource(idol.Type + "Brush") as SolidColorBrush;
            ToolTip     = Info.GetInfo(idol.Id);
        }
예제 #5
0
        private void refresh(string text)
        {
            gridContent.Children.Clear();
            DictView.Clear();

            for (int i = 0; i < Data.Idols.Count; i++)
            {
                Idol idol = Data.Idols[i];

                IdolView view = new IdolView(idol, Data.GetCount(idol.Id));
                view.Margin        = new Thickness(70 * (i % 8), 70 * (i / 8), 0, 0);
                view.CheckChanged += CheckChanged;

                gridContent.Children.Add(view);
                DictView.Add(idol.Id, view);
            }

            refreshCount();
            refreshFilter(text);
        }
예제 #6
0
        private void addAllIdol(int cnt)
        {
            gridContent.Children.Clear();
            DictView.Clear();

            for (int i = 0; i < Data.Idols.Count; i++)
            {
                Idol idol = Data.Idols[i];
                if (idol.Rarity == Rarity.SSR)
                {
                    Data.ApplyCount(idol.Id, cnt);
                }

                IdolView view = new IdolView(idol, Data.GetCount(idol.Id));
                view.Margin        = new Thickness(70 * (i % 8), 70 * (i / 8), 0, 0);
                view.CheckChanged += CheckChanged;

                gridContent.Children.Add(view);
                DictView.Add(idol.Id, view);
            }

            refreshCount();
            refreshFilter("");
        }
예제 #7
0
        public static Deck CalculateBest(Burst burstMode, Type musicType)
        {
            if (musicType == Type.All && burstMode != Burst.None)
            {
                return(null);
            }

            List <Idol> guests = null;

            if (burstMode != Burst.None)
            {
                guests = new List <Idol>(new Idol[] { new Idol() });
            }
            else
            {
                guests = Idols.Where(i => i.RarityNumber == 8).ToList();
            }

            List <Idol> myIdols = Idols
                                  .Where(i => CountMap.ContainsKey(i.Id) &&
                                         CountMap[i.Id] > 0)
                                  .ToList();

            Deck        bestDeck = null;
            List <Deck> deckRank = new List <Deck>();

            foreach (Idol guest in guests)
            {
                foreach (Idol leader in myIdols)
                {
                    if (guest.CenterSkillCondition != leader.CenterSkillCondition)
                    {
                        continue;
                    }

                    Idol[] effectIdols = new Idol[] { leader, guest };

                    Bonus bonus = getBonus(musicType, burstMode, effectIdols);

                    IdolSummary nGuest  = applyBonus2(guest, bonus, false);
                    IdolSummary nLeader = applyBonus2(leader, bonus, false);

                    List <IdolSummary> members = new List <IdolSummary>();

                    int[] skillCount, typeCount;

                    if (leader.CenterSkillCondition == CenterSkillCondition.All)
                    {
                        typeCount = new int[] { 2, 1, 1, 1 };
                        if (typeCount[getTypeIndex(leader.Type)] != 0)
                        {
                            typeCount[getTypeIndex(leader.Type)]--;
                        }
                    }
                    else if (leader.CenterSkillCondition != CenterSkillCondition.None)
                    {
                        typeCount = new int[] { 0, 0, 0, 0 };
                        typeCount[getTypeIndex(leader.Type)] += 4;
                    }
                    else
                    {
                        typeCount = new int[] { 4, 0, 0, 0 }
                    };

                    skillCount = new int[SkillCount.Length + 1];
                    skillCount[getSkillIndex(Skill.Ignore)] = 5;
                    if (CheckSkill)
                    {
                        for (int i = 0; i < SkillCount.Length; i++)
                        {
                            skillCount[i] = SkillCount[i];
                            skillCount[getSkillIndex(Skill.Ignore)] -= SkillCount[i];
                        }
                    }
                    if (skillCount[getSkillIndex(leader.Skill)] != 0)
                    {
                        skillCount[getSkillIndex(leader.Skill)]--;
                    }
                    else if (skillCount[getSkillIndex(Skill.Ignore)] == 0)
                    {
                        continue;
                    }
                    else
                    {
                        skillCount[getSkillIndex(Skill.Ignore)]--;
                    }


                    members.AddRange(getRankedIdol(myIdols, leader.Id, skillCount, typeCount, bonus, 4));

                    Deck deck = new Deck(nGuest, nLeader, members);

                    if (bestDeck == null)
                    {
                        bestDeck = deck;
                    }
                    else if (bestDeck.isBetter(deck))
                    {
                        bestDeck = deck;
                    }
                }
            }

            if (bestDeck == null)
            {
                return(null);
            }

            Bonus supportBonus = getBonus(musicType, burstMode, null, true);

            List <IdolSummary> supporters = Idols
                                            .Where(i => getIdolLessCount(i.Id, bestDeck) > 0)
                                            .SelectMany(i => Enumerable.Repeat(i, getIdolLessCount(i.Id, bestDeck)))
                                            .Select(i => applyBonus2(i, supportBonus, true))
                                            .OrderByDescending(i => i.Appeal)
                                            .Take(10)
                                            .ToList();

            bestDeck.SetSupporters(supporters);

            return(bestDeck);
        }