Ejemplo n.º 1
0
        private void mainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            BackpackWindow bw = new BackpackWindow();
            bw.Owner = this;
            ClassRaceChoiceWindow crcw = new ClassRaceChoiceWindow();
            crcw.Owner = this;
            StatWindow sw = new StatWindow();
            sw.Owner = this;

            sw.Show();
            bw.Show();
            this.Activate();
            Init i = new Init();
            i.Initialize(this, bw, crcw, sw);
        }
Ejemplo n.º 2
0
        public void Initialize(MainWindow window, BackpackWindow bpwindow, ClassRaceChoiceWindow crcwindow, StatWindow swindow)
        {
            Program.main = new Main(window, crcwindow, swindow);
            window.Title = "Realm 2: " + GetTitle();
            if (!Program.noUpdate)
            {
                //if the game needs an update show the update dialog
                var fi = new FileIO();
                if (fi.checkver())
                {
                    var dnvw = new DownloadNewVersionWindow(window);
                    dnvw.Show();
                }
            }
            string temppath = Program.path + "\\test.exe";

            if (File.Exists(temppath))
            {
                File.Delete(temppath);
            }
            if (!FileIO.LoadGame())
            {
                Program.main.player = new Player {
                    combatAbilities = new List <Ability> {
                        new Attack()
                    }
                };
                Program.main.write("Hello there. It looks like you're new to Realm 2.", "Black", true);
                Program.main.write("What is your name?", "SteelBlue");
                Program.main.player.backpack.Add(new Stick());
                Program.main.map = new Map(7);
                Program.main.gm  = GameState.GettingPlayerInfo;
            }
            else
            {
                var templist = Program.main.player.combatAbilities.Select(ability => (Ability)Activator.CreateInstance(Type.GetType("Realm2." + ability.Name.Replace(" ", String.Empty)))).ToList();
                Program.main.player.combatAbilities = templist;
                Program.main.write("Welcome back, " + Program.main.player.name + ".", "SteelBlue");
                Program.main.writeStats();
                Program.main.currentplace = Program.main.map.getPlace(new Tuple <int, int>(Program.main.player.position.x, Program.main.player.position.y));
                Program.main.write("Current Place: ", "Black");
                Program.main.write(Program.main.currentplace.name, "Blue", true);
                Program.main.write(Program.main.currentplace.desc, "Black");
                Program.main.gm = GameState.Main;
            }
            bpwindow.itemBox.ItemsSource = Program.main.player.backpack;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructs the Main class.
        /// </summary>
        /// <param name="_mainWindow">Instance of the MainWindow.</param>
        /// <param name="bpwindow">Instance of the BackpackWindow</param>
        /// <param name="crcwindow">Instance of the ClassRaceChoiceWindow</param>
        /// <param name="swindow">Instance of the StatWindow</param>
        public Main(MainWindow _mainWindow, BackpackWindow bpwindow, ClassRaceChoiceWindow crcwindow, StatWindow swindow)
        {
            //save the windows
            mainWindow = _mainWindow;
            bw = bpwindow;
            cw = crcwindow;
            sw = swindow;
            //instantiate the player
            player = new Player();
            //make a new map
            map = new Map(7);

            //for the libraries
            mainBookList = new List<Book>() { };

            //these are for data binding in the ClassRaceChoiceWindow. And any other time you might want a list with all of the Classes and Races
            mainClassList = new List<PlayerClass>() { new Knight(), new Lancer(), new Brawler(), new Mage(), new Ranger(), new Rogue(), new BladeDancer(), new Assassin(), new DreadKnight(), new Jester() };
            mainRaceList = new List<Race>() { new Human(), new Elf(), new Dwarf(), new Orc(), new Lycanthrope(), new Halfdragon(), new Revenant(), new Djinn(), new Vampire(), new Demon() };
        }
Ejemplo n.º 4
0
        private void mainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var bw = new BackpackWindow {
                Owner = this
            };
            var crcw = new ClassRaceChoiceWindow {
                Owner = this
            };
            var sw = new StatWindow {
                Owner = this
            };

            sw.Show();
            bw.Show();
            Activate();
            var i = new Init();

            i.Initialize(this, bw, crcw, sw);
        }
Ejemplo n.º 5
0
 public void Initialize(MainWindow window, BackpackWindow bpwindow, ClassRaceChoiceWindow crcwindow, StatWindow swindow)
 {
     Program.main = new Main(window, bpwindow, crcwindow, swindow);
     bpwindow.itemBox.ItemsSource = Program.main.player.backpack;
     window.Title = "Realm 2: " + GetTitle();
     if (!Program.noUpdate)
     {
         //if the game needs an update show the update dialog
         FileIO fi = new FileIO();
         if (fi.checkver())
         {
             DownloadNewVersionWindow dnvw = new DownloadNewVersionWindow(window);
             dnvw.Show();
         }
     }
     string temppath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\test.exe";
     if (File.Exists(temppath))
         File.Delete(temppath);
     Program.main.write("Hello there. It looks like you're new to Realm 2.", "Black", true);
     Program.main.write("What is your name?", "SteelBlue");
     Program.main.player.backpack.Add(new Stick());
     Program.main.gm = GameState.GettingPlayerInfo;
 }