Exemple #1
0
 public void draw(GOut g) {
   Tex at = null;
   if (none) {
   } else if (myown != null) {
     at = myown;
   } else {
     Gob gob = ui.sess.glob.oc.getgob(avagob);
     Avatar ava = null;
     if (gob != null) ava = gob.getattr(Avatar.class);
     if (ava != null) at = ava.rend;
   }
   GOut g2 = g.reclip(Window.wbox.tloff().add(unborder.inv()), asz);
   int yo;
   if (at == null) {
     at = missing;
     yo = 0;
   } else {
     g2.image(Equipory.bg, new Coord(Equipory.bg.sz().x / 2 - asz.x / 2, 20).inv());
     yo = (20 * asz.y) / dasz.y;
   }
   Coord tsz = new Coord((at.sz().x * asz.x) / dasz.x, (at.sz().y * asz.y) / dasz.y);
   g2.image(at, new Coord(tsz.x / 2 - asz.x / 2, yo).inv(), tsz);
   g.chcolor(color);
   Window.wbox.draw(g, Coord.z, asz.add(Window.wbox.bisz()).add(unborder.mul(2).inv()));
 }
 public synchronized void cres(int id, int frame, Indir<Resource> res, Message sdt) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   ResDrawable d = (ResDrawable) g.getattr(Drawable.class);
   if ((d == null) || (d.res != res) || (d.sdt.blob.length > 0) || (sdt.blob.length > 0)) {
     g.setattr(new ResDrawable(g, res, sdt));
   }
 }
 public synchronized void homocoord(int id, int frame, Coord tc, int v) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   Homing h**o = g.getattr(Homing.class);
   if (h**o != null) {
     h**o.tc = tc;
     h**o.v = v;
   }
 }
 public synchronized void avatar(int id, int frame, List<Indir<Resource>> layers) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   Avatar ava = g.getattr(Avatar.class);
   if (ava == null) {
     ava = new Avatar(g);
     g.setattr(ava);
   }
   ava.setlayers(layers);
 }
 public synchronized void layers(
     int id, int frame, Indir<Resource> base, List<Indir<Resource>> layers) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   Layered lay = (Layered) g.getattr(Drawable.class);
   if ((lay == null) || (lay.base != base)) {
     lay = new Layered(g, base);
     g.setattr(lay);
   }
   lay.setlayers(layers);
 }
 public synchronized void buddy(int id, int frame, String name, int group, int type) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   if ((name.length() == 0) && (group == 0) && (type == 0)) {
     g.delattr(KinInfo.class);
   } else {
     KinInfo b = g.getattr(KinInfo.class);
     if (b == null) {
       g.setattr(new KinInfo(g, name, group, type));
     } else {
       b.update(name, group, type);
     }
   }
 }
 public synchronized void drawoff(int id, int frame, Coord off) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   if ((off.x == 0) && (off.y == 0)) {
     g.delattr(DrawOffset.class);
   } else {
     DrawOffset dro = g.getattr(DrawOffset.class);
     if (dro == null) {
       dro = new DrawOffset(g, off);
       g.setattr(dro);
     } else {
       dro.off = off;
     }
   }
 }
 public synchronized void speak(int id, int frame, Coord off, String text) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   if (text.length() < 1) {
     g.delattr(Speaking.class);
   } else {
     Speaking m = g.getattr(Speaking.class);
     if (m == null) {
       g.setattr(new Speaking(g, off, text));
     } else {
       m.off = off;
       m.update(text);
     }
   }
 }
 public void drawicons(GOut g) {
   OCache oc = ui.sess.glob.oc;
   synchronized (oc) {
     for (Gob gob : oc) {
       try {
         GobIcon icon = gob.getattr(GobIcon.class);
         if (icon != null) {
           Coord gc = p2c(gob.rc);
           Tex tex = icon.tex();
           g.image(tex, gc.sub(tex.sz().div(2)));
         }
       } catch (Loading l) {
       }
     }
   }
 }
 public synchronized void follow(int id, int frame, int oid, Coord off, int szo) {
   Gob g = getgob(id, frame);
   if (g == null) return;
   if (oid == -1) {
     g.delattr(Following.class);
   } else {
     Following flw = g.getattr(Following.class);
     if (flw == null) {
       flw = new Following(g, oid, off, szo);
       g.setattr(flw);
     } else {
       flw.tgt = oid;
       flw.doff = off;
       flw.szo = szo;
     }
   }
 }
 public Gob findicongob(Coord c) {
   OCache oc = ui.sess.glob.oc;
   synchronized (oc) {
     for (Gob gob : oc) {
       try {
         GobIcon icon = gob.getattr(GobIcon.class);
         if (icon != null) {
           Coord gc = p2c(gob.rc);
           Coord sz = icon.tex().sz();
           if (c.isect(gc.sub(sz.div(2)), sz)) return (gob);
         }
       } catch (Loading l) {
       }
     }
   }
   return (null);
 }
 public synchronized void linstep(int id, int frame, int l) {
   boolean isplayer = isplayerid(id);
   Gob g = getgob(id, frame);
   if (g == null) return;
   Moving m = g.getattr(Moving.class);
   if ((m == null) || !(m instanceof LinMove)) return;
   LinMove lm = (LinMove) m;
   if ((l < 0) || (l >= lm.c)) {
     g.delattr(Moving.class);
     if (isplayer) {
       ismoving = false;
       checkqueue();
     }
   } else {
     lm.setl(l);
     if (isplayer) {
       ismoving = true;
     }
   }
 }