Example usage for com.badlogic.gdx.utils OrderedMap put

List of usage examples for com.badlogic.gdx.utils OrderedMap put

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils OrderedMap put.

Prototype

public V put(K key, V value) 

Source Link

Usage

From source file:com.tnf.ptm.handler.dra.DraMan.java

License:Apache License

public void addAll(List<Dra> dras) {
    for (int i = 0, drasSize = dras.size(); i < drasSize; i++) {
        Dra dra = dras.get(i);//from   w w w  .ja  v a 2  s. co  m
        DraLevel l = dra.getLevel();
        OrderedMap<Texture, List<Dra>> map = myDras.get(l.ordinal());
        Texture tex = dra.getTex0();
        List<Dra> set = map.get(tex);
        if (set == null) {
            set = new ArrayList<Dra>();
            map.put(tex, set);
        }
        if (set.contains(dra)) {
            continue;
        }
        set.add(dra);
        myInCam.remove(dra);
    }
}

From source file:it.alcacoop.backgammon.utils.MatchRecorder.java

License:Open Source License

public void loadFromFile(String fname) {
    FileHandle fh = Gdx.files.absolute(fname);
    matchInfo.clear();//from www  .j  a v a 2 s .c  om

    JSONProperties jp = new JSONProperties(fh);
    Array<Object> a = (Array<Object>) jp.asArray("matchInfo", null);

    for (int i = 0; i < a.size; i++) {
        @SuppressWarnings("unchecked")
        OrderedMap<String, Object> m = (OrderedMap<String, Object>) a.get(i);
        @SuppressWarnings("unchecked")
        OrderedMap<String, Object> gi = (OrderedMap<String, Object>) m.get("gameinfo");

        gi.put("ff", ((Float) gi.get("ff")).intValue());
        gi.put("gm", ((Float) gi.get("gm")).intValue());
        gi.put("mi_length", ((Float) gi.get("mi_length")).intValue());
        gi.put("mi_game", ((Float) gi.get("mi_game")).intValue());
        gi.put("mi_ws", ((Float) gi.get("mi_ws")).intValue());
        gi.put("mi_bs", ((Float) gi.get("mi_bs")).intValue());
        gi.put("_cr", ((Float) gi.get("_cr")).intValue());
        gi.put("_df", ((Float) gi.get("_df")).intValue());
        gi.put("_co", ((Float) gi.get("_co")).intValue());
        gi.put("_cv", ((Float) gi.get("_cv")).intValue());

        Game g = new Game(gi);

        @SuppressWarnings("unchecked")
        Array<Object> ar = (Array<Object>) m.get("moves");
        for (int j = 0; j < ar.size; j++) {
            @SuppressWarnings("unchecked")
            OrderedMap<String, Object> mv = (OrderedMap<String, Object>) ar.get(j);
            mv.put("type", ((Float) mv.get("type")).intValue());
            mv.put("c", ((Float) mv.get("c")).intValue());
            if (mv.containsKey("d1"))
                mv.put("d1", ((Float) mv.get("d1")).intValue());
            if (mv.containsKey("d2"))
                mv.put("d2", ((Float) mv.get("d2")).intValue());
            if (mv.containsKey("m"))
                mv.put("m", (mv.get("m")).toString());
            g.moves.add(mv);
        }

        matchInfo.add(g);
    }
}