public MobSpriteDef(String defName, int kind) throws Exception { super(); name = defName; if (defMap.containsKey(name)) { } else { InputStream stream = ModdingMode.getInputStream(name); StringBuilder animationDef = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line = reader.readLine(); while (line != null) { animationDef.append(line); line = reader.readLine(); } reader.close(); defMap.put(name, (JSONObject) new JSONTokener(animationDef.toString()).nextValue()); } selectKind(kind); }
public void showStatus(int color, String text, Object... args) { if (getVisible()) { if (args.length > 0) { text = Utils.format(text, args); } if (ModdingMode.getClassicTextRenderingMode()) { if (ch != null) { FloatingText.show(x + width * 0.5f, y, ch.getPos(), text, color); } else { FloatingText.show(x + width * 0.5f, y, text, color); } } else { if (ch != null) { SystemFloatingText.show(x + width * 0.5f, y, ch.getPos(), text, color); } else { SystemFloatingText.show(x + width * 0.5f, y, text, color); } } } }
public static void classicFont(boolean value) { ModdingMode.setClassicTextRenderingMode(value); Preferences.INSTANCE.put(Preferences.KEY_CLASSIC_FONT, value); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedpreferences.edit(); int countShowAds = sharedpreferences.getInt("countShowAds", 0); // String placeModFilesHere = "placeModFilesHere"; PixelDungeon.moddingMode(false); ModdingMode.mode(PixelDungeon.moddingMode()); /* if(!FileSystem.getExternalStorageFile(placeModFilesHere).exists()) { try { FileSystem.getExternalStorageFile(placeModFilesHere).createNewFile(); } catch (IOException e) { GLog.i(e.getMessage()); e.printStackTrace(); } } */ PixelDungeon.instance().initIap(); if (PixelDungeon.uiLanguage().equals("ko")) { PixelDungeon.classicFont(false); } ModdingMode.setClassicTextRenderingMode(PixelDungeon.classicFont()); useLocale(uiLanguage()); updateImmersiveMode(); DisplayMetrics metrics = new DisplayMetrics(); instance().getWindowManager().getDefaultDisplay().getMetrics(metrics); boolean landscape = metrics.widthPixels > metrics.heightPixels; if (Preferences.INSTANCE.getBoolean(Preferences.KEY_LANDSCAPE, false) != landscape) { landscape(!landscape); } Music.INSTANCE.enable(music()); Sample.INSTANCE.enable(soundFx()); secondQuickslot(); if (PixelDungeon.version() != Game.versionCode) { switchScene(WelcomeScene.class); } if (countShowAds >= 2) { final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo(); if (activeNetwork != null && activeNetwork.isConnected()) { Intent intent = new Intent(this, Ads.class); startActivity(intent); } editor.putInt("countShowAds", 0); } else { if (countShowAds == 0) { editor.putInt("countShowAds", 1); } else { editor.putInt("countShowAds", countShowAds + 1); } } editor.commit(); }
public static boolean classicFont() { boolean val = Preferences.INSTANCE.getBoolean(Preferences.KEY_CLASSIC_FONT, true); ModdingMode.setClassicTextRenderingMode(val); return val; }