当前位置: 首页>>代码示例>>Java>>正文


Java IModifier类代码示例

本文整理汇总了Java中org.andengine.util.modifier.IModifier的典型用法代码示例。如果您正苦于以下问题:Java IModifier类的具体用法?Java IModifier怎么用?Java IModifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IModifier类属于org.andengine.util.modifier包,在下文中一共展示了IModifier类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerBackgroundModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
@Override
public void registerBackgroundModifier(final IModifier<IBackground> pBackgroundModifier) {
	if (this.mBackgroundModifiers == null) {
		this.allocateBackgroundModifiers();
	}
	this.mBackgroundModifiers.add(pBackgroundModifier);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:Background.java

示例2: unregisterBackgroundModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
@Override
public boolean unregisterBackgroundModifier(final IModifier<IBackground> pBackgroundModifier) {
	if (this.mBackgroundModifiers != null) {
		return this.mBackgroundModifiers.remove(pBackgroundModifier);
	} else {
		return false;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:Background.java

示例3: getSequenceDurationOfModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
public static float getSequenceDurationOfModifier(final IModifier<?>[] pModifiers) {
	float duration = Float.MIN_VALUE;

	for (int i = pModifiers.length - 1; i >= 0; i--) {
		duration += pModifiers[i].getDuration();
	}

	return duration;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:10,代码来源:ModifierUtils.java

示例4: registerBackgroundModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
@Override
public void registerBackgroundModifier(final IModifier<IBackground> pBackgroundModifier) {
	if(this.mBackgroundModifiers == null) {
		this.allocateBackgroundModifiers();
	}
	this.mBackgroundModifiers.add(pBackgroundModifier);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:8,代码来源:Background.java

示例5: unregisterBackgroundModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
@Override
public boolean unregisterBackgroundModifier(final IModifier<IBackground> pBackgroundModifier) {
	if(this.mBackgroundModifiers != null) {
		return this.mBackgroundModifiers.remove(pBackgroundModifier);
	} else {
		return false;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:9,代码来源:Background.java

示例6: getSequenceDurationOfModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
public static float getSequenceDurationOfModifier(final IModifier<?>[] pModifiers){
	float duration = Float.MIN_VALUE;

	for(int i = pModifiers.length - 1; i >= 0; i--) {
		duration += pModifiers[i].getDuration();
	}

	return duration;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:10,代码来源:ModifierUtils.java

示例7: createBackground

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
private void createBackground(final Bitmap background, @Nullable final String backgroundUrl) {
    if (background == null) return;

    BitmapTextureAtlas bitmapTextureAtlas = new BitmapTextureAtlas(_engine.getTextureManager(), _width, _height, TextureOptions.BILINEAR);
    IBitmapTextureAtlasSource baseTextureSource = new EmptyBitmapTextureAtlasSource(_width, _height);

    final IBitmapTextureAtlasSource bitmapTextureAtlasSource = new BaseBitmapTextureAtlasSourceDecorator(baseTextureSource) {
        @Override
        protected void onDecorateBitmap(Canvas pCanvas) throws Exception {
            if (backgroundUrl != null) {
                Bitmap template = BitmapFactory.decodeStream(GoogleFlipGameApplication.sContext.getAssets().open(backgroundUrl));
                pCanvas.drawBitmap(template, 0, 0, mPaint);
            }

            pCanvas.drawColor(_backgroundColor);
            pCanvas.drawBitmap(background, 0, 0, mPaint);
        }

        @Override
        public BaseBitmapTextureAtlasSourceDecorator deepCopy() {
            throw new IModifier.DeepCopyNotSupportedException();
        }
    };

    ITextureRegion mDecoratedBalloonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(bitmapTextureAtlas, bitmapTextureAtlasSource,
            0, 0);
    bitmapTextureAtlas.load();

    Sprite sprite = new Sprite(0, 0, mDecoratedBalloonTextureRegion, _engine.getVertexBufferObjectManager());
    sprite.setOffsetCenter(0, 0);
    sprite.setWidth(_width);
    sprite.setHeight(_height);
    _background = new SpriteBackground(sprite);
    _engine.getScene().setBackground(_background);
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:36,代码来源:WorldController.java

示例8: animateCardDeletion

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
private void animateCardDeletion(final Card card) {
    activity.getScene().unregisterTouchArea(card);

    final IEntityModifier.IEntityModifierListener logListener = new IEntityModifier.IEntityModifierListener() {
        @Override
        public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
        }

        @Override
        public void onModifierFinished(final IModifier<IEntity> pEntityModifier, final IEntity pEntity) {
            activity.runOnUpdateThread(new Runnable() {
                @Override
                public void run() {
                    deleteCard(card, true, true);
                    Log.d(TAG, "run - Animation finished, deleting card " + card.getType());
                }
            });
        }
    };
    final float fromAlpha = card.getAlpha();
    final float toAlpha = 0;

    final SequenceEntityModifier entityModifier = new SequenceEntityModifier(
            new AlphaModifier(WIN_DURATION, fromAlpha, toAlpha),
            new DelayModifier(WIN_DURATION)
    );

    card.registerEntityModifier(new LoopEntityModifier(entityModifier, 1, logListener));
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:30,代码来源:PictoGame.java

示例9: animate

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
protected void animate(final WorldObject object, Color fromColor, Color toColor) {
        final IEntityModifier.IEntityModifierListener logListener = new IEntityModifier.IEntityModifierListener() {
            @Override
            public void onModifierStarted(final IModifier<IEntity> pModifier, final IEntity pItem) {
//                activity.runOnUiThread(new Runnable() {
//                    @Override
//                    public void run() {
//                        final String text = "Animation started.";
//                        Log.v(TAG, "onModifierStarted - " + text);
//                    }
//                });
            }

            @Override
            public void onModifierFinished(final IModifier<IEntity> pEntityModifier, final IEntity pEntity) {
//                activity.runOnUiThread(new Runnable() {
//                    @Override
//                    public void run() {
//                        final String text = "Animation finished.";
//                        Log.v(TAG, "onModifierFinished - " + text);
//                    }
//                });
            }
        };

        final float pDuration = 0.25f;

        final SequenceEntityModifier entityModifier = new SequenceEntityModifier(
                new ColorModifier(pDuration, fromColor, toColor),
                new ColorModifier(pDuration, toColor, fromColor),
                new DelayModifier(pDuration * 2)
        );

        animate(object, entityModifier, logListener);
    }
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:36,代码来源:BaseGame.java

示例10: PathModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
public PathModifier(final float pDuration, final Path pPath, final IEntityModifierListener pEntityModiferListener, final IPathModifierListener pPathModifierListener, final IEaseFunction pEaseFunction) throws IllegalArgumentException {
	super(pEntityModiferListener);
	final int pathSize = pPath.getSize();

	if (pathSize < 2) {
		throw new IllegalArgumentException("Path needs at least 2 waypoints!");
	}

	this.mPath = pPath;
	this.mPathModifierListener = pPathModifierListener;

	final MoveModifier[] moveModifiers = new MoveModifier[pathSize - 1];

	final float[] coordinatesX = pPath.getCoordinatesX();
	final float[] coordinatesY = pPath.getCoordinatesY();

	final float velocity = pPath.getLength() / pDuration;

	final int modifierCount = moveModifiers.length;
	for (int i = 0; i < modifierCount; i++) {
		final float duration = pPath.getSegmentLength(i) / velocity;
		moveModifiers[i] = new MoveModifier(duration, coordinatesX[i], coordinatesY[i], coordinatesX[i + 1], coordinatesY[i + 1], null, pEaseFunction);
	}

	/* Create a new SequenceModifier and register the listeners that
	 * call through to mEntityModifierListener and mPathModifierListener. */
	this.mSequenceModifier = new SequenceModifier<IEntity>(
			new ISubSequenceModifierListener<IEntity>() {
				@Override
				public void onSubSequenceStarted(final IModifier<IEntity> pModifier, final IEntity pEntity, final int pIndex) {
					if (PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathWaypointStarted(PathModifier.this, pEntity, pIndex);
					}
				}

				@Override
				public void onSubSequenceFinished(final IModifier<IEntity> pEntityModifier, final IEntity pEntity, final int pIndex) {
					if (PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathWaypointFinished(PathModifier.this, pEntity, pIndex);
					}
				}
			},
			new IEntityModifierListener() {
				@Override
				public void onModifierStarted(final IModifier<IEntity> pModifier, final IEntity pEntity) {
					PathModifier.this.onModifierStarted(pEntity);
					if (PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathStarted(PathModifier.this, pEntity);
					}
				}

				@Override
				public void onModifierFinished(final IModifier<IEntity> pEntityModifier, final IEntity pEntity) {
					PathModifier.this.onModifierFinished(pEntity);
					if (PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathFinished(PathModifier.this, pEntity);
					}
				}
			},
			moveModifiers
	);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:63,代码来源:PathModifier.java

示例11: PathModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
public PathModifier(final float pDuration, final Path pPath, final IEntityModifierListener pEntityModiferListener, final IPathModifierListener pPathModifierListener, final IEaseFunction pEaseFunction) throws IllegalArgumentException {
	super(pEntityModiferListener);
	final int pathSize = pPath.getSize();

	if (pathSize < 2) {
		throw new IllegalArgumentException("Path needs at least 2 waypoints!");
	}

	this.mPath = pPath;
	this.mPathModifierListener = pPathModifierListener;

	final MoveModifier[] moveModifiers = new MoveModifier[pathSize - 1];

	final float[] coordinatesX = pPath.getCoordinatesX();
	final float[] coordinatesY = pPath.getCoordinatesY();

	final float velocity = pPath.getLength() / pDuration;

	final int modifierCount = moveModifiers.length;
	for(int i = 0; i < modifierCount; i++) {
		final float duration = pPath.getSegmentLength(i) / velocity;
		moveModifiers[i] = new MoveModifier(duration, coordinatesX[i], coordinatesX[i + 1], coordinatesY[i], coordinatesY[i + 1], null, pEaseFunction);
	}

	/* Create a new SequenceModifier and register the listeners that
	 * call through to mEntityModifierListener and mPathModifierListener. */
	this.mSequenceModifier = new SequenceModifier<IEntity>(
			new ISubSequenceModifierListener<IEntity>() {
				@Override
				public void onSubSequenceStarted(final IModifier<IEntity> pModifier, final IEntity pEntity, final int pIndex) {
					if(PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathWaypointStarted(PathModifier.this, pEntity, pIndex);
					}
				}

				@Override
				public void onSubSequenceFinished(final IModifier<IEntity> pEntityModifier, final IEntity pEntity, final int pIndex) {
					if(PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathWaypointFinished(PathModifier.this, pEntity, pIndex);
					}
				}
			},
			new IEntityModifierListener() {
				@Override
				public void onModifierStarted(final IModifier<IEntity> pModifier, final IEntity pEntity) {
					PathModifier.this.onModifierStarted(pEntity);
					if(PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathStarted(PathModifier.this, pEntity);
					}
				}

				@Override
				public void onModifierFinished(final IModifier<IEntity> pEntityModifier, final IEntity pEntity) {
					PathModifier.this.onModifierFinished(pEntity);
					if(PathModifier.this.mPathModifierListener != null) {
						PathModifier.this.mPathModifierListener.onPathFinished(PathModifier.this, pEntity);
					}
				}
			},
			moveModifiers
	);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:63,代码来源:PathModifier.java

示例12: registerBackgroundModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
public void registerBackgroundModifier(final IModifier<IBackground> pBackgroundModifier); 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:2,代码来源:IBackground.java

示例13: unregisterBackgroundModifier

import org.andengine.util.modifier.IModifier; //导入依赖的package包/类
public boolean unregisterBackgroundModifier(final IModifier<IBackground> pBackgroundModifier); 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:2,代码来源:IBackground.java


注:本文中的org.andengine.util.modifier.IModifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。