Commit ab0f9890 authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

Fixed merge conflict

parents 94f3166d 2d12d28f
......@@ -11,6 +11,8 @@ import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.mygdx.game.controllers.NetworkController;
import com.mygdx.game.controllers.PlayerController;
import com.mygdx.game.model.Game;
import com.mygdx.game.model.GameState;
import com.mygdx.game.views.GameViewManager;
import com.mygdx.game.views.MenuLoadingView;
......@@ -42,7 +44,8 @@ public class UniCheckersClient extends ApplicationAdapter {
Gdx.input.setInputProcessor(stage);
// Initialize Models..
Game model = new Game(new GameState());
System.out.println("Det gikk bra");
// Initialize controllers..
NetworkController networkController = new NetworkController();
......
......@@ -25,7 +25,7 @@ public class NetworkController {
this.client = new Client();
client.start();
try {
String IP4_LAN_ADDRESS = "192.168.87.20";
String IP4_LAN_ADDRESS = "192.168.0.136"; //"192.168.87.20";
client.connect(10000, IP4_LAN_ADDRESS, 54555, 54777);
} catch (IOException e) {
e.printStackTrace();
......
//Inside gameState, data for a specific field
package com.mygdx.game.model
import java.lang.Exception
class Field {
private var piece: Piece?
//private var powerup: Powerup?
init {
this.piece = null
}
fun setPiece(piece: Piece) {
if (this.piece != null) {
throw Exception("Field already holds a piece.")
} else {
this.piece = piece
}
}
fun getPiece(): Piece? {
return this.piece
}
fun removePiece() {
this.piece = null
}
}
\ No newline at end of file
import com.mygdx.game.model.GameState
package com.mygdx.game.model
//Logic of the game, holds a GameState, operations
//(((Controller???))) Model can change its own data, but has to be told by controller
class Game(gameState: GameState) {
}
private var gameState: GameState
init {
this.gameState = gameState
}
}
\ No newline at end of file
//Holds a ruleset and a board
package com.mygdx.game.model//Holds a ruleset and a board
class GameMode(rules:AbstractRules? = null, board:AbstractBoard? = null) {
private var rules: AbstractRules?
private var board: AbstractBoard?
init {
this.rules = rules
this.board = board
}
fun setBoard(board:AbstractBoard) {
this.board = board
}
fun getBoard(): AbstractBoard? {
return this.board
}
fun setRules(rules: AbstractRules) {
this.rules = rules
}
fun getRules(): AbstractRules? {
return this.rules
}
}
\ No newline at end of file
......@@ -3,16 +3,21 @@ package com.mygdx.game.model
/*
Holds the state of the game and all data related to this.
*/
class GameState(board: AbstractBoard, rules: AbstractRules) {
class GameState(gameMode: GameMode? = null) {
private var boardState:AbstractBoard
private var rules:AbstractRules
private var boardState:AbstractBoard?
private var rules:AbstractRules?
private var isStarted: Boolean
private var winner: Player?
init {
this.rules = rules
this.boardState = board
if (gameMode == null) {
this.rules = null
this.boardState = null
} else {
this.rules = gameMode.getRules()
this.boardState = gameMode.getBoard()
}
this.isStarted = false
this.winner = null
}
......@@ -21,11 +26,11 @@ class GameState(board: AbstractBoard, rules: AbstractRules) {
this.boardState = boardState
}
fun getBoradState(): AbstractBoard {
fun getBoardState(): AbstractBoard? {
return boardState
}
fun getRules(): AbstractRules {
fun getRules(): AbstractRules? {
return rules
}
......
//Inside gameState
\ No newline at end of file
package com.mygdx.game.model
class Piece(owner: Player) {
var owner:Player
init {
this.owner = owner
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment