<commit_before>/*
 *  Copyright 2011 RoboViz
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package rv.ui.screens;

import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.media.opengl.GL2;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import js.jogl.view.Viewport;
import js.math.vector.Vec3f;
import rv.Viewer;
import rv.comm.drawing.BufferedSet;
import rv.comm.drawing.annotations.Annotation;
import rv.comm.rcssserver.ServerComm;
import rv.world.ISelectable;
import rv.world.Team;
import rv.world.WorldModel;
import rv.world.objects.Agent;
import rv.world.objects.Ball;
import com.jogamp.opengl.util.gl2.GLUT;

public class LiveGameScreen extends ViewerScreenBase implements ServerComm.ServerChangeListener {
    private final PlaymodeOverlay playmodeOverlay;
    private final InfoOverlay     connectionOverlay;

    public LiveGameScreen(Viewer viewer) {
        super(viewer);
        playmodeOverlay = new PlaymodeOverlay(viewer, this);
        overlays.add(playmodeOverlay);
        connectionOverlay = new InfoOverlay("Disconnected");
        overlays.add(connectionOverlay);
    }

    @Override
    public void setEnabled(GLCanvas canvas, boolean enabled) {
        super.setEnabled(canvas, enabled);
        if (enabled) {
            viewer.getNetManager().getServer().addChangeListener(this);
        } else {
            viewer.getNetManager().getServer().removeChangeListener(this);
        }
    }

    private void renderAnnotations() {
        List<BufferedSet<Annotation>> sets = viewer.getDrawings().getAnnotationSets();
        if (sets.size() > 0) {
            for (BufferedSet<Annotation> set : sets) {
                if (set.isVisible()) {
                    ArrayList<Annotation> annotations = set.getFrontSet();
                    for (Annotation a : annotations) {
                        if (a != null) {<commit_msg>Live Mode: more helpful connectionOverlay message<commit_after>/*
 *  Copyright 2011 RoboViz
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package rv.ui.screens;

import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.media.opengl.GL2;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import js.jogl.view.Viewport;
import js.math.vector.Vec3f;
import rv.Configuration;
import rv.Viewer;
import rv.comm.drawing.BufferedSet;
import rv.comm.drawing.annotations.Annotation;
import rv.comm.rcssserver.ServerComm;
import rv.world.ISelectable;
import rv.world.Team;
import rv.world.WorldModel;
import rv.world.objects.Agent;
import rv.world.objects.Ball;
import com.jogamp.opengl.util.gl2.GLUT;

public class LiveGameScreen extends ViewerScreenBase implements ServerComm.ServerChangeListener {
    private final PlaymodeOverlay playmodeOverlay;
    private final InfoOverlay     connectionOverlay;

    public LiveGameScreen(Viewer viewer) {
        super(viewer);
        playmodeOverlay = new PlaymodeOverlay(viewer, this);
        overlays.add(playmodeOverlay);
        connectionOverlay = new InfoOverlay(getConnectionMessage());
        overlays.add(connectionOverlay);
    }

    private String getConnectionMessage() {
        Configuration.Networking config = viewer.getConfig().networking;
        String server = config.getServerHost() + ":" + config.getServerPort();
        if (config.autoConnect)
            return "Trying to connect to " + server + "...";
        else
            return "Press C to connect to " + server + ".";
    }

    @Override
    public void setEnabled(GLCanvas canvas, boolean enabled) {
        super.setEnabled(canvas, enabled);
        if (enabled) {
            viewer.getNetManager().getServer().addChangeListener(this);
        } else {
            viewer.getNetManager().getServer().removeChangeListener(this);
        }
    }

    private void renderAnnotations() {
        List<BufferedSet<Annotation>> sets = viewer.getDrawings().getAnnotationSets();
        if (sets.size() > 0) {
            for (BufferedSet<Annotation> set : sets) {
                if (set.isVisible()) {
                    ArrayList<Annotation> annotations = set.getFrontSet();
                    for (Annotation a : annotations) {
                        if (a != null) {
{'fraction_non_alphanumeric': 0.0971449758991472, 'fraction_numerical': 0.004449388209121246, 'mean_word_length': 3.166023166023166, 'pattern_counts': {'":': 1, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5379960', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1509, 'n_words': 411}