// Weak links to children /** Update the layout of the stepper with the given touch location. */ protected void UpdateLayoutUsingTouchLocation(CCPoint location) { if (location.X < _minusSprite.ContentSize.Width && _value > _minimumValue) { _touchedPart = CCControlStepperPart.PartMinus; _minusSprite.Color = CCTypes.CCGray; _plusSprite.Color = CCTypes.CCWhite; } else if (location.X >= _minusSprite.ContentSize.Width && _value < _maximumValue) { _touchedPart = CCControlStepperPart.PartPlus; _minusSprite.Color = CCTypes.CCWhite; _plusSprite.Color = CCTypes.CCGray; } else { _touchedPart = CCControlStepperPart.PartNone; _minusSprite.Color = CCTypes.CCWhite; _plusSprite.Color = CCTypes.CCWhite; } }
void OnTouchMoved(CCTouch pTouch, CCEvent touchEvent) { if (IsTouchInside(pTouch)) { CCPoint location = GetTouchLocation(pTouch); UpdateLayoutUsingTouchLocation(location); if (!touchInsideFlag) { touchInsideFlag = true; if (autorepeat) { StartAutorepeat(); } } } else { touchInsideFlag = false; touchedPart = CCControlStepperPart.PartNone; MinusSprite.Color = CCColor3B.White; PlusSprite.Color = CCColor3B.White; if (autorepeat) { StopAutorepeat(); } } }
public override void TouchMoved(CCTouch pTouch) { if (IsTouchInside(pTouch)) { CCPoint location = GetTouchLocation(pTouch); UpdateLayoutUsingTouchLocation(location); if (!_touchInsideFlag) { _touchInsideFlag = true; if (_autorepeat) { StartAutorepeat(); } } } else { _touchInsideFlag = false; _touchedPart = CCControlStepperPart.PartNone; _minusSprite.Color = CCTypes.CCWhite; _plusSprite.Color = CCTypes.CCWhite; if (_autorepeat) { StopAutorepeat(); } } }
/** Update the layout of the stepper with the given touch location. */ protected void UpdateLayoutUsingTouchLocation(CCPoint location) { if (location.X < MinusSprite.ContentSize.Width && this.value > minimumValue) { touchedPart = CCControlStepperPart.PartMinus; MinusSprite.Color = CCColor3B.Gray; PlusSprite.Color = CCColor3B.White; } else if (location.X >= MinusSprite.ContentSize.Width && this.value < maximumValue) { touchedPart = CCControlStepperPart.PartPlus; MinusSprite.Color = CCColor3B.White; PlusSprite.Color = CCColor3B.Gray; } else { touchedPart = CCControlStepperPart.PartNone; MinusSprite.Color = CCColor3B.White; PlusSprite.Color = CCColor3B.White; } }