NewMapDialog.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // The Command & Conquer Map Editor and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // The Command & Conquer Map Editor and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. using MobiusEditor.Interface;
  15. using System;
  16. using System.Windows.Forms;
  17. namespace MobiusEditor.Dialogs
  18. {
  19. public partial class NewMapDialog : Form
  20. {
  21. private GameType gameType = GameType.TiberianDawn;
  22. public GameType GameType
  23. {
  24. get => gameType;
  25. set
  26. {
  27. if (gameType != value)
  28. {
  29. gameType = value;
  30. UpdateGameType();
  31. }
  32. }
  33. }
  34. public string TheaterName
  35. {
  36. get
  37. {
  38. if (radioTheater1.Checked) return radioTheater1.Text;
  39. if (radioTheater2.Checked) return radioTheater2.Text;
  40. if (radioTheater3.Checked) return radioTheater3.Text;
  41. return null;
  42. }
  43. }
  44. public NewMapDialog()
  45. {
  46. InitializeComponent();
  47. }
  48. private void UpdateGameType()
  49. {
  50. switch(GameType)
  51. {
  52. case GameType.TiberianDawn:
  53. {
  54. radioTheater1.Text = "Desert";
  55. radioTheater2.Text = "Temperate";
  56. radioTheater3.Text = "Winter";
  57. } break;
  58. case GameType.RedAlert:
  59. {
  60. radioTheater1.Text = "Temperate";
  61. radioTheater2.Text = "Snow";
  62. radioTheater3.Text = "Interior";
  63. }
  64. break;
  65. }
  66. }
  67. private void radioGameType_CheckedChanged(object sender, EventArgs e)
  68. {
  69. if (radioTD.Checked)
  70. {
  71. GameType = GameType.TiberianDawn;
  72. }
  73. else if (radioRA.Checked)
  74. {
  75. GameType = GameType.RedAlert;
  76. }
  77. }
  78. }
  79. }