Beispiel #1
0
        //TODO: ...

        //TODO: remove
        private void do_test(object sender, RoutedEventArgs e)
        {
            CampaignSave state = new CampaignSave(new Calendar(), new CharacterSheet());
            Guid         villain_id = Guid.NewGuid(), houserules_id = Guid.NewGuid();

            state.domain.topics[villain_id]    = new Topic("Baddy McVillainface", "This is the BBEG of the whole campaign, and a jerk-face.");
            state.domain.topics[houserules_id] = new Topic("House Rules", "House rules we use for this campaign.");
            state.domain.notes[Guid.NewGuid()] = new ExternalNote(
                "Polymorph preserves base HP, but adjusts total HP based on new Con mod.", DateTime.Now, new HashSet <Guid>()
            {
                houserules_id
            }
                );
            TopicWindow tw = new TopicWindow(
                new Dictionary <Guid, List <EntityRow> >(), state.domain.topics, state, state.domain.state, 0, null, houserules_id
                )
            {
                Owner = this
            };

            tw.ShowDialog();
#if false
            if (!iw.valid)
            {
                return;
            }
            List <string> action_types = new List <string>();
            foreach (EntryAction action in iw.get_actions())
            {
                action_types.Add(action.GetType().ToString());
            }
            MessageBox.Show(String.Join(", ", action_types), "Actions", MessageBoxButton.OK);
#endif
        }
        private void do_add_view(Guid?topic_guid = null)
        {
            if ((this.topics is null) || (this.notes is null) || (this.save_state is null) || (this.state is null))
            {
                return;
            }
            Guid        ent_guid      = this.entry_guid ?? Guid.NewGuid();
            TopicWindow dialog_window = new TopicWindow(
                this.topic_cache, this.topics, this.save_state, this.state, this.now, ent_guid, topic_guid
                )
            {
                Owner = Window.GetWindow(this)
            };

            dialog_window.ShowDialog();
            if (this.change_callback is null)
            {
                return;
            }
            Dictionary <Guid, Topic>        topics     = dialog_window.get_topics();
            Dictionary <Guid, int>          topic_refs = dialog_window.get_topic_refs();
            Dictionary <Guid, ExternalNote> notes      = dialog_window.get_notes();
            List <EntryAction> actions = dialog_window.get_actions();

            if (topics is not null)
            {
                this.topics = topics;
            }
            if (topic_refs is not null)
            {
                foreach (Guid guid in topic_refs.Keys)
                {
                    if (!this.topic_refs.ContainsKey(guid))
                    {
                        this.topic_refs[guid] = 0;
                    }
                    this.topic_refs[guid] += topic_refs[guid];
                }
            }
            if (notes is not null)
            {
                this.notes = notes;
            }
            this.change_callback(actions, ent_guid, this.topics, this.topic_refs, this.notes);
        }