public OutputConsole(IPotatoChipGame game, int width = 80, int height = 32)
     : base(width, height)
 {
     this.game = game;
     Cursor.UseStringParser  = false;
     Cursor.DisableWordBreak = true;
 }
Beispiel #2
0
 public BuyClaimCommandTests()
 {
     proc      = new MockMainProcess();
     gameState = new GameState();
     Game.SetMainProcess(proc);
     gameState.Miner             = Miner.Default();
     gameState.Miner.TaterTokens = MINER_TOKENS;
 }
Beispiel #3
0
        public InputConsole(IPotatoChipGame game, GameState gameState)
            : base(125, 6)
        {
            this.game      = game;
            this.gameState = gameState;

            this.gameState.PromptTextChanged += () =>
            {
                //Prompt = gameState.PromptText ?? $"{gameState.CurrentRoom.Name} Command >>" ?? string.Empty;
                //Prompt = Prompt + " ";
                //Cursor.Print(Prompt);
            };

            _keyboardHandlerObject = new ClassicConsoleKeyboardHandler();

            // Assign our custom handler method from our handler object to this consoles keyboard handler.
            // We could have overridden the ProcessKeyboard method, but I wanted to demonstrate how you
            // can use your own handler on any console type.
            Components.Add(_keyboardHandlerObject);

            // Our custom handler has a call back for processing the commands the user types. We could handle
            // this in any method object anywhere, but we've implemented it on this console directly.
            _keyboardHandlerObject.EnterPressedAction = EnterPressedActionHandler;

            // Enable the keyboard and setup the prompt.
            UseKeyboard      = true;
            Cursor.IsVisible = true;

            // Startup description
            ClearText();

            Cursor.Position = new Point(0, 0);
            _keyboardHandlerObject.CursorLastY = 0;
            TimesShiftedUp = 0;

            Cursor.DisableWordBreak = true;
            Cursor.Print(Prompt);
            Cursor.DisableWordBreak = false;
        }
 public GameEventsConsole(IPotatoChipGame game, int width = 80, int height = 32)
     : base(width, height)
 {
     this.game = game;
     Cursor.DisableWordBreak = true;
 }
Beispiel #5
0
 public static void SetMainProcess(IPotatoChipGame mainProcess)
 {
     Game.potatoChipGame = mainProcess;
 }