public void PostEvent(Events.Base theevent) { if (theevent == null) { throw new ArgumentNullException(nameof(theevent)); } m_eventqueue.Enqueue(theevent); }
void RunEvents() { while (m_eventqueue.Count > 0) { Events.Base e = m_eventqueue.Dequeue(); if (e is Events.LoadReplay) { var ee = e as Events.LoadReplay; ReplayScreen.SetReplay(ee.Recording); GetMainSystem <Combat.FightEngine>().Set(ee.Recording.InitializationSettings); } if (e is Events.SwitchScreen) { var ee = e as Events.SwitchScreen; switch (ee.Screen) { case ScreenType.Select: SetScreen(SelectScreen); break; case ScreenType.Title: SetScreen(TitleScreen); break; case ScreenType.Versus: SetScreen(VersusScreen); break; case ScreenType.Combat: SetScreen(CombatScreen); break; case ScreenType.Replay: SetScreen(ReplayScreen); break; } } if (e is Events.FadeScreen) { var ee = e as Events.FadeScreen; switch (ee.Direction) { case FadeDirection.In: FadeInScreen(CurrentScreen); break; case FadeDirection.Out: FadeOutScreen(CurrentScreen); break; } } if (e is Events.SetupCombat) { var ee = e as Events.SetupCombat; GetMainSystem <Combat.FightEngine>().Set(ee.Initialization); VersusScreen.P1.Profile = ee.Initialization.P1.Profile; VersusScreen.P2.Profile = ee.Initialization.P2.Profile; } } }