示例#1
0
        private void GameSelectionFormLoad(object sender, EventArgs e)
        {
            GameTable.RowStyles.Clear();
            foreach (var g in _environments.GroupBy(x => x.Type).OrderBy(x => x.Key))
            {
                GameTable.RowStyles.Add(new RowStyle(SizeType.Absolute, 20));
                GameTable.Controls.Add(new Label {
                    Text = g.Key, Font = new Font(Font, FontStyle.Bold), Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleLeft
                });
                GameTable.Controls.Add(new Label {
                    Text = ""
                });
                foreach (var game in g)
                {
                    GameTable.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
                    GameTable.Controls.Add(new Label {
                        Text = game.Name, Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleLeft
                    });
                    var btn = new Button {
                        Text = @">>", Width = 40
                    };
                    var btnGame = game;
                    btn.Click += (s, ev) => SelectGame(btnGame);
                    GameTable.Controls.Add(btn);
                }
            }

            if (!_environments.Any())
            {
                SelectedEnvironment = null;
                Close();
            }
        }
示例#2
0
        public IEnvironment Deserialise(SerialisedEnvironment environment)
        {
            var gse = new ShadowEngineEnviroment()
            {
                ID            = environment.ID,
                Name          = environment.Name,
                BaseDirectory = GetVal(environment.Properties, "BaseDirectory", ""),
            };

            return(gse);
        }
示例#3
0
        public SerialisedEnvironment Serialise(IEnvironment environment)
        {
            var env = (GoldsourceEnvironment)environment;
            var se  = new SerialisedEnvironment
            {
                ID         = environment.ID,
                Name       = environment.Name,
                Type       = TypeName,
                Properties =
                {
                    { "BaseDirectory",                      env.BaseDirectory             },
                    { "GameDirectory",                      env.GameDirectory             },
                    { "ModDirectory",                       env.ModDirectory              },
                    { "GameExe",                            env.GameExe                   },
                    { "LoadHdModels",                       Convert.ToString(env.LoadHdModels, CultureInfo.InvariantCulture)},

                    { "FgdFiles",                           String.Join(";", env.FgdFiles)},
                    { "DefaultPointEntity",                 env.DefaultPointEntity        },
                    { "DefaultBrushEntity",                 env.DefaultBrushEntity        },
                    { "OverrideMapSize",                    Convert.ToString(env.OverrideMapSize, CultureInfo.InvariantCulture)},
                    { "MapSizeLow",                         Convert.ToString(env.MapSizeLow, CultureInfo.InvariantCulture)},
                    { "MapSizeHigh",                        Convert.ToString(env.MapSizeHigh, CultureInfo.InvariantCulture)},
                    { "IncludeFgdDirectoriesInEnvironment", Convert.ToString(env.IncludeFgdDirectoriesInEnvironment, CultureInfo.InvariantCulture)},

                    { "ToolsDirectory",                     env.ToolsDirectory            },
                    { "IncludeToolsDirectoryInEnvironment", Convert.ToString(env.IncludeToolsDirectoryInEnvironment, CultureInfo.InvariantCulture)},
                    { "BspExe",                             env.BspExe                    },
                    { "CsgExe",                             env.CsgExe                    },
                    { "VisExe",                             env.VisExe                    },
                    { "RadExe",                             env.RadExe                    },

                    { "GameCopyBsp",                        Convert.ToString(env.GameCopyBsp, CultureInfo.InvariantCulture)},
                    { "GameRun",                            Convert.ToString(env.GameRun, CultureInfo.InvariantCulture)},
                    { "GameAsk",                            Convert.ToString(env.GameAsk, CultureInfo.InvariantCulture)},

                    { "MapCopyBsp",                         Convert.ToString(env.MapCopyBsp, CultureInfo.InvariantCulture)},
                    { "MapCopyMap",                         Convert.ToString(env.MapCopyMap, CultureInfo.InvariantCulture)},
                    { "MapCopyLog",                         Convert.ToString(env.MapCopyLog, CultureInfo.InvariantCulture)},
                    { "MapCopyErr",                         Convert.ToString(env.MapCopyErr, CultureInfo.InvariantCulture)},
                    { "MapCopyRes",                         Convert.ToString(env.MapCopyRes, CultureInfo.InvariantCulture)},

                    { "DefaultTextureScale",                Convert.ToString(env.DefaultTextureScale, CultureInfo.InvariantCulture)},

                    { "ExcludedWads",                       String.Join(";", env.ExcludedWads)},
                    { "AdditionalTextureFiles",             String.Join(";", env.AdditionalTextureFiles)}
                }
            };

            return(se);
        }
示例#4
0
        public SerialisedEnvironment Serialise(IEnvironment environment)
        {
            var env = (ShadowEngineEnviroment)environment;
            var se  = new SerialisedEnvironment
            {
                ID         = environment.ID,
                Name       = environment.Name,
                Type       = TypeName,
                Properties =
                {
                    { "BaseDirectory", env.BaseDirectory }
                }
            };

            return(se);
        }
