Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package cz.vsb.ekf.lan0116;
  2.  
  3. import ...
  4.  
  5. public class Launcher {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in, "UTF-8");
  9. //Volba lokalizace - jazyka hry
  10.         System.out.println("Language/Jazyk");
  11.         String pref;
  12.         do {
  13.             System.out.println("en/cz");
  14.             pref = scanner.nextLine();
  15.         } while (!(pref.equals("en") || pref.equals("cz")));
  16.         Localization l;
  17.         switch (pref) {
  18.             case "en":
  19.                 l = new Localization(ResourceUtil.getResource(ResourceType.LOCALIZATION, "en"));
  20.                 break;
  21.             case "cz":
  22.                 l = new Localization(ResourceUtil.getResource(ResourceType.LOCALIZATION, "cz"));
  23.                 break;
  24.             default:
  25.                 l = new Localization(ResourceUtil.getResource(ResourceType.LOCALIZATION, "en"));
  26.                 break;
  27.         }
  28.         Localization localization = l;
  29.  
  30. //Načtení potřebných dat do ResourceCache
  31.         Map<String, Attack> attackMap = ResourceToMapUtil.createAttackMap(ResourceUtil
  32.                 .getResource(ResourceType.ATTACK_ALL, "attacks"));
  33.         Map<String, Consumable> consumableMap = ResourceToMapUtil.createConsumableMap(ResourceUtil
  34.                 .getResource(ResourceType.CONSUMABLE_ALL, "consumables"));
  35.         Map<String, Weapon> weaponMap = ResourceToMapUtil.createWeaponMap(ResourceUtil
  36.                         .getResource(ResourceType.WEAPON_ALL, "weapons"),
  37.                 attackMap);
  38.         Map<String, Creature> creatureMap = ResourceToMapUtil.createCreatureMap(ResourceUtil
  39.                 .getResource(ResourceType.CREATURES_ALL, "creatures"), attackMap, weaponMap);
  40.         ResourceCache cache = new ResourceCache(attackMap, consumableMap, creatureMap, null, weaponMap);
  41.        
  42. //Vytvoření zbývajících instancí souvisejících s kontextem 
  43.         World world = World.layout(cache);
  44.         Hero hero = HeroCreationUi.creationOfHero(scanner, localization);
  45.         ResponseChannel responseChannel = new ResponseChannel();
  46.         EventPublisher eventPublisher = new EventPublisher(hero, world, responseChannel);
  47.         Session session = new Session(eventPublisher, responseChannel);
  48.         Context context = new Context(eventPublisher, hero, world, cache, scanner, localization, session);
  49.         TextEvents textEvents = new TextEvents(context);
  50.         textEvents.playGame();
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement