Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Pedroalves

pegar e legar um item

Recommended Posts

não estou a conseguir por a funcionar o pegar e lagar

segue-se o codigo

 

package mygame.menus;

import org.slf4j.*;

import com.jme3.app.Application;
import com.jme3.app.state.BaseAppState;
import com.jme3.math.*;
import com.jme3.scene.*;

import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;

import com.simsilica.lemur.grid.ArrayGridModel;
import com.simsilica.lemur.input.InputMapper;
import com.simsilica.lemur.style.ElementId;
import mygame.Main;
import mygame.MainGameFunctions;
import mygame.MainMenuState;
import mygame.panels.CustomGridPanel;

/**
 *
 *
 * @author Pedro Alves
 */
public class InventoryMenuState extends BaseAppState {

    static Logger log = LoggerFactory.getLogger(InventoryMenuState.class);

    private Container mainWindow;

    //private Container sessionButtons;
    public InventoryMenuState(boolean enabled) {
        setEnabled(enabled);

    }

    /**
     * Returns the tabbed panel used in the in-game menu. This lets other states
     * potentially add their own in-game menu tabs.
     *
     * @return
     */
    /* public TabbedPanel getTabs() {
        return tabs;
    }

    public List<Action> getSessionActions() {
        return sessionActions;
    }
     */
    public void toggleEnabled() {
        setEnabled(!isEnabled());
    }

