mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Compare commits
12 Commits
fix-item-d
...
fix-visual
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1c2a4ef8c | ||
|
|
af3109b9d9 | ||
|
|
bac004ae33 | ||
|
|
e5acb89f1b | ||
|
|
950310906e | ||
|
|
4f2733324f | ||
|
|
7379277b1d | ||
|
|
6387b87ced | ||
|
|
f01c5ff237 | ||
|
|
5843be57c0 | ||
|
|
4a62613375 | ||
|
|
bec17c65e4 |
@@ -152,6 +152,12 @@ public final class DebugInterface {
|
|||||||
public void onClick(View arg0) {
|
public void onClick(View arg0) {
|
||||||
showToast(mainActivity, "DEBUG: map=" + world.model.currentMaps.map.name , Toast.LENGTH_SHORT);
|
showToast(mainActivity, "DEBUG: map=" + world.model.currentMaps.map.name , Toast.LENGTH_SHORT);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("tim", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
world.model.worldData.tickWorldTime(10);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,23 @@ import com.gpl.rpg.AndorsTrail.util.Coord;
|
|||||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public final class VisualEffectController {
|
public final class VisualEffectController {
|
||||||
|
private static final long EFFECT_UPDATE_INTERVAL = 25;
|
||||||
private int effectCount = 0;
|
private int effectCount = 0;
|
||||||
|
|
||||||
private final ControllerContext controllers;
|
private final ControllerContext controllers;
|
||||||
private final WorldContext world;
|
private final WorldContext world;
|
||||||
private final VisualEffectCollection effectTypes;
|
private final VisualEffectCollection effectTypes;
|
||||||
|
private final Handler animationHandler = new Handler();
|
||||||
|
private final List<VisualEffectAnimation> activeAnimations = new ArrayList<>();
|
||||||
|
|
||||||
public final VisualEffectFrameListeners visualEffectFrameListeners = new VisualEffectFrameListeners();
|
public final VisualEffectFrameListeners visualEffectFrameListeners = new VisualEffectFrameListeners();
|
||||||
|
private long getEffectUpdateInterval() {
|
||||||
|
return EFFECT_UPDATE_INTERVAL * controllers.preferences.attackspeed_milliseconds / AndorsTrailPreferences.ATTACKSPEED_DEFAULT_MILLISECONDS;
|
||||||
|
}
|
||||||
|
|
||||||
public VisualEffectController(ControllerContext controllers, WorldContext world) {
|
public VisualEffectController(ControllerContext controllers, WorldContext world) {
|
||||||
this.controllers = controllers;
|
this.controllers = controllers;
|
||||||
@@ -38,10 +47,42 @@ public final class VisualEffectController {
|
|||||||
|
|
||||||
public void startEffect(Coord position, VisualEffectCollection.VisualEffectID effectID, String displayValue, VisualEffectCompletedCallback callback, int callbackValue) {
|
public void startEffect(Coord position, VisualEffectCollection.VisualEffectID effectID, String displayValue, VisualEffectCompletedCallback callback, int callbackValue) {
|
||||||
++effectCount;
|
++effectCount;
|
||||||
(new VisualEffectAnimation(effectTypes.getVisualEffect(effectID), position, displayValue, callback, callbackValue))
|
VisualEffectAnimation animation = new VisualEffectAnimation(effectTypes.getVisualEffect(effectID), position, displayValue, callback, callbackValue);
|
||||||
.start();
|
animation.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startAnimation(VisualEffectAnimation animation) {
|
||||||
|
activeAnimations.add(animation);
|
||||||
|
animation.update();
|
||||||
|
if (activeAnimations.size() == 1) {
|
||||||
|
animationHandler.postDelayed(animationRunnable, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Runnable animationRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if(!activeAnimations.isEmpty()) {
|
||||||
|
long updateInterval = getEffectUpdateInterval();
|
||||||
|
animationHandler.postDelayed(this, updateInterval);
|
||||||
|
|
||||||
|
for (int i = 0; i < activeAnimations.size(); i++) {
|
||||||
|
VisualEffectAnimation animation = activeAnimations.get(i);
|
||||||
|
animation.durationPassed += updateInterval;
|
||||||
|
animation.updateFrame();
|
||||||
|
animation.update();
|
||||||
|
if (animation.currentFrame >= animation.effect.lastFrame) {
|
||||||
|
animation.onCompleted();
|
||||||
|
activeAnimations.remove(i);
|
||||||
|
effectCount--;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visualEffectFrameListeners.onNewAnimationFrames(activeAnimations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private VisualEffectCollection.VisualEffectID enqueuedEffectID = null;
|
private VisualEffectCollection.VisualEffectID enqueuedEffectID = null;
|
||||||
private int enqueuedEffectValue = 0;
|
private int enqueuedEffectValue = 0;
|
||||||
public void enqueueEffect(VisualEffectCollection.VisualEffectID effectID, int displayValue) {
|
public void enqueueEffect(VisualEffectCollection.VisualEffectID effectID, int displayValue) {
|
||||||
@@ -65,9 +106,8 @@ public final class VisualEffectController {
|
|||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class SpriteMoveAnimation extends Handler implements Runnable {
|
public final class SpriteMoveAnimation implements Runnable {
|
||||||
|
private final Handler handler = new Handler();
|
||||||
// private static final int millisecondsPerFrame=25;
|
|
||||||
|
|
||||||
private final VisualEffectCompletedCallback callback;
|
private final VisualEffectCompletedCallback callback;
|
||||||
private final int callbackValue;
|
private final int callbackValue;
|
||||||
@@ -82,11 +122,6 @@ public final class VisualEffectController {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
onCompleted();
|
onCompleted();
|
||||||
// update();
|
|
||||||
// if (System.currentTimeMillis() - actor.vfxStartTime >= duration) {
|
|
||||||
// } else {
|
|
||||||
// postDelayed(this, millisecondsPerFrame);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpriteMoveAnimation(Coord origin, Coord destination, int duration, Actor actor, PredefinedMap map, VisualEffectCompletedCallback callback, int callbackValue) {
|
public SpriteMoveAnimation(Coord origin, Coord destination, int duration, Actor actor, PredefinedMap map, VisualEffectCompletedCallback callback, int callbackValue) {
|
||||||
@@ -100,11 +135,6 @@ public final class VisualEffectController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void update() {
|
|
||||||
//
|
|
||||||
// visualEffectFrameListeners.onNewSpriteMoveFrame(this);
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void onCompleted() {
|
private void onCompleted() {
|
||||||
--effectCount;
|
--effectCount;
|
||||||
actor.hasVFXRunning = false;
|
actor.hasVFXRunning = false;
|
||||||
@@ -112,7 +142,6 @@ public final class VisualEffectController {
|
|||||||
visualEffectFrameListeners.onSpriteMoveCompleted(this);
|
visualEffectFrameListeners.onSpriteMoveCompleted(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
actor.hasVFXRunning = true;
|
actor.hasVFXRunning = true;
|
||||||
actor.vfxDuration = duration;
|
actor.vfxDuration = duration;
|
||||||
@@ -120,12 +149,9 @@ public final class VisualEffectController {
|
|||||||
visualEffectFrameListeners.onSpriteMoveStarted(this);
|
visualEffectFrameListeners.onSpriteMoveStarted(this);
|
||||||
if (duration == 0 || !controllers.preferences.enableUiAnimations) onCompleted();
|
if (duration == 0 || !controllers.preferences.enableUiAnimations) onCompleted();
|
||||||
else {
|
else {
|
||||||
postDelayed(this, duration);
|
handler.postDelayed(this, duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Paint textPaint = new Paint();
|
public static final Paint textPaint = new Paint();
|
||||||
@@ -135,40 +161,41 @@ public final class VisualEffectController {
|
|||||||
textPaint.setTextAlign(Align.CENTER);
|
textPaint.setTextAlign(Align.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class VisualEffectAnimation extends Handler implements Runnable {
|
public final class VisualEffectAnimation {
|
||||||
|
public int tileID;
|
||||||
|
public int textYOffset;
|
||||||
|
public long durationPassed = 0;
|
||||||
|
|
||||||
@Override
|
private void updateFrame() {
|
||||||
public void run() {
|
long frameDuration = (long) effect.millisecondPerFrame * controllers.preferences.attackspeed_milliseconds / AndorsTrailPreferences.ATTACKSPEED_DEFAULT_MILLISECONDS;
|
||||||
if (currentFrame >= effect.lastFrame) {
|
while (durationPassed > frameDuration) {
|
||||||
onCompleted();
|
currentFrame++;
|
||||||
} else {
|
durationPassed -= frameDuration;
|
||||||
postDelayed(this, effect.millisecondPerFrame * controllers.preferences.attackspeed_milliseconds / AndorsTrailPreferences.ATTACKSPEED_DEFAULT_MILLISECONDS);
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
++currentFrame;
|
if (currentFrame >= effect.lastFrame) {
|
||||||
int frame = currentFrame;
|
return;
|
||||||
|
|
||||||
int tileID = effect.frameIconIDs[frame];
|
|
||||||
int textYOffset = -2 * (frame);
|
|
||||||
if (frame >= beginFadeAtFrame && displayText != null) {
|
|
||||||
textPaint.setAlpha(255 * (effect.lastFrame - frame) / (effect.lastFrame - beginFadeAtFrame));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tileID = effect.frameIconIDs[currentFrame];
|
||||||
|
textYOffset = -2 * (currentFrame);
|
||||||
|
|
||||||
|
if (currentFrame >= beginFadeAtFrame && displayText != null) {
|
||||||
|
textPaint.setAlpha(255 * (effect.lastFrame - currentFrame) / (effect.lastFrame - beginFadeAtFrame));
|
||||||
|
}
|
||||||
|
|
||||||
area.topLeft.y = position.y - 1;
|
area.topLeft.y = position.y - 1;
|
||||||
visualEffectFrameListeners.onNewAnimationFrame(this, tileID, textYOffset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCompleted() {
|
private void onCompleted() {
|
||||||
--effectCount;
|
|
||||||
visualEffectFrameListeners.onAnimationCompleted(this);
|
visualEffectFrameListeners.onAnimationCompleted(this);
|
||||||
if (callback != null) callback.onVisualEffectCompleted(callbackValue);
|
if (callback != null) callback.onVisualEffectCompleted(callbackValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
if (!controllers.preferences.enableUiAnimations) onCompleted();
|
if (!controllers.preferences.enableUiAnimations) onCompleted();
|
||||||
else postDelayed(this, 0);
|
else startAnimation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int currentFrame = 0;
|
private int currentFrame = 0;
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.SpriteMoveAnima
|
|||||||
import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.VisualEffectAnimation;
|
import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.VisualEffectAnimation;
|
||||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface VisualEffectFrameListener {
|
public interface VisualEffectFrameListener {
|
||||||
void onNewAnimationFrame(VisualEffectAnimation animation, int tileID, int textYOffset);
|
void onNewAnimationFrames(List<VisualEffectAnimation> effects);
|
||||||
void onAnimationCompleted(VisualEffectAnimation animation);
|
void onAnimationCompleted(VisualEffectAnimation animation);
|
||||||
void onSpriteMoveStarted(SpriteMoveAnimation animation);
|
void onSpriteMoveStarted(SpriteMoveAnimation animation);
|
||||||
void onNewSpriteMoveFrame(SpriteMoveAnimation animation);
|
void onNewSpriteMoveFrame(SpriteMoveAnimation animation);
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.VisualEffectAni
|
|||||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||||
import com.gpl.rpg.AndorsTrail.util.ListOfListeners;
|
import com.gpl.rpg.AndorsTrail.util.ListOfListeners;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public final class VisualEffectFrameListeners extends ListOfListeners<VisualEffectFrameListener> implements VisualEffectFrameListener {
|
public final class VisualEffectFrameListeners extends ListOfListeners<VisualEffectFrameListener> implements VisualEffectFrameListener {
|
||||||
|
|
||||||
private final Function3<VisualEffectFrameListener, VisualEffectAnimation, Integer, Integer> onNewAnimationFrame = new Function3<VisualEffectFrameListener, VisualEffectAnimation, Integer, Integer>() {
|
private final Function1<VisualEffectFrameListener, List<VisualEffectAnimation>> onNewAnimationFrames = new Function1<VisualEffectFrameListener, List<VisualEffectAnimation>>() {
|
||||||
@Override public void call(VisualEffectFrameListener listener, VisualEffectAnimation animation, Integer tileID, Integer textYOffset) { listener.onNewAnimationFrame(animation, tileID, textYOffset); }
|
@Override public void call(VisualEffectFrameListener listener, List<VisualEffectAnimation> effects) { listener.onNewAnimationFrames(effects); }
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Function1<VisualEffectFrameListener, VisualEffectAnimation> onAnimationCompleted = new Function1<VisualEffectFrameListener, VisualEffectAnimation>() {
|
private final Function1<VisualEffectFrameListener, VisualEffectAnimation> onAnimationCompleted = new Function1<VisualEffectFrameListener, VisualEffectAnimation>() {
|
||||||
@@ -32,8 +34,8 @@ public final class VisualEffectFrameListeners extends ListOfListeners<VisualEffe
|
|||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewAnimationFrame(VisualEffectAnimation animation, int tileID, int textYOffset) {
|
public void onNewAnimationFrames(List<VisualEffectAnimation> effects) {
|
||||||
callAllListeners(this.onNewAnimationFrame, animation, tileID, textYOffset);
|
callAllListeners(this.onNewAnimationFrames, effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ public final class ResourceLoader {
|
|||||||
loader.prepareTileset(R.drawable.map_border_1, "map_border_1", mapTileSize, sz1x1, mTileSize);
|
loader.prepareTileset(R.drawable.map_border_1, "map_border_1", mapTileSize, sz1x1, mTileSize);
|
||||||
loader.prepareTileset(R.drawable.map_bridge_1, "map_bridge_1", mapTileSize, sz1x1, mTileSize);
|
loader.prepareTileset(R.drawable.map_bridge_1, "map_bridge_1", mapTileSize, sz1x1, mTileSize);
|
||||||
loader.prepareTileset(R.drawable.map_bridge_2, "map_bridge_2", mapTileSize, sz1x1, mTileSize);
|
loader.prepareTileset(R.drawable.map_bridge_2, "map_bridge_2", mapTileSize, sz1x1, mTileSize);
|
||||||
|
loader.prepareTileset(R.drawable.map_brightport, "map_brightport", new Size(7, 5), sz1x1, mTileSize);
|
||||||
loader.prepareTileset(R.drawable.map_broken_1, "map_broken_1", mapTileSize, sz1x1, mTileSize);
|
loader.prepareTileset(R.drawable.map_broken_1, "map_broken_1", mapTileSize, sz1x1, mTileSize);
|
||||||
loader.prepareTileset(R.drawable.map_cavewall_1, "map_cavewall_1", new Size(18, 6), sz1x1, mTileSize);
|
loader.prepareTileset(R.drawable.map_cavewall_1, "map_cavewall_1", new Size(18, 6), sz1x1, mTileSize);
|
||||||
loader.prepareTileset(R.drawable.map_cavewall_2, "map_cavewall_2", new Size(18, 6), sz1x1, mTileSize);
|
loader.prepareTileset(R.drawable.map_cavewall_2, "map_cavewall_2", new Size(18, 6), sz1x1, mTileSize);
|
||||||
|
|||||||
@@ -30,6 +30,18 @@ public final class CoordRect {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CoordRect union(CoordRect r1, CoordRect r2) {
|
||||||
|
int left = Math.min(r1.topLeft.x, r2.topLeft.x);
|
||||||
|
int top = Math.min(r1.topLeft.y, r2.topLeft.y);
|
||||||
|
int right = Math.max(r1.topLeft.x + r1.size.width, r2.topLeft.x + r2.size.width);
|
||||||
|
int bottom = Math.max(r1.topLeft.y + r1.size.height, r2.topLeft.y + r2.size.height);
|
||||||
|
|
||||||
|
int width = right - left;
|
||||||
|
int height = bottom - top;
|
||||||
|
|
||||||
|
return new CoordRect(new Coord(left, top), new Size(width, height));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static boolean contains(final int x, final int y, final Size size, final Coord p) {
|
public static boolean contains(final int x, final int y, final Size size, final Coord p) {
|
||||||
if (p.x < x) return false;
|
if (p.x < x) return false;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gpl.rpg.AndorsTrail.view;
|
package com.gpl.rpg.AndorsTrail.view;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||||
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
||||||
@@ -158,8 +159,8 @@ public final class MainView extends SurfaceView
|
|||||||
// this.surfaceSize = new Size(w, h);
|
// this.surfaceSize = new Size(w, h);
|
||||||
this.surfaceSize = new Size((int) (getWidth() / scale), (int) (getHeight() / scale));
|
this.surfaceSize = new Size((int) (getWidth() / scale), (int) (getHeight() / scale));
|
||||||
this.screenSizeTileCount = new Size(
|
this.screenSizeTileCount = new Size(
|
||||||
(int) Math.floor(getWidth() / scaledTileSize)
|
getWidth() / scaledTileSize
|
||||||
,(int) Math.floor(getHeight() / scaledTileSize)
|
,getHeight() / scaledTileSize
|
||||||
);
|
);
|
||||||
|
|
||||||
if (sh.getSurfaceFrame().right != surfaceSize.width || sh.getSurfaceFrame().bottom != surfaceSize.height) {
|
if (sh.getSurfaceFrame().right != surfaceSize.width || sh.getSurfaceFrame().bottom != surfaceSize.height) {
|
||||||
@@ -226,18 +227,18 @@ public final class MainView extends SurfaceView
|
|||||||
if (scrolling && why != RedrawAllDebugReason.MapScrolling) return;
|
if (scrolling && why != RedrawAllDebugReason.MapScrolling) return;
|
||||||
if (!scrolling && movingSprites > 0 && why != RedrawAllDebugReason.SpriteMoved) return;
|
if (!scrolling && movingSprites > 0 && why != RedrawAllDebugReason.SpriteMoved) return;
|
||||||
}
|
}
|
||||||
redrawArea_(mapViewArea, null, 0, 0);
|
redrawArea_(mapViewArea, null);
|
||||||
}
|
}
|
||||||
private void redrawTile(final Coord p, RedrawTileDebugReason why) {
|
private void redrawTile(final Coord p, RedrawTileDebugReason why) {
|
||||||
if (scrolling) return;
|
if (scrolling) return;
|
||||||
p1x1.topLeft.set(p);
|
p1x1.topLeft.set(p);
|
||||||
redrawArea_(p1x1, null, 0, 0);
|
redrawArea_(p1x1, null);
|
||||||
}
|
}
|
||||||
private void redrawArea(final CoordRect area, RedrawAreaDebugReason why) {
|
private void redrawArea(final CoordRect area, RedrawAreaDebugReason why) {
|
||||||
if (scrolling) return;
|
if (scrolling) return;
|
||||||
redrawArea_(area, null, 0, 0);
|
redrawArea_(area, null);
|
||||||
}
|
}
|
||||||
private void redrawArea_(CoordRect area, final VisualEffectAnimation effect, int tileID, int textYOffset) {
|
private void redrawArea_(CoordRect area, final List<VisualEffectAnimation> effects) {
|
||||||
if (!hasSurface) return;
|
if (!hasSurface) return;
|
||||||
|
|
||||||
|
|
||||||
@@ -275,33 +276,26 @@ public final class MainView extends SurfaceView
|
|||||||
}
|
}
|
||||||
c.clipRect(redrawClip);
|
c.clipRect(redrawClip);
|
||||||
c.translate(screenOffset.x + xScroll, screenOffset.y + yScroll);
|
c.translate(screenOffset.x + xScroll, screenOffset.y + yScroll);
|
||||||
// c.scale(scale, scale);
|
|
||||||
doDrawRect(c, area);
|
doDrawRect(c, area);
|
||||||
if (effect != null) {
|
renderEffects(c, effects);
|
||||||
drawFromMapPosition(c, area, effect.position, tileID);
|
|
||||||
if (effect.displayText != null) {
|
|
||||||
drawEffectText(c, area, effect, textYOffset, effect.getTextPaint());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// c.drawRect(new Rect(
|
|
||||||
// (area.topLeft.x - mapViewArea.topLeft.x) * tileSize,
|
|
||||||
// (area.topLeft.y - mapViewArea.topLeft.y) * tileSize,
|
|
||||||
// (area.topLeft.x - mapViewArea.topLeft.x + area.size.width) * tileSize - 1,
|
|
||||||
// (area.topLeft.y - mapViewArea.topLeft.y + area.size.height) * tileSize - 1),
|
|
||||||
// redrawHighlight);
|
|
||||||
// if (touchedTile != null) c.drawRect(new Rect(
|
|
||||||
// (touchedTile.x - mapViewArea.topLeft.x) * tileSize,
|
|
||||||
// (touchedTile.y - mapViewArea.topLeft.y) * tileSize,
|
|
||||||
// (touchedTile.x - mapViewArea.topLeft.x + 1) * tileSize - 1,
|
|
||||||
// (touchedTile.y - mapViewArea.topLeft.y + 1) * tileSize - 1),
|
|
||||||
// touchHighlight);
|
|
||||||
} }
|
} }
|
||||||
} finally {
|
} finally {
|
||||||
if (c != null) holder.unlockCanvasAndPost(c);
|
if (c != null) holder.unlockCanvasAndPost(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderEffects(Canvas canvas ,List<VisualEffectAnimation> effects) {
|
||||||
|
if(effects == null) return;
|
||||||
|
for (VisualEffectAnimation effect : effects) {
|
||||||
|
int tileID = effect.tileID;
|
||||||
|
int textYOffset = effect.textYOffset;
|
||||||
|
drawFromMapPosition(canvas, effect.area, effect.position, tileID);
|
||||||
|
if (effect.displayText != null) {
|
||||||
|
drawEffectText(canvas, effect.area, effect, textYOffset, effect.getTextPaint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isRedrawRectWholeScreen(Rect redrawRect) {
|
private boolean isRedrawRectWholeScreen(Rect redrawRect) {
|
||||||
// if (redrawRect.width() < mapViewArea.size.width * scaledTileSize) return false;
|
// if (redrawRect.width() < mapViewArea.size.width * scaledTileSize) return false;
|
||||||
// if (redrawRect.height() < mapViewArea.size.height * scaledTileSize) return false;
|
// if (redrawRect.height() < mapViewArea.size.height * scaledTileSize) return false;
|
||||||
@@ -317,11 +311,21 @@ public final class MainView extends SurfaceView
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
private final Rect redrawRect = new Rect();
|
private final Rect redrawRect = new Rect();
|
||||||
private void redrawAreaWithEffect(final VisualEffectAnimation effect, int tileID, int textYOffset) {
|
private void redrawAreaWithEffect(List<VisualEffectAnimation> effects) {
|
||||||
CoordRect area = effect.area;
|
CoordRect area = null;
|
||||||
// if (shouldRedrawEverythingForVisualEffect()) area = mapViewArea;
|
for (int i = 0; i < effects.size(); i++) {
|
||||||
redrawArea_(area, effect, tileID, textYOffset);
|
VisualEffectAnimation effect = effects.get(i);
|
||||||
|
if (area == null) {
|
||||||
|
area = effect.area;
|
||||||
|
} else {
|
||||||
|
area = CoordRect.union(area, effect.area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (area != null) {
|
||||||
|
redrawArea_(area, effects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearCanvas() {
|
private void clearCanvas() {
|
||||||
if (!hasSurface) return;
|
if (!hasSurface) return;
|
||||||
Canvas c = null;
|
Canvas c = null;
|
||||||
@@ -794,8 +798,8 @@ public final class MainView extends SurfaceView
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewAnimationFrame(VisualEffectAnimation animation, int tileID, int textYOffset) {
|
public void onNewAnimationFrames(List<VisualEffectAnimation> effects) {
|
||||||
redrawAreaWithEffect(animation, tileID, textYOffset);
|
redrawAreaWithEffect(effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
BIN
AndorsTrail/res/drawable/map_brightport.png
Normal file
BIN
AndorsTrail/res/drawable/map_brightport.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -59,6 +59,7 @@
|
|||||||
• Draze<br/>
|
• Draze<br/>
|
||||||
• Antison<br/>
|
• Antison<br/>
|
||||||
• Raphi<br/>
|
• Raphi<br/>
|
||||||
|
• Dimitri Vellemans (Odin)<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<b>Translations</b><br/>
|
<b>Translations</b><br/>
|
||||||
• Russian translation by Dreamer..., e.solodookhin, shell.andor, konstmih, istasman, Aleksey Kabanov, Alexander Zubok, Paul Sulemenkov, dromoz, avatar232 and Mingun<br/>
|
• Russian translation by Dreamer..., e.solodookhin, shell.andor, konstmih, istasman, Aleksey Kabanov, Alexander Zubok, Paul Sulemenkov, dromoz, avatar232 and Mingun<br/>
|
||||||
|
|||||||
Reference in New Issue
Block a user