Esempio n. 1
0
        public frmSelectMod(Backend.ModSelection selector)
        {
            this.modsel = selector;
            InitializeComponent();

            // detect where the game is located
            // 1. custom path from args[0]
            modsel.ModDir = modsel.ModBase + "/mods/";
            if (Directory.Exists(modsel.ModDir) == false)
            {
                // 2. path from current directory
                modsel.ModDir = Directory.GetCurrentDirectory() + "/mods/";
                if (Directory.Exists(modsel.ModDir) == false)
                {
                    // 3. path from hard-coded location
                    modsel.ModDir = MOD_DIR_FB + "mods/";
                    if (Directory.Exists(modsel.ModDir) == false)
                    {
                        throw new IOException("Could not detect game mods folder");
                    }
                }
            }
            modsel.ModBase = modsel.ModDir;
            // populate mods
            string[] subs = Directory.GetDirectories(modsel.ModBase);
            cboModlist.Items.AddRange(subs);
            foreach (string subdir in subs)
            {
                Console.WriteLine("Found mod folder: " + subdir);
            }
            // select first available mod
            cboModlist.SelectedIndex = 0;
            // select most common tile size
            cboTileSize.SelectedIndex = 0;
        }
Esempio n. 2
0
        public frmMain(string[] args)
        {
            InitializeComponent();

            editor1.onTileChanged += editor1_onTileChanged;
            string custom_path = "";

            if (args.Length > 0)
            {
                custom_path = args[0];
            }

            modsel = new Backend.ModSelection(custom_path);
            var p = new frmSelectMod(modsel);

            p.ShowDialog();
            System.Console.WriteLine("Detected mod: " + modsel.ModDir);

            Image     tiles    = Image.FromFile(modsel.ModDir + "/bitmaps/tiles.png");
            const int gridsize = 16;

            editor1.initialize(modsel.ModDir, tiles, modsel.TileSize, gridsize);
            if (gridsize == 16)
            {
                mnuGrid16x16.Checked = true;
            }
            else
            {
                mnuGrid8x8.Checked = true;
            }
            string replaced = modsel.ModDir.Replace("/", "\\") + "\\maps";

            openFile1.InitialDirectory = replaced;
            saveFile1.InitialDirectory = replaced;

            toolShowGrid.Checked        = editor1.ShowGrid;
            toolLayerAbove.Checked      = editor1.LayersAbove;
            toolShowMask.Enabled        = false;
            toolShowFlags.SelectedIndex = 1;
            // no tile flags by default
            cboTileFlags.SelectedIndex = 0;

            floorList = new List <ToolStripMenuItem>();
            layerList = new List <ToolStripMenuItem>();
        }