示例#1
0
        public Timeline(string name, List <TimelineActivity> items_, List <TimelineAnchor> anchors_, List <ActivityAlert> alerts_, AlertSoundAssets soundAssets)
        {
            Name  = name;
            items = items_;
            int i = 0;

            foreach (TimelineActivity a in items_)
            {
                a.Index = i++;
            }
            items.Sort(TimelineActivity.CompareByEndTime);
            itemsEndTime = items.Select(a => a.EndTime).ToList();

            anchors     = anchors_.OrderBy(anchor => anchor.TimeFromStart).ToList();
            anchorsTree = new IntervalTree.IntervalTree <double, TimelineAnchor>();
            foreach (TimelineAnchor a in anchors)
            {
                anchorsTree.Add(a.Interval, a);
            }

            alerts = alerts_;
            alerts.Sort();
            alertsTimeFromStart = alerts.Select(a => a.TimeFromStart).ToList();
            AlertSoundAssets    = soundAssets;

            EndTime = Items.Any() ? Items.Last().EndTime : 0;
        }
        /*--- Method: public ------------------------------------------------------------------------------------------------------------------------------------------*/

        /// <summary> タイムラインデータを生成します。
        /// </summary>
        /// <param name="pName"> タイムライン名 </param>
        /// <param name="pActivityList"> アクティビティリスト </param>
        /// <param name="pAnchorList"> アンカーリスト </param>
        /// <param name="pAlertList"> アラートリスト </param>
        /// <param name="pSoundAssets"> サウンドアセット </param>
        public void SetTimelineData(string pName, List <TimelineActivityData> pActivityList, List <TimelineAnchorData> pAnchorList, List <TimelineAlertObjectModel> pAlertList, AlertSoundAssets pSoundAssets)
        {
            this.Name             = pName;
            this.AlertSoundAssets = pSoundAssets;

            pAlertList.Sort();
            this.AlertList = pAlertList;

            this.AnchorList = pAnchorList.OrderBy(anchor => anchor.TimeFromStart).ToList();
            anchorsTree     = new IntervalTree.IntervalTree <double, TimelineAnchorData>();
            foreach (TimelineAnchorData a in this.AnchorList)
            {
                anchorsTree.Add(a.Interval, a);
            }

            int i = 0;

            pActivityList.Sort(TimelineActivityData.CompareByEndTime);
            foreach (TimelineActivityData a in pActivityList)
            {
                a.Index              = i++;
                a.TimerData          = this.TimerData;
                a.TimelineAlert      = this.AlertList.FirstOrDefault(s => s.Activity == a);
                a.TimelineAnchorData = this.AnchorList.FirstOrDefault(anc => anc.TimeFromStart == a.TimeFromStart);
                this.ActivityCollection.Add(a);
                this.TimerData.CombatTimeChangedRefreshList.Add(a);
            }

            this.activityEndTimeList = this.ActivityCollection.Select(a => a.EndTime).ToList();



            alertsTimeFromStart = AlertList.Select(a => a.TimeFromStart).ToList();

            this.EndTime = this.ActivityCollection.Any() ? this.ActivityCollection.Last().EndTime : 0;

            this.TimerData.CurrentCombatEndTime = this.EndTime;
        }