Esempio n. 1
0
 private void InitKey()
 {
     KeyReceiver = new KeyReceiver(Layer.Env, BlockType.None);
     KeyReceiver.AddAction(UserInputKey.ShowRecord, (data) => { _adapter.Enable = true; });
     KeyReceiver.AddAction(UserInputKey.HideRecord, (data) => { _adapter.Enable = false; });
     //_adapter.RegisterKeyReceive(KeyReceiver);
     _adapter.RegisterOpenKey(KeyReceiver);
 }
Esempio n. 2
0
 public void RegisterSpecialCmdKeyInput(KeyReceiver keyReceiver, UserCmd userCmd)
 {
     keyReceiver.AddAction(UserInputKey.Switch1, (data) => userCmd.CurWeapon = (int)EWeaponSlotType.PrimeWeapon);
     keyReceiver.AddAction(UserInputKey.Switch3, (data) => userCmd.CurWeapon = (int)EWeaponSlotType.PistolWeapon);
     keyReceiver.AddAction(UserInputKey.Switch4, (data) => userCmd.CurWeapon = (int)EWeaponSlotType.MeleeWeapon);
     keyReceiver.AddAction(UserInputKey.Switch5, (data) => userCmd.CurWeapon = (int)EWeaponSlotType.ThrowingWeapon);
     //     keyReceiver.AddAction(UserInputKey.Switch6, (data) => userCmd.CurWeapon = (int)EWeaponSlotType.TacticWeapon);
 }
Esempio n. 3
0
 private void InitKey()
 {
     openKeyReceiver = new KeyReceiver(UiConstant.userCmdKeyLayer, BlockType.None);
     openKeyReceiver.AddAction(UserInputKey.OpenBag, (data) => { _adapter.Enable = true; });
     _adapter.RegisterOpenKey(openKeyReceiver);
     keyReveiver = new KeyReceiver(UiConstant.userCmdUIKeyLayer, BlockType.All);
     keyReveiver.AddAction(UserInputKey.OpenBag, (data) => { _adapter.Enable = false; });
     pointerReceiver = new PointerReceiver(UiConstant.userCmdUIKeyLayer, BlockType.All);
 }
Esempio n. 4
0
 private void InitOpenKeyReveiver()
 {
     openKeyReceiver = new KeyReceiver(UiConstant.weaponBagWindowLayer, BlockType.None);
     openKeyReceiver.AddAction(UserInputKey.OpenWeaponBag, (data) =>
     {
         SwitchWeaponBagViewShow();
     });
     _adapter.RegisterOpenKey(openKeyReceiver);
     //_adapter.RegisterKeyReceive(openKeyReceiver);
 }
Esempio n. 5
0
 void DynamicKeyBinding()
 {
     //保证 菜单界面打开的时候 打不开大地图界面
     pointerReceiver = new PointerReceiver(UiConstant.menuWindowPointBlockLayer, BlockType.All);
     keyReceive      = new KeyReceiver(UiConstant.menuWindowKeyBlockLayer, BlockType.All);
     keyReceive.AddAction(UserInputKey.OpenMenu, (data) =>
     {
         ShowMenu(false);
     });
 }
Esempio n. 6
0
        private void InitKey()
        {
            openKeyReceiver = new KeyReceiver(UiConstant.paintWindowLayer, BlockType.None);
            openKeyReceiver.AddAction(UserInputKey.F1, (data) => { _adapter.Enable = true; });
            //_adapter.RegisterKeyReceive(openKeyReceiver);
            _adapter.RegisterOpenKey(openKeyReceiver);

            keyReveiver = new KeyReceiver(UiConstant.paintWindowKeyBlockLayer, BlockType.All);
            keyReveiver.AddAction(UserInputKey.F1, (data) => { _adapter.Enable = false; });
            pointerReceiver = new PointerReceiver(UiConstant.paintWindowKeyBlockLayer, BlockType.All);
        }
