Example #1
0
        /// <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();
        }
Example #2
0
 /// <summary>
 /// 获取按键
 /// </summary>
 /// <param name="consoleKey"></param>
 /// <returns>是否成功</returns>
 public static bool GetKey(ConsoleKey consoleKey)
 {
     return(CONSOLE.GetKey(consoleKey));
 }
Example #3
0
 /// <summary>
 /// 获取鼠标
 /// </summary>
 /// <param name="mouseButton">鼠标按键</param>
 /// <returns>是否成功</returns>
 public static bool GetMouseButton(MouseButton mouseButton)
 {
     return(CONSOLE.GetKey((ConsoleKey)mouseButton));
 }