Multiplayer: added mobile devies support

master
EmaMaker 2020-05-15 12:44:11 +02:00
commit 33e0b38608
22 changed files with 45 additions and 46 deletions

View File

@ -91,7 +91,13 @@ task run(type: Exec) {
dependencies {
implementation files('/home/emamaker/github/amazeing/gdx/lib/kryonet-2.21-all.jar')
<<<<<<< HEAD
}
=======
implementation files('/home/emamaker/github/amazeing/gdx/lib/kryonet-2.21-all.jar')
}
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
eclipse.project.name = appName + "-android"

View File

@ -49,11 +49,18 @@ project(":desktop") {
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
<<<<<<< HEAD
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
api "de.tomgrill.gdxdialogs:gdx-dialogs-desktop:1.2.5"
=======
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
}
}
@ -77,17 +84,27 @@ project(":android") {
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64"
<<<<<<< HEAD
=======
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
<<<<<<< HEAD
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "de.tomgrill.gdxdialogs:gdx-dialogs-android:1.2.5"
=======
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
}
}
@ -105,7 +122,10 @@ project(":ios") {
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
<<<<<<< HEAD
api "de.tomgrill.gdxdialogs:gdx-dialogs-ios:1.2.5"
=======
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
}
}
@ -117,12 +137,19 @@ project(":core") {
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
<<<<<<< HEAD
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "net.dermetfan.libgdx-utils:libgdx-utils:0.13.4"
api "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.2.5"
=======
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
}
}

View File

