Esempio n. 1
0
        private void DoCastAction()
        {
            if (Time.time - _lastCastTime < SingletonManager.Get <RaycastActionConfigManager>().Interval)
            {
                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug("action in cd ");
                }
                return;
            }
            _lastCastTime = Time.time;
            if (null == _castData)
            {
                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug("caset Data is null");
                }
                return;
            }
            if (null != _currentCastLogic)
            {
                _currentCastLogic.Action();
            }
            else
            {
                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug("current cast logic is null");
                }
            }

            _castData         = null;
            _currentCastLogic = null;
        }
Esempio n. 2
0
        public CommonPickUpModel(IPickUpUiAdapter pickUpUiAdapter) : base(pickUpUiAdapter)
        {
            _pickUpUiAdapter = pickUpUiAdapter;
            RegisterKeyBinding();

            _currentCastLogic     = null;
            _sceneObjectCastLogic = _pickUpUiAdapter.GetSceneObjectCastLogic();
            _mapObjectCastLogic   = _pickUpUiAdapter.GetMapObjectCastLogic();
            _vehicleCastLogic     = _pickUpUiAdapter.GetVehicleCastLogic();
            _freeCastLogic        = _pickUpUiAdapter.GetFreeObjectCastLogic();
            _doorCastLogic        = _pickUpUiAdapter.GetDoorCastLogic();
            _playerCastLogic      = _pickUpUiAdapter.GetPlayerCastLogic();
            _playerStateTipLogic  = _pickUpUiAdapter.GetPlayerStateTipLogic();
            _commonCastLogic      = _pickUpUiAdapter.GetCommonCastLogic();
        }
Esempio n. 3
0
        public override void Update(float interval)
        {
            _viewModel.Show = false;

            ResetCastLogic();

            if (_buffTipLogic.HasTipState())
            {
                ShowBuffTip();
            }

            if (_playerStateTipLogic.HasTipState())
            {
                ShowStateTip();
            }
            else if (CheckCastData())
            {
                ShowCastTip();
            }

            _castData         = null;
            _doCastAction     = null;
            _currentCastLogic = null;
        }
Esempio n. 4
0
        private void ShowCastTip()
        {
            _viewModel.Show = false;
            var pointerData = _castData;

            if (null == pointerData)
            {
                Logger.Error("no pointer data ");
                return;
            }
            if (null == pointerData.IdList)
            {
                Logger.Error("id list of pointer data  is null, raycast target may not been inited");
                return;
            }
            var type = pointerData.IdList[0];

            switch ((ECastDataType)type)
            {
            case ECastDataType.SceneObject:
                _currentCastLogic = _sceneObjectCastLogic;
                break;

            case ECastDataType.MapObject:
                _currentCastLogic = _mapObjectCastLogic;
                break;

            case ECastDataType.Vehicle:
                _currentCastLogic = _vehicleCastLogic;
                break;

            case ECastDataType.FreeObject:
                _currentCastLogic = _freeCastLogic;
                break;

            case ECastDataType.Door:
                _currentCastLogic = _doorCastLogic;
                break;

            case ECastDataType.Player:
                _currentCastLogic = _playerCastLogic;
                break;

            case ECastDataType.Common:
                _currentCastLogic = _commonCastLogic;
                break;
            }
            _currentCastLogic.SetData(pointerData);
            var tip = _currentCastLogic.Tip;

            //倒计时出现时不显示Tip,不能进行F键操作
            if (_pickUpUiAdapter.IsCountDown())
            {
                return;
            }

            if (string.IsNullOrEmpty(tip))
            {
                return;
            }
            else
            {
                ShowText(tip);
                if (null != _doCastAction)
                {
                    _doCastAction();
                    _doCastAction = null;
                }
            }
        }