示例#5
0
        public IEnvironment Deserialise(SerialisedEnvironment environment)
        {
            var gse = new GoldsourceEnvironment()
            {
                ID            = environment.ID,
                Name          = environment.Name,
                BaseDirectory = GetVal(environment.Properties, "BaseDirectory", ""),
                GameDirectory = GetVal(environment.Properties, "GameDirectory", ""),
                ModDirectory  = GetVal(environment.Properties, "ModDirectory", ""),
                GameExe       = GetVal(environment.Properties, "GameExe", ""),
                LoadHdModels  = GetVal(environment.Properties, "LoadHdModels", true),

                FgdFiles           = GetVal(environment.Properties, "FgdFiles", "").Split(';').Where(x => !String.IsNullOrWhiteSpace(x)).ToList(),
                DefaultPointEntity = GetVal(environment.Properties, "DefaultPointEntity", ""),
                DefaultBrushEntity = GetVal(environment.Properties, "DefaultBrushEntity", ""),
                OverrideMapSize    = GetVal(environment.Properties, "OverrideMapSize", false),
                MapSizeLow         = GetVal(environment.Properties, "MapSizeLow", -4096m),
                MapSizeHigh        = GetVal(environment.Properties, "MapSizeHigh", 4096m),
                IncludeFgdDirectoriesInEnvironment = GetVal(environment.Properties, "IncludeFgdDirectoriesInEnvironment", true),

                ToolsDirectory = GetVal(environment.Properties, "ToolsDirectory", ""),
                IncludeToolsDirectoryInEnvironment = GetVal(environment.Properties, "IncludeToolsDirectoryInEnvironment", true),
                BspExe = GetVal(environment.Properties, "BspExe", ""),
                CsgExe = GetVal(environment.Properties, "CsgExe", ""),
                VisExe = GetVal(environment.Properties, "VisExe", ""),
                RadExe = GetVal(environment.Properties, "RadExe", ""),

                GameCopyBsp = GetVal(environment.Properties, "GameCopyBsp", true),
                GameRun     = GetVal(environment.Properties, "GameRun", true),
                GameAsk     = GetVal(environment.Properties, "GameAsk", true),

                MapCopyBsp = GetVal(environment.Properties, "MapCopyBsp", false),
                MapCopyMap = GetVal(environment.Properties, "MapCopyMap", false),
                MapCopyLog = GetVal(environment.Properties, "MapCopyLog", false),
                MapCopyErr = GetVal(environment.Properties, "MapCopyErr", false),
                MapCopyRes = GetVal(environment.Properties, "MapCopyRes", false),

                DefaultTextureScale    = GetVal(environment.Properties, "DefaultTextureScale", 1m),
                ExcludedWads           = GetVal(environment.Properties, "ExcludedWads", "").Split(';').Where(x => !String.IsNullOrWhiteSpace(x)).ToList(),
                AdditionalTextureFiles = GetVal(environment.Properties, "AdditionalTextureFiles", "").Split(';').Where(x => !String.IsNullOrWhiteSpace(x)).ToList(),
            };

            return(gse);
        }
        /// <summary>
        /// Get an environment for the document.
        /// If more than one environment exists, then the user will be prompted.
        /// If the user chooses to cancel, null will be returned.
        /// If no environment is configured, <see cref="EmptyEnvironment"/> will be returned.
        /// </summary>
        private async Task <IEnvironment> GetEnvironment()
        {
            var envs = _environments.Value.GetSerialisedEnvironments().ToList();
            SerialisedEnvironment chosenEnvironment = null;

            if (envs.Count == 1)
            {
                chosenEnvironment = envs[0];
            }
            else if (envs.Count > 1)
            {
                DialogResult result = DialogResult.Cancel;
                await _shell.Value.InvokeAsync(() =>
                {
                    using (var esf = new EnvironmentSelectionForm(envs))
                    {
                        result = esf.ShowDialog();
                        if (result == DialogResult.OK)
                        {
                            chosenEnvironment = esf.SelectedEnvironment;
                        }
                    }
                });

                if (result != DialogResult.OK)
                {
                    return(null);
                }
            }

            if (chosenEnvironment?.ID != null)
            {
                return(_environments.Value.GetEnvironment(chosenEnvironment.ID));
            }
            return(new EmptyEnvironment());
        }
示例#7
0
 private void SelectGame(SerialisedEnvironment environment)
 {
     DialogResult        = DialogResult.OK;
     SelectedEnvironment = environment;
     Close();
 }
示例#8
0
 public EnvironmentSelectionForm(List <SerialisedEnvironment> environments)
 {
     _environments = environments;
     InitializeComponent();
     SelectedEnvironment = null;
 }