示例#1
0
文件: Assets.cs 项目: yjn88/Destroy
        /// <summary>
        /// 播放MadeWithDestroy的动画
        /// </summary>
        /// <param name="center">是否居中显示</param>
        /// <param name="x">横向坐标</param>
        /// <param name="y">纵向坐标</param>
        /// <param name="consoleKey">按键</param>
        public static void MadeWithDestroy(bool center, short x, short y, ConsoleKey consoleKey = ConsoleKey.Enter)
        {
            string logo = "Made with Destroy";

            if (center)
            {
                x  = (short)(CONSOLE.WindowWidth / 2);
                x -= (short)(logo.Length / 2);
                y  = (short)(CONSOLE.WindowHeight / 2);
            }
            CONSOLE.SetCursorPosition(x, y);
            CONSOLE.ForegroundColor = Colour.Black;
            CONSOLE.BackgroundColor = Colour.White;
            CONSOLE.Write(logo);
            CONSOLE.ResetColor();
            CONSOLE.SetCursorPosition(0, 0);
            //窗口透明度渐变
            for (int i = 0; i < 256; i++)
            {
                //按下回车键直接恢复透明度并且退出渐变阶段
                if (CONSOLE.GetKey(consoleKey))
                {
                    KERNEL.SET_WINDOW_ALPHA(255);
                    break;
                }
                KERNEL.SET_WINDOW_ALPHA((byte)i);
                KERNEL.SLEEP(10);
            }
            KERNEL.SLEEP(1000);
            CONSOLE.Clear();
        }