-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (34 loc) · 1.19 KB
/
Program.cs
File metadata and controls
37 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Windows.Forms;
namespace Spacewar
{
internal static class Program
{
/// <summary>
/// Uygulamanın ana girdi noktası.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Kullanıcı adını almak için NameInputForm'u açıyoruz
string playerName = null;
using (NameInputForm nameForm = new NameInputForm())
{
if (nameForm.ShowDialog() == DialogResult.OK)
{
playerName = nameForm.PlayerName; // Kullanıcı adını al
}
else
{
// Kullanıcı adı girmediyse uygulamayı kapat
MessageBox.Show("You must enter a valid name to play the game!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
// Eğer kullanıcı adı alındıysa oyunu başlat
Application.Run(new Game(playerName)); // Oyuncu adını oyun ekranına gönder
}
}
}