@ -95,8 +95,8 @@ public class GameManager {
mazeGen.generateMaze();
if (type != GameType.CLIENT) {
mazeGen.setupEndPoint();
spreadPlayers();
mazeGen.setupEndPoint();
}
if (todraw != null && showGame == true) {

View File

@ -6,7 +6,6 @@ import java.util.HashSet;
import java.util.Hashtable;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3;
@ -268,6 +267,7 @@ public class GameClient {
}
}
}else{
//Search for mobile players
if(updateMobilePlayers){
for(int i = 0; i < MazeSettings.MAXPLAYERS; i++) {
p = PlayerUtils.getPlayerWithTouchCtrl(i, new HashSet<>(players.values()));
@ -290,7 +290,6 @@ public class GameClient {
updateMobilePlayers = false;
}
}
//Search for mobile players
}
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Random;
import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.maze.settings.MazeSetting;
import com.emamaker.amazeing.maze.settings.MazeSettings;
import com.emamaker.voxelengine.block.CellId;

View File

@ -42,17 +42,6 @@ public class MazeSetting {
this.uiManager = uiManager_;
setOptions(options_, defaultOption);
//Build the Table which will be later used to add this to the screen
table = new Table();
nameLabel = new Label(this.name, uiManager.skin);
currentOptLabel = new Label(this.options[currentOption], uiManager.skin);
backBtn = new TextButton("<", uiManager.skin);
forthBtn = new TextButton(">", uiManager.skin);
resetBtn = new TextButton("R", uiManager.skin);
update();
// Add actions to the buttons
backBtn.addListener(new InputListener() {

View File

@ -1,6 +1,5 @@
package com.emamaker.amazeing.maze.settings;
import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.ui.UIManager;
public class MazeSettingMaxPlayersMobile extends MazeSetting{

View File

@ -36,8 +36,8 @@ public class UIManager {
public void setupScreens() {
//Load all the screens after loading the skin
titleScreen = new TitleScreen(this);
setScreen = new SettingsScreen(this);
playersScreen = new PlayerChooseScreen(this);
setScreen = new SettingsScreen(this);
srvJoinScreen = new ServerJoinScreen(this);
srvLaunchScreen = new ServerLaunchScreen(this);
preGameScreen = new PreGameScreen(this);

View File

@ -1,5 +1,8 @@
package com.emamaker.amazeing.ui.screens;
import java.util.ArrayList;
import java.util.HashSet;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
@ -13,16 +16,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.AMazeIng.Platform;
import com.emamaker.amazeing.maze.settings.MazeSetting;
import com.emamaker.amazeing.maze.settings.MazeSettings;
import com.emamaker.amazeing.player.MazePlayer;
import com.emamaker.amazeing.player.MazePlayerLocal;
import com.emamaker.amazeing.player.PlayerUtils;
import com.emamaker.amazeing.ui.UIManager;
import java.util.ArrayList;
import java.util.HashSet;
public class PlayerChooseScreen extends MyScreen {
Label[] labels;
@ -143,14 +142,12 @@ public class PlayerChooseScreen extends MyScreen {
totalPlayers = 0;
if (AMazeIng.PLATFORM == Platform.DESKTOP) {
labels = new Label[MazeSettings.MAXPLAYERS];
// Labels to know if players joined
for (int i = 0; i < labels.length; i++) {
labels[i] = new Label("-- empty slot --", uiManager.skin);
}
} else {
buttons = new CheckBox[MazeSettings.MAXPLAYERS];
// Labels to know if players joined
for (int i = 0; i < buttons.length; i++) {

View File

@ -1,10 +1,5 @@
package com.emamaker.amazeing.ui.screens;
import java.util.Arrays;
import java.util.HashSet;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.Container;
@ -12,14 +7,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.manager.GameType;
import com.emamaker.amazeing.manager.network.NetworkCommon;
import com.emamaker.amazeing.maze.settings.MazeSetting;
import com.emamaker.amazeing.maze.settings.MazeSettings;
import com.emamaker.amazeing.player.MazePlayerLocal;
import com.emamaker.amazeing.player.PlayerUtils;
import com.emamaker.amazeing.ui.UIManager;
public class PreGameScreen extends MyScreen {
@ -57,8 +47,6 @@ public class PreGameScreen extends MyScreen {
firstRowContainer = new Container<Table>();
instLab = new Label("Waiting for players to join...", uiManager.skin);
mobileLab1 = new Label("Remote Players: ", uiManager.skin);
backBtn = new TextButton("<", uiManager.skin);
@ -171,7 +159,6 @@ public class PreGameScreen extends MyScreen {
labels[i] = new Label("-- empty slot --", uiManager.skin);
}
}
firstRowContainer.setSize(cw, ch * 0.2f);
firstRowContainer.setPosition(tableContainer.getX(), ch * 0.1f);
firstRowContainer.fill();

View File

@ -110,7 +110,6 @@ public class ServerLaunchScreen extends MyScreen {
if(uiManager.main.server.startServer(Integer.valueOf(srvPort.getText()))) {
// If the server and the client have been started successfully, we can show the
// joining screen
MazeSettings.setPlayers.setOptions(MazeSettings.maxPlayersDesktop, 3);
uiManager.preGameScreen.setGameType(GameType.SERVER);

View File

@ -213,12 +213,6 @@ public class SettingsScreen extends MyScreen {
table.row().colspan(2);
table.add(s.getTable());
}
/*table.row().colspan(2);
table.add(MazeSettings.setDim.getTable());
table.row().colspan(2);
table.add(MazeSettings.setPlayers.getTable());
table.row().colspan(2);
table.add(MazeSettings.setEpDist.getTable());*/
return table;
}

View File

@ -81,7 +81,6 @@ public class TitleScreen extends MyScreen {
hide();
MazeSettings.setPlayers.setOptions(MazeSettings.maxPlayersDesktop, 2);
uiManager.main.setScreen(uiManager.srvLaunchScreen);
return true;
}
@ -136,8 +135,6 @@ public class TitleScreen extends MyScreen {
table.row().colspan(1);
table.add(amazeingLab).spaceBottom(spaceBetweenBtns * 3);
table.row();
//table.add(setBut).spaceBottom(spaceBetweenBtns).height(btnHeight).width(btnWidth);
//table.row();
table.add(makeSrvBtn).spaceBottom(spaceBetweenBtns).height(btnHeight).width(btnWidth);
table.row();
table.add(joinSrvBtn).spaceBottom(spaceBetweenBtns).height(btnHeight).width(btnWidth);

View File

@ -42,12 +42,18 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<<<<<<< HEAD
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
=======
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
ios/data/Default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
ios/data/Default@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
ios/data/Default~ipad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB