贪吃蛇小项目

This commit is contained in:
2025-09-21 20:11:21 +08:00
parent 0a1446e7b3
commit 116b65164b
18 changed files with 695 additions and 25 deletions
+54 -24
View File
@@ -1,25 +1,55 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
#region
#endregion
using System;
namespace Test
{
enum E_RoomType
{
Bedroom,
LivingRoom
}
class Bedroom : IChangeRoom
{
public void ChangeRoom()
{
Console.WriteLine("卧室");
}
}
class LivingRoom : IChangeRoom
{
public void ChangeRoom()
{
Console.WriteLine("客厅");
}
}
interface IChangeRoom
{
void ChangeRoom() { }
}
class Show
{
IChangeRoom room;
public Show()
{
room = new Bedroom();
}
public Show(IChangeRoom room)
{
this.room = room;
}
public void ShowRoom()
{
room.ChangeRoom();
}
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
}
class Program
{
static void Main(string[] args)
{
Show s1 = new Show();
Show s2 = new Show(new LivingRoom());
s1.ShowRoom();
s2.ShowRoom();
}
}
}