public LocalMiniMap(Coord sz, MapView mv) { super(sz); this.mv = mv; if (ResCache.global != null) { save = MapFile.load(ResCache.global); } else { save = null; } }
public void draw(GOut g) { if (cc == null) return; map: { final Grid plg; try { plg = ui.sess.glob.map.getgrid(cc.div(cmaps)); } catch (Loading l) { break map; } final int seq = plg.seq; if ((cur == null) || (plg != cur.grid) || (seq != cur.seq)) { Defer.Future<MapTile> f; synchronized (cache) { f = cache.get(new Pair<Grid, Integer>(plg, seq)); if (f == null) { f = Defer.later( new Defer.Callable<MapTile>() { public MapTile call() { Coord ul = plg.ul.sub(cmaps).add(1, 1); return (new MapTile( new TexI(drawmap(ul, cmaps.mul(3).sub(2, 2))), ul, plg, seq)); } }); cache.put(new Pair<Grid, Integer>(plg, seq), f); } } if (f.done()) { cur = f.get(); if (save != null) save.update(ui.sess.glob.map, cur.grid.gc); } } } if (cur != null) { g.image(MiniMap.bg, Coord.z); g.image(cur.img, cur.ul.sub(cc).add(sz.div(2))); try { synchronized (ui.sess.glob.party.memb) { for (Party.Member m : ui.sess.glob.party.memb.values()) { Coord ptc; try { ptc = m.getc(); } catch (MCache.LoadingMap e) { ptc = null; } if (ptc == null) continue; ptc = p2c(ptc); g.chcolor(m.col.getRed(), m.col.getGreen(), m.col.getBlue(), 128); g.image( MiniMap.plx.layer(Resource.imgc).tex(), ptc.add(MiniMap.plx.layer(Resource.negc).cc.inv())); g.chcolor(); } } } catch (Loading l) { } } else { g.image(MiniMap.nomap, Coord.z); } drawicons(g); }