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); }
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; } }
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); }
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; } }
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; }
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; }
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); } }
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); } }
public FreeOffMotor(float transitionTime ) { _transitionTime = transitionTime; _motorType = SubCameraMotorType.View; }
public SubCameraMotorState Get(SubCameraMotorType type) { return(Dict[(int)type]); }
public Dictionary <int, ICameraNewMotor> GetDict(SubCameraMotorType type) { return(Dict[(int)type]); }
public FreeOnMotor(Motors m) : base(m) { _motorType = SubCameraMotorType.View; }
public static bool TestChangeCurFrame(ICameraMotorState state, SubCameraMotorType type, int modeId) { var index = CalcuMotorNum(type, modeId); return(EnterAction[EnumToMask(index)]); }
public static float GetPostureTransitionTime(SubCameraMotorType motorType, SubCameraMotorState state) { return(_manager.GetTransitionTime(motorType, state)); }
public FreeOnMotor() { _motorType = SubCameraMotorType.View; }