private static bool handleDuplicatePropertiesInTween(GoTween tween) { List <GoTween> list = tweensWithTarget(tween.target); List <AbstractTweenProperty> list2 = tween.allTweenProperties(); for (int i = 0; i < list.Count; i++) { GoTween goTween = list[i]; for (int j = 0; j < list2.Count; j++) { AbstractTweenProperty property = list2[j]; if (goTween.containsTweenProperty(property)) { if (duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty) { return(true); } if (duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty) { goTween.removeTweenProperty(property); } return(false); } } } return(false); }
static public int allTweenProperties(IntPtr l) { try { GoTween self = (GoTween)checkSelf(l); var ret = self.allTweenProperties(); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// checks for duplicate properties. if one is found and the DuplicatePropertyRuleType is set to /// DontAddCurrentProperty it will return true indicating that the tween should not be added. /// this only checks tweens that are not part of an AbstractTweenCollection /// </summary> private bool handleDuplicatePropertiesInTween(GoTween tween) { // first fetch all the current tweens with the same target object as this one var allTweensWithTarget = tweensWithTarget(tween.target); // store a list of all the properties in the tween var allProperties = tween.allTweenProperties(); // TODO: perhaps only perform the check on running Tweens? // loop through all the tweens with the same target for (int k = 0; k < allTweensWithTarget.Count; ++k) { GoTween tweenWithTarget = allTweensWithTarget[k]; // loop through all the properties in the tween and see if there are any dupes for (int z = 0; z < allProperties.Count; ++z) { AbstractTweenProperty tweenProp = allProperties[z]; // check for a matched property if (tweenWithTarget.containsTweenProperty(tweenProp)) { warn("found duplicate TweenProperty {0} in tween {1}", tweenProp, tween); // handle the different duplicate property rules if (duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty) { return(true); } else if (duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty) { // TODO: perhaps check if the Tween has any properties left and remove it if it doesnt? tweenWithTarget.removeTweenProperty(tweenProp); } return(false); } } } return(false); }
/// <summary> /// checks for duplicate properties. if one is found and the DuplicatePropertyRuleType is set to /// DontAddCurrentProperty it will return true indicating that the tween should not be added. /// this only checks tweens that are not part of an AbstractTweenCollection /// </summary> private static bool handleDuplicatePropertiesInTween( GoTween tween ) { // first fetch all the current tweens with the same target object as this one var allTweensWithTarget = tweensWithTarget( tween.target ); // store a list of all the properties in the tween var allProperties = tween.allTweenProperties(); // loop through all the tweens with the same target foreach( var tweenWithTarget in allTweensWithTarget ) { // loop through all the properties in the tween and see if there are any dupes foreach( var tweenProp in allProperties ) { warn( "found duplicate TweenProperty {0} in tween {1}", tweenProp, tween ); // check for a matched property if( tweenWithTarget.containsTweenProperty( tweenProp ) ) { // handle the different duplicate property rules if( duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty ) { return true; } else if( duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty ) { tweenWithTarget.removeTweenProperty( tweenProp ); } return false; } } } return false; }
/// <summary> /// checks for duplicate properties. if one is found and the DuplicatePropertyRuleType is set to /// DontAddCurrentProperty it will return true indicating that the tween should not be added. /// this only checks tweens that are not part of an AbstractTweenCollection /// </summary> private static bool handleDuplicatePropertiesInTween(GoTween tween) { // first fetch all the current tweens with the same target object as this one var allTweensWithTarget = tweensWithTarget(tween.target); // store a list of all the properties in the tween var allProperties = tween.allTweenProperties(); // TODO: perhaps only perform the check on running Tweens? for (int i = 0; allTweensWithTarget.Count > i; i++) { GoTween tweenWithTarget = allTweensWithTarget[i]; for (int j = 0; allProperties.Count > j; j++) { AbstractTweenProperty tweenProp = allProperties[j]; if (tweenWithTarget.containsTweenProperty(tweenProp)) { // handle the different duplicate property rules if (duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty) { return(true); } else if (duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty) { // TODO: perhaps check if the Tween has any properties left and remove it if it doesnt? tweenWithTarget.removeTweenProperty(tweenProp); } return(false); } } } /*// loop through all the tweens with the same target * foreach ( var tweenWithTarget in allTweensWithTarget ) * { * // loop through all the properties in the tween and see if there are any dupes * foreach ( var tweenProp in allProperties ) * { * warn( "found duplicate TweenProperty {0} in tween {1}" , tweenProp , tween ); * * // check for a matched property * if ( tweenWithTarget.containsTweenProperty( tweenProp ) ) * { * // handle the different duplicate property rules * if ( duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty ) * { * return true; * } * else if ( duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty ) * { * // TODO: perhaps check if the Tween has any properties left and remove it if it doesnt? * tweenWithTarget.removeTweenProperty( tweenProp ); * } * * return false; * } * } * }*/ return(false); }
/// <summary> /// checks for duplicate properties. if one is found and the DuplicatePropertyRuleType is set to /// DontAddCurrentProperty it will return true indicating that the tween should not be added. /// this only checks tweens that are not part of an AbstractTweenCollection /// </summary> private static bool handleDuplicatePropertiesInTween( GoTween tween ) { // first fetch all the current tweens with the same target object as this one var allTweensWithTarget = tweensWithTarget( tween.target ); // store a list of all the properties in the tween var allProperties = tween.allTweenProperties(); // TODO: perhaps only perform the check on running Tweens? // loop through all the tweens with the same target for( int k = 0; k < allTweensWithTarget.Count; ++k ) { GoTween tweenWithTarget = allTweensWithTarget[k]; // loop through all the properties in the tween and see if there are any dupes for( int z = 0; z < allProperties.Count; ++z ) { AbstractTweenProperty tweenProp = allProperties[z]; warn( "found duplicate TweenProperty {0} in tween {1}", tweenProp, tween ); // check for a matched property if( tweenWithTarget.containsTweenProperty( tweenProp ) ) { // handle the different duplicate property rules if( duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty ) { return true; } else if( duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty ) { // TODO: perhaps check if the Tween has any properties left and remove it if it doesnt? tweenWithTarget.removeTweenProperty( tweenProp ); } return false; } } } return false; }