コード例 #1
0
        public override bool ProcessKeyboard(Keyboard info)
        {
            foreach (var keybinding in IndexedKeybindings)
            {
                if (info.IsKeyPressed(keybinding.Key))
                {
                    var itemPreviewWindow = UserInterfaceManager.Get <ItemPreviewWindow>();
                    itemPreviewWindow.
                    SetObjectForPreview(InventoryManager.GetSlot <ISlot>(Game.GameSession.Player.Inventory, keybinding.ObjectId).Item.FirstOrDefault().ObjectId);
                    return(true);
                }
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybindings.Back)))
            {
                this.FullTransition(UserInterfaceManager.Get <GameWindow>());
                return(true);
            }

            if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.E)) // REWORK
            {
                Equip();
            }

            if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.U))
            {
                Enchant.EnchantSteel(Game.GameSession.Player.Inventory.CurrentWeapon);
            }

            return(false);
        }
コード例 #2
0
        public override bool ProcessKeyboard(Keyboard info)
        {
            if (UserInterfaceManager.Get <CharacterKeybindingsWindow>().IndexedKeybindings != null) // IndexedKeybindings is created after this window becomes visible
            {
                foreach (var keybinding in UserInterfaceManager.Get <CharacterKeybindingsWindow>().IndexedKeybindings)
                {
                    if (info.IsKeyPressed(keybinding.Key))
                    {
                        var itemPreviewWindow = UserInterfaceManager.Get <ItemPreviewWindow>();
                        itemPreviewWindow.
                        SetObjectForPreview(keybinding.ObjectId);
                        return(true);
                    }
                }
            }

            if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.A))
            {
                Game.GameSession.Player.Experience += 1;
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Back)))
            {
                this.FullTransition(UserInterfaceManager.Get <GameWindow>());
            }

            return(false);
        }
コード例 #3
0
        public override bool ProcessKeyboard(Keyboard info)
        {
            if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.H))
            {
                ChopWood();
                return(true);
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Back)))
            {
                this.FullTransition(UserInterfaceManager.Get <GameWindow>());
            }

            return(false);
        }
コード例 #4
0
ファイル: TravelWindow.cs プロジェクト: dpnull/NullRPG-Legacy
        public override bool ProcessKeyboard(Keyboard info)
        {
            foreach (var keybinding in IndexedKeybindings)
            {
                if (info.IsKeyPressed(keybinding.Key))
                {
                    var player = EntityManager.Get <IEntity>(Game.GameSession.Player.ObjectId); // Todo: make gamesession player less accessible
                    EntityManager.TravelEntityToArea((Player)player, keybinding.ObjectId);
                    return(true);
                }
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Back)))
            {
                this.FullTransition(UserInterfaceManager.Get <GameWindow>());
            }

            return(false);
        }
コード例 #5
0
        public override bool ProcessKeyboard(Keyboard info)
        {
            // TODO: SOMETIMES THROWS NULL REFERENCE
            if (UserInterfaceManager.Get <LocationKeybindingsWindow>().IndexedKeybindings != null)
            {
                foreach (var keybinding in UserInterfaceManager.Get <LocationKeybindingsWindow>().IndexedKeybindings)
                {
                    if (info.IsKeyPressed(keybinding.Key))
                    {
                        EntityManager.TravelEntityToLocation(Game.GameSession.Player, keybinding.ObjectId);
                        return(true);
                    }
                }
            }


            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Character)))
            {
                OpenCharacterWindow();
                return(true);
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Inventory)))
            {
                OpenInventoryWindow();
                return(true);
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Travel)))
            {
                OpenTravelWindow();
                return(true);
            }

            if (info.IsKeyPressed(KeybindingManager.GetKeybinding <IKeybinding>(Keybinding.Keybindings.Chop)))
            {
                OpenChoppingWindow();
            }

            return(false);
        }