コード例 #1
0
        protected override void KeyBindUp(GUIBoundKeyEventArgs args)
        {
            base.KeyBindUp(args);

            if (!_isPlayer || args.Handled)
            {
                return;
            }

            if (args.Function == ContentKeyFunctions.ArcadeLeft)
            {
                _owner.SendAction(BlockGamePlayerAction.EndLeft);
            }
            else if (args.Function == ContentKeyFunctions.ArcadeRight)
            {
                _owner.SendAction(BlockGamePlayerAction.EndRight);
            }
            else if (args.Function == ContentKeyFunctions.ArcadeDown)
            {
                _owner.SendAction(BlockGamePlayerAction.SoftdropEnd);
            }
        }
コード例 #2
0
        public bool OnButtonPressed(GUIBoundKeyEventArgs args, IEntity item)
        {
            if (item == null)
            {
                return(false);
            }

            if (args.Function == ContentKeyFunctions.ExamineEntity)
            {
                _entitySystemManager.GetEntitySystem <ExamineSystem>()
                .DoExamine(item);
            }
            else if (args.Function == ContentKeyFunctions.OpenContextMenu)
            {
                _entitySystemManager.GetEntitySystem <VerbSystem>()
                .OpenContextMenu(item, new ScreenCoordinates(args.PointerLocation.Position));
            }
            else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
            {
                var inputSys = _entitySystemManager.GetEntitySystem <InputSystem>();

                var func   = args.Function;
                var funcId = _inputManager.NetworkBindMap.KeyFunctionID(args.Function);

                var mousePosWorld = _eyeManager.ScreenToWorld(args.PointerLocation);
                var message       = new FullInputCmdMessage(_gameTiming.CurTick, funcId, BoundKeyState.Down, mousePosWorld,
                                                            args.PointerLocation, item.Uid);

                // client side command handlers will always be sent the local player session.
                var session = _playerManager.LocalPlayer.Session;
                inputSys.HandleInputCommand(session, func, message);
            }
            else
            {
                return(false);
            }
            args.Handle();
            return(true);
        }
コード例 #3
0
        protected override void KeyBindDown(GUIBoundKeyEventArgs args)
        {
            base.KeyBindDown(args);

            if (!_isPlayer || args.Handled)
            {
                return;
            }

            if (args.Function == ContentKeyFunctions.ArcadeLeft)
            {
                _owner.SendAction(BlockGamePlayerAction.StartLeft);
            }
            else if (args.Function == ContentKeyFunctions.ArcadeRight)
            {
                _owner.SendAction(BlockGamePlayerAction.StartRight);
            }
            else if (args.Function == ContentKeyFunctions.ArcadeUp)
            {
                _owner.SendAction(BlockGamePlayerAction.Rotate);
            }
            else if (args.Function == ContentKeyFunctions.Arcade3)
            {
                _owner.SendAction(BlockGamePlayerAction.CounterRotate);
            }
            else if (args.Function == ContentKeyFunctions.ArcadeDown)
            {
                _owner.SendAction(BlockGamePlayerAction.SoftdropStart);
            }
            else if (args.Function == ContentKeyFunctions.Arcade2)
            {
                _owner.SendAction(BlockGamePlayerAction.Hold);
            }
            else if (args.Function == ContentKeyFunctions.Arcade1)
            {
                _owner.SendAction(BlockGamePlayerAction.Harddrop);
            }
        }