コード例 #1
0
ファイル: Features.java プロジェクト: superlode/Features
 @EventHandler(priority = EventPriority.MONITOR)
 public void onScreenClose(final ScreenCloseEvent event) {
   if (!event.isCancelled() && event.getScreenType() == ScreenType.CHAT_SCREEN) {
     Widget bar = chatbar.remove(event.getPlayer());
     if (bar != null) {
       bar.setVisible(false);
     }
   }
 }
コード例 #2
0
ファイル: Features.java プロジェクト: superlode/Features
 @EventHandler(priority = EventPriority.MONITOR)
 public void onScreenOpen(final ScreenOpenEvent event) {
   if (!event.isCancelled() && event.getScreenType() == ScreenType.CHAT_SCREEN) {
     Color black = new Color(0f, 0f, 0f, 0.5f), white = new Color(1f, 1f, 1f, 0.5f);
     SpoutPlayer player = event.getPlayer();
     Widget label, bar = chatbar.get(player);
     if (bar == null) {
       bar =
           new GenericContainer(
                   label =
                       new GenericLabel(
                               ChatColor.GRAY
                                   + Herochat.getChatterManager()
                                       .getChatter(player)
                                       .getActiveChannel()
                                       .getName())
                           .setResize(true)
                           .setFixed(true)
                           .setMargin(3, 3, 0, 3),
                   new GenericGradient(black).setPriority(RenderPriority.Highest),
                   new GenericGradient(white)
                       .setMaxWidth(1)
                       .setPriority(RenderPriority.High)
                       .setVisible(false),
                   new GenericGradient(white)
                       .setMaxWidth(1)
                       .setMarginLeft(label.getWidth() + 5)
                       .setPriority(RenderPriority.High),
                   new GenericGradient(white).setMaxHeight(1).setPriority(RenderPriority.High))
               .setLayout(ContainerType.OVERLAY)
               .setAnchor(WidgetAnchor.BOTTOM_LEFT)
               .setY(-27)
               .setX(4)
               .setHeight(13)
               .setWidth(label.getWidth() + 6);
       chatbar.put(player, bar);
       player.getMainScreen().attachWidget(this, bar);
     }
     bar.setVisible(true);
   }
 }
コード例 #3
0
 private void setXToMid(Widget w) {
   w.setX((maxWidth - w.getWidth()) / 2);
 }
コード例 #4
0
ファイル: Features.java プロジェクト: superlode/Features
 public void redrawAll(Player player) {
   SpoutPlayer splayer = SpoutManager.getPlayer(player);
   if (splayer.isSpoutCraftEnabled())
     for (Widget widget : splayer.getMainScreen().getAttachedWidgets())
       if ((widget.getPlugin() instanceof Features)) widget.setDirty(true);
 }