SettingsLangScreen.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class SettingsLangScreen {
  2. start() {
  3. let current = hmFS.SysProGetChars("mmk_tb_lang");
  4. if(!current) current = "false";
  5. const data = {
  6. "false": "(system)",
  7. "en-US": "English",
  8. "zh-CN": "简体中文",
  9. "zh-TW": "繁體中文",
  10. "ru-RU": "Русский",
  11. "de-DE": "Deutsch"
  12. };
  13. let y = 64;
  14. for(let key in data) {
  15. this.makeRow(key, data[key], y, current === key);
  16. y += 76;
  17. }
  18. }
  19. makeRow(key, name, y, active) {
  20. hmUI.createWidget(hmUI.widget.BUTTON, {
  21. x: 8,
  22. y,
  23. w: 192-16,
  24. h: 64,
  25. press_color: active ? 0x09253b : 0x333333,
  26. normal_color: active ? 0x09253b : 0x222222,
  27. radius: 12,
  28. text: name,
  29. color: active ? 0x008fff : 0xffffff,
  30. click_func: () => {
  31. hmFS.SysProSetChars("mmk_tb_lang", key);
  32. hmApp.goBack();
  33. }
  34. })
  35. }
  36. }
  37. let __$$app$$__ = __$$hmAppManager$$__.currentApp;
  38. let __$$module$$__ = __$$app$$__.current;
  39. __$$module$$__.module = DeviceRuntimeCore.Page({
  40. onInit(p) {
  41. this.screen = new SettingsLangScreen();
  42. this.screen.start();
  43. }
  44. });