    @Override
    protected void initialize(Application app) {
        mainWindow = new Container();

        // mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        Label o = mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        o.setFontSize(12);
        o.setPreferredSize(new Vector3f(50, 25, 0));
        o.setTextHAlignment(HAlignment.Center);
        Label f = mainWindow.addChild(new Label("Default Cube", new ElementId("title")));
        f.setTextHAlignment(HAlignment.Center);
        f.setFontSize(12);
        f.setPreferredSize(new Vector3f(50, 25, 0));
        Panel[][] data = new Panel[4][8];
        Panel[][] data1 = new Panel[4][8];
        Label slot1 = new Label("1");
        Label slot2 = new Label("2");
        Label slot3 = new Label("3");
        Label slot4 = new Label("4");
        Label slot5 = new Label("5");
        Label slot6 = new Label("6");
        Label slot7 = new Label("7");
        Label slot8 = new Label("8");
        Label slot9 = new Label("1");
        Label slot10 = new Label("2");
        Label slot11 = new Label("3");
        Label slot12 = new Label("4");
        Label slot13 = new Label("5");
        Label slot14 = new Label("6");
        Label slot15 = new Label("7");
        Label slot16 = new Label("8");
        Label slot17 = new Label("1");
        Label slot18 = new Label("2");
        Label slot19 = new Label("3");
        Label slot20 = new Label("4");
        Label slot21 = new Label("5");
        Label slot22 = new Label("6");
        Label slot23 = new Label("7");
        Label slot24 = new Label("8");
        Label slot25 = new Label("1");
        Label slot26 = new Label("2");
        Label slot27 = new Label("3");
        Label slot28 = new Label("4");
        Label slot29 = new Label("5");
        Label slot30 = new Label("6");
        Label slot31 = new Label("7");
        Label slot32 = new Label("8");
        Label slot33 = new Label("1");
        Label slot34 = new Label("2");
        Label slot35 = new Label("3");
        Label slot36 = new Label("4");
        Label slot37 = new Label("5");
        Label slot38 = new Label("6");
        Label slot39 = new Label("7");
        Label slot40 = new Label("8");
        Label slot41 = new Label("1");
        Label slot42 = new Label("2");
        Label slot43 = new Label("3");
        Label slot44 = new Label("4");
        Label slot45 = new Label("5");
        Label slot46 = new Label("6");
        Label slot47 = new Label("7");
        Label slot48 = new Label("8");
        Label slot49 = new Label("1");
        Label slot50 = new Label("2");
        Label slot51 = new Label("3");
        Label slot52 = new Label("4");
        Label slot53 = new Label("5");
        Label slot54 = new Label("6");
        Label slot55 = new Label("7");
        Label slot56 = new Label("8");
         Label slot57 = new Label("1");
        Label slot58 = new Label("2");
        Label slot59 = new Label("3");
        Label slot60 = new Label("4");
        Label slot61 = new Label("5");
        Label slot62 = new Label("6");
        Label slot63 = new Label("7");
        Label slot64 = new Label("8");
        
        slot2.setPreferredSize(new Vector3f(50, 25, 0));
        slot3.setPreferredSize(new Vector3f(50, 25, 0));
        slot4.setPreferredSize(new Vector3f(50, 25, 0));
        slot5.setPreferredSize(new Vector3f(50, 25, 0));
        slot6.setPreferredSize(new Vector3f(50, 25, 0));
        slot7.setPreferredSize(new Vector3f(50, 25, 0));
        slot8.setPreferredSize(new Vector3f(50, 25, 0));

        data[0][0] = slot1;
        data[0][1] = slot2;
        data[0][2] = slot3;
        data[0][3] = slot4;
        data[0][4] = slot5;
        data[0][5] = slot6;
        data[0][6] = slot7;
        data[0][7] = slot8;
        data[1][0] = slot9;
        data[1][1] = slot10;
        data[1][2] = slot11;
        data[1][3] = slot12;
        data[1][4] = slot13;
        data[1][5] = slot14;
        data[1][6] = slot15;
        data[1][7] = slot16;
        data[2][0] = slot17;
        data[2][1] = slot18;
        data[2][2] = slot19;
        data[2][3] = slot20;
        data[2][4] = slot21;
        data[2][5] = slot22;
        data[2][6] = slot23;
        data[2][7] = slot24;
        data[3][0] = slot25;
        data[3][1] = slot26;
        data[3][2] = slot27;
        data[3][3] = slot28;
        data[3][4] = slot29;
        data[3][5] = slot30;
        data[3][6] = slot31;
        data[3][7] = slot32;

        CustomGridPanel ola = new CustomGridPanel(new ArrayGridModel<>(data));
ola.getModel().setCell(3, 7, data[3][7]);
ola.setVisibleRows(4);

ola.setVisibleColumns(8);
  ola.setInsets(new Insets3f(10, 10, 0, 10));
        System.err.println(""+ola.getModel().getColumnCount());
          System.err.println(""+ola.getModel().getRowCount());
//ola.setPreferredSize(new Vector3f(400, 400, 0));

        mainWindow.addChild(ola);
        // ola.setPreferredSize(new Vector3f(25, 350, 0));

        mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        data1[0][0] = slot33;
        data1[0][1] = slot34;
        data1[0][2] = slot35;
        data1[0][3] = slot36;
        data1[0][4] = slot37;
        data1[0][5] = slot38;
        data1[0][6] = slot39;
        data1[0][7] = slot40;
        data1[1][0] = slot41;
        data1[1][1] = slot42;
        data1[1][2] = slot43;
        data1[1][3] = slot44;
        data1[1][4] = slot45;
        data1[1][5] = slot46;
        data1[1][6] = slot47;
        data1[1][7] = slot48;
        data1[2][0] = slot49;
        data1[2][1] = slot50;
        data1[2][2] = slot51;
        data1[2][3] = slot52;
        data1[2][4] = slot53;
        data1[2][5] = slot54;
        data1[2][6] = slot55;
        data1[2][7] = slot56;
        data1[3][0] = slot57;
        data1[3][1] = slot58;
        data1[3][2] = slot59;
        data1[3][3] = slot60;
        data1[3][4] = slot61;
        data1[3][5] = slot62;
        data1[3][6] = slot63;
        data1[3][7] = slot64;
        Container loginPanel=mainWindow.addChild(new Container());
       GridPanel maria = new GridPanel(new ArrayGridModel<>(data1));
        loginPanel.addChild(maria);
       maria.setVisibleRows(4);
maria.setVisibleColumns(8);
        mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        mainWindow.addChild(new Label("Inventory", new ElementId("title")));
        mainWindow.addChild(new Label("Inventory", new ElementId("title")));

        mainWindow.setPreferredSize(new Vector3f(350, 450, 0));
        int height = app.getCamera().getHeight();
        Vector3f pref = mainWindow.getPreferredSize().clone();

        float standardScale = getState(MainMenuState.class).getStandardScale();
        pref.multLocal(1.5f * standardScale);

        // With a slight bias toward the top        
        float y = height * 0.9f + pref.y * 0.0f;

        mainWindow.setLocalTranslation(250 * standardScale, y, 0);

        InputMapper inputMapper = GuiGlobals.getInstance().getInputMapper();
        inputMapper.addDelegate(MainGameFunctions.F_IN_GAME_INVENTORY, this, "toggleEnabled");
    }

