Package civquest.parser.ruleset

Examples of civquest.parser.ruleset.Registry


  private CivQuest civQuest = null;

  public GlobalFunctionComponent(CivQuest civQuest) throws RulesetException {
    this.civQuest = civQuest;

    Registry topRegistry = civQuest.getTopRegistry();
    Registry mainRegistry = topRegistry.getSubRegistry("gui").getSubRegistry("main");
    Section globalFctSection = mainRegistry.getRuleset("functions").getSection("global");

    try {
      RulesetFunctionLoader.addFunctions(functionManager,
                         globalFctSection.toSwifuSection());
    } catch (FunctionException e) {
View Full Code Here


        this.markedFieldUnits = new HashMap();
        this.wfUnits = new HashMap();
       
    setUpPositionListener();
   
    Registry unitRegistry = paneRegistry.getSubRegistry("units");

        this.detailedFieldInfoComp = new DetailedFieldInfoComponent(
                fieldScrollPane.getViewport().getWidth());
        this.fieldScrollPane.setViewportView(this.detailedFieldInfoComp);

    this.unitInfoRuleset = unitRegistry.getRuleset(
                "detailedUnitInfoComp");

    JSplitPane splitPane
      = new JSplitPane(JSplitPane.VERTICAL_SPLIT, fieldScrollPane, unitScrollPane);
    component.add(splitPane);
View Full Code Here

    setUpListeners();
  }

  private void setUpListeners() throws RulesetException, GameChangeException  {
    Registry mainRegistry = guiRegistry.getSubRegistry("main");

    GameChangeManager gcManager = GameChangeManager.getGameChangeManager();
    gcManager.addAfterListener(this, "SetDisplayNation",
                   GameChangeManager.Listening.ALL_NATIONS,
                   "SetDisplayNation");

   
    Ruleset listenerRuleset = mainRegistry.getRuleset(".listens");
    Section listenerSection
      = listenerRuleset.getSection("civquest_listens");

    try {
      RulesetGameChangeLoader.addListener(listenerSection, this,
View Full Code Here

      // enforce theme being recognized as a directory
      if (!theme.endsWith(getDirectorySeparator())) {       
        theme += getDirectorySeparator();
      }
     
      return new Registry(resolve(baseURL, "config" + getDirectorySeparator() + theme));
    } catch (MalformedURLException e) {
      System.err.println("JarLoadingSource.constructRegistry says: " + e);
      System.err.println("====> Registry cannot be constructed and CivQuest will abort NOW!!!");
      System.exit(-1);
      return null;
View Full Code Here

      // enforce theme being recognized as a directory
      if (!theme.endsWith(getDirectorySeparator())) {
        theme += getDirectorySeparator();
      }
     
      return new Registry(resolve(baseURL, "config" + getDirectorySeparator() + theme));
    } catch (MalformedURLException e) {
      System.err.println("FileLoadingSource.constructRegistry says: " + e);
      System.err.println("====> Registry cannot be constructed and CivQuest will abort NOW!!!");
      System.exit(-1);
      return null;
View Full Code Here

  // This method serves for adding some players/nations, as long as this
  // can't be done in a regular way
  private void addSomePlayersAndNations()
    throws RulesetException {
    Registry nationRegistry = registry.getSubRegistry("nations");
    Registry visRegistry = registry.getSubRegistry("visibility");

    AddNation addNation1 = new AddNation("NationName1", nationRegistry, visRegistry);
    addNation1.execute();

    AddNation addNation2 = new AddNation("Michaelians", nationRegistry, visRegistry);
View Full Code Here

    this.civQuest = civQuest;
  }

  public void actionPerformed(FunctionActionEvent e) {
    try {
      Registry registry = civQuest.getTopRegistry();
      Game.constructGame(registry);
      Game game = Game.getGame();
      game.loadUnitRulesets();

      constructMap();
View Full Code Here

  public static void buildGameGUI(CivQuest civQuest)
    throws RulesetException {

   

    Registry registry = civQuest.getTopRegistry();
    ImageSet topImageSet = civQuest.getTopImageSet();

    Registry guiRegistry = registry.getSubRegistry("gui");
    Session session = new Session(guiRegistry);

//     Nation activeNation = Game.getGame().getActiveNation();
//     VisibilityManager visManager = activeNation.getVisibilityManager();

    JScrollPane scrollPane = null;
    QuadMap map = null;
    try {
       scrollPane = new JScrollPane();

       MapData mapData = Game.getMapData();

       if(mapData instanceof FlatMapData) {
         map = new QuadMap(civQuest,
                   registry, topImageSet, Const.FLAT,
                  QuadMap.Mode.GAME,
                   scrollPane, session);
       } else if (mapData instanceof IsoMapData) {
         map = new QuadMap(civQuest,
                   registry, topImageSet, Const.ISO,
                  QuadMap.Mode.GAME,
                   scrollPane, session);

       }

      JComponent infoPaneComponent = new JPanel();
      Registry paneRegistry = guiRegistry.getSubRegistry("panes");
      AbstractInfoPaneManager infoPaneManager = new EquiInfoPaneManager(infoPaneComponent,
                                        map,
                                        paneRegistry);
     
      GameStatusComponent gameStatusComp = new GameStatusComponent(session);
      GlobalFunctionComponent globFC = civQuest.getGlobalFunctionComponent();
      globFC.switchedToGame(new GameFunctionComponent(infoPaneManager,
                              map, gameStatusComp, guiRegistry,
                              civQuest));   
     
      JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                          infoPaneComponent, scrollPane);
      Integer prefWidth = infoPaneManager.getPreferredWidth();
       if (prefWidth != null) {
         splitPane.setDividerLocation(prefWidth);
       }
      splitPane.setOneTouchExpandable(true);

      setUpTopGameComponent(civQuest, splitPane, gameStatusComp);

      // start game
      Game.getGame().getTurnManager().start();
    } catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(civQuest,
                      "There was an error loading the map.\n\nMessage:\n"
                       + e.getMessage(),
                      "Error",
                                          JOptionPane.WARNING_MESSAGE);
    }

    Registry gameRegistry = registry.getSubRegistry("gui").getSubRegistry("menus");
    swifu.parser.ruleset.Ruleset menuRuleset
      = gameRegistry.toSwifuRegistry().getRuleset("gameMenus");
    constructMenuBar(civQuest, menuRuleset);   
    civQuest.validate();
  }
View Full Code Here

  }

  public static void buildScenarioEditorGUI(CivQuest civQuest)
    throws RulesetException {

    Registry registry = civQuest.getTopRegistry();
    ImageSet topImageSet = civQuest.getTopImageSet();

    Registry guiRegistry = registry.getSubRegistry("gui");
    Session session = new Session(guiRegistry);

    JScrollPane scrollPane = null;
    QuadMap map = null;
    try {
       scrollPane = new JScrollPane();

       MapData mapData = Game.getMapData();


       if(mapData instanceof FlatMapData) {
         map = new QuadMap(civQuest, Game.getGame(),
                   registry, topImageSet, Const.FLAT,
                  QuadMap.Mode.SCENARIO,
                   scrollPane, session);
       } else if (mapData instanceof IsoMapData) {
         map = new QuadMap(civQuest, Game.getGame(),
                   registry, topImageSet, Const.ISO,
                  QuadMap.Mode.SCENARIO,
                   scrollPane, session);
       }

      JPanel infoPaneComponent = new JPanel();

       Registry paneRegistry = guiRegistry.getSubRegistry("panes");
       ScenarioEditorInfoPaneManager infoPaneManager = new
           ScenarioEditorInfoPaneManager(civQuest, infoPaneComponent,
                        Game.getGame(), map, registry, paneRegistry);
     
       GlobalFunctionComponent globFC = civQuest.getGlobalFunctionComponent();
      ScenarioEditorFunctionComponent comp
        = new ScenarioEditorFunctionComponent(map, civQuest,
                            registry, infoPaneManager);
      globFC.switchedToEditor(comp);

      JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                          infoPaneComponent, scrollPane);
       Integer prefWidth = infoPaneManager.getPreferredWidth();
       if (prefWidth != null) {
         splitPane.setDividerLocation(prefWidth);
       }
      splitPane.setOneTouchExpandable(true);

      civQuest.setMainComponent(splitPane);
     
    } catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(civQuest,
                      "There was an error loading the map.\n\nMessage:\n"
                       + e.getMessage(),
                      "Error",
                                          JOptionPane.WARNING_MESSAGE);
    }

    Registry gameRegistry = registry.getSubRegistry("gui").getSubRegistry("menus");
    swifu.parser.ruleset.Ruleset menuRuleset
      = gameRegistry.toSwifuRegistry().getRuleset("editorMenus");
    constructMenuBar(civQuest, menuRuleset);

    civQuest.validate();
  }
View Full Code Here

    private Game(Registry registry) throws RulesetException,
                       ConfigurationException {

    performCommonSetup(registry);
   
    Registry rulesRegistry = registry.getSubRegistry("rules");
    Ruleset timeRuleset = rulesRegistry.getRuleset("time");
    timeRules = new TimeRules(timeRuleset);
    rules = new Rules(this);

    this.turnManager = new TurnManager();
    this.resourceData = new ResourceData(this);
View Full Code Here

TOP

Related Classes of civquest.parser.ruleset.Registry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.