示例#1
0
 public void onMouseButtonEvent(MouseButtonEvent evt) {
   if (evt.getButtonIndex() == 0 && evt.isPressed()) {
     if (inventoryType == InventoryType.PointClick) {
       if (cursor.getUserData("worldObject") != null) {
         InteractiveNode node = cursor.getUserData("worldObject");
         main.getRootNode().attachChild(node);
         node.setIsInScene(true);
         cursor.setUserData("worldObject", null);
         cursor.setTextureAtlasImage(objIcons, iconDefault);
       }
     }
   }
 }
示例#2
0
 private void handleObjectClick(Node parent) {
   switch (inventoryType) {
     case DragDrop:
       DragElement de = createNewDragElement();
       de.setUserData("worldObject", parent);
       de.setTextureAtlasImage(objIcons, ((InteractiveNode) parent).getIcon());
       String ttt = ((InteractiveNode) parent).getToolTipText();
       de.setToolTipText(
           ttt.substring(0, ttt.indexOf("\n")) + "\n\nDrop me back into\nthe world.");
       parent.removeFromParent();
       ((InteractiveNode) parent).setIsInScene(false);
       screen.forceFocusElementRefresh();
       break;
     case PointClick:
       cursor.setTextureAtlasImage(objIcons, ((InteractiveNode) parent).getIcon());
       cursor.setUserData("worldObject", parent);
       parent.removeFromParent();
       ((InteractiveNode) parent).setIsInScene(false);
       screen.forceFocusElementRefresh();
       break;
   }
 }