Skip to content
Snippets Groups Projects
Commit 06dcf518 authored by Petter Selfors Rølvåg's avatar Petter Selfors Rølvåg
Browse files

bugfix

parent 9b85b23d
No related branches found
No related tags found
1 merge request!8Dev
No preview for this file type
<component name="libraryTable">
<library name="Gradle: CheckersClient.core.core-1.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/core/build/libs/core-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
......@@ -26,7 +26,7 @@ public class NetworkController {
this.client = new Client();
client.start();
try {
String IP4_LAN_ADDRESS = "192.168.10.154";
String IP4_LAN_ADDRESS = "192.168.87.34";
client.connect(10000, IP4_LAN_ADDRESS, 54555, 54777);
} catch (IOException e) {
e.printStackTrace();
......
package com.mygdx.game.model;
import com.mygdx.game.views.tokens.PlayerAvatar;
public class Player {
private int ID;
private int indexAvatar;
private PlayerAvatar playerAvatar;
private String playerName;
public Player(){}
......@@ -35,12 +32,12 @@ public class Player {
'}';
}
public void setPlayerAvatar(PlayerAvatar playerAvatar){
this.playerAvatar = playerAvatar;
public void setIndexAvatar(int indexAvatar){
this.indexAvatar = indexAvatar;
}
public PlayerAvatar getPlayerAvatar(PlayerAvatar playerAvatar){
return this.playerAvatar;
public int getPlayerAvatar(int indexAvatar){
return this.indexAvatar;
}
public void setPlayerName(String playerName) {
......
......@@ -8,7 +8,6 @@ import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
......@@ -31,11 +30,6 @@ import com.mygdx.game.views.tokens.PlayerAvatar;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Hashtable;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
public class MenuView extends View{
......@@ -76,7 +70,7 @@ public class MenuView extends View{
private ArrayList<PlayerAvatar> availableAvatars;
int currentAvatarIndex = 0;
int currentIndexAvatar = 0;
public MenuView(final GameViewManager gvm, final PlayerController playerController, AssetManager assetManager, final Stage stage, Skin skin) {
......@@ -190,7 +184,7 @@ public class MenuView extends View{
Drawable flippedDrawable = new TextureRegionDrawable(texReg);
previousAvatarButton = new ImageButton(flippedDrawable);
Drawable portraitDrawable = new TextureRegionDrawable(new TextureRegion(availableAvatars.get(currentAvatarIndex).getPortrait()));
Drawable portraitDrawable = new TextureRegionDrawable(new TextureRegion(availableAvatars.get(currentIndexAvatar).getPortrait()));
avatarPortraitImage = new Image(portraitDrawable);
avatarPortraitImage.setBounds(0, 0, col_width*1.8f, col_width*1.8f);
......@@ -211,8 +205,8 @@ public class MenuView extends View{
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
buttonClickAudio.play(0.8f);
if(currentAvatarIndex>0){
currentAvatarIndex -= 1;
if(currentIndexAvatar >0){
currentIndexAvatar -= 1;
}
updateAvatarPortrait();
outputLabel.setText("PREV AVATAR: current avatar is: " + currentAvatar);
......@@ -225,11 +219,11 @@ public class MenuView extends View{
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
buttonClickAudio.play(0.8f);
if(currentAvatarIndex<availableAvatars.size()-1){
currentAvatarIndex += 1;
if(currentIndexAvatar <availableAvatars.size()-1){
currentIndexAvatar += 1;
}
updateAvatarPortrait();
outputLabel.setText("NEXT AVATAR: current avatar is: " + availableAvatars.get(currentAvatarIndex).getName());
outputLabel.setText("NEXT AVATAR: current avatar is: " + availableAvatars.get(currentIndexAvatar).getName());
return true;
}
});
......@@ -243,7 +237,7 @@ public class MenuView extends View{
transitionAudio.play(0.50f);
startFadeFromBlankToWhite = true;
whiteImage.setZIndex(stage.getActors().size);
playerController.getPlayer().setPlayerAvatar(availableAvatars.get(currentAvatarIndex));
playerController.getPlayer().setIndexAvatar(currentIndexAvatar);
}
return true;
}
......@@ -279,7 +273,7 @@ public class MenuView extends View{
}
private void updateAvatarPortrait(){
Drawable portraitDrawable = new TextureRegionDrawable(new TextureRegion(availableAvatars.get(currentAvatarIndex).getPortrait()));
Drawable portraitDrawable = new TextureRegionDrawable(new TextureRegion(availableAvatars.get(currentIndexAvatar).getPortrait()));
avatarPortraitImage.setDrawable(portraitDrawable);
}
......
No preview for this file type
<component name="libraryTable">
<library name="Gradle: CheckersServer.core.core-1.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/core/build/libs/core-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
......@@ -2,10 +2,10 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/CheckersServer.iml" filepath="$PROJECT_DIR$/.idea/CheckersServer.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android/CheckersServer.android.iml" filepath="$PROJECT_DIR$/.idea/modules/android/CheckersServer.android.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/core/CheckersServer.core.iml" filepath="$PROJECT_DIR$/.idea/modules/core/CheckersServer.core.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/desktop/CheckersServer.desktop.iml" filepath="$PROJECT_DIR$/.idea/modules/desktop/CheckersServer.desktop.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/tdt4240-progark-project.CheckersServer.iml" filepath="$PROJECT_DIR$/.idea/modules/tdt4240-progark-project.CheckersServer.iml" />
</modules>
</component>
</project>
\ No newline at end of file
......@@ -4,6 +4,7 @@ public class Player {
private int ID;
private int indexAvatar;
private String playerName;
public Player(){}
......@@ -31,4 +32,15 @@ public class Player {
'}';
}
public void setIndexAvatar(int indexAvatar){
this.indexAvatar = indexAvatar;
}
public int getPlayerAvatar(int indexAvatar){
return this.indexAvatar;
}
public void setPlayerName(String playerName) {
this.playerName = playerName;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment