mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
Added option that AbilityPicker is forced to show if ability or spell has no or only tap cost (not finished yet).
This commit is contained in:
parent
81eaac46c7
commit
ee76ccfee4
14 changed files with 194 additions and 103 deletions
|
|
@ -48,6 +48,7 @@ public class Connection {
|
|||
private String proxyPassword;
|
||||
|
||||
private int avatarId;
|
||||
private boolean showAbilityPickerForced;
|
||||
|
||||
private static final String serialization = "?serializationtype=jboss";
|
||||
private static final String transport = "bisocket";
|
||||
|
|
@ -204,4 +205,12 @@ public class Connection {
|
|||
this.avatarId = avatarId;
|
||||
}
|
||||
|
||||
public boolean isShowAbilityPickerForced() {
|
||||
return showAbilityPickerForced;
|
||||
}
|
||||
|
||||
public void setShowAbilityPickerForced(boolean showAbilityPickerForced) {
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public class SessionImpl implements Session {
|
|||
this.sessionId = callbackClient.getSessionId();
|
||||
boolean registerResult;
|
||||
if (connection.getPassword() == null) {
|
||||
UserDataView userDataView = new UserDataView(connection.getAvatarId());
|
||||
UserDataView userDataView = new UserDataView(connection.getAvatarId(), connection.isShowAbilityPickerForced());
|
||||
// for backward compatibility. don't remove twice call - first one does nothing but for version checking
|
||||
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
|
||||
server.setUserData(connection.getUsername(), sessionId, userDataView);
|
||||
|
|
@ -367,8 +367,6 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -381,8 +379,6 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -395,8 +391,6 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -423,8 +417,6 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1243,10 +1235,10 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean updateAvatar(int avatarId) {
|
||||
public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
UserDataView userDataView = new UserDataView(avatarId);
|
||||
UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced);
|
||||
server.setUserData(connection.getUsername(), sessionId, userDataView);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ public interface ClientData {
|
|||
|
||||
String getUserName();
|
||||
|
||||
boolean updateAvatar(int avatarId);
|
||||
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class PlayerView implements Serializable {
|
|||
if (player.getUserData() != null) {
|
||||
this.userDataView = new UserDataView(player.getUserData());
|
||||
} else {
|
||||
this.userDataView = new UserDataView(0);
|
||||
this.userDataView = new UserDataView(0, false);
|
||||
}
|
||||
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ public class UserDataView implements Serializable {
|
|||
|
||||
protected int avatarId;
|
||||
protected int userGroup;
|
||||
protected boolean showAbilityPickerForced;
|
||||
|
||||
public UserDataView(int avatarId) {
|
||||
public UserDataView(int avatarId, boolean showAbilityPickerForced) {
|
||||
this.avatarId = avatarId;
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
}
|
||||
|
||||
public UserDataView(UserData userData) {
|
||||
|
|
@ -26,4 +28,9 @@ public class UserDataView implements Serializable {
|
|||
public int getAvatarId() {
|
||||
return avatarId;
|
||||
}
|
||||
|
||||
public boolean isShowAbilityPickerForced() {
|
||||
return showAbilityPickerForced;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue