public void Execute(object parameter) { ChangeDirection direction = (ChangeDirection)parameter; int filmsCount = _movieCarouselViewModel.Films.Count; if (direction == ChangeDirection.Left) { if (_movieCarouselViewModel.CurrentIndex == 0) { _movieCarouselViewModel.CurrentIndex = filmsCount - 1; } else { _movieCarouselViewModel.CurrentIndex--; } } else { if (_movieCarouselViewModel.CurrentIndex == filmsCount - 1) { _movieCarouselViewModel.CurrentIndex = 0; } else { _movieCarouselViewModel.CurrentIndex++; } } _movieCarouselViewModel.Timer.Stop(); _movieCarouselViewModel.Timer.Start(); }
private void Update() { _targetVelocity = new Vector2(Input.GetAxis("Horizontal"), 0); if (_targetVelocity.x < 0) { BeganWalking?.Invoke(); IsWalkingLeft = true; ChangeDirection?.Invoke(); } else if (_targetVelocity.x == 0) { StoppedWalking?.Invoke(); } else { BeganWalking?.Invoke(); IsWalkingLeft = false; ChangeDirection?.Invoke(); } if (Input.GetKey(KeyCode.Space) && Grounded) { Jumped?.Invoke(); } }
public ChangeOrder(object key, object projectKey, int number) : base(key) { this.projectKey = projectKey; this.number = number; this.effectiveDate = DateTime.Now; this.contractor = null; this.description = string.Empty; this.changeType = null; this.priceChangeDirection = ChangeDirection.Unchanged; this.previousAuthorizedAmount = null; this.previousTimeChangedTotal = null; this.amountChanged = 0; this.timeChangeDirection = ChangeDirection.Unchanged; this.timeChanged = 0; this.routingItems = new List<RoutingItem>(); this.status = null; this.agencyApprovedDate = null; this.dateToField = null; this.ownerSignatureDate = null; this.architectSignatureDate = null; this.contractorSignatureDate = null; this.numberSpecification = new NumberSpecification<ChangeOrder>(); this.descriptionSpecification = new DescriptionSpecification<ChangeOrder>(); this.ValidateInitialization(); }
public ChangeOrder(object key, object projectKey, int number) : base(key) { this.projectKey = projectKey; this.number = number; this.effectiveDate = DateTime.Now; this.contractor = null; this.description = string.Empty; this.changeType = null; this.priceChangeDirection = ChangeDirection.Unchanged; this.previousAuthorizedAmount = null; this.previousTimeChangedTotal = null; this.amountChanged = 0; this.timeChangeDirection = ChangeDirection.Unchanged; this.timeChanged = 0; this.routingItems = new List <RoutingItem>(); this.status = null; this.agencyApprovedDate = null; this.dateToField = null; this.ownerSignatureDate = null; this.architectSignatureDate = null; this.contractorSignatureDate = null; this.numberSpecification = new NumberSpecification <ChangeOrder>(); this.descriptionSpecification = new DescriptionSpecification <ChangeOrder>(); this.ValidateInitialization(); }
private async void FocusAdjuster_OnRepeatClick(ChangeDirection obj) { if (Model?.SelectedCamera?.Camera != null) { await Model.SelectedCamera.Camera.ChangeFocus(obj); } }
public async Task <bool> ChangeFocus(ChangeDirection focusDirection) { ReportAction(focusDirection); return(await Try(async() => { var focus = await http.GetString("?mode=camctrl&type=focus&value=" + focusDirection.GetString()); var fp = Parser.ParseFocus(focus); if (fp == null) { return false; } if (fp.Maximum != LumixState.MaximumFocus) { LumixState.MaximumFocus = fp.Maximum; } if (fp.Value != LumixState.CurrentFocus) { LumixState.CurrentFocus = fp.Value; } return true; })); }
private async void ZoomAdjuster_OnPressedReleased(ChangeDirection obj) { if (Model?.SelectedCamera?.Camera != null) { await Model.SelectedCamera.Camera.ChangeZoom(obj); } }
public ConstructionChangeDirective(object key, object projectKey, int number) : base(key, projectKey) { this.number = number; this.to = null; this.from = null; this.issueDate = null; this.contractor = null; this.description = string.Empty; this.attachment = string.Empty; this.reason = string.Empty; this.initiator = string.Empty; this.cause = 0; this.origin = 0; this.remarks = string.Empty; this.changeType = null; this.priceChangeDirection = ChangeDirection.Unchanged; this.amountChanged = 0; this.timeChangeDirection = ChangeDirection.Unchanged; this.timeChanged = 0; this.ownerSignatureDate = null; this.architectSignatureDate = null; this.contractorSignatureDate = null; this.numberSpecification = new NumberSpecification <ConstructionChangeDirective>(); this.descriptionSpecification = new DescriptionSpecification <ConstructionChangeDirective>(); this.changeOrderKey = null; this.ValidateInitialization(); this.brokenRuleMessages = new ConstructionChangeDirectiveRuleMessages(); }
private void Update() { if (_elapsedTimeToBeginWalk >= _timeToBeginWalk) { Transform target = _points[_currentPointIndex]; IsWalkingLeft = (transform.position.x - target.position.x) > 0 ? true : false; transform.position = Vector2.MoveTowards(transform.position, target.position, _speed * Time.deltaTime); IsWalking = true; if (transform.position == target.position) { IsWalking = false; _elapsedTimeToBeginWalk = 0; _currentPointIndex++; ChangeDirection?.Invoke(); if (_currentPointIndex >= _points.Length) { _currentPointIndex = 0; } } } else { _elapsedTimeToBeginWalk += Time.deltaTime; } }
public ConstructionChangeDirective(object key, object projectKey, int number) : base(key, projectKey) { this.number = number; this.to = null; this.from = null; this.issueDate = null; this.contractor = null; this.description = string.Empty; this.attachment = string.Empty; this.reason = string.Empty; this.initiator = string.Empty; this.cause = 0; this.origin = 0; this.remarks = string.Empty; this.changeType = null; this.priceChangeDirection = ChangeDirection.Unchanged; this.amountChanged = 0; this.timeChangeDirection = ChangeDirection.Unchanged; this.timeChanged = 0; this.ownerSignatureDate = null; this.architectSignatureDate = null; this.contractorSignatureDate = null; this.numberSpecification = new NumberSpecification<ConstructionChangeDirective>(); this.descriptionSpecification = new DescriptionSpecification<ConstructionChangeDirective>(); this.changeOrderKey = null; this.ValidateInitialization(); this.brokenRuleMessages = new ConstructionChangeDirectiveRuleMessages(); }
public void ChangeAgeValue(ChangeDirection changeDirection) { if (changeDirection == ChangeDirection.Add) { if (AgeAmount == 99) { return; } else { AgeAmount++; } } else { if (AgeAmount == 10) { return; } else { AgeAmount--; } } }
public RecognitionCorrectionHint(SkeletonJoint joint = SkeletonJoint.NUM_JOINTS, float dirX = 0, float dirY = 0, float dirZ = 0, float dist = 0, bool isAngle = false, ChangeType changeType = ChangeType.SPEED, ChangeDirection changeDir = ChangeDirection.DIFFERENT, BodyMeasurement measuringUnit = BodyMeasurement.NUM_MEASUREMENTS, int failedState = -1) { m_joint = joint; m_dirX = dirX; m_dirY = dirY; m_dirZ = dirZ; m_dist = dist; m_isAngle = isAngle; m_changeType = changeType; m_changeDirection = changeDir; m_measuringUnit = measuringUnit; m_failedState = failedState; }
IEnumerator CreatePowerUps() { var random = new System.Random(); int randNum; while (Application.isPlaying) { if (!delay.IsDelayed) { randNum = random.Next(5); if (randNum == 0) { print("Creating powerup"); var powerUp = Instantiate(PowerUp); randNum = random.Next(5); Ability ability = null; switch (randNum) { case 0: ability = new SpeedUp(gameBall, this); break; case 1: ability = new SlowDown(gameBall, this); break; case 2: ability = new Grow(leftPaddle, rightPaddle, gameBall); break; case 3: ability = new Shrink(leftPaddle, rightPaddle, gameBall); break; case 4: ability = new ChangeDirection(gameBall); break; } var position = new Vector3((float)random.NextDouble() * 6 - 3, (float)random.NextDouble() * 6 - 3, 0); powerUp.Init(ability, position); PowerUpsOnField.Add(powerUp); powerUp.GameManager = this; } } yield return(new WaitForSeconds(1f)); } }
/// <summary> /// /// </summary> /// <param name="writer"></param> /// <returns>True on success</returns> public override bool Save(XmlWriter writer) { if (writer == null) { return(false); } writer.WriteStartElement(Name); writer.WriteStartElement("changedirection"); writer.WriteAttributeString("value", ChangeDirection.ToString()); writer.WriteEndElement(); base.Save(writer); writer.WriteEndElement(); return(true); }
public override int ChangeSwitchPosition(ChangeDirection changeDirection) { int bufAngle; if (changeDirection == ChangeDirection.Up) { if (currentPosition + 1 == conditionList.Count) { return(0); } else { bufAngle = conditionList[currentPosition + 1].degreeOfPosition - conditionList[currentPosition].degreeOfPosition; currentPosition += 1; conditionList[currentPosition].TakeUsedTime(); if (isItfirstUse) { isItfirstUse = false; return(bufAngle + firstPositionAngle); } else { return(bufAngle); } } } else if (currentPosition - 1 < 0) { if (isItfirstUse) { isItfirstUse = false; return(firstPositionAngle); } else { return(0); } } { bufAngle = conditionList[currentPosition - 1].degreeOfPosition - conditionList[currentPosition].degreeOfPosition; currentPosition -= 1; return(bufAngle); } }
private static string GenerateViewChangeScript(SchemaComparisonItem item, ChangeDirection direction) { StringBuilder sb = new StringBuilder(); if (item.Result == ComparisonResult.ExistsInLeftDB) { if (direction == ChangeDirection.LeftToRight) { DeleteView(sb, item.LeftDdlStatement); } else { CopyView(sb, item.LeftDdlStatement); } } else if (item.Result == ComparisonResult.ExistsInRightDB) { if (direction == ChangeDirection.LeftToRight) { CopyView(sb, item.RightDdlStatement); } else { DeleteView(sb, item.RightDdlStatement); } } else if (item.Result == ComparisonResult.DifferentSchema) { if (direction == ChangeDirection.LeftToRight) { CopyView(sb, item.RightDdlStatement); } else { CopyView(sb, item.LeftDdlStatement); } } // else return(sb.ToString()); }
/// <exception cref="MobileException"></exception> /// <exception cref="DatabaseException"></exception> private async Task ChangeIdAsync(object?obj, string requestId, ChangeDirection direction, ApiRequestType requestType) { if (obj == null) { return; } //替换ID foreach (PropertyInfo propertyInfo in obj.GetType().GetProperties().Where(p => Attribute.IsDefined(p, typeof(IdBarrierAttribute)))) { object?propertyValue = propertyInfo.GetValue(obj); if (propertyValue == null) { continue; } if (propertyValue is long id) { await ConvertLongIdAsync(obj, id, propertyInfo, requestType, direction, requestId).ConfigureAwait(false); } else if (propertyValue is IEnumerable <long> longIds) { foreach (long iditem in longIds) { await ConvertLongIdAsync(obj, iditem, propertyInfo, requestType, direction, requestId).ConfigureAwait(false); } } else if (propertyValue is IEnumerable enumerable) { foreach (object subObj in enumerable) { await ChangeIdAsync(subObj, requestId, direction, requestType).ConfigureAwait(false); } } else { throw MobileExceptions.IdBarrierError(cause: "Id Barrier碰到无法解析的类型"); } } }
public override int ChangeSwitchPosition(ChangeDirection changeDirection) { if (changeDirection == ChangeDirection.Up) { if (value + 1 < maxValue) { if (firstUse) { firstUse = false; return(minValue); } else { value += stepValue; return(stepValue); } } else { return(0); } } else { if (value - 1 < minValue) { if (firstUse) { firstUse = false; return(minValue); } return(0); } else { value -= stepValue; return(-stepValue); } } }
public void RightMove(object obj) { while (direction == "Right" && stop == true) { Thread.Sleep(100); position.X += 10; if (position.X >= 1090) { StopMove(); if (position.Y == 100) { Delegate[] delList = ChangeDirection.GetInvocationList(); // ассинхронное событие // и выполнить их асинхронно foreach (Delegate del in delList) { AsyncMove deleg = (AsyncMove)del; // Текущий делегат deleg.BeginInvoke(null, null); // Выполнить } } } } }
private void ChangeMinutes(ChangeDirection direction) { var currentMinutes = Minutes; switch (direction) { case ChangeDirection.Increment: currentMinutes++; if (currentMinutes > 59) { currentMinutes = 0; } break; case ChangeDirection.Decrement: currentMinutes--; if (currentMinutes < 0) { currentMinutes = 59; } break; } Minutes = currentMinutes; }
private void ChangeHours(ChangeDirection direction) { var currentHours = Hours; switch (direction) { case ChangeDirection.Increment: currentHours++; if (currentHours > 23) { currentHours = 0; } break; case ChangeDirection.Decrement: currentHours--; if (currentHours < 0) { currentHours = 23; } break; } Hours = currentHours; }
/// <summary> /// changes the track /// </summary> /// <param name="direction"></param> private void ChangeClip(ChangeDirection direction) { if (direction == ChangeDirection.Next) { index = (index + 1) % clips.Count; } else if (--index < 0) index = clips.Count - 1; if (source.isPlaying) { source.clip = clips[index]; source.Play(); } else source.clip = clips[index]; }
public void ChangeWeightValue(ChangeDirection changeDirection) { switch (MeasurementType) { case Measurement.metric: { if (changeDirection == ChangeDirection.Add) { if (WeightAmount == 150) { break; } else { WeightAmount++; } } else { if (WeightAmount == 30) { break; } else { WeightAmount--; } } break; } case Measurement.imperial: { if (changeDirection == ChangeDirection.Add) { if (WeightAmount == 330) { break; } else { WeightAmount++; } } else { if (WeightAmount == 66) { break; } else { WeightAmount--; } } break; } } }
Focusable GetNextFocusable2D(Focusable currentFocusable, ChangeDirection direction) { if (!(currentFocusable is VisualElement ve)) { ve = m_Root; } ve = GetRootFocusable(ve); Rect rect = ve.worldBound; Rect validRect = new Rect(rect.position - Vector2.one, rect.size + Vector2.one * 2); if (direction == Up) { validRect.yMin = 0; } else if (direction == Down) { validRect.yMax = Screen.height; } else if (direction == Left) { validRect.xMin = 0; } else if (direction == Right) { validRect.xMax = Screen.width; } var best = new FocusableHierarchyTraversal { currentFocusable = ve, direction = direction, validRect = validRect, firstPass = true }.GetBestOverall(m_Root); if (best != null) { return(GetLeafFocusable(best)); } validRect = new Rect(rect.position - Vector2.one, rect.size + Vector2.one * 2); if (direction == Down) { validRect.yMin = 0; } else if (direction == Up) { validRect.yMax = Screen.height; } else if (direction == Right) { validRect.xMin = 0; } else if (direction == Left) { validRect.xMax = Screen.height; } best = new FocusableHierarchyTraversal { currentFocusable = ve, direction = direction, validRect = validRect, firstPass = false }.GetBestOverall(m_Root); if (best != null) { return(GetLeafFocusable(best)); } return(currentFocusable); }
public void Turn_in_the_right_direction_when_direction_command_given(CardinalDirection startingDirection, char command, CardinalDirection result) { Assert.Equal(result, ChangeDirection.GetNextDirection(startingDirection, command)); }
public async Task <bool> ChangeZoom(ChangeDirection zoomDirection) { ReportAction(zoomDirection); return(await Try(async() => await http.Get <BaseRequestResult>("?mode=camcmd&value=" + zoomDirection.GetString()))); }
/// <summary> /// Generate a change script needed to migrate from the left database to the right database object /// </summary> /// <returns></returns> public static string Generate( string leftdb, string rightdb, Dictionary <SchemaObject, Dictionary <string, SQLiteDdlStatement> > leftSchema, Dictionary <SchemaObject, Dictionary <string, SQLiteDdlStatement> > rightSchema, Dictionary <SchemaObject, List <SchemaComparisonItem> > comp, ChangeDirection direction) { StringBuilder sb = new StringBuilder(); // Do everything within a transaction sb.Append("-- Generated by SQLite Compare utility\r\n\r\n"); if (direction == ChangeDirection.LeftToRight) { sb.Append("-- The script can be used to migrate database\r\n-- " + leftdb + " schema\r\n-- to the schema of database\r\n-- " + rightdb + "\r\n\r\n"); } else { sb.Append("-- The script can be used to migrate database\r\n-- " + rightdb + " schema\r\n-- to the schema of database\r\n-- " + leftdb + "\r\n\r\n"); } sb.Append("BEGIN TRANSACTION;\r\n\r\n"); // There are 4 different types of objects that can be migrated: // 1. Tables // 2. Indexes // 3. Triggers // 4. Views // Indexes depend on their tables so we can handle them only after handling the // respective tables. Triggers depend on the associated table or view. If a trigger // depends on a table - we can handle it only after handling the related table. If // a trigger depends on a view - we can handle it only after handling the view. // A view depends on one or more tables, but, unlike other objects - we can simply drop // it and re-create it from scratch without damaging any data or schema information. // We'll start by handling the hardest part first - tables List <SchemaComparisonItem> tables = comp[SchemaObject.Table]; foreach (SchemaComparisonItem item in tables) { if (item.Result != ComparisonResult.Same) { string script = GenerateTableChangeScript(item, comp, direction, leftSchema, rightSchema); sb.Append(script); } else { // The table itself did not change, but we still need to check its indexes and triggers if (direction == ChangeDirection.LeftToRight) { ApplyIndexOrTriggerChanges(sb, item.LeftDdlStatement, leftSchema, rightSchema); } else { ApplyIndexOrTriggerChanges(sb, item.RightDdlStatement, rightSchema, leftSchema); } } // else } // foreach // Note: as part of creating a change script for a table object - we'll also // generate change script for its related indexes and triggers so they // don't require a separate handling here. // We'll finish my handling views List <SchemaComparisonItem> views = comp[SchemaObject.View]; foreach (SchemaComparisonItem item in views) { if (item.Result != ComparisonResult.Same) { string script = GenerateViewChangeScript(item, direction); sb.Append(script); } else { // The view itself did not change, but we still need to check its triggers if (direction == ChangeDirection.LeftToRight) { ApplyIndexOrTriggerChanges(sb, item.LeftDdlStatement, leftSchema, rightSchema); } else { ApplyIndexOrTriggerChanges(sb, item.RightDdlStatement, rightSchema, leftSchema); } } } // foreachs // Commit the transaction sb.Append("\r\nCOMMIT TRANSACTION;\r\n"); return(sb.ToString()); }
public abstract int ChangeSwitchPosition(ChangeDirection changeDirection);
public RecognitionCorrectionHint(SkeletonJoint joint = SkeletonJoint.NUM_JOINTS, float dirX = 0, float dirY = 0, float dirZ = 0, bool isAngle = false, ChangeType changeType = ChangeType.SPEED, ChangeDirection changeDir = ChangeDirection.DIFFERENT, int failedState = -1) { m_joint = joint; m_dirX = dirX; m_dirY = dirY; m_dirZ = dirZ; m_isAngle = isAngle; m_changeType = changeType; m_changeDirection = changeDir; m_failedState = failedState; }
public void Turn(ChangeDirection change) { _directionChanges.Enqueue(change); }
public void Turn(int playerNumber, ChangeDirection change) { _players[playerNumber].Turn(change); }
/// <exception cref="DatabaseException"></exception> private async Task ConvertLongIdAsync(object obj, long id, PropertyInfo propertyInfo, ApiRequestType requestType, ChangeDirection direction, string requestId) { if (id < 0) { return; } if (propertyInfo.Name == nameof(ApiResource.Id) && requestType == ApiRequestType.Add && direction == ChangeDirection.ToServer) { _addRequestClientIdDict[requestId].Add(id); propertyInfo.SetValue(obj, -1); return; } long changedId = direction switch { ChangeDirection.ToServer => await _idBarrierRepo.GetServerIdAsync(id).ConfigureAwait(false), ChangeDirection.FromServer => await _idBarrierRepo.GetClientIdAsync(id).ConfigureAwait(false), _ => - 1, }; if (direction == ChangeDirection.FromServer && changedId < 0 && id > 0 && (requestType == ApiRequestType.Get || requestType == ApiRequestType.GetSingle)) { changedId = StaticIdGen.GetId(); await AddServerIdToClientIdAsync(id, changedId).ConfigureAwait(false); } //如果服务器返回Id=-1,即这个数据不是使用Id来作为主键的,客户端实体应该避免使用IdGenEntity propertyInfo.SetValue(obj, changedId); }
private static ChangeDirectionContract ToChangeDirectionContract(ChangeDirection changeDirection) { return (ChangeDirectionContract)Enum.Parse(typeof(ChangeDirectionContract), changeDirection.ToString()); }
// Searches for a navigable element starting from currentFocusable and scanning along the specified direction. // If no elements are found, wraps around from the other side of the panel and scan along the same direction // up to currentFocusable. If still no elements are found, returns currentFocusable. // // Though search order is hierarchy-based, the "best candidate" selection process is intended to be independent // from any hierarchy consideration. Scanned elements are validated using an intersection test between their // worldBound and a scanning validation rect, currentFocusable's worldBound extended to the panel's limits in // the direction of the search (or from the other side during the second "wrap-around" scan). // // The best candidate is the element whose border is "least advanced" in the scanning direction, using the // element's worldBound border opposite from scanning direction, left border when scanning right, right border // for scanning left, etc. See FocusableHierarchyTraversal for more details and how further ties are resolved. Focusable GetNextFocusable2D(Focusable currentFocusable, ChangeDirection direction) { if (!(currentFocusable is VisualElement ve)) { ve = m_Root; } Rect panelBounds = m_Root.worldBoundingBox; Rect panelRect = new Rect(panelBounds.position - Vector2.one, panelBounds.size + Vector2.one * 2); Rect rect = ve.worldBound; Rect validRect = new Rect(rect.position - Vector2.one, rect.size + Vector2.one * 2); if (direction == Up) { validRect.yMin = panelRect.yMin; } else if (direction == Down) { validRect.yMax = panelRect.yMax; } else if (direction == Left) { validRect.xMin = panelRect.xMin; } else if (direction == Right) { validRect.xMax = panelRect.xMax; } Focusable best = new FocusableHierarchyTraversal { currentFocusable = ve, direction = direction, validRect = validRect, firstPass = true }.GetBestOverall(m_Root); if (best != null) { return(best); } validRect = new Rect(rect.position - Vector2.one, rect.size + Vector2.one * 2); if (direction == Down) { validRect.yMin = panelRect.yMin; } else if (direction == Up) { validRect.yMax = panelRect.yMax; } else if (direction == Right) { validRect.xMin = panelRect.xMin; } else if (direction == Left) { validRect.xMax = panelRect.xMax; } best = new FocusableHierarchyTraversal { currentFocusable = ve, direction = direction, validRect = validRect, firstPass = false }.GetBestOverall(m_Root); if (best != null) { return(best); } return(currentFocusable); }
private static string GenerateTableChangeScript(SchemaComparisonItem item, Dictionary <SchemaObject, List <SchemaComparisonItem> > comp, ChangeDirection direction, Dictionary <SchemaObject, Dictionary <string, SQLiteDdlStatement> > leftSchema, Dictionary <SchemaObject, Dictionary <string, SQLiteDdlStatement> > rightSchema) { StringBuilder sb = new StringBuilder(); if (item.Result == ComparisonResult.ExistsInLeftDB) { if (direction == ChangeDirection.LeftToRight) { DeleteTable(sb, item.LeftDdlStatement); } else { CopyTable(sb, item.LeftDdlStatement, leftSchema); } } else if (item.Result == ComparisonResult.ExistsInRightDB) { if (direction == ChangeDirection.RightToLeft) { DeleteTable(sb, item.RightDdlStatement); } else { CopyTable(sb, item.RightDdlStatement, rightSchema); } } else if (item.Result == ComparisonResult.DifferentSchema) { if (direction == ChangeDirection.LeftToRight) { MigrateTable(sb, item.RightDdlStatement, leftSchema, rightSchema); } else { MigrateTable(sb, item.LeftDdlStatement, rightSchema, leftSchema); } } return(sb.ToString()); }