Esempio n. 7
0
        public void InitKeyBinding()
        {
            var receiver = new KeyReceiver(UiConstant.menuWindowLayer, BlockType.None);

            receiver.AddAction(UserInputKey.OpenMenu, (data) =>
            {
                ShowMenu(true);
            });
            //menuUiAdapter.RegisterKeyReceive(receiver);
            menuUiAdapter.RegisterOpenKey(receiver);
            DynamicKeyBinding();
        }
Esempio n. 8
0
        public void InitKeyBinding()
        {
            //屏幕所有操作
            pointerReceiver = new PointerReceiver(UiConstant.noticeWindowPointBlockLayer, BlockType.All);

            //屏蔽所有操作
            keyReceive = new KeyReceiver(UiConstant.noticeWindowKeyBlockLayer, BlockType.All);
            keyReceive.AddAction(UserInputKey.HideWindow, (data) =>
            {
                HideWindow();
            });
        }
Esempio n. 9
0
        public void InitKeyBinding(Contexts contexts)
        {
            var receiver = new KeyReceiver(Layer.Ui, BlockType.None);

            receiver.AddAction(UserInputKey.Switch1, (data) => { SelectType(1, _defaultColor); });
            receiver.AddAction(UserInputKey.Switch2, (data) => { SelectType(2, _defaultColor); });
            receiver.AddAction(UserInputKey.Switch3, (data) => { SelectType(3, _defaultColor); });
            receiver.AddAction(UserInputKey.Switch4, (data) => { SelectType(4, _defaultColor); });
            receiver.AddAction(UserInputKey.Switch5, (data) => { SelectType(5, _defaultColor); });
            receiver.AddAction(UserInputKey.Switch6, (data) => { SelectType(6, _defaultColor); });
            contexts.userInput.userInputManager.Instance.RegisterKeyReceiver(receiver);
        }
Esempio n. 10
0
        public void InitKeyBinding()
        {
            var receiver = new KeyReceiver(UiConstant.maxMapWindowLayer, BlockType.None);

            receiver.AddAction(UserInputKey.ShowMaxMap, (data) =>
            {
                if (root != null)
                {
                    ShowMap(!adapter.Enable);
                }
            });
            //adapter.RegisterKeyReceive(receiver);
            adapter.RegisterOpenKey(receiver);

            //            DynamicKeyReceive();
            pointerReceiver = new PointerReceiver(UiConstant.maxMapWindowPointBlockLayer, BlockType.All);
            keyReceive      = new KeyReceiver(UiConstant.maxMapWindowKeyBlockLayer, BlockType.All);
            keyReceive.AddAction(UserInputKey.ChangeMapRate, OnChangeMapRate);
            keyReceive.AddAction(UserInputKey.AddMark, (data) =>
            {
                if (MapLevel.Min.Equals(adapter.MapLevel) == false)
                {
                    Vector2 markPos = adapter.CurPlayerPos;
                    adapter.SendMarkMessage(markPos);
                }
            });
            keyReceive.AddAction(UserInputKey.MouseAddMark, (data) =>
            {
                Vector2 hitPoint  = Vector2.zero;
                Vector2 hitPoint1 = Vector2.zero;
                if (MapLevel.Min.Equals(adapter.MapLevel) == false)
                {
                    if (RectTransformUtility.ScreenPointToLocalPointInRectangle(rootRectTf, Input.mousePosition, uiCamera, out hitPoint1))
                    {
//                        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(mapBgRectTran, Input.mousePosition, uiCamera, out hitPoint))
//                        {
                        var markPos = _centerPos + hitPoint1 / rate;
                        adapter.SendMarkMessage(markPos);
//                        }
                    }
                }
            });
            keyReceive.AddAction(UserInputKey.LocationCurPlay, OnLocationCurPlay);

            keyReceive.AddAction(UserInputKey.HideWindow, (data) =>
            {
                if (adapter.Enable)
                {
                    ShowMap(!adapter.Enable);
                }
            });
        }
