Package scotlandyard.engine.spec

Examples of scotlandyard.engine.spec.IUser


    myEngine.icons.put("x1.gif",false);
    myEngine.icons.put("d1.gif",false);
   
   
    IUser mrx = myEngine.login(mrxEmail,mrxName,"0");
    IUser detective = myEngine.login(detectiveEmail,detectiveName,"1");

    game.addPlayer(mrx,true);

    game.addPlayer(detective,false);
    IPlayer player = game.getPlayer(mrxHash);
View Full Code Here


    gameId=(gameId==null||"optional".equals(gameId)?System.currentTimeMillis()+"":gameId);
    Game game = new Game(gameId,mp);
    Engine.instance().games.put(game.getId(),game);
    game.setMapPath("/maps/palmerstonNorth.xml");

    IUser mrx = Engine.instance().login(mrxEmail,mrxName,"0");
    IUser detective = Engine.instance().login(detectiveEmail,detectiveName,"1");
   
    game.addPlayer(mrx,true);
    game.addPlayer(detective,false);
    game.start(game.getPlayer(mrxHash));
  }
View Full Code Here

    myEngine.icons.put("x1.gif",false);
    myEngine.icons.put("d1.gif",false);
   
   
    IUser mrx = myEngine.login(mrxEmail,mrxName,"0");
    IUser detective = myEngine.login(detectiveEmail,detectiveName,"1");

    game.addPlayer(mrx,true);

    game.addPlayer(detective,false);
    IPlayer player = game.getPlayer(mrxHash);
View Full Code Here

    new WebUserBean();
  }
 
  @Test
  public void testLogin() throws Exception{
    IUser mrx = Engine.instance().login(mrxEmail, mrxName,"0");
    IUser detective = Engine.instance().login(detectiveEmail, detectiveName,"1");
    Assert.assertTrue(Engine.instance().getUser(mrxHash).equals(mrx));
    Assert.assertTrue(Engine.instance().getUser(detectiveHash).equals(detective));
    Assert.assertFalse(Engine.instance().getUser(mrxHash).equals(detective));
    Assert.assertFalse(Engine.instance().getUser(detectiveHash).equals(mrx));
  }
View Full Code Here

    try{
      final Engine engine = Engine.instance();
      String icon = request.getParameter("icon");
      String hash = request.getParameter("xhash");

      final IUser user = engine.getUser(hash);

      if(user!=null){
        user.setIcon(icon);
        for(IGame game:engine.games.values()){
          for(IPlayer player:game.getPlayers()){
            if(user.getHash().equals(player.getHash())){
              player.setIcon(icon);
            }
          }
        }
      }
View Full Code Here

      if(hash==null||"".equals(hash)){
        throw new Exception("Unknown HASH");
      }

      final IUser user = Engine.instance().getUser(hash);

      if(user==null){
        throw new Exception("Unknown User");
      }
View Full Code Here

        sb.append("  </div>");
        sb.append("</li>");
      }
      sb.append("</ul>");
      final IUser user = Engine.instance().getUser(xhash);
      if(game.getStatus()==Game.NEW && (user!=null && (game.getPlayers().size()==0 || (game.getPlayers().size()<6 && !game.hasPlayer(user))))){
        sb.append("<div id='game_buttons_"+game.getId()+"' align='right'>");
        sb.append("<table><tr>");
        if(game.getMrX()==null){
          sb.append("<td><button onclick='join_game(\""+game.getId()+"\",true)'>");
View Full Code Here

      if(game==null){
        throw new Exception("Unknown Game");
      }

        final IUser user = Engine.instance().getUser(hash);

        if(user==null){
          throw new Exception("Unknown USER");
        }
        if(game.getStatus()!=IGame.NEW){
          throw new Exception("the game has already started.");
        }
        game.removePlayer("{\"msg\" : \""+user.getEmail()+"\"}");
       
      }catch(Exception e){
        out.print("{\"msg\" : \"EXCEPTION : "+(e.getMessage()+"").replace("\"", "'")+"\", \"className\" : \""+getClass().getName()+"\"}");
      }
  }
View Full Code Here

TOP

Related Classes of scotlandyard.engine.spec.IUser

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.