我以前从未有过修复构建相关问题的经验,所以当Jmonkey Engine决定生成一个不像在编译器中运行那样的构建时,我不知道(现在仍然不知道)该怎么做。Jmonkey引擎运行在netbeans之上,但在这个特殊的游戏中,我们主要使用Nifty GUI,因为只有一个3D对象(地球仪)。
没有错误信息-构建是"成功的",游戏运行没有错误。问题是玩家无法从职业菜单移动到恶意软件中心,或者游戏开始的地方。我会张贴我的构建日志,类菜单,和恶意软件中心。
即使你对Jmonkey没有任何直接的经验,你能给我解释一下为什么会发生这种情况,我可能需要做些什么来修复它吗?注意:我没有控制台知识,所以在这个顺序上的任何帮助可能需要一些解释。
谢谢。
我希望我能提供更小的代码段,重新创建的问题,但我实际上不知道问题是什么,因此我所能做的就是张贴两个类。然而,我将在这里张贴代码的一部分,你可能应该注意。如果你想要一个完整的类,请查看链接。
链接和代码
构建日志:http://pastebin.com/bgaVNvKi
类菜单:http(结肠)//pastebin(点)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(结肠)//噗(点)sh/9 su8k/3910 c2365a(点)png
在弄清楚如何使用命令提示符后,我发现了一个"非法参数异常"。它抱怨给定的根路径"C:UsersDeanDistAssetsInterface"不是一个目录,但是我在编译器中没有得到这个。这到底是什么意思?我得到这个移动从ClassMenu到MalwareHub。
注:
http://puu.sh/9wml6/50eed968f8.png
实际情况是,我已经注册了我之前谈到的定位器,我本不应该这样做。随后,在我的xml文件中,我(不小心)忘记把Interface/放在文件名前面。这在编译器中有效,因为从Jmonkey的角度来看,Assets/Interface是一个实际的文件夹,但在构建中,所有内容都应该从Assets .jar中访问。这就是为什么它会报怨Assets/Interface文件夹不存在。
谢谢你的帮助!