示例#1
0
        /// <summary>
        /// Creates an instance of a quest given the accordingly table containing the information.
        /// </summary>
        /// <param name="questTable"></param>
        public Quest(QuestTemplate questTable)
        {
            Name = questTable.Name;
            Description = questTable.Description;
            QuestId = questTable.Id;
            CanRepeat = questTable.CanRepeat;

            // Load up requirements
            LoadStartRequirements(questTable);
            LoadRewards(questTable);

            Steps = new List<QuestStep>();

            foreach (var step in questTable.QuestSteps)
            {
                var newStep = new QuestStep();

                foreach (var requirement in step.Requirements)
                {
                    var concreteRequirement = QuestRequirementFactory.GetConcreteQuestRequirement(requirement);
                    newStep.Requirements.Add(concreteRequirement);
                }

                Steps.Add(newStep);
            }

            Script = ScriptLoader.Instance.GetQuestScript(this);
        }
示例#2
0
        public QuestEditorForm(QuestTemplate questTemplate)
        {
            InitializeComponent();
            SetContentTemplate(questTemplate);
            questRewardEditor1.Template = questTemplate;
            questStepEditor1.Template = questTemplate;

            // Do some data binding where possible
            textName.DataBindings.Add("Text", ContentTemplate, "Name");
            textDescription.DataBindings.Add("Text", ContentTemplate, "Description");
            checkRepeat.DataBindings.Add("Checked", ContentTemplate, "CanRepeat");
        }
示例#3
0
 private void LoadStartRequirements(QuestTemplate questTable)
 {
     StartRequirements = new List<IQuestRequirement>();
 }
示例#4
0
        private void LoadRewards(QuestTemplate questTable)
        {
            QuestRewards = new List<IQuestReward>();

            foreach (var reward in questTable.Rewards)
            {
                var concreteReward = QuestRequirementFactory.GetConcreteQuestReward(reward);
                QuestRewards.Add(concreteReward);
            }
        }