Example #1
0
 private void UnregisterProperptyChanged(OwnedIdol idol)
 {
     if (idol != null)
     {
         (idol as INotifyPropertyChanged).PropertyChanged -= SkillTimeline_PropertyChanged;
     }
 }
Example #2
0
        private string GetSkillSummary(OwnedIdol idol)
        {
            if (idol == null)
            {
                return("編成されていません\r\n\r\n");
            }

            var name = string.Format("{0}[{1}]{2}({3})\r\n", string.IsNullOrEmpty(idol.Label) ? "" : string.Format("[{0}]", idol.Label),
                                     idol.Rarity.ToLocalizedString(), idol.Name,
                                     idol.Skill == null ? "特技なし" : string.Format("{0}Lv{1}", idol.Skill.Name, idol.SkillLevel));
            var skillEffect = idol.Skill == null ? "・" : GetSkillEffect(idol.Skill) + "・";
            var skillDetail = idol.Skill == null ? "" : GetSkillDetails(idol.Skill, idol.SkillLevel);

            if (SimulationResult == null)
            {
                return(name + skillEffect + skillDetail);
            }
            else
            {
                string triggerDetail = "";
                if (idol.Skill != null)
                {
                    int triggered = m_triggeredSkills.ContainsKey(idol.Oid) ? m_triggeredSkills[idol.Oid].Length : 0;
                    int expected  = (int)Math.Floor((SimulationResult.Duration - 1.0) / idol.Skill.Interval);
                    triggerDetail = $"{triggered}/{expected}回発動({((double)triggered / expected):P1})";
                }
                return(name + skillEffect + skillDetail + "\r\n" + triggerDetail);
            }
        }
Example #3
0
 public void RemoveIdolFromUnits(OwnedIdol idol)
 {
     TemporalUnit.RemoveIdol(idol);
     foreach (var x in Units)
     {
         x.RemoveIdol(idol);
     }
 }
Example #4
0
 public void Dispose()
 {
     OwnedIdol.Dispose();
     ImplementedIdol.Dispose();
     Units.Dispose();
     Potential.Dispose();
     Simulation.Dispose();
     m_config.Save();
 }
Example #5
0
        private void DrawTimeline(Canvas c, OwnedIdol idol)
        {
            c.Children.Clear();
            if (idol == null || idol.Skill == null || c.ActualHeight == 0)
            {
                return;
            }
            double interval      = idol.Skill.Interval;
            var    duration      = idol.Skill.EstimateDuration(idol.SkillLevel);
            var    playTime      = (SimulationResult == null? 120:SimulationResult.Duration) - 1;
            var    triggerCount  = (int)Math.Floor(playTime / interval);
            var    totalWidth    = c.ActualWidth;
            var    skillWidth    = (duration / playTime) * totalWidth;
            var    intervalWidth = (interval / playTime) * totalWidth;
            var    brush         = GetBrushBySkill(idol.Skill);
            var    disabled      = new SolidColorBrush(Colors.LightGray);
            bool   notAvail;

            for (int i = 1; i <= triggerCount; i++)
            {
                double left  = i * intervalWidth;
                double right = left + skillWidth;

                if (right > c.ActualWidth && skillWidth < (right - c.ActualWidth))
                {
                    break;
                }

                notAvail = SimulationResult != null && !(m_triggeredSkills.ContainsKey(idol.Oid) && m_triggeredSkills[idol.Oid].Any(x => Math.Round(x.Since) == i * interval));

                var rect = new Rectangle
                {
                    Fill    = notAvail? disabled : brush,
                    Width   = right > c.ActualWidth ? skillWidth - (right - c.ActualWidth) : skillWidth,
                    Height  = c.ActualHeight,
                    Opacity = 1
                };
                if (rect.Width < 5)
                {
                    left      -= 5 - rect.Width;
                    rect.Width = 5;
                }
                Canvas.SetLeft(rect, left);
                Canvas.SetTop(rect, 0);
                c.Children.Add(rect);
            }
        }
Example #6
0
 public void DeleteOwnedIdol(OwnedIdol idol)
 {
     m_config.OwnedIdols.Remove(idol);
     m_mvm.Units.RemoveIdolFromUnits(idol);
 }
Example #7
0
 public bool IsIdolInUse(OwnedIdol idol)
 {
     return(TemporalUnit.OccupiedByUnit(idol) || m_config.Units.Any(x => x.OccupiedByUnit(idol)));
 }