Ejemplo n.º 1
0
 public int getol(Coord tc) {
   Grid g = getgridt(tc);
   int ol = g.getol(tc.sub(g.ul));
   for (Overlay lol : ols) {
     if (tc.isect(lol.c1, lol.c2.add(lol.c1.inv()).add(new Coord(1, 1)))) ol |= lol.mask;
   }
   return (ol);
 }
Ejemplo n.º 2
0
 public boolean mousewheel(Coord c, int amount) {
   for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
     if (!wdg.visible) continue;
     Coord cc = xlate(wdg.c, true);
     if (c.isect(cc, wdg.sz)) {
       if (wdg.mousewheel(c.add(cc.inv()), amount)) {
         return (true);
       }
     }
   }
   return (false);
 }
 public boolean dropthing(Widget w, Coord c, Object thing) {
   if (w instanceof DropTarget) {
     if (((DropTarget) w).dropthing(c, thing)) return (true);
   }
   for (Widget wdg = w.lchild; wdg != null; wdg = wdg.prev) {
     Coord cc = w.xlate(wdg.c, true);
     if (c.isect(cc, wdg.sz)) {
       if (dropthing(wdg, c.add(cc.inv()), thing)) return (true);
     }
   }
   return (false);
 }
Ejemplo n.º 4
0
 public Object tooltip(Coord c, Widget prev) {
   for (Buff buff : fv.buffs.children(Buff.class)) {
     Coord dc = pcc.add(-buff.c.x - Buff.cframe.sz().x - 20, buff.c.y + pho - Buff.cframe.sz().y);
     if (c.isect(dc, buff.sz)) {
       Object ret = buff.tooltip(c.sub(dc), prevtt);
       if (ret != null) {
         prevtt = buff;
         return (ret);
       }
     }
   }
   if (fv.current != null) {
     for (Buff buff : fv.current.buffs.children(Buff.class)) {
       Coord dc = pcc.add(buff.c.x + 20, buff.c.y + pho - Buff.cframe.sz().y);
       if (c.isect(dc, buff.sz)) {
         Object ret = buff.tooltip(c.sub(dc), prevtt);
         if (ret != null) {
           prevtt = buff;
           return (ret);
         }
       }
     }
   }
   Coord ca = pcc.add(-(actions.length * actpitch) / 2, 45);
   for (int i = 0; i < actions.length; i++) {
     Indir<Resource> act = actions[i];
     try {
       if (act != null) {
         Tex img = act.get().layer(Resource.imgc).tex();
         if (c.isect(ca, img.sz())) {
           if (dyn[i]) return ("Combat discovery");
           return (act.get().layer(Resource.tooltip).t);
         }
       }
     } catch (Loading l) {
     }
     ca.x += actpitch;
   }
   return (null);
 }
Ejemplo n.º 5
0
  public Resource getcurs(Coord c) {
    Resource ret;

    for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
      if (!wdg.visible) continue;
      Coord cc = xlate(wdg.c, true);
      if (c.isect(cc, wdg.sz)) {
        if ((ret = wdg.getcurs(c.add(cc.inv()))) != null) return (ret);
      }
    }
    try {
      return ((cursor == null) ? null : cursor.get());
    } catch (Loading l) {
      return (null);
    }
  }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 public Object tooltip(Coord c, Widget prev) {
   if (prev != this) prevtt = null;
   if (tooltip != null) {
     prevtt = null;
     return (tooltip);
   }
   for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
     if (!wdg.visible) continue;
     Coord cc = xlate(wdg.c, true);
     if (c.isect(cc, wdg.sz)) {
       Object ret = wdg.tooltip(c.add(cc.inv()), prevtt);
       if (ret != null) {
         prevtt = wdg;
         return (ret);
       }
     }
   }
   prevtt = null;
   return (tooltip(c, prev == this));
 }
Ejemplo n.º 8
0
 public Object tooltip(Coord c, Widget prev) {
   if (!c.isect(boxc, boxsz)) return (null);
   return (super.tooltip(c, prev));
 }
Ejemplo n.º 9
0
  public Object tooltip(Coord mc, Widget prev) {
    Resource tres = null;
    Coord c;
    if (qmod != null) {
      c = new Coord(xoff, qmy);
      try {
        for (Indir<Resource> qm : qmod) {
          Tex t = qm.get().layer(Resource.imgc).tex();
          Coord sz = t.sz();
          try {
            Glob.CAttr attr = ui.gui.chrwdg.findattr(qm.get().basename());
            if (attr != null) {
              sz = sz.add(attr.comptex().sz().x + 8, 0);
            }
          } catch (Exception ignored) {
          }

          if (mc.isect(c, sz)) return (qm.get().layer(Resource.tooltip).t);
          c = c.add(sz.x + 1, 0);
        }
      } catch (Loading l) {
      }
    }
    find:
    {
      c = new Coord(xoff, 0);
      for (Spec s : inputs) {
        if (mc.isect(c, Inventory.invsq.sz())) {
          tres = s.res.get();
          break find;
        }
        c = c.add(31, 0);
      }
      c = new Coord(xoff, outy);
      for (Spec s : outputs) {
        if (mc.isect(c, Inventory.invsq.sz())) {
          tres = s.res.get();
          break find;
        }
        c = c.add(31, 0);
      }
    }
    Resource.Tooltip tt;
    if ((tres == null) || ((tt = tres.layer(Resource.tooltip)) == null)) return (null);
    if (lasttip != tres) {
      lasttip = tres;
      stip = ltip = null;
    }
    long now = System.currentTimeMillis();
    boolean sh = true;
    if (prev != this) hoverstart = now;
    else if (now - hoverstart > 1000) sh = false;
    if (sh) {
      if (stip == null) stip = Text.render(tt.t);
      return (stip);
    } else {
      if (ltip == null) {
        String t = tt.t;
        Resource.Pagina p = tres.layer(Resource.pagina);
        if (p != null) t += "\n\n" + tres.layer(Resource.pagina).text;
        ltip = RichText.render(t, 300);
      }
      return (ltip);
    }
  }