예제 #1
0
        private ICameraNewMotor SetNextMotor(PlayerEntity player, SubCameraMotorType type,
                                             ICameraMotorState stat, DummyCameraMotorInput input
                                             )
        {
            var dict     = _motors.GetDict(type);
            var subState = _state.Get(type);

            if (!dict.ContainsKey(subState.NowMode))
            {
                return(null);
            }
            var oldMotor = dict[subState.NowMode];

            var excludes  = oldMotor.ExcludeNextMotor();
            var nextMotor = oldMotor;
            var orderId   = int.MinValue;

            foreach (var motor in dict.Values)
            {
                if (excludes.Contains(motor.ModeId))
                {
                    continue;
                }
                if (motor.IsActive(input, stat))
                {
                    if (motor.Order > orderId)
                    {
                        nextMotor = motor;
                        orderId   = motor.Order;
                    }
                }
            }

            if (nextMotor.ModeId != oldMotor.ModeId || subState.ModeTime == 0)
            {
                Logger.DebugFormat("{0} Levae :{1} To {2} with input{3}", _cmdSeq, oldMotor.ModeId, nextMotor.ModeId,
                                   input);

                CameraActionManager.SetActionCode(CameraActionType.Leave, type, oldMotor.ModeId);
                CameraActionManager.SetActionCode(CameraActionType.Enter, type, nextMotor.ModeId);

                subState.NowMode  = (byte)nextMotor.ModeId;
                subState.ModeTime = player.time.ClientTime;
                subState.LastMode = (byte)oldMotor.ModeId;
            }

            if (type == SubCameraMotorType.View)
            {
                if (CanChangeViewMotor(input))
                {
                    UpdateOrderViewMode(player, nextMotor.ModeId);
                }
            }

            return(oldMotor);
        }
예제 #2
0
 public static void SetActionCode(CameraActionType actionType, SubCameraMotorType motorType, int id)
 {
     if (actionType == CameraActionType.Enter)
     {
         EnterAction[EnumToMask(CalcuMotorNum(motorType, id))] = true;
     }
     else if (actionType == CameraActionType.Leave)
     {
         LeaveAction[EnumToMask(CalcuMotorNum(motorType, id))] = true;
     }
 }
예제 #3
0
 public int GetTransitionTime(SubCameraMotorType type, SubCameraMotorState state)
 {
     if (type == SubCameraMotorType.Pose)
     {
         return(PoseTransitionTime((ECameraPoseMode)state.LastMode, (ECameraPoseMode)state.NowMode));
     }
     if (type == SubCameraMotorType.Free)
     {
         return(_config.FreeConfig.TransitionTime);
     }
     return(DefaultTranstionTime);
 }
예제 #4
0
 public static void AddAction(CameraActionType actionType, SubCameraMotorType motorType, int motorId,
                              Action <PlayerEntity, ICameraMotorState> act)
 {
     if (actionType == CameraActionType.Enter)
     {
         EnterActionList[CalcuMotorNum(motorType, motorId)] = act;
     }
     else if (actionType == CameraActionType.Leave)
     {
         LeaveActionList[CalcuMotorNum(motorType, motorId)] = act;
     }
 }
예제 #5
0
        public NormalPoseMotor(ECameraPoseMode modeId,
                               CameraConfig config,
                               HashSet <ECameraPoseMode> excludes,
                               IMotorActive active
                               )
        {
            _modeId    = (short)modeId;
            _motorType = SubCameraMotorType.Pose;

            this._excludes = new HashSet <short>();
            foreach (var e in excludes)
            {
                this._excludes.Add((short)e);
            }

            _config = config.GetCameraConfigItem(modeId);
            _active = active;
        }
예제 #6
0
        public NormalPoseMotor(ECameraPoseMode modeId,
                               HashSet <ECameraPoseMode> excludes,
                               IMotorActive active, Motors m) : base(m)
        {
            _modeId    = (short)modeId;
            _motorType = SubCameraMotorType.Pose;

            this._excludes = new HashSet <short>();
            foreach (var e in excludes)
            {
                this._excludes.Add((short)e);
            }

            _order = SingletonManager.Get <CameraConfigManager>().GetRoleConfig()
                     .GetCameraConfigItem((ECameraPoseMode)_modeId).Order;

            _active = active;
        }
예제 #7
0
        public static int CalcuMotorNum(SubCameraMotorType Mode, int id)
        {
            int result = 0;

            switch (Mode)
            {
            case SubCameraMotorType.Pose:
                return(id);

            case SubCameraMotorType.Free:
                return(id + (int)ECameraPoseMode.End + 1);

            case SubCameraMotorType.Peek:
                return(id + (int)ECameraPoseMode.End + (int)ECameraFreeMode.End + 2);

            case SubCameraMotorType.View:
                return(id + (int)ECameraPoseMode.End + (int)ECameraFreeMode.End + (int)ECameraPeekMode.End + 3);

            default:
                return(0);
            }
        }
예제 #8
0
 public void AddAction(CameraActionType actionType, SubCameraMotorType motorType, int motorId,
                       Action <PlayerEntity, ICameraMotorState> act)
 {
     if (actionType == CameraActionType.Enter)
     {
         int index = CalcuMotorNum(motorType, motorId);
         if (!EnterActionList.ContainsKey(index))
         {
             EnterActionList.Add(index, new List <Action <PlayerEntity, ICameraMotorState> >());
         }
         var list = EnterActionList[index];
         list.Add(act);
     }
     else if (actionType == CameraActionType.Leave)
     {
         int index = CalcuMotorNum(motorType, motorId);
         if (!LeaveActionList.ContainsKey(index))
         {
             LeaveActionList.Add(index, new List <Action <PlayerEntity, ICameraMotorState> >());
         }
         var list = LeaveActionList[index];
         list.Add(act);
     }
 }
예제 #9
0
 public FreeOffMotor(float transitionTime
                     )
 {
     _transitionTime = transitionTime;
     _motorType      = SubCameraMotorType.View;
 }
예제 #10
0
 public SubCameraMotorState Get(SubCameraMotorType type)
 {
     return(Dict[(int)type]);
 }
예제 #11
0
파일: Motors.cs 프로젝트: yangfan111/common
 public Dictionary <int, ICameraNewMotor> GetDict(SubCameraMotorType type)
 {
     return(Dict[(int)type]);
 }
예제 #12
0
 public FreeOnMotor(Motors m) : base(m)
 {
     _motorType = SubCameraMotorType.View;
 }
예제 #13
0
        public static bool TestChangeCurFrame(ICameraMotorState state, SubCameraMotorType type, int modeId)
        {
            var index = CalcuMotorNum(type, modeId);

            return(EnterAction[EnumToMask(index)]);
        }
예제 #14
0
 public static float GetPostureTransitionTime(SubCameraMotorType motorType, SubCameraMotorState state)
 {
     return(_manager.GetTransitionTime(motorType, state));
 }
예제 #15
0
 public FreeOnMotor()
 {
     _motorType = SubCameraMotorType.View;
 }