Search in sources :

Example 16 with Player

use of com.google.android.exoplayer2.Player in project powerbot by powerbot.

the class DrawObjects method repaint.

@Override
public void repaint(final Graphics render) {
    if (ctx.game.clientState() != Constants.GAME_LOADED) {
        return;
    }
    final Player player = ctx.players.local();
    if (player == null) {
        return;
    }
    final FontMetrics metrics = render.getFontMetrics();
    final int textHeight = metrics.getHeight();
    final Map<Tile, AtomicInteger> counts = new HashMap<Tile, AtomicInteger>();
    for (final GameObject object : ctx.objects.select(8)) {
        final Tile t = object.tile();
        if (t == null) {
            continue;
        }
        if (!counts.containsKey(t)) {
            counts.put(t, new AtomicInteger(0));
        }
        final Point p = object.centerPoint();
        if (p.x == -1) {
            continue;
        }
        render.setColor(Color.black);
        render.fillRect(p.x - 1, p.y - 1, 2, 2);
        final String s = Integer.toString(object.id());
        final int ty = p.y - textHeight / 2;
        final int tx = p.x - metrics.stringWidth(s) / 2;
        render.setColor(C[object.type().ordinal()]);
        final StringBuilder b = new StringBuilder(s);
        final String n = object.name();
        if (!n.isEmpty() && !n.equals("null")) {
            int[] arr = object.meshIds();
            if (arr.length < 1) {
                arr = new int[] { -1 };
            }
            b.append(" (").append(n).append('/').append(arr[0]).append(')');
        }
        render.drawString(b.toString(), tx, ty - textHeight * counts.get(t).getAndIncrement());
    }
}
Also used : Player(org.powerbot.script.rt4.Player) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HashMap(java.util.HashMap) FontMetrics(java.awt.FontMetrics) GameObject(org.powerbot.script.rt4.GameObject) Tile(org.powerbot.script.Tile) Point(java.awt.Point) Point(java.awt.Point)

Example 17 with Player

use of com.google.android.exoplayer2.Player in project powerbot by powerbot.

the class TLocation method draw.

public int draw(int idx, final Graphics render) {
    final Player player = ctx.players.local();
    if (player != null) {
        final Tile tile = player.tile();
        drawLine(render, idx++, "Position: " + (tile != null ? tile.toString() : ""));
    }
    return idx;
}
Also used : Player(org.powerbot.script.rt6.Player) Tile(org.powerbot.script.Tile)

Example 18 with Player

use of com.google.android.exoplayer2.Player in project powerbot by powerbot.

the class TLocation method draw.

public int draw(int idx, final Graphics render) {
    final Player player = ctx.players.local();
    if (player != null) {
        final Tile tile = player.tile();
        drawLine(render, idx++, "Position: " + (tile != null ? tile.toString() : ""));
    }
    return idx;
}
Also used : Player(org.powerbot.script.rt4.Player) Tile(org.powerbot.script.Tile)

Example 19 with Player

use of com.google.android.exoplayer2.Player in project powerbot by powerbot.

the class TPlayer method draw.

@SuppressWarnings("deprecation")
public int draw(int idx, final Graphics render) {
    final Player player = ctx.players.local();
    drawLine(render, idx++, String.format("[%s] A: %d, CBL: %d, HP: %d, T: %d, S: %d, INT: %s", player.name(), player.animation(), player.combatLevel(), player.health(), player.team(), player.speed(), player.interacting()));
    drawLine(render, idx++, String.format("ORIENT: %d, COMBAT: %s, APP (VE): %s", player.orientation(), Boolean.toString(player.inCombat()), Arrays.toString(player.appearance())));
    return idx;
}
Also used : Player(org.powerbot.script.rt4.Player)

Example 20 with Player

use of com.google.android.exoplayer2.Player in project react-native-video by react-native-community.

the class ReactExoplayerView method initializePlayer.

