Example #1
0
        // This console domonstrates a classic MS-DOS or Windows Command Prompt style console.
        public DOSConsole()
            : base(80, 25)
        {
            this.IsVisible = false;

            // This is our cusotmer keyboard handler we'll be using to process the cursor on this console.
            _keyboardHandlerObject = new InputHandling.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.
            KeyboardHandler = _keyboardHandlerObject.HandleKeyboard;

            // 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.
            CanUseKeyboard          = true;
            VirtualCursor.IsVisible = true;
            Prompt = "DOS Prompt> ";


            // Startup description
            CellData.Clear();
            VirtualCursor.Position = new Point(0, 24);
            VirtualCursor.Print("Try typing in the following commands: help, ver, cls, look. If you type exit or quit, the program will end.").NewLine().NewLine();
            _keyboardHandlerObject.VirtualCursorLastY = 24;
            _cellData.TimesShiftedUp = 0;
            VirtualCursor.Print(Prompt);
        }
Example #2
0
        public CastleConsole() : base(40, 25)
        {
            currentTurnCount       = 0;
            this.mapReader         = new MapReader();
            GameResult             = GameResult.Quit;
            ItemManager            = new ItemManager(UpdateMap);
            this.gameOver          = false;
            this.IsVisible         = false;
            this.firstRelease      = true;
            RunTick                = false;
            keyboardHandlerObject  = new ClassicConsoleKeyboardHandler();
            VirtualCursor.Position = new Point(Room.MapWidth + 1, Room.MapHeight + 4);
            KeyboardHandler        = keyboardHandlerObject.HandleKeyboard;

            keyboardHandlerObject.EnterPressedAction = EnterPressedActionHandler;

            // Enable the keyboard and setup the prompt.
            CanUseKeyboard          = true;
            VirtualCursor.IsVisible = true;
            // Startup description
            CellData.Clear();
            _cellData.TimesShiftedUp = 0;
            VirtualCursor.Print(CastleAdventureResources.CommandPrompt);


            currentRoomIndex = 1;
            player           = new Player();
            player.Position  = new Microsoft.Xna.Framework.Point(_cellData.Width / 2, _cellData.Height / 2);



            DrawBorder();
            DrawRoom();
        }
Example #3
0
 protected override void OnVisibleChanged()
 {
     if (IsVisible && !initialized)
     {
         // Write to the message layer
         CellData.Clear();
         CellData.Print(0, 0, "Generating map, please wait...");
         initialized = true;
     }
 }
Example #4
0
 protected override void Start()
 {
     map = gameObject.GetComponentInParents <Canvas>().gameObject.GetLinkMap();
     map.Get <Button>("BtnClear").SetOnClickAction(delegate {
         allData.Clear(); CellData.Clear(); ReloadData();
     });
     map.Get <Button>("BtnHideLog").SetOnClickAction(delegate {
         var nowActive = !gameObject.activeSelf;
         gameObject.SetActiveV2(nowActive);
         map.Get <CanvasGroup>("MenuButtons").interactable   = nowActive;
         map.Get <CanvasGroup>("MenuButtons").blocksRaycasts = nowActive;
     });
     ToggleShowDebugs().SetOnValueChangedAction(delegate { UpdateFilter(NewFilter()); return(true); });
     ToggleShowWarngs().SetOnValueChangedAction(delegate { UpdateFilter(NewFilter()); return(true); });
     ToggleShowErrors().SetOnValueChangedAction(delegate { UpdateFilter(NewFilter()); return(true); });
     SearchInputField().SetOnValueChangedAction(delegate { UpdateFilter(NewFilter()); return(true); });
 }
Example #5
0
 public void ClearConsole()
 {
     allData.Clear(); CellData.Clear(); ReloadData();
 }
Example #6
0
 public void Clear()
 {
     CellData.Clear();
     VirtualCursor.Position = new Point(0, 24);
     _keyboardHandlerObject.VirtualCursorLastY = 24;
 }