Beispiel #1
0
        public void AddQuest(ModelQuest quest, int postion = -1)
        {
            if (postion == -1 || postion == Quests.Count)
                Quests.Add(quest);
            else
                Quests.Insert(postion, quest);

            OnQuestAdded(quest);
        }
Beispiel #2
0
        public ProxyQuest(ModelQuest quest)
        {
            Stages = new ObservableCollection<ProxyStage>();
            mQuest = quest;

            foreach (ModelStage stage in mQuest.Stages)
            {
                ProxyStage ps = new ProxyStage(stage);
                Stages.Add(ps);
            }
        }
Beispiel #3
0
 void OnStageRemoved(ModelQuest quest, ModelStage stage)
 {
     stage.Quest = null;
     if (StageRemoved != null)
     {
         QuestEvtArgs e = new QuestEvtArgs();
         e.Quest = quest;
         e.Story = this;
         e.Stage = stage;
         StageRemoved(this, e);
     }
 }
Beispiel #4
0
        void OnQuestRemoved(ModelQuest quest)
        {
            quest.Story = null;

            if (QuestRemoved != null)
            {
                QuestEvtArgs e = new QuestEvtArgs();
                e.Quest = quest;
                e.Story = this;
                QuestRemoved(this, e);
            }
        }
Beispiel #5
0
        public void Load(XElement storyElement)
        {
            foreach (XElement questElement in storyElement.Elements("Quest"))
            {
                ModelQuest quest = new ModelQuest();
                Quests.Add(quest);

                XAttribute nameAttr         = questElement.Attribute("Name");
                XAttribute titleAttr        = questElement.Attribute("Title");
                XAttribute startScriptAttr  = questElement.Attribute("StartScript");
                XAttribute finishScriptAttr = questElement.Attribute("FinishScript");
                XAttribute updateScriptAttr = questElement.Attribute("UpdateScript");

                quest.ID    = nameAttr.Value;
                quest.Title = titleAttr.Value;
                if (startScriptAttr != null)
                {
                    quest.OnStart = startScriptAttr.Value;
                }
                if (finishScriptAttr != null)
                {
                    quest.OnFinish = finishScriptAttr.Value;
                }

                if (updateScriptAttr != null)
                {
                    quest.OnUpdate = updateScriptAttr.Value;
                }

                foreach (XElement stageElement in questElement.Elements("Stage"))
                {
                    ModelStage stage = new ModelStage();
                    quest.Stages.Add(stage);

                    XAttribute idAttr                = stageElement.Attribute("ID");
                    XAttribute textAttr              = stageElement.Attribute("Text");
                    XAttribute stageStartScriptAttr  = stageElement.Attribute("StartScript");
                    XAttribute stageUpdateScriptAttr = stageElement.Attribute("UpdateScript");

                    stage.ID   = int.Parse(idAttr.Value.ToString());
                    stage.Text = textAttr.Value;
                    if (stageStartScriptAttr != null)
                    {
                        stage.OnStart = stageStartScriptAttr.Value;
                    }
                    if (stageUpdateScriptAttr != null)
                    {
                        stage.OnUpdate = stageUpdateScriptAttr.Value;
                    }
                }
            }
        }
Beispiel #6
0
        public void AddQuest(ModelQuest quest, int postion = -1)
        {
            if (postion == -1 || postion == Quests.Count)
            {
                Quests.Add(quest);
            }
            else
            {
                Quests.Insert(postion, quest);
            }

            OnQuestAdded(quest);
        }
