예제 #1
0
        public static Package[] GetPackages()
        {
            Package[] packages;
            String[] packageFiles = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Empires\\packages\\", "*.epkg");
            packages = new Package[packageFiles.Length];

            for (int i = 0; i < packageFiles.Length; i++)
            {
                packages[i] = new Package(packageFiles[i]);
            }

            return packages;
        }
예제 #2
0
 public EditPackage(Package package)
 {
     this.package = package;
     InitializeComponent();
     loadData();
 }
예제 #3
0
        private void btn_CreateGame_Click(object sender, EventArgs e)
        {
            Game.Game game = new Game.Game();
            game.data.name = this.tb_GameName.Text;

            try
            {
                game.data.resourceModifier = Convert.ToDouble(this.tb_ResourceModifier.Text);
            }
            catch (Exception ex)
            {
                game.data.resourceModifier = 1.0;
            }

            try
            {
                game.data.startingPopulation = Convert.ToDouble(this.tb_StartingPopulation.Text);
            }
            catch (Exception ex)
            {
                game.data.startingPopulation = 1000;
            }

            int counter = 0;

            for (int i = 0; i < packages.Length; i++)
            {
                if (packagesIn[i])
                {
                    counter++;
                }
            }

            Package[] packagesToUse = new Package[counter];
            counter = 0;

            for (int i = 0; i < packages.Length; i++)
            {
                if (packagesIn[i])
                {
                    packagesToUse[counter] = packages[i];
                    counter++;
                }
            }

            game.data.packages = packagesToUse;

            Objects.game = game;
            Objects.game.onePackage();
            Objects.game.generate();
            Objects.game.save();
            Objects.game = null;
            this.Close();
        }