public Date(char divider, string displayStyle, TimeDirection timing, string time) { this.divider = divider; this.displayStyle = displayStyle; timeDirection = timing; SetTime(time); }
public static DateTime Move(TimeUnit u, int x, TimeDirection r, DateTime item) { DateTime value; int i = (r.Equals(TimeDirection.Backward) ? -1 : 1) * x; switch (u) { case TimeUnit.YY: value = item.AddYears(i); break; case TimeUnit.MM: value = item.AddMonths(i); break; case TimeUnit.DD: value = item.AddDays(i); break; case TimeUnit.HH: value = item.AddHours(i); break; case TimeUnit.MI: value = item.AddMinutes(i); break; default: throw new ArgumentException("Not a TimeUnit: " + u); } return(value); }
public List <Frame> GetFramesInTimespan(TimeSpan span, DateTime target, TimeDirection direction) { List <Frame> result = new List <Frame>(); lock (_historyList) { IEnumerable <DateTime> selectResult = null; switch (direction) { case TimeDirection.Before: selectResult = _historyList.Keys.Where(fileTime => fileTime < target && ((target - fileTime).TotalSeconds < span.TotalSeconds)); break; case TimeDirection.After: selectResult = _historyList.Keys.Where(fileTime => fileTime > target && ((fileTime - target).TotalSeconds < span.TotalSeconds)); break; case TimeDirection.Both: selectResult = _historyList.Keys.Where(fileTime => (fileTime < target && ((target - fileTime).TotalSeconds < span.TotalSeconds)) || (fileTime > target && ((fileTime - target).TotalSeconds < span.TotalSeconds))); break; } foreach (var ft in selectResult) { result.Add(_historyList[ft]); } } return(result); }
// Update is called once per frame void FixedUpdate() { TimeDirection direction = _timeDirectionReference.Value; var position = transform.position; if (direction == TimeDirection.Forward && cycle % (skipIterations + 1) == 0) { if (_rb) { _rb.bodyType = _rbType; } if (_isPlayer) { _timeStore.Push(new Time { posX = position.x, posY = position.y, rotZ = transform.rotation.z, animState = _animator?.GetFloat(PlayerVelocity) }); } else { _timeStore.Push(new Time { posX = position.x, posY = position.y, rotZ = transform.rotation.z }); } } if (direction == TimeDirection.Backward) { if (_rb) { _rb.bodyType = RigidbodyType2D.Kinematic; } if (_timeStore.Count == 0) { _timeDirectionReference.Value = TimeDirection.Idle; return; } Time time = _timeStore.Pop(); transform.position = new Vector3(time.posX, time.posY); Quaternion currentRotation = transform.rotation; currentRotation.z = time.rotZ; transform.rotation = currentRotation; if (_hasAnimator && time.animState != null && _isPlayer) { _animator.SetFloat(PlayerVelocity, time.animState.Value); } } cycle++; }
public List<Vector3> move(Level level, Transform transform, TimeDirection timeD, out Vector3 rotation) { List <Vector3> movement = new List<Vector3>(); //might not want to return empty objects this often //move these to start rotation = Vector3.zero; //first check if grabbing something //might want to add delay before going further to allow for turning before moving block if(level.getEntity(transform.position,transform.TransformDirection(Vector3.forward)).type==states.block) { grabbing = true; } //otherwise turn to block else { List<Entity> temp = level.getsurroundingEntity(transform.position); { foreach(Entity entity in temp) { if(entity.type==states.block) { grabbing = true; float angle = Vector3.Angle(transform.TransformDirection(Vector3.forward),entity.obj.transform.position-transform.position); Vector3 cross = Vector3.Cross(transform.TransformDirection(Vector3.forward),entity.obj.transform.position-transform.position); rotation = (cross.y>0)?new Vector3(0,angle,0):new Vector3(0,-angle,0); return movement; } } } } //if block is in front if(grabbing) { if(transform.TransformDirection(Vector3.forward)==Vector3.right||transform.TransformDirection(Vector3.forward)==Vector3.left) { if (timeD.direction==Vector3.right) movement.Add (Vector3.right); else if(timeD.direction==Vector3.left) movement.Add (Vector3.left); } else if(transform.TransformDirection(Vector3.forward)==Vector3.forward||transform.TransformDirection(Vector3.forward)==Vector3.back) { if (timeD.direction==Vector3.forward) movement.Add (Vector3.forward); else if(timeD.direction==Vector3.back) movement.Add (Vector3.back); } else{ return new List<Vector3>(); } //if returning actual values, then fix up the moves to account for both objects if (movement.Count>0&&timeD.time>0.1f) return move_checks(level, movement,transform); } return new List<Vector3>(); }
public LPtr GetTradeTransactionReportsAndSubscribeToNotifications(TimeDirection direction, bool subscribe, DateTime?from, DateTime?to, int preferedBufferSize, bool?skipCancel, int timeoutInMilliseconds) { this.VerifyInitialized(); int?skipCancelInt = null; if (skipCancel.HasValue) { skipCancelInt = skipCancel.Value ? 1 : 0; } return(Native.TradeServer.GetTradeTransactionReportsAndSubscribe(this.handle, (int)direction, subscribe, from, to, (UInt32)preferedBufferSize, skipCancelInt, (UInt32)timeoutInMilliseconds)); }
private static List <RelativeTimeStruct> BuildRelativeTimeStructs(List <Token> tokens, Token last) { TimeDirection direction = last.GetTokenType().Equals(TokenType.After) ? TimeDirection.After : TimeDirection.Before; if (tokens.Count == 0) { throw new SyntaxErrorException("ERROR! Relative time expression do not have definition for time length."); } List <RelativeTimeStruct> relativeTimes = new List <RelativeTimeStruct>(); List <Token> currentTokens = new List <Token>(); foreach (Token tok in tokens) { currentTokens.Add(tok); if (IsAnyKeyword(tok)) { RelativeTimeStruct rts = BuildSingleRTS(currentTokens.Take(currentTokens.Count - 1).ToList(), currentTokens.Last(), direction); if (rts.IsNull()) { return(null); } else { relativeTimes.Add(rts); } currentTokens.Clear(); } } if (currentTokens.Count > 0) { RelativeTimeStruct rts = BuildSingleRTS(currentTokens.Take(currentTokens.Count - 1).ToList(), currentTokens.Last(), direction); if (rts.IsNull()) { return(null); } else { relativeTimes.Add(rts); } } return(relativeTimes); }
public Vector3 move(Level level, Transform transform, TimeDirection timeD,float timetoMove, out Vector3 rotation) { //currently when going to hang off a ledge you are falling for a split second //could be an issue?? rotation = Vector3.zero; if(level.getEntity(transform.position,Vector3.down).type==states.empty) { return Down; } if(timeD.direction!=transform.TransformDirection(Vector3.forward)) //if direction that is designated for character does not equal current rotation { if (timeD.direction==Vector3.right) //if right { rotation = new Vector3(0,90,0)-transform.eulerAngles; //turn towards right } else if(timeD.direction==Vector3.left) { rotation = new Vector3(0,-90,0)-transform.eulerAngles; } else if(timeD.direction==Vector3.forward) { rotation = new Vector3(0,0,0)-transform.eulerAngles; } else if(timeD.direction==Vector3.back) { rotation = new Vector3(0,180,0)-transform.eulerAngles; } } if(timeD.time>timetoMove) { return displace(level,transform.position, transform); } return Vector3.zero; }
/// <summary> /// The method gets snapshot of trade transaction reports and subscribe to notifications. /// All reports will be received as events. /// </summary> /// <param name="direction">Time direction of reports snapshot</param>> /// <param name="subscribeToNotifications">Specifye false to receive only history snapshot; true to receive history snapshot and updates.</param> /// <param name="from"> /// Optional parameter, which specifies the start date and time for trade transaction reports. /// You should specify the parameter, if you specified "to" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="to"> /// Optional parameter, which specifies the finish date and time for trade transaction reports. /// You should specify the parameter, if you specified "from" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="preferedBufferSize"> Specifies number of reports requested at once. Server has itself limitation and if you specify out of range value it will be ignored.</param> /// <returns>Can not be null.</returns> public StreamIterator<TradeTransactionReport> GetTradeTransactionReports(TimeDirection direction, bool subscribeToNotifications, DateTime? from, DateTime? to, int preferedBufferSize, bool? skipCancel) { return this.GetTradeTransactionReportsEx(direction, subscribeToNotifications, from, to, preferedBufferSize, skipCancel, this.Client.SynchOperationTimeout); }
// Update is called once per frame public Vector3 move(Level level, Transform transform, TimeDirection timeD, out Vector3 rotation) { //set up return value rotation = Vector3.zero; if (timeD.time>0.1f) { //if right //check if block directly to right, if so then rotate if (timeD.direction==Vector3.right) { if(level.getEntity(transform.position,transform.TransformDirection(Vector3.right)).type==states.block) { rotation = transform.TransformDirection(new Vector3(0,90,0)); return Vector3.zero; } //if no block to the right, then check if block forward and right from the characters is empty. //if so then move around the corner //otherwise if there is a block forward and right, move right //in both cases, make sure there is no block above the new position else { if(level.getEntity(transform.position+transform.TransformDirection(Vector3.forward),transform.TransformDirection(Vector3.right)).type==states.block && level.getEntity(transform.position,Vector3.up+transform.TransformDirection(Vector3.right)).type==states.empty) { return transform.TransformDirection(Vector3.right); } else if(level.getEntity(transform.position,transform.TransformDirection(Vector3.forward)+transform.TransformDirection(Vector3.right)).type==states.empty && level.getEntity(transform.position,Vector3.up+transform.TransformDirection(Vector3.right)+transform.TransformDirection(Vector3.forward)).type==states.empty) { rotation = transform.TransformDirection(new Vector3(0,-90,0)); return transform.TransformDirection(Vector3.forward+Vector3.right); } } } //inverse of previous section else if(timeD.direction==Vector3.left) { if(level.getEntity(transform.position,transform.TransformDirection(Vector3.left)).type==states.block) { rotation = new Vector3(0,-90,0); return Vector3.zero; } else { if(level.getEntity(transform.position,transform.TransformDirection(Vector3.forward)+transform.TransformDirection(Vector3.left)).type==states.block && level.getEntity(transform.position,Vector3.up+transform.TransformDirection(Vector3.left)).type==states.empty) { return transform.TransformDirection(Vector3.left); } else if(level.getEntity(transform.position,transform.TransformDirection(Vector3.forward)+transform.TransformDirection(Vector3.left)).type==states.empty && level.getEntity(transform.position,Vector3.up+transform.TransformDirection(Vector3.left)+transform.TransformDirection(Vector3.forward)).type==states.empty) { rotation = transform.TransformDirection(new Vector3(0,90,0)); return transform.TransformDirection(Vector3.forward+Vector3.left); } } } //if up or down is pressed //if it's up, check if character can climb up //if down then fall else if (timeD.direction==Vector3.forward) { if (level.getEntity(transform.position,Vector3.up).type==states.empty&& level.getEntity(transform.position+Vector3.up,transform.TransformDirection(Vector3.forward)).type==states.empty) { return Vector3.up+transform.TransformDirection(Vector3.forward); } } else if (timeD.direction==Vector3.back) { return Vector3.down; } Debug.Log("SHOULN'T BE REACHIGN THIS"); return Vector3.zero; } else return Vector3.zero; }
private Biquad CreateBiquad(FilterType type, double f0, double gainInDB, double q, TimeDirection timeDirection) { Biquad biquad = new Biquad(); biquad.F0 = f0; biquad.GainInDB = gainInDB; biquad.Q = q; biquad.TimeDirection = timeDirection; biquad.Type = type; return(biquad); }
// Use this for initialization void Start() { //initialize all the things movement = new Character_Movement(); ledge_movement = new Character_Movement_Ledge(); block_movement = new Character_Block_Move(); moving = false; hanging = false; timeD=new TimeDirection(0f,Vector3.back); //initializess the timeD varible, see bottom for structure rotation = new Vector3(0,180,0); //makes character face forward transform.eulerAngles = rotation; timetoMove = 0.15f; }
/// <summary> /// The method gets daily account snapshots. /// </summary> /// <param name="direction">Time direction of reports snapshot</param>> /// <param name="from"> /// Optional parameter, which specifies the start date and time for trade transaction reports. /// You should specify the parameter, if you specified "to" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="to"> /// Optional parameter, which specifies the finish date and time for trade transaction reports. /// You should specify the parameter, if you specified "from" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="preferedBufferSize"> Specifies number of reports requested at once. Server has itself limitation and if you specify out of range value it will be ignored.</param> /// <returns>Can not be null.</returns> public StreamIterator<DailyAccountSnapshotReport> GetDailyAccountSnapshotsEx(TimeDirection direction, DateTime? from, DateTime? to, int preferedBufferSize, int timeoutInMilliseconds) { var data = this.Client.DataTradeHandle.GetDailyAccountSnapshots(direction, from, to, preferedBufferSize, timeoutInMilliseconds); return new DailyAccountSnapshotReportsIterator(this.Client, data); }
public RelativeTimeStruct(RelativeTimeType type, INumerable value, TimeDirection timeDirection) { this.type = type; this.value = value; this.timeDirection = timeDirection; }
/// <summary> /// The method gets daily account snapshots. /// </summary> /// <param name="direction">Time direction of reports snapshot</param>> /// <param name="from"> /// Optional parameter, which specifies the start date and time for trade transaction reports. /// You should specify the parameter, if you specified "to" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="to"> /// Optional parameter, which specifies the finish date and time for trade transaction reports. /// You should specify the parameter, if you specified "from" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="preferedBufferSize"> Specifies number of reports requested at once. Server has itself limitation and if you specify out of range value it will be ignored.</param> /// <returns>Can not be null.</returns> public StreamIterator<DailyAccountSnapshotReport> GetDailyAccountSnapshots(TimeDirection direction, DateTime? from, DateTime? to, int preferedBufferSize) { return this.GetDailyAccountSnapshotsEx(direction, from, to, preferedBufferSize, this.Client.SynchOperationTimeout); }
public LPtr GetTradeTransactionReportsAndSubscribeToNotifications(TimeDirection direction, bool subscribe, DateTime? from, DateTime? to, int preferedBufferSize, int timeoutInMilliseconds) { this.VerifyInitialized(); return Native.TradeServer.GetTradeTransactionReportsAndSubscribe(this.handle, (int)direction, subscribe, from, to, (UInt32)preferedBufferSize, (UInt32)timeoutInMilliseconds); }
private static RelativeTimeStruct BuildSingleRTS(List <Token> tokens, Token tok, TimeDirection direction) { if (IsSingleKeyword(tok)) { if (tokens.Count == 1 && tokens[0].GetTokenType().Equals(TokenType.NumericConstant) && tokens[0].GetNumericContent() == 1) { switch (tok.GetContent().ToLower()) { case "century": return(new RelativeTimeStruct(RelativeTimeType.Centuries, new NumericConstant(1), direction)); case "decade": return(new RelativeTimeStruct(RelativeTimeType.Decades, new NumericConstant(1), direction)); case "year": return(new RelativeTimeStruct(RelativeTimeType.Years, new NumericConstant(1), direction)); case "month": return(new RelativeTimeStruct(RelativeTimeType.Months, new NumericConstant(1), direction)); case "week": return(new RelativeTimeStruct(RelativeTimeType.Weeks, new NumericConstant(1), direction)); case "day": return(new RelativeTimeStruct(RelativeTimeType.Days, new NumericConstant(1), direction)); case "hour": return(new RelativeTimeStruct(RelativeTimeType.Hours, new NumericConstant(1), direction)); case "minute": return(new RelativeTimeStruct(RelativeTimeType.Minutes, new NumericConstant(1), direction)); case "second": return(new RelativeTimeStruct(RelativeTimeType.Seconds, new NumericConstant(1), direction)); } } else { return(null); } } else { INumerable inum = NumerableBuilder.Build(tokens); if (inum.IsNull()) { return(null); } else { switch (tok.GetContent().ToLower()) { case "centuries": return(new RelativeTimeStruct(RelativeTimeType.Centuries, inum, direction)); case "decades": return(new RelativeTimeStruct(RelativeTimeType.Decades, inum, direction)); case "years": return(new RelativeTimeStruct(RelativeTimeType.Years, inum, direction)); case "months": return(new RelativeTimeStruct(RelativeTimeType.Months, inum, direction)); case "weeks": return(new RelativeTimeStruct(RelativeTimeType.Weeks, inum, direction)); case "days": return(new RelativeTimeStruct(RelativeTimeType.Days, inum, direction)); case "hours": return(new RelativeTimeStruct(RelativeTimeType.Hours, inum, direction)); case "minutes": return(new RelativeTimeStruct(RelativeTimeType.Minutes, inum, direction)); case "seconds": return(new RelativeTimeStruct(RelativeTimeType.Seconds, inum, direction)); } } } return(null); }
/// <summary> /// The method gets snapshot of trade transaction reports and subscribe to notifications. /// All reports will be received as events. /// </summary> /// <param name="direction">Time direction of reports snapshot</param>> /// <param name="subscribeToNotifications">Specify false to receive only history snapshot; true to receive history snapshot and updates.</param> /// <param name="from"> /// Optional parameter, which specifies the start date and time for trade transaction reports. /// You should specify the parameter, if you specified "to" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="to"> /// Optional parameter, which specifies the finish date and time for trade transaction reports. /// You should specify the parameter, if you specified "from" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <returns>Can not be null.</returns> public StreamIterator<TradeTransactionReport> GetTradeTransactionReports(TimeDirection direction, bool subscribeToNotifications, DateTime? from, DateTime? to, bool? skipCancel) { return this.GetTradeTransactionReports(direction, subscribeToNotifications, from, to, 16, skipCancel); }
public LPtr GetDailyAccountSnapshots(TimeDirection direction, DateTime?from, DateTime?to, int preferedBufferSize, int timeoutInMilliseconds) { this.VerifyInitialized(); return(Native.TradeServer.GetDailyAccountSnapshots(this.handle, (int)direction, from, to, (UInt32)preferedBufferSize, (UInt32)timeoutInMilliseconds)); }
public CurrentYearRangeAttribute(int limit, TimeDirection direction = TimeDirection.Past) : base(direction == TimeDirection.Past ? limit : DateTime.Today.Year, direction == TimeDirection.Future ? limit : DateTime.Today.Year) { }
/// <summary> /// The method gets snapshot of trade transaction reports and subscribe to notifications. /// All reports will be received as events. /// </summary> /// <param name="direction">Time direction of reports snapshot</param> /// <param name="subscribeToNotifications">Specifye false to receive only history snapshot; true to receive history snapshot and updates.</param> /// <param name="from"> /// Optional parameter, which specifies the start date and time for trade transaction reports. /// You should specify the parameter, if you specified "to" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="to"> /// Optional parameter, which specifies the finish date and time for trade transaction reports. /// You should specify the parameter, if you specified "from" parameter. /// The parameter is supported since 1.6 FIX version. /// </param> /// <param name="preferedBufferSize"> Specifies number of reports requested at once. Server has itself limitation and if you specify out of range value it will be ignored.</param> /// <param name="timeoutInMilliseconds">Timeout of the operation in milliseconds</param> /// <returns>Can not be null.</returns> public unsafe StreamIterator<TradeTransactionReport> GetTradeTransactionReportsEx(TimeDirection direction, bool subscribeToNotifications, DateTime? from, DateTime? to, int preferedBufferSize, bool? skipCancel, int timeoutInMilliseconds) { var data = this.Client.DataTradeHandle.GetTradeTransactionReportsAndSubscribeToNotifications(direction, subscribeToNotifications, from, to, preferedBufferSize, skipCancel, timeoutInMilliseconds); return new TradeTransactionReportsIterator(this.Client, data); }