Beispiel #7
0
        public void Load(XElement storyElement)
        {
            foreach (XElement questElement in storyElement.Elements("Quest"))
            {
                ModelQuest quest = new ModelQuest();
                Quests.Add(quest);

                XAttribute nameAttr = questElement.Attribute("Name");
                XAttribute titleAttr = questElement.Attribute("Title");
                XAttribute startScriptAttr = questElement.Attribute("StartScript");
                XAttribute finishScriptAttr = questElement.Attribute("FinishScript");
                XAttribute updateScriptAttr = questElement.Attribute("UpdateScript");

                quest.ID = nameAttr.Value;
                quest.Title = titleAttr.Value;
                if (startScriptAttr != null)
                    quest.OnStart = startScriptAttr.Value;
                if (finishScriptAttr != null)
                    quest.OnFinish = finishScriptAttr.Value;

                if (updateScriptAttr != null)
                    quest.OnUpdate = updateScriptAttr.Value;

                foreach (XElement stageElement in questElement.Elements("Stage"))
                {
                    ModelStage stage = new ModelStage();
                    quest.Stages.Add(stage);

                    XAttribute idAttr = stageElement.Attribute("ID");
                    XAttribute textAttr = stageElement.Attribute("Text");
                    XAttribute stageStartScriptAttr = stageElement.Attribute("StartScript");
                    XAttribute stageUpdateScriptAttr = stageElement.Attribute("UpdateScript");

                    stage.ID = int.Parse(idAttr.Value.ToString());
                    stage.Text = textAttr.Value;
                    if (stageStartScriptAttr != null)
                       stage.OnStart = stageStartScriptAttr.Value;
                    if (stageUpdateScriptAttr != null)
                       stage.OnUpdate = stageUpdateScriptAttr.Value;
                }
            }
        }
        public QuestEditorWindow()
        {
            InitializeComponent();

            CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, ExecutedDelete, CanExecuteDelete));
            CommandBindings.Add(new CommandBinding(AddStage, ExecutedAddStage, CanExecuteAddStage));
            CommandBindings.Add(new CommandBinding(AddQuest, ExecutedAddQuestCommand, CanExecuteAddQuestCommand));

            ModelQuest q = new ModelQuest() { Title = "Test quest", ID = "test" };
            Proxy.ProxyStory s = new Proxy.ProxyStory(mStory);
            s.AddQuest(s.CreateNewQuest());
            s.AddQuest(s.CreateNewQuest());
            s.AddQuest(s.CreateNewQuest());
            s.AddQuest(s.CreateNewQuest());

            mStoryTreeView.DataContext = s;
            mProxyStory = s;

               // CommandBindings.Add(new CommandBinding(QuestEditorWindow.AddQuest, ExecutedAddQuestCommand, CanExecuteAddQuestCommand));
        }
Beispiel #9
0
 public void AddStage(ModelQuest quest, ModelStage stage)
 {
     quest.Stages.Add(stage);
     OnStageAdded(quest, stage);
 }
Beispiel #10
0
 void OnStageRemoved(ModelQuest quest, ModelStage stage)
 {
     stage.Quest = null;
     if (StageRemoved != null)
     {
         QuestEvtArgs e = new QuestEvtArgs();
         e.Quest = quest;
         e.Story = this;
         e.Stage = stage;
         StageRemoved(this, e);
     }
 }
Beispiel #11
0
        void OnQuestRemoved(ModelQuest quest)
        {
            quest.Story = null;

            if (QuestRemoved != null)
            {
                QuestEvtArgs e = new QuestEvtArgs();
                e.Quest = quest;
                e.Story = this;
                QuestRemoved(this, e);
            }
        }
Beispiel #12
0
 public void RemoveStage(ModelQuest quest, ModelStage stage)
 {
     quest.Stages.Remove(stage);
     OnStageRemoved(quest, stage);
 }
Beispiel #13
0
 public void RemoveQuest(ModelQuest quest)
 {
     Quests.Remove(quest);
     OnQuestRemoved(quest);
 }
Beispiel #14
0
 public void RemoveStage(ModelQuest quest, ModelStage stage)
 {
     quest.Stages.Remove(stage);
     OnStageRemoved(quest, stage);
 }
Beispiel #15
0
 public void AddStage(ModelQuest quest, ModelStage stage)
 {
     quest.Stages.Add(stage);
     OnStageAdded(quest, stage);
 }
Beispiel #16
0
 public void RemoveQuest(ModelQuest quest)
 {
     Quests.Remove(quest);
     OnQuestRemoved(quest);
 }