Esempio n. 1
0
        /// <summary>
        /// Load the quest you want to view.
        /// </summary>
        /// <param name="quest"></param>
        public void Load(Quest quest)
        {
            // load the quest
            currentQuest = quest;

            // load text
            name.Text        = currentQuest.Name;
            description.Text = currentQuest.Description;
            cashReward.Text  = "$" + currentQuest.CashReward + "";
            pointReward.Text = "@" + currentQuest.Reward + "";

            // load objectives
            ObjectivesUI tmpObjective = null;

            switch (quest.WinCondition)
            {
            case WinCondition.AllEnemiesDead:
                // enemies to kill? (not sure about this one)
                // foreach for #

                // tmp dict.

                /*
                 * Dictionary<string, Entity.LivingEntity> objectiveEntities = new Dictionary<string, Entity.LivingEntity>();
                 * foreach(Entity.Entity ent in quest.entitites)
                 * {
                 *  Console.WriteLine(ent.GetType());
                 * }
                 */

                // Currently no way to get entity names or group them by types (no mugger class etc...) (?)
                tmpObjective = new ObjectivesUI(objectivesContainer.Size);

                string namesOfEnemies = "";
                foreach (Entity.Entity e in quest.entitites)
                {
                    namesOfEnemies += e.Name + "\n";
                }

                tmpObjective.Load("Kill these enemies:\n" + namesOfEnemies, "", quest.entitites[0].sprite.Texture);
                //tmpObjective.parent = objectivesContainer;
                objectivesContainer.Add(tmpObjective);
                break;

            case WinCondition.DeliverItem:
                // deliver some item to some recipient
                tmpObjective = new ObjectivesUI(new Vector2(objectivesContainer.Size.X, objectivesContainer.Size.Y / 2));
                tmpObjective.Load("Deliver this", quest.Delivery.name, quest.Delivery.previewSprite.Texture);
                //tmpObjective.parent = objectivesContainer;
                objectivesContainer.Add(tmpObjective);

                tmpObjective.Load("Recipient", quest.Recipient.Name, quest.Recipient.sprite.Texture);
                tmpObjective.Location = new Vector2(0, objectivesContainer.Size.Y / 2);
                //tmpObjective.parent = objectivesContainer;
                objectivesContainer.Add(tmpObjective);
                break;

            case WinCondition.EnemyDies:
                // kill some enemy
                tmpObjective = new ObjectivesUI(objectivesContainer.Size);
                tmpObjective.Load("Kill this enemy", quest.EnemyToKill.Name, quest.EnemyToKill.sprite.Texture);
                //tmpObjective.parent = objectivesContainer;
                objectivesContainer.Add(tmpObjective);
                break;

            case WinCondition.ObtainItem:
                // find this
                tmpObjective = new ObjectivesUI(objectivesContainer.Size);
                tmpObjective.Load("Find this item", quest.FindThis.name, quest.FindThis.previewSprite.Texture);
                //tmpObjective.parent = objectivesContainer;
                objectivesContainer.Add(tmpObjective);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Load the quest you want to view.
        /// </summary>
        /// <param name="quest"></param>
        public void Load(Quest quest)
        {
            // load the quest
            currentQuest = quest;

            // load text
            name.Text = currentQuest.Name;
            description.Text = currentQuest.Description;
            cashReward.Text = "$" + currentQuest.CashReward + "";
            pointReward.Text = "@" + currentQuest.Reward + "";

            // load objectives
            ObjectivesUI tmpObjective = null;
            switch(quest.WinCondition)
            {
                case WinCondition.AllEnemiesDead:
                    // enemies to kill? (not sure about this one)
                    // foreach for #

                    // tmp dict.
                    /*
                    Dictionary<string, Entity.LivingEntity> objectiveEntities = new Dictionary<string, Entity.LivingEntity>();
                    foreach(Entity.Entity ent in quest.entitites)
                    {
                        Console.WriteLine(ent.GetType());
                    }
                    */

                    // Currently no way to get entity names or group them by types (no mugger class etc...) (?)
                    tmpObjective = new ObjectivesUI(objectivesContainer.Size);

                    string namesOfEnemies = "";
                    foreach (Entity.Entity e in quest.entitites)
                        namesOfEnemies += e.Name + "\n";

                    tmpObjective.Load("Kill these enemies:\n" + namesOfEnemies, "", quest.entitites[0].sprite.Texture);
                    //tmpObjective.parent = objectivesContainer;
                    objectivesContainer.Add(tmpObjective);
                    break;

                case WinCondition.DeliverItem:
                    // deliver some item to some recipient
                    tmpObjective = new ObjectivesUI(new Vector2(objectivesContainer.Size.X, objectivesContainer.Size.Y / 2));
                    tmpObjective.Load("Deliver this", quest.Delivery.name, quest.Delivery.previewSprite.Texture);
                    //tmpObjective.parent = objectivesContainer;
                    objectivesContainer.Add(tmpObjective);

                    tmpObjective.Load("Recipient", quest.Recipient.Name, quest.Recipient.sprite.Texture);
                    tmpObjective.Location = new Vector2(0, objectivesContainer.Size.Y / 2);
                    //tmpObjective.parent = objectivesContainer;
                    objectivesContainer.Add(tmpObjective);
                    break;

                case WinCondition.EnemyDies:
                    // kill some enemy
                    tmpObjective = new ObjectivesUI(objectivesContainer.Size);
                    tmpObjective.Load("Kill this enemy", quest.EnemyToKill.Name, quest.EnemyToKill.sprite.Texture);
                    //tmpObjective.parent = objectivesContainer;
                    objectivesContainer.Add(tmpObjective);
                    break;

                case WinCondition.ObtainItem:
                    // find this
                    tmpObjective = new ObjectivesUI(objectivesContainer.Size);
                    tmpObjective.Load("Find this item", quest.FindThis.name, quest.FindThis.previewSprite.Texture);
                    //tmpObjective.parent = objectivesContainer;
                    objectivesContainer.Add(tmpObjective);
                    break;
            }
        }