예제 #1
0
        public void newEvent(object sender, RoutedEventArgs e)
        {
            if (this.campaign == null)
            {
                return;
            }
            Ruleset ruleset = this.campaign.getRuleset();
            String  eventType;

            String[] eventTypes = ruleset.getEventTypes().ToArray();
            if (eventTypes.Length == 0)
            {
                return;
            }
            if (eventTypes.Length > 1)
            {
                eventType = SimpleDialog.askList("New Event", "Event Type:", ruleset.getEventTypes().ToArray(), owner: this);
            }
            else
            {
                eventType = eventTypes[0];
            }
            String      player = this.getPlayerOrGm();
            EventDialog dlg    = ruleset.viewEvent(this.campaign, ruleset.newEvent(eventType, player), this.campaign.getTimestamp(), "New Event", player, this);

            if ((dlg == null) || (dlg.timestamp == null) || (dlg.evt == null))
            {
                return;
            }
            this.campaign.addEvent(dlg.timestamp, dlg.evt);
            this.showCampaign();
        }