    @Override
    protected void cleanup(Application app) {

        InputMapper inputMapper = GuiGlobals.getInstance().getInputMapper();
        inputMapper.removeDelegate(MainGameFunctions.F_IN_GAME_INVENTORY, this, "toggleEnabled");
    }

    @Override
    protected void onEnable() {
        Node gui = ((Main) getApplication()).getGuiNode();
        gui.attachChild(mainWindow);
    }

    @Override
    protected void onDisable() {
        mainWindow.removeFromParent();
    }
    
}

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por ILR master
      Pessoal, pergunta bem simples. Abaixo tenho o seguinte código:
       
      <script>
      function alerta()
      {
        if (window.confirm("Você realmente quer sair?")) {
          window.open("sair.html");
      }
      }
      </script>
       
      Funciona perfeitamente, só que está abrindo em outra janela e quero que abra na mesma janela.
       
      Alguém pode me ajudar?
    • Por Jack Oliveira
      Ola pessoal boa tarde
      estou tentando fazer um texto se mover dentro do input porem nao esta dando resultado que preciso
       
      Este é o codigo 
      <script type="text/javascript"> $(document).ready(function () { var frases = [{ 'elemento': $('input[name=search_string]'), 'frases': ["O que você está procurando?", "Buscar por: Academia, Barbearia, Churrascaria, Decoração, Escola, Farmácia, Gráfica, Imobiliaria, Lanchonete, Mecânica, Odontologia, Pizzaria...", "Faça sua busca por segmentos aqui.", "São mais de 3mil empresas para serem exploradas."] }]; animaInput(frases); }); </script>  
    • Por Rengavitp
      Boa noite pessoal!
       
      Estou fazendo um projeto web com spring boot e é a primeira vez que lido com imagens. Minha idéia é salvar imagens em uma pasta e depois recuperar essa imagem e mostrar, mas o problema que estou enfrentando é o seguinte, seu eu envio para o src do projeto na pasta imagens, eu até consigo acessar as imagens, mas preciso atualizar o projeto na IDE (isso vai acontecer em produção?) eu tentei salvar em uma pasta fora do source do projeto mas ai não consigo acessar. como devo fazer? fiz várias pesquisas, mas nenhuma me ajudou.
       
      Desde já agradeço.
    • Por Rengavitp
      Bom dia pessoal!

      Estou com o seguinte problema, tenho uma aplicação que funciona perfeitamente rodando na minha IDE (Spring Tool Suite) mas ao gerar o arquivo war e subir a aplicação no tom cat ele não funciona, mas apenas erro 404, abri o war e todos os arquivo estão lá, já tem seguir tudo quando e tutorial com problemas semelhantes mas nenhum resolveu. Abaixo mais informações,.

      Versão do java na aplicacao 11
      Versão do jva no servidor 11
      Versão do tomcat no servidor 8.5.55
       
      minha classe principal
      package br.com.masterplastfitas; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class MasterApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(MasterApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(MasterApplication.class); } } meu pom.xml
      <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.2</version> <relativePath /> <!-- lookup parent from repository --> </parent> <groupId>masterplast</groupId> <artifactId>Master</artifactId> <version>2.0</version> <packaging>war</packaging> <name>Master</name> <description>Aplicação web </description> <properties> <java.version>11</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.thymeleaf.extras</groupId> <artifactId>thymeleaf-extras-springsecurity5</artifactId> </dependency> <dependency> <groupId>org.mindrot</groupId> <artifactId>jbcrypt</artifactId> <version>0.4</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.0</version> </dependency> </dependencies> <build> <plugins> <!-- <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> --> </plugins> </build> </project>  
    • Por Stephhany909
      While trying to persist an object with an attribute of type Point, defined as follows:
       
      @Entity @Table(name = "event") public class Event { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private long id; @Column(columnDefinition = "POINT") private Point coordinate; } I'm getting the error Data truncation: Cannot get geometry object from data you send to the GEOMETRY field.
      The corresponding database table is defined as follows:
       
      create table event ( id bigint not null auto_increment, coordinate POINT, primary key (id) ) engine= InnoDB; What am I missing?
       
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.