Esempio n. 11
0
        private void RegisterKeyBinding()
        {
            // 虽然是Ui但是其实层级应该是Env
            var keyreciever = new KeyReceiver(Layer.Env, BlockType.None);

            keyreciever.AddAction(UserInputKey.PickUp, OnAction);
            _pickUpUiAdapter.RegisterKeyReceiver(keyreciever);

            var pointerReceiver = new PointerReceiver(Layer.Env, BlockType.None);

            pointerReceiver.AddAction(UserInputKey.PickUpTip, SetCastData);
            _pickUpUiAdapter.RegisterPointerReceiver(pointerReceiver);
        }
Esempio n. 12
0
 private void InitKeyBinding()
 {
     keyReveiver = new KeyReceiver(UiConstant.splitWindowKeyBlockLayer, BlockType.All);
     keyReveiver.AddAction(UserInputKey.SplitProp, (data) =>
     {
         if (!_viewModel.splitBtnInteractable)
         {
             return;
         }
         SendMessage();
         HideWindow();
     });
 }
Esempio n. 13
0
        private void InitKeyReceiver(UserInputContext context)
        {
            var recevier = new KeyReceiver(Layer.Env + 2, BlockType.None);

            recevier.AddAction(UserInputKey.LockCursor, (data) =>
            {
                //暂时屏蔽
                _contexts.ui.uI.IsShowCrossHair = true;
            });
            recevier.AddAction(UserInputKey.UnlockCursor, (data) =>
            {
                //暂时屏蔽
                _contexts.ui.uI.IsShowCrossHair = false;
            });
            context.userInputManager.Instance.RegisterKeyReceiver(recevier);
        }
Esempio n. 14
0
        public void InitKeyBinding()
        {
            var receiver = new KeyReceiver(UiConstant.maxMapWindowLayer, BlockType.None);

            receiver.AddAction(UserInputKey.ShowMaxMap, (data) =>
            {
                if (root != null)
                {
                    ShowMap(!adapter.Enable);
                }
            });
            //adapter.RegisterKeyReceive(receiver);
            adapter.RegisterOpenKey(receiver);

            DynamicKeyReceive();
        }
        public UnityVehicleCmdGenerator(IUserInputManager manager)
        {
            _lastCmd      = new VehicleCmd();
            _inputManager = manager;
            // 界面不会影响车辆控制
            var keyReceiver = new KeyReceiver(Layer.Ui, BlockType.None);

            _inputManager.RegisterKeyReceiver(keyReceiver);
            keyReceiver.AddAction(UserInputKey.MoveVertical, data => _lastCmd.MoveVertical     = data.Axis);
            keyReceiver.AddAction(UserInputKey.MoveHorizontal, data => _lastCmd.MoveHorizontal = data.Axis);
            keyReceiver.AddAction(UserInputKey.VehicleSpeedUp, data => _lastCmd.IsSpeedup      = true);
            keyReceiver.AddAction(UserInputKey.VehicleBrake, data => _lastCmd.IsHandbrake      = true);
            keyReceiver.AddAction(UserInputKey.VehicleHorn, data => _lastCmd.IsHornOn          = true);

            keyReceiver.AddAction(UserInputKey.VehicleLeftShift, data => _lastCmd.IsLeftShift   = true);
            keyReceiver.AddAction(UserInputKey.VehicleRightShift, data => _lastCmd.IsRightShift = true);
            keyReceiver.AddAction(UserInputKey.VehicleStunt, data => _lastCmd.IsStunt           = true);
        }
Esempio n. 16
0
        static void Main()
        {
            GameSettings  gameSettings  = new GameSettings();
            ScreenFactory screenFactory = InitScreenFactory(gameSettings);
            MainScreen    mainScreen    = screenFactory.CreateMainScreen();

            KeyReceiver keyReceiver = new KeyReceiver();
            KeyListener keyListener = new KeyListener(keyReceiver);
            Engine      engine      = new Engine(gameSettings.FPS, mainScreen, keyReceiver);

            keyListener.Start();
            engine.Start();
            while (engine.Started)
            {
                engine.Loop();
            }
            keyListener.Stop();
        }
