当前位置: 首页>>代码示例>>Java>>正文


Java I18NBundle类代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.I18NBundle的典型用法代码示例。如果您正苦于以下问题:Java I18NBundle类的具体用法?Java I18NBundle怎么用?Java I18NBundle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


I18NBundle类属于com.badlogic.gdx.utils包,在下文中一共展示了I18NBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public void render(OrthographicCamera camera, SpriteBatch batch, int y, MenuEntry activeEntry, SchoolGame game, I18NBundle localeBundle, float deltaTime) {

            Color entryColor = getColor();
            if (this == activeEntry)
            {
                entryColor = getActiveColor();
                if (used == 1)
                {
                    entryColor = getDisabledColor();
                }
            }

            if (font == null)
                font = game.getDefaultFont();

            if (fontSmall == null)
                fontSmall = game.getLongTextFont();

            fontLayout.setText(font, localeBundle.format(getLabel(), id, used, playerName, gender), entryColor, camera.viewportWidth, Align.center, false);
            font.draw(batch, fontLayout, -camera.viewportWidth / 2, y);

            fontLayout.setText(fontSmall, localeBundle.format(detail, used, levelName, playTime), entryColor, camera.viewportWidth, Align.center, false);
            fontSmall.draw(batch, fontLayout, -camera.viewportWidth / 2, y - 50);
        }
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:25,代码来源:NewGameMenu.java

示例2: create

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
/**
 * Initialisierung.
 *
 * @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
 */
@Override
public void create(SchoolGame game) {
    Gdx.app.getApplicationLogger().log("INFO", "Menu init...");

    this.game = game;
    entries = new ArrayList<MenuEntry>();
    this.setupMenu();

    batch = new SpriteBatch();
    font = game.getDefaultFont();

    fontLayout = new GlyphLayout();

    selectSound = game.getAudioManager().createSound("menu", "select.wav", true);
    changeSound = game.getAudioManager().createSound("menu", "change.wav", true);

    game.getAudioManager().selectMusic(MUSIC_NAME, 0f);

    FileHandle baseFileHandle = Gdx.files.internal("data/I18n/" + getI18nName());
    localeBundle = I18NBundle.createBundle(baseFileHandle);

    Gdx.app.getApplicationLogger().log("INFO", "Menu finished...");
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:29,代码来源:MenuState.java

示例3: create

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
/**
 * Initialisierung
 *
 * @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
 */
@Override
public void create(SchoolGame game) {
    this.game = game;

    saveData = new SaveData(this.game, this.slot);

    batch = new SpriteBatch();
    font = game.getDefaultFont();
    smallFont = game.getLongTextFont();

    fontLayout = new GlyphLayout();

    FileHandle baseFileHandle = Gdx.files.internal("data/I18n/GameMenu");
    localeBundle = I18NBundle.createBundle(baseFileHandle);
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:21,代码来源:CreateGameSlot.java

示例4: render

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public void render(OrthographicCamera camera, SpriteBatch batch, int y, MenuEntry activeEntry, SchoolGame game, I18NBundle localeBundle, float deltaTime) {

            Color entryColor = getColor();
            if (this == activeEntry)
            {
                entryColor = getActiveColor();
            }
            if (!isEnabled())
            {
                entryColor = getDisabledColor();
            }

            if (font == null)
                font = game.getDefaultFont();

            if (fontSmall == null)
                fontSmall = game.getLongTextFont();

            fontLayout.setText(font, localeBundle.format(getLabel(), id, used, playerName, gender), entryColor, camera.viewportWidth, Align.center, false);
            font.draw(batch, fontLayout, -camera.viewportWidth / 2, y);

            fontLayout.setText(fontSmall, localeBundle.format(detail, used, levelName, playTime), entryColor, camera.viewportWidth, Align.center, false);
            fontSmall.draw(batch, fontLayout, -camera.viewportWidth / 2, y - 50);
        }
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:25,代码来源:LoadGameMenu.java

示例5: toString

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public String toString(I18NBundle bundle) {

        String s = "";

        if(minScore != Integer.MIN_VALUE)
        {
            s+= bundle.format("objective_score", minScore);
        }

        for(int i = 0; i < Const.BUILDING_COUNT; i++)
        {
            if(buildingRequirement[i] > 0)
            {
                if(!s.equals(""))
                    s+="\n";

                s+= bundle.format("objective_building",
                        buildingRequirement[i],
                        bundle.format(BuildingType.values()[i + 1].name().toLowerCase() + "_choice", buildingRequirement[i]));
            }
        }

        return s;
    }
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:25,代码来源:Objective.java

示例6: ActionDialog

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public ActionDialog(Label text, Action action, I18NBundle bundle, Skin skin, Hexpert hexpert) {
    super(hexpert, skin);
    this.action = action;

    getBackground().setMinWidth(1000);
    getBackground().setMinHeight(400);
    text.setWrap(true);
    text.setAlignment(Align.center);

    getContentTable().add(text).width(getBackground().getMinWidth()).expandX();

    getButtonTable().defaults().width(200).height(120).pad(15);

    TextButton textButtonYes = new TextButton(bundle.get("yes"), skin);
    getButtonTable().add(textButtonYes);
    setObject(textButtonYes, 1);
    TextButton textButtonNo = new TextButton(bundle.get("no"), skin);
    getButtonTable().add(textButtonNo);
    setObject(textButtonNo, null);
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:21,代码来源:ActionDialog.java

示例7: TutorialDialog

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public TutorialDialog(Hexpert hexpert, Skin skin, boolean useScrollPane) {
    super(hexpert, skin);
    scrollContent = new Table();
    if(useScrollPane) {
        scrollPane = new ScrollPane(scrollContent, skin);
        getContentTable().add(scrollPane);
    }

    getButtonTable().defaults().pad(15);
    I18NBundle i18N = hexpert.i18NBundle;

    TextButton textButtonOk = new TextButton(i18N.get("ok"), skin);
    getButtonTable().add(textButtonOk);

    setObject(textButtonOk, null);
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:17,代码来源:TutorialDialog.java

示例8: init

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public void init() {

        /*************** ASSET MANAGER ********************/
        assetManager.load("data/gui.json", Skin.class, new SkinLoader.SkinParameter(guiAtlas));
        assetManager.load(gameAtlas, TextureAtlas.class);
        assetManager.load("data/mental-space", I18NBundle.class, new I18NBundleLoader.I18NBundleParameter(java.util.Locale.getDefault()));

        /**************** Load Sounds and music *******************/
        SoundManager.getInstance().loadBasicSounds();
        MusicManager.getInstance().init(this);
        MusicManager.getInstance().loadBasics();

        /**************** Finish ******************/
        this.finishLoading();

        this.loadParticles();
    }
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:18,代码来源:LoaderUtils.java

示例9: preLoad

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public void preLoad()
{
	input = new InputManager(se);
	Controllers.addListener(input);
	
	atlas = new TextureAtlas("main.atlas");
	titleScreenAtlas = new TextureAtlas("titlescreen.atlas");
	menuControlsAtlas = new TextureAtlas("menu.atlas");
	menuFont = new BitmapFont(Gdx.files.internal("data/cgcfont.fnt"), atlas.findRegion("cgcfont"), false);
	titleFont = new BitmapFont(Gdx.files.internal("data/cgctitlefont.fnt"), atlas.findRegion("cgctitlefont"), false);
	sBatch = new SpriteBatch(1625);
	shapes = new ShapeRenderer();
	tManager = new TweenManager();

	FileHandle baseFileHandle = Gdx.files.internal("i18n/CGCLang");
	I18NBundle myBundle = I18NBundle.createBundle(baseFileHandle, locale);

	lang = myBundle;
	ChaseApp.alert("lang loaded");
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:21,代码来源:ChaseApp.java

示例10: LoadingStage

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
public LoadingStage() {
        GDefence.getInstance().assetLoader.load("MainMenuBg.png", Texture.class);//TODO
        GDefence.getInstance().assetLoader.load("mobHpBarBg.png", Texture.class);
        GDefence.getInstance().assetLoader.load("mobHpBarKnob.png", Texture.class);
//        I18NBundleLoader.I18NBundleParameter param = new I18NBundleLoader.I18NBundleParameter(/*new Locale("ru")*/Locale.US, "UTF-8");//TODO move to another place
//        GDefence.getInstance().assetLoader.load("Language/text", I18NBundle.class, param);
//        GDefence.getInstance().assetLoader.finishLoading();
        GDefence.getInstance().assetLoader.initLang("en");


        Image bg = new Image(GDefence.getInstance().assetLoader.get("MainMenuBg.png", Texture.class));
        addActor(bg);
        loadBar = new ProgressBar(0, 100, 1, false, GDefence.getInstance().assetLoader.getMobHpBarStyle());
        loadBar.setSize(300, 50);
        loadBar.getStyle().background.setMinHeight(loadBar.getHeight());
        loadBar.getStyle().knob.setMinHeight(loadBar.getHeight());
        loadBar.setPosition(Gdx.graphics.getWidth()/2 - loadBar.getWidth()/2, Gdx.graphics.getHeight()/2 - loadBar.getHeight()/2);
        addActor(loadBar);
        I18NBundle b = GDefence.getInstance().assetLoader.get("Language/text", I18NBundle.class);
        Label loading = new Label(b.get("loading"), FontLoader.generateStyle(34, Color.BLACK));//
        loading.setPosition(loadBar.getX() + loadBar.getWidth()/2 - loading.getWidth()/2,
                            loadBar.getY() - loadBar.getHeight());
        addActor(loading);
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:25,代码来源:LoadingStage.java

示例11: getLocalizedLabel

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
/**
 * returns localized label {@code labelKey} out of the label bundle file.
 * 
 * The label bundle file path is specified within the GameConstants class (check LABE_BUNDLE_PATH)
 * 
 * @param labelKey key to be searched within the label bundle
 * 
 * @return localized label of key {@code labelKey}
 */
public static String getLocalizedLabel(String labelKey) {
	if (labelBundle == null) {
		String cfgFileValue = getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_LANGUAGE);
		Locale locale = null;
		if (cfgFileValue != null) {
			locale = new Locale(cfgFileValue);
		} else {
			// get default locale
			locale = Locale.getDefault();
		}
		labelBundle = I18NBundle.createBundle(Gdx.files.internal(GameConstants.LABEL_BUNDLE_PATH), locale);
	}

	String result = "";
	try {
		result = labelBundle.get(labelKey);
	} catch (MissingResourceException e) {
		Gdx.app.error(GameConstants.LOG_TAG_ERROR, "Could not find label for key: " + labelKey, e);
	}

	return result;
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:32,代码来源:GameUtils.java

示例12: provide

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
@Override
public I18NBundle provide(final Object target, final Member member) {
    if (member == null) {
        throwUnknownPathException();
    }
    final String id = member.getName();
    if (id.isEmpty()) {
        throwUnknownPathException();
    }
    final I18NBundle asset = getOrLoad(id);
    if (member instanceof FieldMember) {
        final BundleInjection injection = new BundleInjection(determinePath(id), ((FieldMember) member).getField(),
                target);
        if (target instanceof Loaded) {
            ((Loaded) target).onLoad(determinePath(id), I18NBundle.class, asset);
        }
        bundlesData.get(id).add(injection);
    }
    return asset;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:21,代码来源:I18NBundleProvider.java

示例13: reloadBundles

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
/** @param locale will be used to reload all managed {@link I18NBundle} instances. */
public void reloadBundles(final Locale locale) {
    final AssetManager assetManager = getAssetManager();
    for (final String id : bundles.keys()) {
        final String path = determinePath(id);
        try {
            assetManager.unload(path);
        } catch (final Exception exception) {
            Exceptions.ignore(exception); // Asset not loaded. Somewhat expected.
        }
        final I18NBundle bundle = I18NBundle.createBundle(Gdx.files.internal(path), locale, encoding);
        bundles.put(id, bundle);
        final EagerI18NBundleParameter parameters = new EagerI18NBundleParameter(bundle);
        assetManager.load(path, I18NBundle.class, parameters);
        assetManager.finishLoadingAsset(path);
        for (final BundleInjection injection : bundlesData.get(id)) {
            injection.inject(bundle);
        }
        parser.getData().addI18nBundle(id, bundle);
        if (defaultBundle.equals(id)) {
            parser.getData().setDefaultI18nBundle(bundle);
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:25,代码来源:I18NBundleProvider.java

示例14: loadAsync

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle file, I18NBundleParameter parameter) {
	this.bundle = null;
	Locale locale;
	String encoding;
	if (parameter == null) {
		locale = Locale.getDefault();
		encoding = null;
	} else {
		locale = parameter.locale == null ? Locale.getDefault() : parameter.locale;
		encoding = parameter.encoding;
	}
	if (encoding == null) {
		this.bundle = I18NBundle.createBundle(file, locale);
	} else {
		this.bundle = I18NBundle.createBundle(file, locale, encoding);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:19,代码来源:I18NBundleLoader.java

示例15: AssetManager

import com.badlogic.gdx.utils.I18NBundle; //导入依赖的package包/类
/** Creates a new AssetManager with all default loaders. */
public AssetManager (FileHandleResolver resolver) {
	setLoader(BitmapFont.class, new BitmapFontLoader(resolver));
	setLoader(Music.class, new MusicLoader(resolver));
	setLoader(Pixmap.class, new PixmapLoader(resolver));
	setLoader(Sound.class, new SoundLoader(resolver));
	setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
	setLoader(Texture.class, new TextureLoader(resolver));
	setLoader(Skin.class, new SkinLoader(resolver));
	setLoader(ParticleEffect.class, new ParticleEffectLoader(resolver));
	setLoader(PolygonRegion.class, new PolygonRegionLoader(resolver));
	setLoader(I18NBundle.class, new I18NBundleLoader(resolver));
	setLoader(Model.class, ".g3dj", new G3dModelLoader(new JsonReader(), resolver));
	setLoader(Model.class, ".g3db", new G3dModelLoader(new UBJsonReader(), resolver));
	setLoader(Model.class, ".obj", new ObjLoader(resolver));
	executor = new AsyncExecutor(1);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:AssetManager.java


注:本文中的com.badlogic.gdx.utils.I18NBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。