c#控制台应用程序|双色书写线?
我正在学习C#,我正在写一个基于文本的游戏 我想知道是否有可能有一行代码(Console.WriteLine方法),但从我的游戏中输出一条消息,玩家的名字使用不同的颜色,所以它会有点突出显示 这是我当前的消息简单代码:c#控制台应用程序|双色书写线?,c#,colors,console-application,console.writeline,C#,Colors,Console Application,Console.writeline,我正在学习C#,我正在写一个基于文本的游戏 我想知道是否有可能有一行代码(Console.WriteLine方法),但从我的游戏中输出一条消息,玩家的名字使用不同的颜色,所以它会有点突出显示 这是我当前的消息简单代码: Console.WriteLine("Can you survive, {0}?", player.GetName(); //player.Getname() just returns the name of the user 这会询问用户的姓名: string
Console.WriteLine("Can you survive, {0}?", player.GetName(); //player.Getname() just returns the name of the user
这会询问用户的姓名:
string name = null;
string input = null;
Console.WriteLine("Before you can start your journey, you will have to enter your name.");
while(input != "Y")
{
if( input == null || input == "N" )
{
Console.WriteLine("Please enter your name and press enter:");
name = Console.ReadLine();
}
Console.WriteLine("Your name is {0}",name);
Console.WriteLine("Is this correct? (y/n)");
input = Console.ReadLine();
input = input.ToUpper();
}
我只能找到一个答案,但那是两年前的答案。。那么,可能是改变了
如果您知道答案,请提前感谢