private void menuSelection(LocalEventNotifier.Event e) { MenuElementSelectedEvent menuSelectionEvent = e as MenuElementSelectedEvent; if (menuSelectionEvent.Element == _menuElement) { if (this.SlotType != WeaponData.Slot.Empty) { if (ProgressData.GetPointsForPlayer(this.PlayerIndex) >= _cost) { ProgressData.SmartSlot[] smartSlots = ProgressData.GetSmartSlots(this.PlayerIndex); bool ok = true; for (int i = 0; i < smartSlots.Length; ++i) { if (smartSlots[i].SlotType == this.SlotType) { ok = smartSlots[i].Level < WeaponData.GetMaxSlotsByType()[this.SlotType] || smartSlots[i].Ammo < WeaponData.GetSlotDurationsByType()[this.SlotType]; break; } } if (ok) { this.SelectionImage.color = _normalColor; ProgressData.ApplyPointsDeltaForPlayer(this.PlayerIndex, -_cost); ProgressData.PickupSlot(this.PlayerIndex, this.SlotType); GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(this.PlayerIndex, -_cost)); updateDisplay(); } else { this.SelectionImage.color = this.NotEnoughColor; } } else { this.SelectionImage.color = this.NotEnoughColor; } } else if (ProgressData.GetHealthForPlayer(this.PlayerIndex) < ProgressData.MAX_HEALTH && ProgressData.GetPointsForPlayer(this.PlayerIndex) >= _cost) { this.SelectionImage.color = _normalColor; ProgressData.SetHealthForPlayer(this.PlayerIndex, ProgressData.GetHealthForPlayer(this.PlayerIndex) + 1); ProgressData.ApplyPointsDeltaForPlayer(this.PlayerIndex, -_cost); GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(this.PlayerIndex, -_cost)); updateDisplay(); } else { this.SelectionImage.color = this.NotEnoughColor; } } }
void choiceMade(LocalEventNotifier.Event e) { MenuElementSelectedEvent selectionEvent = e as MenuElementSelectedEvent; if (selectionEvent.Action.ToLower() == "choice_a") { PersistentData.RegisterAcceptedMaster(); PersistentData.RecordHighScore(); PersistentData.SaveToDisk(); } else if (selectionEvent.Action.ToLower() == "choice_b") { GlobalEvents.Notifier.SendEvent(new PlayMusicEvent()); PersistentData.RegisterRefusedMaster(); PersistentData.SaveToDisk(); } }
private void choiceMade(LocalEventNotifier.Event eventObject) { MenuElementSelectedEvent selectionEvent = eventObject as MenuElementSelectedEvent; if (selectionEvent.Action.ToLower() == "choice_a") { this.PageHandler.AddPage(this.Choices[_choiceIndex].ResultTextA); _destination = this.Choices[_choiceIndex].DestinationA; ++_choiceIndex; this.ChoiceMenu.SetActive(false); this.PageHandler.IncrementPage(); } else if (selectionEvent.Action.ToLower() == "choice_b") { this.PageHandler.AddPage(this.Choices[_choiceIndex].ResultTextB); _destination = this.Choices[_choiceIndex].DestinationB; ++_choiceIndex; this.ChoiceMenu.SetActive(false); this.PageHandler.IncrementPage(); } }