NewMapDialog.cs (2750B)
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 9 // The Command & Conquer Map Editor and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 using MobiusEditor.Interface; 16 using System; 17 using System.Windows.Forms; 18 19 namespace MobiusEditor.Dialogs 20 { 21 public partial class NewMapDialog : Form 22 { 23 private GameType gameType = GameType.TiberianDawn; 24 public GameType GameType 25 { 26 get => gameType; 27 set 28 { 29 if (gameType != value) 30 { 31 gameType = value; 32 UpdateGameType(); 33 } 34 } 35 } 36 37 public string TheaterName 38 { 39 get 40 { 41 if (radioTheater1.Checked) return radioTheater1.Text; 42 if (radioTheater2.Checked) return radioTheater2.Text; 43 if (radioTheater3.Checked) return radioTheater3.Text; 44 return null; 45 } 46 } 47 48 public NewMapDialog() 49 { 50 InitializeComponent(); 51 } 52 53 private void UpdateGameType() 54 { 55 switch(GameType) 56 { 57 case GameType.TiberianDawn: 58 { 59 radioTheater1.Text = "Desert"; 60 radioTheater2.Text = "Temperate"; 61 radioTheater3.Text = "Winter"; 62 } break; 63 case GameType.RedAlert: 64 { 65 radioTheater1.Text = "Temperate"; 66 radioTheater2.Text = "Snow"; 67 radioTheater3.Text = "Interior"; 68 } 69 break; 70 } 71 } 72 73 private void radioGameType_CheckedChanged(object sender, EventArgs e) 74 { 75 if (radioTD.Checked) 76 { 77 GameType = GameType.TiberianDawn; 78 } 79 else if (radioRA.Checked) 80 { 81 GameType = GameType.RedAlert; 82 } 83 } 84 } 85 }