Esempio n. 17
0
        private void InitKeyBinding()
        {
            var receiver = new KeyReceiver(UiConstant.rangingWindowLayer, BlockType.None);

            receiver.AddAction(UserInputKey.CheckRanging, (data) =>
            {
                Debug.Log("CheckRanging..........................");
                var selfPlayer = adapter.GetPlayerEntity();
                if (selfPlayer.gamePlay.IsObserving())
                {
                    return;
                }
                var playerTrans = selfPlayer.characterContoller.Value.transform;

                var cameraPos     = selfPlayer.cameraObj.MainCamera.transform.position;
                var cameraForword = selfPlayer.cameraObj.MainCamera.transform.forward;

                RaycastHit hit;
                int bricksLayer = LayerMask.NameToLayer("Player");  //不检测player层级的东西
                int layerMask   = 1 << bricksLayer;
                layerMask       = ~layerMask;
                if (Physics.Raycast(cameraPos, cameraForword, out hit, int.MaxValue, layerMask))
                {
                    var hitPos   = hit.point;
                    var distance = Vector3.Distance(hitPos, playerTrans.position);
                    distance     = Mathf.Max(distance, 1);
                    //Debug.Log("name:" + hit.collider.gameObject.name);

                    if (adapter.RangeInfo == null)
                    {
                        adapter.RangeInfo = new RangingInfo((long)distance, hitPos);
                    }
                    else
                    {
                        adapter.RangeInfo.distance   = (long)distance;
                        adapter.RangeInfo.contactPos = hitPos;
                    }
                }
                RefreshGui();
            });
            adapter.RegisterKeyReceive(receiver);
        }
Esempio n. 18
0
 private void InitKeyReveiver()
 {
     keyReveiver = new KeyReceiver(UiConstant.weaponBagWindowKeyBlockLayer, BlockType.All);
     for (int i = 0; i < _haveBagForIndexList.Count; i++)
     {
         if (_haveBagForIndexList[i])
         {
             var index = i - 1;
             keyReveiver.AddAction(UserInputKey.Switch1 + index,
                                   (data) => {
                 btnGroupTab.SetSelect(index);
                 CloseView();
             });
             keyReveiver.AddAction(UserInputKey.HideWindow,
                                   (data) => {
                 CloseView();
             });
         }
     }
     pointerReceiver = new PointerReceiver(UiConstant.weaponBagWindowKeyBlockLayer, BlockType.All);
 }
Esempio n. 19
0
        private void InitKeyReveiver()
        {
            var keyReceiver = new KeyReceiver(UiConstant.chatWindowLayer, BlockType.None);

            keyReceiver.AddAction(UserInputKey.SendChatMessage, (data) =>
            {
                if (ChatListState != EUIChatListState.Send)
                {
                    SwitchToSendState();
                }
            });
            switchKeyReceiver = new KeyReceiver(UiConstant.chatWindowKeyBlockLayer, BlockType.All);
            switchKeyReceiver.AddAction(UserInputKey.SendChatMessage, (data) => { SendMessage(); });
            switchKeyReceiver.AddAction(UserInputKey.SwitchChatChannel, (data) =>
            {
                SwitchChannel();
                UpdateChannel();
            });

            //_chatState.RegisterKeyReceive(keyReveiver);
            _chatState.RegisterOpenKey(keyReceiver);
        }
Esempio n. 20
0
 public void RegisterEnvKeyInput(KeyReceiver keyReceiver, UserCmd userCmd)
 {
 }
Esempio n. 21
0
 private void InitKey()
 {
     KeyReceiver = new KeyReceiver(Layer.System, BlockType.None);
     KeyReceiver.AddAction(UserInputKey.ShowDebug, (data) => { _adapter.Enable = !_adapter.Enable; });
     _adapter.RegisterKeyReceive(KeyReceiver);
 }
