コード例 #1
0
  public void reset(boolean isFinal) {
    m_info.m_score = 0;
    m_info.m_lines = 0;

    if (false == BattleTrisApp.isTestMode()) {
      m_info.m_money = 0;
      m_inventory.removeAll();
    }
  }
コード例 #2
0
  public PlayerImpl(
      AppControllable ac,
      PieceControllable pc,
      String serverHost,
      String username,
      String displayName) {
    // TODO: For now, use default, eventually pass in config file path
    m_inputControls =
        new InputControls(BattleTrisApp.getRootPath() + InputControls.DEFAULT_CONFIG_PATH);

    m_ac = ac;
    m_pc = pc;

    m_info = new PlayerInfoImpl();

    m_info.m_username = username;
    m_info.m_displayName = displayName;
    m_info.m_score = 0;

    if (BattleTrisApp.isTestMode()) {
      m_info.m_money = 10000;
    } else {
      m_info.m_money = 0;
    }
    m_info.m_lines = 0;

    /*
    // Get the localhost
    // Get ip address
    InetAddress l_ipAddr = null;
    String l_hostIp = null;
    try
    {
    	l_ipAddr = InetAddress.getLocalHost();

    	l_hostIp = l_ipAddr.getHostName();
    }
    catch(java.net.UnknownHostException uhe)
    {
    	l_hostIp = "localhost";
    	//String l_ipAddr = //"192.168.1.101";

    	uhe.printStackTrace(System.err);
    }
    */

    // String l_uriPrefix = "rmi://"+l_hostIp+":"+DEFAULT_PORT+"/";

    // m_info.m_uri = l_uriPrefix+m_info.m_username;

    m_netClient = new ConnectedPlayerImpl(this, username, serverHost, 3333, System.out, System.err);

    /*
    try {
    	m_info.m_uri = m_netClient.getPlayerInfo().getUri();
    }
    catch(NetworkException ne)
    {
    	ne.printStackTrace(System.err);
    }
    */

    m_inventory = new Inventory();
  }