From 09f07eb5d935f9df414063b5fad6c81542687dc8 Mon Sep 17 00:00:00 2001 From: Markus Kofler Date: Thu, 26 May 2022 19:50:04 +0200 Subject: [PATCH] #41 Add PlayerSocketID to Player Model for future usage --- core/src/playerLogic/Player.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/core/src/playerLogic/Player.java b/core/src/playerLogic/Player.java index 1062de3..f0f8f2b 100644 --- a/core/src/playerLogic/Player.java +++ b/core/src/playerLogic/Player.java @@ -17,6 +17,7 @@ public class Player extends Actor { private static float SIZE = Gdx.graphics.getHeight() / 15; private int playerIndex; + private String playerSocketID; private int money; private Field currentPosition; private SecureRandom secRand = new SecureRandom(); @@ -28,7 +29,7 @@ public Player() { } - public Player(Field startingField, int playerIndex) { + public Player(Field startingField, int playerIndex, String playerSocketID) { money = 1000000; // movePath = new IntArray(); shares = new HashMap<>(); @@ -38,39 +39,40 @@ public Player(Field startingField, int playerIndex) { this.setX(currentPosition.getX()); this.setY(currentPosition.getY()); playerTexture = new Texture("p" + playerIndex + "icon.png"); + this.playerSocketID = playerSocketID; } //--------GETTERS----------- public int getPlayerIndex() { return playerIndex; } - + public String getPlayerSocketID() { + return playerSocketID; + } public int getMoney() { return money; } - public int getAmountOfShare(Share shareName) { return shares.get(shareName); } - public Field getCurrentPosition() { return currentPosition; } - //-------------------------- + //--------SETTERS----------- public void setCurrentFieldPosition(Field field) { this.currentPosition = field; } - + public void setPlayerSocketID(String playerSocketID) { + this.playerSocketID = playerSocketID; + } public void setPlayerIndex(int playerIndex) { this.playerIndex = playerIndex; } - public void setMoney(int money) { this.money = money; } - public void setInitialRandomShares(int share_Index) { switch (share_Index) { case 1: