當前位置: 首頁>>代碼示例>>Java>>正文


Java Localization類代碼示例

本文整理匯總了Java中ethanjones.cubes.core.localization.Localization的典型用法代碼示例。如果您正苦於以下問題:Java Localization類的具體用法?Java Localization怎麽用?Java Localization使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Localization類屬於ethanjones.cubes.core.localization包,在下文中一共展示了Localization類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ServerSetupMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public ServerSetupMenu(final Save save) {
  super();
  title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
  saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
  saveLabel.setAlignment(Align.center);
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  start = new TextButton(Localization.get("menu.server.start"), skin);
  back = MenuTools.getBackButton(this);

  start.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT) : Integer.parseInt(port.getText());
      Adapter.setMenu(new ServerRunningMenu(save, p));
    }
  });

  stage.addActor(title);
  stage.addActor(saveLabel);
  stage.addActor(port);
  stage.addActor(start);
  stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:26,代碼來源:ServerSetupMenu.java

示例2: handlePacket

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
@Override
public void handlePacket() {
	if (Side.isServer()) {
		Player player = Cubes.getServer().getClient(getSocketMonitor()).getPlayer();
		Log.info("[" + Localization.get("server.chat") + "] [" + player.username + "] " + msg);
		if (msg.startsWith("/")) {
			CommandManager.run(msg.substring(1), player);
		} else {
			PacketChat packetChat = new PacketChat();
			packetChat.msg = "[" + player.username + "] " + msg;
			NetworkingManager.sendPacketToAllClients(packetChat);
		}
	} else {
		Cubes.getClient().renderer.guiRenderer.print(msg);
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:17,代碼來源:PacketChat.java

示例3: SingleplayerSaveDeleteMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public SingleplayerSaveDeleteMenu(final Save save) {
	title = new Label(Localization.get("menu.singleplayer.delete.title"),
			skin.get("title", Label.LabelStyle.class));
	text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
	delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
	back = MenuTools.getBackButton(this);

	text.setAlignment(Align.center);

	delete.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			ClientSaveManager.deleteSave(save);
			Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
			if (!(prev instanceof SingleplayerSavesMenu))
				return;
			((SingleplayerSavesMenu) prev).updateSavesList();
			Adapter.setMenu(prev);
		}
	});

	stage.addActor(title);
	stage.addActor(text);
	stage.addActor(delete);
	stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:27,代碼來源:SingleplayerSaveDeleteMenu.java

示例4: ServerRunningMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public ServerRunningMenu(Save save, int port) {
  super(Localization.get("menu.general.loading"), Localization.get("menu.server.stop"));
  this.save = save;
  this.port = port;

  addButtonListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof ChangeListener.ChangeEvent)) return false;
      try {
        Adapter.gotoMainMenu();
      } catch (StopLoopException ignored) {
      }
      return true;
    }
  });
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:18,代碼來源:ServerRunningMenu.java

示例5: render

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public void render() {
  super.render();
  frameNum++;
  if (frameNum != 2) return;
  try {
    NetworkingManager.serverPreInit(new ServerNetworkingParameter(port));
    Adapter.setServer(new ServerOnlyServer(save));
    Adapter.setClient(null);
  } catch (Exception e) {
    Log.error("Failed to start server", e);
    Adapter.setMenu(new FailedStartingServerMenu(e));
    Adapter.setClient(null);
    Adapter.setServer(null);
    return;
  }
  text.setText(Localization.get("menu.server.running"));
  resize(GUI_WIDTH, GUI_HEIGHT);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:19,代碼來源:ServerRunningMenu.java

示例6: MultiplayerConnectMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:25,代碼來源:MultiplayerConnectMenu.java

示例7: init

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public static void init() {
  CommandBuilder save = new CommandBuilder("save").register().setCommandPermission(CommandPermission.Extended);

  save.setCommandListener(new CommandListener() {
    @Override
    public void onCommand(CommandBuilder builder, List<CommandArgument> arguments, CommandSender sender) {
      World world = Cubes.getServer().world;
      if (world.save.readOnly) {
        sender.print(Localization.get("command.save.readOnly"));
      } else {
        sender.print(Localization.get( "command.save.starting"));
        Cubes.getServer().world.save();
      }
    }
  });
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:17,代碼來源:SaveCommand.java

示例8: handlePacket

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
@Override
public void handlePacket() {
  if (Side.isServer()) {
    Player player = Cubes.getServer().getClient(getSocketMonitor()).getPlayer();
    Log.info("[" + Localization.get("server.chat") + "] [" + player.username + "] " + msg);
    if (msg.startsWith("/")) {
      CommandManager.run(msg.substring(1), player);
    } else {
      PacketChat packetChat = new PacketChat();
      packetChat.msg = "[" + player.username + "] " + msg;
      NetworkingManager.sendPacketToAllClients(packetChat);
    }
  } else {
    Cubes.getClient().renderer.guiRenderer.print(msg);
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:17,代碼來源:PacketChat.java

示例9: SingleplayerSaveDeleteMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public SingleplayerSaveDeleteMenu(final Save save) {
  title = new Label(Localization.get("menu.singleplayer.delete.title"), skin.get("title", Label.LabelStyle.class));
  text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
  delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
  back = MenuTools.getBackButton(this);

  text.setAlignment(Align.center);

  delete.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      ClientSaveManager.deleteSave(save);
      Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
      if (!(prev instanceof SingleplayerSavesMenu)) return;
      ((SingleplayerSavesMenu) prev).updateSavesList();
      Adapter.setMenu(prev);
    }
  });

  stage.addActor(title);
  stage.addActor(text);
  stage.addActor(delete);
  stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:25,代碼來源:SingleplayerSaveDeleteMenu.java

示例10: ServerSetupMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public ServerSetupMenu(final Save save) {
	super();
	title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
	saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
	saveLabel.setAlignment(Align.center);
	port = new TextField("", skin);
	port.setMessageText(
			Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
	port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
	start = new TextButton(Localization.get("menu.server.start"), skin);
	back = MenuTools.getBackButton(this);

	start.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)
					: Integer.parseInt(port.getText());
			Adapter.setMenu(new ServerRunningMenu(save, p));
		}
	});

	stage.addActor(title);
	stage.addActor(saveLabel);
	stage.addActor(port);
	stage.addActor(start);
	stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:28,代碼來源:ServerSetupMenu.java

示例11: SingleplayerTemporarySaveMenu

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public SingleplayerTemporarySaveMenu() {
	title.setText(Localization.get("menu.singleplayer.create.temporary_title"));
	name.setVisible(false);

	start.removeListener(startListener);
	start.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			Adapter.setMenu(new SingleplayerLoadingMenu(ClientSaveManager
					.createTemporarySave(generator.getSelected().id, mode.getSelected(), seed.getText())));
		}
	});
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:14,代碼來源:SingleplayerTemporarySaveMenu.java

示例12: getBackButton

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public static TextButton getBackButton(final Menu menu) {
	TextButton textButton = new TextButton(Localization.get("menu.general.back"), Menu.skin);
	textButton.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			Menu prev = MenuManager.getPrevious(menu);
			if (prev == null)
				return;
			Adapter.setMenu(prev);
		}
	});
	return textButton;
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:14,代碼來源:MenuTools.java

示例13: create

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
@Override
public void create() {
	super.create();
	consoleCommandSender = new ConsoleCommandSender();

	Log.info(Localization.get("server.server_loaded"));
	Log.info(Localization.get("server.server_port",
			((ServerNetworking) NetworkingManager.getNetworking(Side.Server)).getPort()));
	loop();
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:11,代碼來源:DedicatedServer.java

示例14: init

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public static void init() {
  new CommandBuilder("stop").register().setCommandPermission(CommandPermission.All).setCommandListener(new CommandListener() {
    @Override
    public void onCommand(CommandBuilder builder, List<CommandArgument> arguments, CommandSender sender) {
      sender.print(Localization.get("Stopping..."));
      Cubes.getServer().dispose();
    }
  });
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:10,代碼來源:StopCommand.java

示例15: print

import ethanjones.cubes.core.localization.Localization; //導入依賴的package包/類
public static void print(CommandBuilder builder, CommandSender sender) {
  String base = builder.getCommandString();
  sender.print(Localization.get("command.help.command", base));
  if (builder.getCommandListener() != null) {
    if (builder.getHelpText() != null) {
      sender.print(format(base, builder.getHelpText()));
    } else {
      sender.print(base);
    }
  }
  for (CommandBuilder child : builder.getChildren()) {
    print(child, sender, base);
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:15,代碼來源:HelpCommand.java


注:本文中的ethanjones.cubes.core.localization.Localization類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。