Esempio n. 22
0
        //这里所有的操作层级都设置为Env,如果有特殊遮挡需求请修改层级并修改这段注释
        public void BeginReceiveUserInput(IUserInputManager manager)
        {
            _userInputManager = manager;
            #region Env keyreceiver

            // 有UI打开的情况下,不能开枪, 不能瞄准
            _specialKeyReceiver = new KeyReceiver(UiConstant.specicalCmdKeyLayer, BlockType.None);
            for (int i = 0; i < _inputMapperList.Count; i++)
            {
                _inputMapperList[i].RegisterSpecialCmdKeyInput(_specialKeyReceiver, _userCmd);
            }
            _specialKeyReceiver.AddAction(UserInputKey.Fire, (data) => _userCmd.IsLeftAttack         = true);
            _specialKeyReceiver.AddAction(UserInputKey.RightAttack, (data) => _userCmd.IsRightAttack = true);
            _specialKeyReceiver.AddAction(UserInputKey.CameraFocus, (data) => _userCmd.IsCameraFocus = true);
            _userInputManager.RegisterKeyReceiver(_specialKeyReceiver);

            _keyReceiver = new KeyReceiver(UiConstant.userCmdKeyLayer, BlockType.None);
            for (int i = 0; i < _inputMapperList.Count; i++)
            {
                _inputMapperList[i].RegisterEnvKeyInput(_keyReceiver, _userCmd);
            }
            _keyReceiver.AddAction(UserInputKey.SwitchFireMode, (data) => _userCmd.IsSwitchFireMode = true);
            _keyReceiver.AddAction(UserInputKey.DrawWeapon, (data) => _userCmd.IsDrawWeapon         = true);
            _keyReceiver.AddAction(UserInputKey.Throwing, (data) => _userCmd.IsThrowing             = true);
            _keyReceiver.AddAction(UserInputKey.FirstPerson, (data) => _userCmd.ChangeCamera        = true);
            _keyReceiver.AddAction(UserInputKey.FreeCamera, (data) => _userCmd.IsCameraFree         = true);
            _keyReceiver.AddAction(UserInputKey.Jump, (data) => _userCmd.IsJump     = true);
            _keyReceiver.AddAction(UserInputKey.Crouch, (data) => _userCmd.IsCrouch = true);
            _keyReceiver.AddAction(UserInputKey.Prone, (data) => _userCmd.IsProne   = true);
            //_keyReceiver.AddAction(UserInputKey.Injured, (data) => _userCmd.BeState = 2);
            //_keyReceiver.AddAction(UserInputKey.Swim, (data) => _userCmd.BeState = 1);
            _keyReceiver.AddAction(UserInputKey.Reload, (data) => _userCmd.IsReload             = true);
            _keyReceiver.AddAction(UserInputKey.PeekLeft, (data) => _userCmd.IsPeekLeft         = true);
            _keyReceiver.AddAction(UserInputKey.PeekRight, (data) => _userCmd.IsPeekRight       = true);
            _keyReceiver.AddAction(UserInputKey.SwitchWeapon, (data) => _userCmd.IsSwitchWeapon = true);
            _keyReceiver.AddAction(UserInputKey.DropWeapon, (data) => _userCmd.IsDropWeapon     = true);
            _keyReceiver.AddAction(UserInputKey.Switch1, data => _userCmd.SwitchNumber          = 1);
            _keyReceiver.AddAction(UserInputKey.Switch7, data => _userCmd.SwitchNumber          = 7);
            _keyReceiver.AddAction(UserInputKey.IsPDown, data => _userCmd.IsPDown               = true);
            _keyReceiver.AddAction(UserInputKey.IsYDown, data => _userCmd.IsYDown               = true);
            _keyReceiver.AddAction(UserInputKey.AddMark, data => _userCmd.IsAddMark             = true);
            _keyReceiver.AddAction(UserInputKey.BreathHold, data => _userCmd.IsHoldBreath       = true);
            _keyReceiver.AddAction(UserInputKey.SwitchAutoRun, data => _userCmd.IsSwitchAutoRun = true);
            _keyReceiver.AddAction(UserInputKey.IsCDown, data => _userCmd.IsCDown               = true);
            _keyReceiver.AddAction(UserInputKey.IsSpaceDown, data => _userCmd.IsSpaceDown       = true);
            _keyReceiver.AddAction(UserInputKey.HoldF, data => _userCmd.IsF = true);
            _keyReceiver.AddAction(UserInputKey.SprayPaint, data => _userCmd.IsSprayPaint = true);
            _keyReceiver.AddAction(UserInputKey.ScopeIn, data => _userCmd.IsScopeIn       = true);
            _keyReceiver.AddAction(UserInputKey.ScopeOut, data => _userCmd.IsScopeOut     = true);
            _userInputManager.RegisterKeyReceiver(_keyReceiver);

            #endregion

            #region Ui Keyreciever

            _uiKeyReceiver = new KeyReceiver(UiConstant.userCmdUIKeyLayer, BlockType.None);
            _uiKeyReceiver.AddAction(UserInputKey.MoveHorizontal, (data) => _userCmd.MoveHorizontal = data.Axis);
            _uiKeyReceiver.AddAction(UserInputKey.MoveVertical, (data) => _userCmd.MoveVertical     = data.Axis);
            _uiKeyReceiver.AddAction(UserInputKey.MoveUpDown, (data) => _userCmd.MoveUpDown         = data.Axis);
            _uiKeyReceiver.AddAction(UserInputKey.Run, (data) => _userCmd.IsRun             = true);
            _uiKeyReceiver.AddAction(UserInputKey.IsTabDown, data => _userCmd.IsTabDown     = true);
            _uiKeyReceiver.AddAction(UserInputKey.SlightWalk, data => _userCmd.IsSlightWalk = true);
            _userInputManager.RegisterKeyReceiver(_uiKeyReceiver);

            #endregion

#if UNITY_EDITOR
            foreach (var mockCmd in _mockCmdList)
            {
                mockCmd(_userCmd);
            }
#endif

            var pointerReceiver = new PointerReceiver(UiConstant.userCmdPointLayer, BlockType.None);
            pointerReceiver.AddAction(UserInputKey.Yaw, (pointerData) =>
            {
                for (int i = 0; i < yaws.Length - 1; i++)
                {
                    yaws[i] = yaws[i + 1];
                }
                yaws[yaws.Length - 1] = pointerData.MouseX;
                float total           = 0;
                for (int i = yaws.Length - 1; i >= Math.Max(0, yaws.Length - BigMapDebug.SmoothFactor); i--)
                {
                    total = total + yaws[i];
                }
                total = total / (float)BigMapDebug.SmoothFactor;
                //Debug.LogFormat("deltaYaw is {0}, deltaTime {1}", total, Time.deltaTime);
#if UNITY_EDITOR
                if (!Cursor.visible)
                {
                    _userCmd.DeltaYaw = total;
                }
#else
                _userCmd.DeltaYaw = total;
#endif
            });
            pointerReceiver.AddAction(UserInputKey.Pitch, (pointerData) =>
            {
                for (int i = 0; i < pitchs.Length - 1; i++)
                {
                    pitchs[i] = pitchs[i + 1];
                }
                pitchs[pitchs.Length - 1] = pointerData.MouseY;
                float total = 0;
                for (int i = pitchs.Length - 1; i >= Math.Max(0, pitchs.Length - BigMapDebug.SmoothFactor); i--)
                {
                    total = total + pitchs[i];
                }
                total = total / (float)BigMapDebug.SmoothFactor;
#if UNITY_EDITOR
                if (!Cursor.visible)
                {
                    _userCmd.DeltaPitch = -total;
                }
#else
                _userCmd.DeltaPitch = -total;
#endif
            });

            _userInputManager.RegisterPointerReceiver(pointerReceiver);
        }
Esempio n. 23
0
        public void DynamicKeyReceive()
        {
            pointerReceiver = new PointerReceiver(UiConstant.maxMapWindowPointBlockLayer, BlockType.All);
            keyReceive      = new KeyReceiver(UiConstant.maxMapWindowKeyBlockLayer, BlockType.All);
            keyReceive.AddAction(UserInputKey.ChangeMapRate, (data) =>
            {
                if (isGameObjectCreated == true)
//                if (isGameObjectCreated == true && MapLevel.Min.Equals(adapter.MapLevel) == false)
                {
                    Vector2 hitPoint = Vector2.zero;
                    if (RectTransformUtility.ScreenPointToLocalPointInRectangle(maxMapMaskControl.GetComponent <RectTransform>(), Input.mousePosition, uiCamera, out hitPoint))
                    {
                        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(mapBgRectTran, Input.mousePosition, uiCamera, out hitPoint))
                        {
                            if (data.Axis > 0)    //正向滚动滑轮  大地图控件可以显示的真实地图大小缩小一半
                            {
                                var temperNum = MaxMapRepresentWHByRice / 2;
                                if (temperNum >= MaxMapRealWHByRice / 16)
                                {
                                    MaxMapRepresentWHByRice = temperNum;
                                }
                            }
                            else if (data.Axis < 0)               //反向滚动滑轮  大地图控件可以显示的真实地图大小扩大一半
                            {
                                var temperNum = MaxMapRepresentWHByRice * 2;
                                if (temperNum <= MaxMapRealWHByRice)
                                {
                                    MaxMapRepresentWHByRice = temperNum;
                                }
                            }

                            //更具滚轮的移动 改变MaxMapWHByRice
                            rate = maxMapMaskWByPixel / MaxMapRepresentWHByRice;
                        }
                    }
                }
            });
            keyReceive.AddAction(UserInputKey.AddMark, (data) =>
            {
                if (MapLevel.Min.Equals(adapter.MapLevel) == false)
                {
                    Vector2 markPos = adapter.CurPlayerPos;
                    adapter.SendMarkMessage(markPos);
                }
            });
            keyReceive.AddAction(UserInputKey.MouseAddMark, (data) =>
            {
                Vector2 hitPoint  = Vector2.zero;
                Vector2 hitPoint1 = Vector2.zero;
                if (MapLevel.Min.Equals(adapter.MapLevel) == false)
                {
                    if (RectTransformUtility.ScreenPointToLocalPointInRectangle(maxMapMaskControlRect, Input.mousePosition, uiCamera, out hitPoint1))
                    {
                        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(mapBgRectTran, Input.mousePosition, uiCamera, out hitPoint))
                        {
                            var markPos = maskCenterPInMapByRice + hitPoint1 / rate;
                            adapter.SendMarkMessage(markPos);
                        }
                    }
                }
            });
            keyReceive.AddAction(UserInputKey.LocationCurPlay, (data) =>
            {
                if (MaxMapRepresentWHByRice != 8000) //缩放模式的时候
                {
                    //将当前玩家尽量移动到地图中心 也就是移动背景图
                    var curPlayPosByPice      = adapter.CurPlayerPos;
                    Vector2 curPlayPosByPixel = (curPlayPosByPice - maskCenterPInMapByRice) * rate;
                    var offset = curPlayPosByPixel - Vector2.zero;
                    SetMapBgLocationByDrag(-offset);
                }
            });

            keyReceive.AddAction(UserInputKey.HideWindow, (data) =>
            {
                if (adapter.Enable)
                {
                    ShowMap(!adapter.Enable);
                }
            });
        }
 public static void SetReceiver(DependencyObject obj, KeyReceiver <object> value)
 {
     obj.SetValue(ReceiverProperty, value);
 }
Esempio n. 25
0
 public void RegisterSpecialCmdKeyInput(KeyReceiver keyReceiver, UserCmd userCmd)
 {
 }