// Internal methods
private void initializePlayer() {
    if (player == null) {
        TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
        trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
        player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, new DefaultLoadControl());
        player.addListener(this);
        player.setMetadataOutput(this);
        exoPlayerView.setPlayer(player);
        audioBecomingNoisyReceiver.setListener(this);
        setPlayWhenReady(!isPaused);
        playerNeedsSource = true;
        PlaybackParameters params = new PlaybackParameters(rate, 1f);
        player.setPlaybackParameters(params);
    }
    if (playerNeedsSource && srcUri != null) {
        MediaSource mediaSource = buildMediaSource(srcUri, extension);
        mediaSource = repeat ? new LoopingMediaSource(mediaSource) : mediaSource;
        boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
        if (haveResumePosition) {
            player.seekTo(resumeWindow, resumePosition);
        }
        player.prepare(mediaSource, !haveResumePosition, false);
        playerNeedsSource = false;
        eventEmitter.loadStart();
        loadVideoStarted = true;
    }
}
Also used : DashMediaSource(com.google.android.exoplayer2.source.dash.DashMediaSource) MediaSource(com.google.android.exoplayer2.source.MediaSource) SsMediaSource(com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource) HlsMediaSource(com.google.android.exoplayer2.source.hls.HlsMediaSource) ExtractorMediaSource(com.google.android.exoplayer2.source.ExtractorMediaSource) LoopingMediaSource(com.google.android.exoplayer2.source.LoopingMediaSource) DefaultExtractorsFactory(com.google.android.exoplayer2.extractor.DefaultExtractorsFactory) ExoPlayerFactory(com.google.android.exoplayer2.ExoPlayerFactory) DefaultTrackSelector(com.google.android.exoplayer2.trackselection.DefaultTrackSelector) TrackSelection(com.google.android.exoplayer2.trackselection.TrackSelection) AdaptiveTrackSelection(com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection) DefaultLoadControl(com.google.android.exoplayer2.DefaultLoadControl) PlaybackParameters(com.google.android.exoplayer2.PlaybackParameters) LoopingMediaSource(com.google.android.exoplayer2.source.LoopingMediaSource)

Aggregations

Test (org.junit.Test)250 FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)185 TestExoPlayerBuilder (com.google.android.exoplayer2.testutil.TestExoPlayerBuilder)174 FakeTimeline (com.google.android.exoplayer2.testutil.FakeTimeline)127 PlayerRunnable (com.google.android.exoplayer2.testutil.ActionSchedule.PlayerRunnable)107 ActionSchedule (com.google.android.exoplayer2.testutil.ActionSchedule)91 SinglePeriodTimeline (com.google.android.exoplayer2.source.SinglePeriodTimeline)89 NoUidTimeline (com.google.android.exoplayer2.testutil.NoUidTimeline)89 Listener (com.google.android.exoplayer2.Player.Listener)85 TimelineWindowDefinition (com.google.android.exoplayer2.testutil.FakeTimeline.TimelineWindowDefinition)72 MediaSource (com.google.android.exoplayer2.source.MediaSource)68 ExoPlayerTestRunner (com.google.android.exoplayer2.testutil.ExoPlayerTestRunner)67 ConcatenatingMediaSource (com.google.android.exoplayer2.source.ConcatenatingMediaSource)66 Nullable (androidx.annotation.Nullable)56 ClippingMediaSource (com.google.android.exoplayer2.source.ClippingMediaSource)49 CompositeMediaSource (com.google.android.exoplayer2.source.CompositeMediaSource)49 MaskingMediaSource (com.google.android.exoplayer2.source.MaskingMediaSource)49 ServerSideAdInsertionMediaSource (com.google.android.exoplayer2.source.ads.ServerSideAdInsertionMediaSource)49 FakeAdaptiveMediaSource (com.google.android.exoplayer2.testutil.FakeAdaptiveMediaSource)49 ExoPlayer (com.google.android.exoplayer2.ExoPlayer)47