Package com.pointcliki.text

Examples of com.pointcliki.text.HyperlinkText


    fDownInfo = new Sprite("downinfo");
    addChild(fDownInfo.position(new Vector2f(60, 115)));
   
    final SyncObject<Integer> done = new SyncObject<Integer>(0);
   
    fDownYes = new HyperlinkText("I have already installed Gruntz", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {

      /**
       * Serial key
       */
      private static final long serialVersionUID = 3255208115397490201L;

      @Override
      public void click() {
        // Locate Gruntz
        JFileChooser loader = new JFileChooser();
        loader.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        loader.setDialogTitle("Locate Gruntz game folder");
        int r = loader.showOpenDialog(null);
        if (r == JFileChooser.APPROVE_OPTION) {
         
          File f = loader.getSelectedFile();
          File rez = new File(f.getAbsolutePath() + "/GRUNTZ.REZ");
          File vrz = new File(f.getAbsolutePath() + "/GRUNTZ.VRZ");
          // TODO: use zzz file
          //File zzz = new File(f.getAbsolutePath() + "/GRUNTZ.ZZZ");
         
          boolean copy = false;
          if (!rez.exists() || !vrz.exists()) {
            JFrame frame = new JFrame();
            frame.setVisible(true);
            frame.setLocationRelativeTo(null);
            frame.setAlwaysOnTop(true);
            JOptionPane.showMessageDialog(frame, "Sorry, the folder selected doesn't appear to have the resources\nrequired to play Dizgruntled. Please try again or select the\noption to download the resources.", "Resources Not Found", 0);                 
            frame.dispose();
          }/* else if (!zzz.exists()) {
            r = JOptionPane.showConfirmDialog(null, "Dizgruntled couldn't find the Gruntz 1.01 patch with your game. Please note that\nwhile you can play Dizgruntled without this patch, a few of the original levels\nare incorrect. Would you like to continue without the patch?", "Patch Not Found", JOptionPane.YES_NO_OPTION);
            if (r == 0) copy = true;
          } */else {
            copy = true;
          }
          if (copy) {
            try {
              copyFile(rez, new File("lib/GRUNTZ.REZ"));
              copyFile(vrz, new File("lib/GRUNTZ.VRZ"));
             
              // Remove Hyperlinks
              fDownYes.cleanup();
              fDownYes = null;
              fDownNo.cleanup();
              fDownNo = null;
              fDownInfo.cleanup();
              fDownInfo = null;
             
              // Continue
              removeChild(fBack);
              showMenuPage();
             
            } catch (IOException e) {
              JFrame frame = new JFrame();
              frame.setVisible(true);
              frame.setLocationRelativeTo(null);
              frame.setAlwaysOnTop(true);
              JOptionPane.showMessageDialog(frame, "Sorry, Dizgruntled couldn't copy over the required resource files GRUNTZ.REZ and GRUNTZ.VRZ. Please check they exist and are not in use.", "Copy Error", 0);
              frame.dispose();
            }
          }
        }
      }
     
    };
    addChild(fDownYes.position(new Vector2f(65, 450)));
   
    fDownNo = new HyperlinkText("I haven't previously installed Gruntz", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {

      /**
       * Serial key
       */
      private static final long serialVersionUID = -4682660357282196588L;

      @Override
      public void click() {
        // Remove Hyperlinks
        fDownYes.cleanup();
        fDownYes = null;
        fDownNo.cleanup();
        fDownNo = null;
        fDownInfo.cleanup();
        fDownInfo = null;
       
        final ProgressBar downloadBar = new ProgressBar(new Vector2f(340, 32), new Color(20, 44, 48), HOVER);
        StartScene.this.addChild(downloadBar.position(new Vector2f(60, 115)));
       
        final TextEntity downloadText = new TextEntity("Please wait while Dizgruntled downloads\nrequired resources", TextEntity.ALIGN_LEFT, fFont);
        StartScene.this.addChild(downloadText.position(new Vector2f(60, 200)));
       
        // Download the resources
        final Thread downloader = new Thread() {
         
          private DownloadExtractor fVrzDown;
          private DownloadExtractor fRezDown;

          @Override
          public void run() {
            try {
              URL url = new URL("http://pointcliki.com/gruntz/download.txt");
              Scanner s = new Scanner(url.openStream());
              final String rez = s.nextLine();
              final String vrz = s.nextLine();
              s.close();
             
              // Download the VRZ
              fVrzDown = new DownloadExtractor(new URL(vrz), new File("lib/vrz.zip"), new File("lib/GRUNTZ.VRZ")) {
 
                @Override
                public void onError(Exception e) {
                  JFrame frame = new JFrame();
                  frame.setVisible(true);
                  frame.setLocationRelativeTo(null);
                  frame.setAlwaysOnTop(true);
                  JOptionPane.showMessageDialog(frame, "Sorry, Dizgruntled can't download the files at this time. Please try again later", "Download Error", 0);
                  frame.dispose();
                  fVrzDown.cancel();
                  fRezDown.cancel();
                 
                  // Clean up
                  removeChild(fBack);
                  downloadBar.cleanup();
                  downloadText.cleanup();
                  showDownloadPage();
                }
 
                @Override
                public void onExtracting() {
                  downloadText.text("Extracting resources...");
                }
 
                @Override
                public void onProgress(float f) {
                  downloadBar.percent(f / 2 + fRezDown.progress() / 2);
                }
 
                @Override
                public void onDone() {
                  done.set(done.get() + 1);
                }
             
              };
             
              // Download the REZ
              fRezDown = new DownloadExtractor(new URL(rez), new File("lib/rez.zip"), new File("lib/GRUNTZ.REZ")) {
 
                @Override
                public void onError(Exception e) {
                  JFrame frame = new JFrame();
                  frame.setVisible(true);
                  frame.setLocationRelativeTo(null);
                  frame.setAlwaysOnTop(true);
                  JOptionPane.showMessageDialog(frame, "Sorry, Dizgruntled can't download the files at this time. Please try again later", "Download Error", 0);
                  frame.dispose();
                  fVrzDown.cancel();
                  fRezDown.cancel();
                 
                  // Clean up
                  removeChild(fBack);
                  downloadBar.cleanup();
                  downloadText.cleanup();
                  showDownloadPage();
                }
 
                @Override
                public void onExtracting() {
                  downloadText.text("Extracting resources...");
                }
 
                @Override
                public void onProgress(float f) {
                  downloadBar.percent(f / 2 + fVrzDown.progress() / 2);
                }
 
                @Override
                public void onDone() {
                  done.set(done.get() + 1);                 
                }
             
              };
             
              final HyperlinkText cancelText = new HyperlinkText("Cancel Download", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {
                /**
                 * Serial key
                 */
                private static final long serialVersionUID = 896122497881495986L;
 
                @Override
                public void click() {
                  fVrzDown.cancel();
                  fRezDown.cancel();
                  // Clean up
                  removeChild(fBack);
                  downloadBar.cleanup();
                  downloadText.cleanup();
                  showDownloadPage();
                }
              };
              StartScene.this.addChild(cancelText.position(new Vector2f(60, 450)));
             
              fVrzDown.start();
              fRezDown.start();
             
            } catch (Exception e) {
View Full Code Here


    addChild(fHoverPlay.position(new Vector2f(60, 90)));
    addChild(fHoverEditor.position(new Vector2f(270, 90)));
    addChild(fHoverLearn.position(new Vector2f(60, 230)));
    addChild(fHoverWww.position(new Vector2f(270, 230)));
   
    fAudio = new HyperlinkText("Audio                   Yes", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {
      /**
       * Serial key
       */
      private static final long serialVersionUID = -5199274170691192012L;

      @Override
      public void click() {
        if (GruntzGame.instance().mute()) {
          GruntzGame.instance().mute(false);
          fAudio.text("Audio                   Yes");
        } else {
          GruntzGame.instance().mute(true);
          fAudio.text("Audio                   No");
        }
      }
    };
    fFullscreen = new HyperlinkText("Fullscreen            Yes", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {
      /**
       * Serial key
       */
      private static final long serialVersionUID = 7826676731391952554L;

      @Override
      public void click() {
        if (GruntzGame.instance().fullscreen()) {
          GruntzGame.instance().fullscreen(false);
          fFullscreen.text("Fullscreen            No");
        } else {
          GruntzGame.instance().fullscreen(true);
          fFullscreen.text("Fullscreen            Yes");
        }
      }
    };
    fScreensize = new HyperlinkText("Screen Size          1024x768", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {
      /**
       * Serial key
       */
      private static final long serialVersionUID = -6542663871541452203L;

View Full Code Here

    int y = 150;
    int i = 0;
    for (String str: s) {
      final int id = i;
      i++;
      HyperlinkText link = new HyperlinkText(str, TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {
        /**
         * Serial key
         */
        private static final long serialVersionUID = 1649654658328820595L;
        @Override
        public void click() {
          if (quest == SET_PLAY) {
            if (id == 0) {
              JFileChooser loader = new JFileChooser();
              loader.setAcceptAllFileFilterUsed(false);
              loader.addChoosableFileFilter(new FileNameExtensionFilter("Dizgruntled Maps (*.map)", "map"));
              loader.addChoosableFileFilter(new FileNameExtensionFilter("Wap World Maps (*.wwd)", "wwd"));
              loader.addChoosableFileFilter(new FileNameExtensionFilter("All Maps", "wwd", "map"));
              loader.setDialogTitle("Open Dizgruntled Map");
              JFrame frame = new JFrame();
              frame.setVisible(true);
              frame.setLocationRelativeTo(null);
              frame.setAlwaysOnTop(true);
              int r = loader.showOpenDialog(frame);
              frame.dispose();
              if (r == JFileChooser.APPROVE_OPTION) GruntzGame.instance().playLevel(loader.getSelectedFile());
             
            } else {
              for (HyperlinkText t: links) t.cleanup();
              removeChild(fBack);
              showLevelPage(id - 1 + SET_WORLD_OFFSET);
            }
          } else if (quest == SET_LEARN) {
            String level = "AREA1/WORLDZ/TRAINING" + (id + 1);
            MonolithFile wwd = GruntzGame.resourceManager().rez().file(level, "wwd");
            GruntzGame.instance().playLevel(wwd);
          } else {
            String level = "AREA" + (quest - SET_WORLD_OFFSET + 1) + "/WORLDZ/LEVEL" + ((id + 1) + 4 * (quest - SET_WORLD_OFFSET));
            MonolithFile wwd = GruntzGame.resourceManager().rez().file(level, "wwd");
            GruntzGame.instance().playLevel(wwd);
          }
        }
      };
      links.add(link);
      addChild(link.position(new Vector2f(70, y)));
      y += 30;
    }
   
    HyperlinkText back = new HyperlinkText("Go Back", TextEntity.ALIGN_LEFT, fFont, Color.white, HOVER) {
      /**
       * Serial key
       */
      private static final long serialVersionUID = 1649654658328820595L;
      @Override
      public void click() {
        for (HyperlinkText t: links) t.cleanup();
        removeChild(fBack);
        if (quest < SET_WORLD_OFFSET) {
          showMenuPage();
        } else {
          showLevelPage(SET_PLAY);
        }
      }
    };
    addChild(back.position(new Vector2f(70, 480)));
  }
View Full Code Here

    resize(new Vector2f(GruntzGame.instance().application().getWidth(), GruntzGame.instance().application().getHeight()));
   
    fText = new TextEntity("", TextEntity.ALIGN_CENTER, GruntzGame.resourceManager().largeFont(), COLOR);
    addChild(fText.position(new Vector2f(GruntzGame.instance().application().getWidth() / 2, GruntzGame.instance().application().getHeight() / 2)));
   
    fContinue = new HyperlinkText("Continue", TextEntity.ALIGN_CENTER, GruntzGame.resourceManager().largeFont(), Color.white, COLOR) {
      /**
       * Serial key
       */
      private static final long serialVersionUID = -8422268305393456577L;
      @Override
      public void click() {
        fHUD.removeChild(HudOverlay.this);
        removeChild(fContinue);
        removeChild(fQuit);
      }
    };
    fQuit = new HyperlinkText("Quit", TextEntity.ALIGN_CENTER, GruntzGame.resourceManager().largeFont(), Color.white, COLOR) {
      /**
       * Serial key
       */
      private static final long serialVersionUID = -4215706932211494531L;
      @Override
View Full Code Here

TOP

Related Classes of com.pointcliki.text.HyperlinkText

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.