void Instance_ProgramEvent(ProgramEvent e) { if (e.Type == ProgramEventType.StartPlayingMap) { StartPlayingMap((ProgramEvents.StartPlayingMap)e); } else if (e.Type == ProgramEventType.StopPlayingMap) { StopPlayingMap((ProgramEvents.StopPlayingMap)e); } else if (e.Type == ProgramEventType.DestructibleKilled) { if (((ProgramEvents.DestructibleKilled)e).Perpetrator is Client.Game.Map.Units.MainCharacter) { var key = ((ProgramEvents.DestructibleKilled)e).Destructible.GetType().Name; int n; if (!NumberOfKilledUnits.TryGetValue(key, out n)) { n = 0; } NumberOfKilledUnits[key] = n + 1; } } else if (e.Type == ProgramEventType.StageCompleted) { var si = ((ProgramEvents.StageCompleted)e).Stage; var bs = GetBestStage(currentMapFileName, si.Stage) ?? si; Dictionary <int, Game.Interface.StageInfo> s; if (!bestStages.TryGetValue(currentMapFileName, out s)) { bestStages[currentMapFileName] = s = new Dictionary <int, Client.Game.Interface.StageInfo>(); } s[si.Stage] = new Client.Game.Interface.StageInfo { HitPoints = Math.Max(si.HitPoints, bs.HitPoints), MaxHitPoints = si.MaxHitPoints, Rage = Math.Max(si.Rage, bs.Rage), Ammo = Math.Max(si.Ammo, bs.Ammo), Time = Math.Min(si.Time, bs.Time), Stage = si.Stage }; Save(); } else if (e.Type == ProgramEventType.ProgramStateChanged) { if (Program.Instance.ProgramState is ProgramStates.ProfileMenuState) { if (!HasDisplayedGameCompletedDialog && IsCompleted("LevelL")) { HasDisplayedGameCompletedDialog = true; Dialog.Show(Locale.Resource.MenuGameCompletedDialogTitle, Locale.Resource.MenuGameCompletedDialogText); } } } }
void Instance_ProgramEvent(ProgramEvent e) { foreach (var v in popups) { if (!v.Completed) { v.HandleEvent(e); } } }
void Instance_ProgramEvent(ProgramEvent e) { if (e.Type == ProgramEventType.MainCharacterRageLevel) { rageLevelGained.Add(new PointF(Game.Game.Instance.GameTime - timeOff, ((ProgramEvents.MainCharacterRageLevel)e).RageLevel)); Invalidate(); } if (e.Type == ProgramEventType.MainCharacterStrike) { if (timeOff == 0) { timeOff = Game.Game.Instance.GameTime; rageLevelGained.Add(new PointF(Game.Game.Instance.GameTime - timeOff, 1)); } } }
void Instance_ProgramEvent(ProgramEvent e) { if (e.Type == ProgramEventType.StartPlayingMap) StartPlayingMap((ProgramEvents.StartPlayingMap)e); else if (e.Type == ProgramEventType.StopPlayingMap) StopPlayingMap((ProgramEvents.StopPlayingMap)e); else if (e.Type == ProgramEventType.DestructibleKilled) { if (((ProgramEvents.DestructibleKilled)e).Perpetrator is Client.Game.Map.Units.MainCharacter) { var key = ((ProgramEvents.DestructibleKilled)e).Destructible.GetType().Name; int n; if (!NumberOfKilledUnits.TryGetValue(key, out n)) n = 0; NumberOfKilledUnits[key] = n + 1; } } else if (e.Type == ProgramEventType.StageCompleted) { var si = ((ProgramEvents.StageCompleted)e).Stage; var bs = GetBestStage(currentMapFileName, si.Stage) ?? si; Dictionary<int, Game.Interface.StageInfo> s; if (!bestStages.TryGetValue(currentMapFileName, out s)) bestStages[currentMapFileName] = s = new Dictionary<int, Client.Game.Interface.StageInfo>(); s[si.Stage] = new Client.Game.Interface.StageInfo { HitPoints = Math.Max(si.HitPoints, bs.HitPoints), MaxHitPoints = si.MaxHitPoints, Rage = Math.Max(si.Rage, bs.Rage), Ammo = Math.Max(si.Ammo, bs.Ammo), Time = Math.Min(si.Time, bs.Time), Stage = si.Stage }; Save(); } else if (e.Type == ProgramEventType.ProgramStateChanged) { if (Program.Instance.ProgramState is ProgramStates.ProfileMenuState) { if (!HasDisplayedGameCompletedDialog && IsCompleted("LevelL")) { HasDisplayedGameCompletedDialog = true; Dialog.Show(Locale.Resource.MenuGameCompletedDialogTitle, Locale.Resource.MenuGameCompletedDialogText); } } } }
public void SignalEvent(ProgramEvent e) { if (ProgramEvent != null) ProgramEvent(e); }
void Instance_ProgramEvent(ProgramEvent e) { eventLogListBox.Items.Add(e); }
public abstract void HandleEvent(ProgramEvent e);
void Instance_ProgramEvent(ProgramEvent e) { if (!Program.Settings.AchievementsEnabled) return; if (!enabled) return; foreach (var v in achievements) { bool completed = v.Completed; if (!completed) { v.HandleEvent(e); if (completed != v.Completed && v.Completed) { AchievementUnlockedPopup.displayedAchievements++; if (Program.Settings.DisplayAchievements) { Program.Instance.AchievementsContainer.AddChild(new AchievementUnlockedPopup { Description = v.Description, DisplayName = v.DisplayName }); Program.Instance.SoundManager.GetSFX(Client.Sound.SFX.AchievementEarned1).Play(new Sound.PlayArgs()); } var a = v; Program.Instance.SignalEvent(new ProgramEvents.AchievementEarned { Achievement = a }); if (Changed != null) Changed(this, null); } } } }