Exemple #1
0
        private static void AddEvent(string command)
        {
            DateTime date;
            string   title;
            string   location;

            GetParameters(command, "AddEvent", out date, out title, out location);

            events.AddEvent(date, title, location);
        }
Exemple #2
0
 private void Setup()
 {
     StartScenes.ForEach(AddScene);
     eventContainer
     .AddEvent(PlayerHealthUpdate)
     .AddEvent(ScoreUpdate)
     .AddEvent(Hit)
     .AddEvent(SpecialUpdate)
     .AddEvent(PlayerBind)
     .AddEvent(ChangeLevel)
     .AddEvent(DestroyEnemy)
     .AddEvent(BossLaser)
     .AddEvent(PlayerDie)
     .AddEvent(BossDied)
     .AddEvent(BossSpawn);
 }
Exemple #3
0
        public static void Expand(this EventContainer container)
        {
            if (container is Element element)
            {
                if (element.TriggerList.Any())
                {
                    foreach (var t in element.TriggerList)
                    {
                        t.Expand();
                    }
                }

                if (element.LoopList.Any())
                {
                    foreach (var loop in element.LoopList)
                    {
                        loop.Expand();
                        var loopCount = loop.LoopCount;
                        var startTime = loop.StartTime;
                        for (int count = 0; count < loopCount; count++)
                        {
                            var fixedStartTime = startTime + (count * loop.MaxTime);
                            foreach (var e in loop.EventList)
                            {
                                element.AddEvent(
                                    e.EventType,
                                    e.Easing,
                                    fixedStartTime + e.StartTime, fixedStartTime + e.EndTime,
                                    e.Start, e.End
                                    );
                            }
                        }
                    }

                    element.LoopList.Clear();
                }
            }

            var events = container.EventList?.GroupBy(k => k.EventType);

            if (events == null)
            {
                return;
            }
            foreach (var kv in events)
            {
                List <CommonEvent> list = kv.ToList();
                for (var i = 0; i < list.Count - 1; i++)
                {
                    if (list[i].Start == list[i].End) // case 1
                    {
                        list[i].EndTime = list[i + 1].StartTime;
                    }

                    if (!list[i].EndTime.Equals(list[i + 1].StartTime)) // case 2
                    {
                        container.AddEvent(
                            list[i].EventType,
                            EasingType.Linear,
                            list[i].EndTime, list[i + 1].StartTime,
                            list[i].End, list[i].End
                            );
                    }
                }
            }
        }