コード例 #1
0
 //private float transitionElapsedTime;
 public EventScreen(UniverseScreen screen, Empire playerEmpire, ExplorationEvent e, Outcome outcome)
 {
     this.outcome = outcome;
     this.ExpEvent = e;
     this.screen = screen;
     base.IsPopup = true;
     base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
     base.TransitionOffTime = TimeSpan.FromSeconds(0.25);
 }
コード例 #2
0
 public EventPopup(UniverseScreen s, Empire playerEmpire, ExplorationEvent e, Outcome outcome)
 {
     this.screen = s;
     this.outcome = outcome;
     this.ExpEvent = e;
     this.fade = true;
     base.IsPopup = true;
     this.FromGame = true;
     base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
     base.TransitionOffTime = TimeSpan.FromSeconds(0);
     this.r = new Rectangle(0, 0, 600, 600);
 }
        public Outcome GetRandomOutcome(ExplorationEvent e)
        {
            int ranMax = 0;
            foreach (Outcome outcome in e.PotentialOutcomes)
            {
                if (outcome.onlyTriggerOnce && outcome.alreadyTriggered)
                {
                    continue;
                }
                else
                {
                    ranMax += outcome.Chance;
                }
            }

            int Random = (int)RandomMath.RandomBetween(0, ranMax);
            Outcome triggeredOutcome = new Outcome();
            int cursor = 0;
            foreach (Outcome outcome in e.PotentialOutcomes)
            {
                if (outcome.onlyTriggerOnce && outcome.alreadyTriggered)
                {
                    continue;
                }
                else
                {
                    cursor = cursor + outcome.Chance;
                    if (Random > cursor)
                    {
                        continue;
                    }
                    triggeredOutcome = outcome;
                    outcome.alreadyTriggered = true;
                    break;
                }
            }
            return triggeredOutcome;
        }
 public void AddEventNotification(ExplorationEvent expEvent, string cMessage)
 {
     Notification cNote = new Notification()
     {
         Pause = false,
         Message = cMessage,
         ReferencedItem1 = expEvent,
         IconPath = "ResearchMenu/icon_event_science",
         Action = "LoadEvent",
         ClickRect = new Rectangle(this.NotificationArea.X, this.NotificationArea.Y, 64, 64),
         DestinationRect = new Rectangle(this.NotificationArea.X, this.NotificationArea.Y + this.NotificationArea.Height - (this.NotificationList.Count + 1) * 70, 64, 64)
     };
     AudioManager.PlayCue("sd_ui_notification_encounter");
     lock (GlobalStats.NotificationLocker)
     {
         this.NotificationList.Add(cNote);
     }
 }