Пример #1
0
        /// <summary>
        /// Loads the quests in the quest folder
        /// </summary>
        /// <param name="log">the directory of the quests</param>
        public void LoadQuests(QuestLog log)
        {
            string[] files = Directory.GetFiles(QUEST_DIRECTORY);
            Quest loaded;
            //loop through all of the files in the directory
            foreach(string path in files)
            {
                //try and parse the quest from each file
                loaded = ParseQuest(path);

                //if the parse was successfull, add it to the log
                if (loaded != null)
                {
                    log.Add(loaded);
                }
            }
        }
Пример #2
0
        //Josiah S DeVizia, implemented world importation
        public WorldManager()
        {
            worlds = new Dictionary<String, World>();
            worldQuests = new QuestLog();
            //TODO: Load/Save worlds.
            current = "main";

            player = new Player(new FloatRectangle(384, 72, 32, 32), Sprites.spritesDictionary["player"]);

            player.inventory.ActiveWeapon = 0;

            if(!worlds.ContainsKey(current))
                worlds.Add(current, Game1.Instance.saveManager.LoadWorld(current));

            worlds["main"].manager.AddEntity(player);
            // DEBUG
            #region debug
            #if false

            LivingEntity mugger = new LivingEntity(new FloatRectangle(384, 150, 32, 32), Sprites.spritesDictionary["player"], 10);
            mugger.ai = new MidAI(mugger);
            mugger.inventory.Add(new Item.Weapon(50, 1, 10, "Bam", 100, 0.5));
            mugger.inventory.ActiveWeapon = 0;
            //mugger.interactData = new Entity.Entity.InteractionData(new List<String>() { "I bite my thumb at you, sir!" });
            worlds["main"].manager.AddEntity(mugger);

            //LivingEntity civvie = new LivingEntity(new FloatRectangle(384, 247, 32, 32), Sprites.spritesDictionary["player"], 4);
            //civvie.ai = new CivilianAI(civvie);
            //civvie.interactData = new Entity.Entity.InteractionData(new List<String>() { "pls no." });
            //worlds["main"].manager.AddEntity(civvie);

            worlds["main"].manager.AddEntity(player);

            Quest mugging = SaveManager.ParseQuest("./Content/Quests/Mugging.quest");
            mugging.SetAvailable();
            mugging.worldManager = this;
            player.log.Add(mugging);
            this.worldQuests.Add(mugging);
            mugging.player = player;

            Quest gunman = SaveManager.ParseQuest("./Content/Quests/Crazed Gunman.quest");
            gunman.SetAvailable();
            player.log.Add(gunman);
            this.worldQuests.Add(gunman);

            Quest war = SaveManager.ParseQuest("./Content/Quests/Gang war.quest");
            war.SetAvailable();
            player.log.Add(war);
            this.worldQuests.Add(war);

            Quest sniper = SaveManager.ParseQuest("./Content/Quests/Sniper.quest");
            sniper.SetAvailable();
            player.log.Add(sniper);
            this.worldQuests.Add(sniper);
            /*
            Quest sniper1 = SaveManager.ParseQuest("./Content/Quests/Sniper1.quest");
            sniper1.SetAvailable();
            player.log.Add(sniper1);
            this.worldQuests.Add(sniper1);

            Quest sniper2 = SaveManager.ParseQuest("./Content/Quests/Sniper2.quest");
            sniper2.SetAvailable();
            player.log.Add(sniper2);
            this.worldQuests.Add(sniper2);

            Quest sniper3 = SaveManager.ParseQuest("./Content/Quests/Sniper3.quest");
            sniper3.SetAvailable();
            player.log.Add(sniper3);
            this.worldQuests.Add(sniper3);

            Quest mugging1 = SaveManager.ParseQuest("./Content/Quests/Mugging1.quest");
            mugging1.SetAvailable();
            player.log.Add(mugging1);
            this.worldQuests.Add(mugging1);

            Quest mugging2 = SaveManager.ParseQuest("./Content/Quests/Mugging2.quest");
            mugging2.SetAvailable();
            player.log.Add(mugging2);
            this.worldQuests.Add(mugging2);

            Quest mugging3 = SaveManager.ParseQuest("./Content/Quests/Mugging3.quest");
            mugging3.SetAvailable();
            player.log.Add(mugging3);
            this.worldQuests.Add(mugging3);
            */
            /*
            Quest test = new Quest("Mugging", "Kill the mugger", "You are being attacked", new Vector2(100, 1000), player, this, WinCondition.EnemyDies, 4, 50);
            test.EnemyToKill = mugger;
            test.entitites.Add(mugger);
            test.Status = 1;
            player.log.Add(test);
             */
            #endif
            // need to fix fleemap lag before renabling the above.
            #endregion
            worldQuests = new QuestLog();
            spawnDaemon = new SpawnDaemon();
            spawnThread = new Thread(new ThreadStart(spawnDaemon.startDaemon));
        }
Пример #3
0
 void closeButton_Click(object sender, EventArgs e)
 {
     Game1.state = GameState.Game;
     questLog = null;
 }
Пример #4
0
        public void Reset()
        {
            spawnThread.Abort();
            worlds = new Dictionary<String, World>();
            worldQuests = new QuestLog();

            //reset the worlds
            foreach(string key in worlds.Keys.ToList())
            {
                worlds[key] = Game1.Instance.saveManager.LoadWorld(key);
            }

            current = "main";

            player = new Player(new FloatRectangle(384, 72, 32, 32), Sprites.spritesDictionary["player"]);

            player.inventory.ActiveWeapon = 0;

            //reset player quest log
            for (int i = 0; i < player.log.Count; i++)
            {
                player.log[i] = SaveManager.ParseQuest(SaveManager.QUEST_DIRECTORY + player.log[i].Name + ".quest");
            }

            if (!worlds.ContainsKey(current))
                worlds.Add(current, Game1.Instance.saveManager.LoadWorld(current));

            worlds["main"].manager.AddEntity(player);

            worldQuests = new QuestLog();
            spawnDaemon = new SpawnDaemon();
            spawnThread = new Thread(new ThreadStart(spawnDaemon.startDaemon));
        }
Пример #5
0
        /// <summary>
        /// WARNING, hard coded for only 4 quest info bars to display at a time!!
        /// </summary>
        /// <param name="log"></param>
        public void Load(QuestLog log)
        {
            questInfoBars.Clear();
            int count = 0;
            botIndex = 0;
            foreach(Quest quest in log)
            {
                if (count == 4)
                    count = 0;

                QuestInfoBarUI infoBar = new QuestInfoBarUI(new Vector2(200, 80));
                infoBar.Location = new Vector2(questBarsContainer.Size.X / 2 - infoBar.Size.X / 2, infoBar.Size.Y * count);
                infoBar.Alignment = ControlAlignment.Left;
                infoBar.parent = questBarsContainer;
                infoBar.Click += infoBar_Click;
                infoBar.Load(quest);
                //infoBar.LoadVisuals();

                if (questInfoBars.Count < 4)
                {
                    questBarsContainer.Add(infoBar);
                    topIndex = 4;
                    //currentIndex = 4;
                }

                questInfoBars.Add(infoBar);
                count++;
            }
            currentPageLabel.Text = String.Format(currentPageLabel.Text, 1, Math.Ceiling(questInfoBars.Count / 4.0));
            questLog = log;
        }