我以前从未有过修复与构建相关的问题的经验,所以当 Jmonkey 引擎决定生成一个无法在编译器中运行的构建时,我不(现在仍然不)真的知道什么去做。Jmonkey 引擎在 netbeans 之上运行,但在这个特定的游戏中,我们主要使用 Nifty GUI,因为只有一个 3D 对象(地球)。
没有错误消息 - 构建“成功”,游戏运行没有错误。问题是玩家无法从类菜单移动到恶意软件中心或游戏开始的地方。我将发布我的构建日志、类菜单和恶意软件中心。
即使您对 Jmonkey 没有任何直接经验,您能否向我解释为什么会发生这种情况以及我可能需要做些什么来解决它?注意:我没有控制台知识,因此该顺序的任何帮助可能需要一些解释。
谢谢。
我希望我可以提供更小的代码段来重现问题,但我实际上并不知道问题是什么,因此我所能做的就是发布这两个类。但是,我将在此处发布您可能应该注意的代码部分。不过,如果您想要完整的课程,请查看链接。
链接和代码
构建日志: http: //pastebin.com/bgaVNvKi
班级菜单: http(冒号)//pastebin(dot)com/9ZBJkGhi
--仅限课程菜单的重要部分--
nifty.fromXml("Interface/NiftyGUI/MalwareHub.xml","start", MH);
//^^ How I reach the Malware Hub.
private MalwareHub MH;
MH = Main.getMalwareHub();
Main.getApplication().getStateManager().attach(MH);
//^^ Value of MH
恶意软件中心完整代码: http: //pastebin.com/AnuTWQP0
--仅重要部分--
public class MalwareHub extends AbstractAppState implements ScreenController {
public MalwareHub() {
day = Time.getDayRate();
timekeeper = 0;
upgradeTimekeeper = 0;
//We add the functionality necessary to let the player rotate the globe.
inputManager = Main.getApplication().getInputManager();
initKeys();
gameStarted = false;
}
@Override
public void onStartScreen() {
System.out.println("Screen Started");
}
@Override
public void onEndScreen() {
System.out.println("Screen Ended");
}
@Override
public void bind(Nifty NIFTY, Screen SCREEN) {
//Actual Screens
nifty = NIFTY;
screen = SCREEN;
//Correct instantiations of other xml files
UA = Main.getUpgradeAbility();
UE = Main.getUpgradeEffect();
UIV = Main.getUpgradeInfectionVector();
PH = Main.getPopupHandler();
//I initialize a lot of Main variables.
app = Main.getApplication();
assetManager = app.getAssetManager();
n = new Node("Globe");
cam = app.getCamera();
onMalwareHub = true;
//<editor-fold desc="Show the beginning popup" defaultstate="collapsed">
if(!gameStarted){
System.out.println("Beginning window shown");
PH.showWindow("Welcome. You have recently posted a piece of malware online that does nothing but will soon be upgraded by you. "
+ "Use these upgrades to increase infectivity, complete new and more powerful effects, and conquer the world.", "");
}
//</editor-fold>
//We're here
gameStarted = true;
UpgradeButton=screen.findElementByName("MalwareButton");
//We are going to create the globe.
//<editor-fold defaultstate="collapsed" desc="It's 'Global'">
//In order to do this, first, we need to transform it to fit whatever device they're using.
//Here we create the actual sphere, with the radius being slightly smaller than the smallest side of whatever device is being used.
globe = assetManager.loadModel("Models/World/World_Globe.obj");
globeGeometry = new Geometry();
//Attach the texture
globeMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
globeMaterial.setTexture("ColorMap", assetManager.loadTexture("Models/World/Globe_Txtr.png"));
globe.setMaterial(globeMaterial);
//Set move the globe to the right location and center it.
globe.setLocalTranslation(0, 1, 0);
globe.center();
//Attach the globe, scale it down (cuz its big), then translate the node to the same spot as the globe so we don't start revolving around 0,0,0.
n.attachChild(globe); //Attach it to the node
n.scale(0.02f); //Scale the globe down
n.setLocalTranslation(0, 1, 0);
//Starring... the globe!
cam.lookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y);
cam.update();
//Now we must give it some light!
//<editor-fold defaultstate="collapsed" desc="Light">
DirectionalLight sun2 = new DirectionalLight();
sun2.setDirection(new Vector3f(0, 1, 0).normalizeLocal());
sun2.setColor(ColorRGBA.White);
n.addLight(sun2);
DirectionalLight sun3 = new DirectionalLight();
sun3.setDirection(new Vector3f(0, 0, 1).normalizeLocal());
sun3.setColor(ColorRGBA.White);
n.addLight(sun3);
DirectionalLight sun4 = new DirectionalLight();
sun4.setDirection(new Vector3f(1, 0, 0).normalizeLocal());
sun4.setColor(ColorRGBA.White);
n.addLight(sun4);
DirectionalLight sun5 = new DirectionalLight();
sun5.setDirection(new Vector3f(-1, 0, 0).normalizeLocal());
sun5.setColor(ColorRGBA.White);
n.addLight(sun5);
DirectionalLight sun6 = new DirectionalLight();
sun6.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
sun6.setColor(ColorRGBA.White);
n.addLight(sun6);
DirectionalLight sun7 = new DirectionalLight();
sun7.setDirection(new Vector3f(0, 0, -1).normalizeLocal());
sun7.setColor(ColorRGBA.White);
n.addLight(sun7);
//</editor-fold>
Main.getRN().attachChild(n); //Finally, attach the node to the root node.
//</editor-fold>
//Initialize text variables
//<editor-fold defaultstate="collapsed" desc="Initialize Text Renderers">
governmentInvestigationText = screen.findElementByName("GovernmentInvestigationText").getRenderer(TextRenderer.class);
computersInfectedText = screen.findElementByName("InfectedText").getRenderer(TextRenderer.class);
moneyMadeText = screen.findElementByName("MoneyText").getRenderer(TextRenderer.class);
destructionDoneText = screen.findElementByName("DestructionText").getRenderer(TextRenderer.class);
//</editor-fold>
}
更新
http(冒号)//puu(点)sh/9su8k/3910c2365a(点)png
在弄清楚如何使用命令提示符后,我发现了一个“非法参数异常”。它抱怨给定的根路径“C:\Users\Dean\Dist\Assets\Interface”不是一个目录,但是我在编译器中没有得到它。那有什么意思?我把这个从 ClassMenu 转移到 MalwareHub。
PS 我在 main 中注册 Assets/Interface 作为我的资产管理器的定位器。