private void initializeGodot() { if (expansion_pack_path != null) { String[] new_cmdline; int cll = 0; if (command_line != null) { Log.d("GODOT", "initializeGodot: command_line: is not null"); new_cmdline = new String[command_line.length + 2]; cll = command_line.length; for (int i = 0; i < command_line.length; i++) { new_cmdline[i] = command_line[i]; } } else { Log.d("GODOT", "initializeGodot: command_line: is null"); new_cmdline = new String[2]; } new_cmdline[cll] = "-main_pack"; new_cmdline[cll + 1] = expansion_pack_path; command_line = new_cmdline; } io = new GodotIO(this); io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID); GodotLib.io = io; Log.d("GODOT", "command_line is null? " + ((command_line == null) ? "yes" : "no")); /*if(command_line != null){ Log.d("GODOT", "Command Line:"); for(int w=0;w <command_line.length;w++){ Log.d("GODOT"," " + command_line[w]); } }*/ GodotLib.initialize(this, io.needsReloadHooks(), command_line); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME); result_callback = null; mPaymentsManager = PaymentsManager.createManager(this).initService(); godot_initialized = true; }
@Override protected void onPause() { super.onPause(); if (!godot_initialized) { if (null != mDownloaderClientStub) { mDownloaderClientStub.disconnect(this); } return; } mView.onPause(); mSensorManager.unregisterListener(this); GodotLib.focusout(); for (int i = 0; i < singleton_count; i++) { singletons[i].onMainPause(); } }
@Override protected void onResume() { super.onResume(); if (!godot_initialized) { if (null != mDownloaderClientStub) { mDownloaderClientStub.connect(this); } return; } mView.onResume(); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); GodotLib.focusin(); for (int i = 0; i < singleton_count; i++) { singletons[i].onMainResume(); } }