added clickDice Action + modelSync

This commit is contained in:
Cedric Beck
2024-12-02 17:11:55 +01:00
parent eb819d4d5e
commit 208261c6bf
3 changed files with 17 additions and 7 deletions

View File

@@ -17,6 +17,7 @@
import pp.mdga.client.board.OutlineControl;
import pp.mdga.client.board.PieceControl;
import pp.mdga.client.gui.CardControl;
import pp.mdga.client.gui.DiceControl;
import pp.mdga.client.view.GameView;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
@@ -93,10 +94,15 @@ public void onAction(String name, boolean isPressed, float tpf) {
}
if(name.equals("Click") && isPressed) {
if (app.getView() instanceof GameView gameView) {
DiceControl diceSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), DiceControl.class);
CardControl cardLayerSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), CardControl.class);
OutlineControl boardSelect = checkHover(app.getCamera(), app.getRootNode(), OutlineControl.class);
if(cardLayerSelect != null) {
if(diceSelect != null) {
app.getModelSynchronize().rolledDice();
gameView.getGuiHandler().hideText();
}
else if(cardLayerSelect != null) {
//cardSelect
if(cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
}
@@ -118,11 +124,11 @@ else if(boardSelect != null) {
}
if(name.equals("Test") &&isPressed){
if(app.getView() instanceof GameView gameView){
gameView.getGuiHandler().rollRankingResult(Color.AIRFORCE, 1);
gameView.getGuiHandler().rollRankingResult(Color.ARMY, 2);
gameView.getGuiHandler().rollRankingResult(Color.NAVY, 3);
gameView.getGuiHandler().rollRankingResult(Color.CYBER, 4);
// gameView.getGuiHandler().rollRankingResult(Color.AIRFORCE, 1);
// gameView.getGuiHandler().rollRankingResult(Color.ARMY, 2);
// gameView.getGuiHandler().rollRankingResult(Color.NAVY, 3);
// gameView.getGuiHandler().rollRankingResult(Color.CYBER, 4);
gameView.getGuiHandler().showDice();
}
}
}

View File

@@ -134,7 +134,7 @@ private ColorRGBA playerColorToColorRGBA(Color color){
void hide(){
ranking = 0;
root.detachAllChildren();
root.detachAllChildren();
}
float paddingRanked = 100;
@@ -149,5 +149,8 @@ void rollRankingResultOwn(Color color, int eye){
ranking++;
}
void diceNow(){
createTopText("Klicke zum Würfeln", 5, 80, ColorRGBA.White, 0);
}
}

View File

@@ -67,6 +67,7 @@ public void showRolledDice(int rollNum, Color color) {
public void showDice() {
cardLayerHandler.showDice();
actionTextHandler.diceNow();
}
public void hideDice() {