mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Client - Added number of active games to the header of the games column of the user list.
This commit is contained in:
parent
30ea2188bf
commit
aad1a2da89
11 changed files with 100 additions and 30 deletions
|
|
@ -45,6 +45,7 @@ import mage.view.MatchView;
|
|||
import mage.view.TableView;
|
||||
import mage.view.TournamentView;
|
||||
import mage.view.UserDataView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.UserView;
|
||||
import mage.view.UsersView;
|
||||
|
||||
|
|
@ -70,7 +71,7 @@ public interface MageServer {
|
|||
|
||||
// server state methods
|
||||
ServerState getServerState() throws MageException;
|
||||
List<UsersView> getConnectedPlayers(UUID roomId) throws MageException;
|
||||
List<RoomUsersView> getRoomUsers(UUID roomId) throws MageException;
|
||||
List<MatchView> getFinishedMatches(UUID roomId) throws MageException;
|
||||
Object getServerMessagesCompressed(String sessionId) throws MageException; // messages of the day
|
||||
|
||||
|
|
|
|||
|
|
@ -524,16 +524,16 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<UsersView> getConnectedPlayers(UUID roomId) throws MageRemoteException {
|
||||
public Collection<RoomUsersView> getRoomUsers(UUID roomId) throws MageRemoteException {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
return server.getConnectedPlayers(roomId);
|
||||
return server.getRoomUsers(roomId);
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
throw new MageRemoteException();
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
handleThrowable(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import mage.view.UserView;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.UsersView;
|
||||
|
||||
/**
|
||||
|
|
@ -46,8 +47,8 @@ public interface ServerState {
|
|||
|
||||
List<UserView> getUsers();
|
||||
|
||||
Collection<UsersView> getConnectedPlayers(UUID roomId) throws MageRemoteException;
|
||||
|
||||
Collection<RoomUsersView> getRoomUsers (UUID roomId) throws MageRemoteException;
|
||||
|
||||
List<String> getServerMessages();
|
||||
|
||||
Collection<TableView> getTables(UUID roomId) throws MageRemoteException;
|
||||
|
|
|
|||
60
Mage.Common/src/mage/view/RoomUsersView.java
Normal file
60
Mage.Common/src/mage/view/RoomUsersView.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.view;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class RoomUsersView implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final int numberActiveGames;
|
||||
|
||||
private final List<UsersView> usersView;
|
||||
|
||||
public RoomUsersView(List<UsersView> usersView, int numberActiveGames) {
|
||||
|
||||
this.numberActiveGames = numberActiveGames;
|
||||
|
||||
this.usersView = usersView;
|
||||
}
|
||||
|
||||
public int getNumberActiveGames() {
|
||||
return numberActiveGames;
|
||||
}
|
||||
|
||||
public List<UsersView> getUsersView() {
|
||||
return usersView;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,9 +37,9 @@ public class UsersView implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String userName;
|
||||
private String infoState;
|
||||
private String infoGames;
|
||||
private final String userName;
|
||||
private final String infoState;
|
||||
private final String infoGames;
|
||||
|
||||
public UsersView(String userName, String infoState, String infoGames) {
|
||||
this.userName = userName;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue