⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.java

📁 一个飞机类游戏
💻 JAVA
字号:
package enemy;
import javax.microedition.lcdui.*;

public class Utils {
  public static final Font cFont = Font.getFont (Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_SMALL);	
	
  private static String locale;
  private static int localeIndex;  
  public static final String[] supportedLocales = {"en","de","cn"};  
  
  private static int ix=0;	
  public static final int ID_CONTINUE = ix++;
  public static final int ID_NEW = ix++;
  public static final int ID_SETTINGS = ix++;
  public static final int ID_HIGH_SCORE = ix++;
  public static final int ID_HELP = ix++;
  public static final int ID_ABOUT = ix++;
  public static final int ID_EXIT = ix++;
  public static final int ID_SELECT = ix++;
  public static final int ID_BACK = ix++;
  public static final int ID_RESET = ix++;
  public static final int ID_OK = ix++;
  public static final int ID_TITLE= ix++;  
  public static final int ID_ERROR= ix++;  
  public static final int ID_ERROR_SUPPORT = ix++;
  public static final int ID_HELP_CONTROLS = ix++;
  public static final int ID_VERSION = ix++;
  public static final int ID_MUSIC = ix++;
  public static final int ID_SOUND = ix++;
  public static final int ID_VIBRATE = ix++;  
  public static final int ID_AUTOFIRE = ix++;
  
  private static final String[][] translationText = {
    {"Continue","New Game","Settings","High Score","Help","About","Exit","Select","Back","Reset","OK","Elminator","ERROR",
     "Game not functioning correctly.  Please contact support","Press ........",
     "Elminator\nVersion 1.0.0\nDeveloped by Jason Lam\nGraphics by Leeman Cheng and Carlo Casimiro","Music","Sound","Vibrate","Auto Fire"
    }, 
    
    // Should be German -- update later
    {"Continue","New Game","Settings","High Score","Help","About","Exit","Select","Back","Reset","OK","Elminator","ERROR",
     "Game not functioning correctly.  Please contact support","Press ........",
     "Elminator\nVersion 1.0.0\nDeveloped by Jason Lam\nGraphics by Leeman Cheng and Carlo Casimiro","Music","Sound","Vibrate","Auto Fire"
    },
    
    // Should be German -- update later
    {"Continue","新游戏","Settings","High Score","Help","About","Exit","Select","Back","Reset","OK","Elminator","ERROR",
     "Game not functioning correctly.  Please contact support","Press ........",
     "Elminator\nVersion 1.0.0\nDeveloped by Jason Lam\nGraphics by Leeman Cheng and Carlo Casimiro","Music","Sound","Vibrate","Auto Fire"
    }
    
  };
  
  private Utils() {
  }
  
  static {
    locale = System.getProperty("microedition.locale");
    
    localeIndex = -1;
    for (int i=0; i< supportedLocales.length; i++) {
      if (locale.equals(supportedLocales[i])) {
      	localeIndex = i;
      	break;
      }
    }
    if (localeIndex == -1) {
      localeIndex = 0;  // default for english
    }      
  }
  
  public static final String getStr(int key) {
    return translationText[localeIndex][key];
  }
  
  public static final Image createImage(String filename) {
    Image image = null;
    try {
      image = Image.createImage(filename);
    } catch (Exception e) {
    }
    return image;
  }  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -