package it.polimi.ingsw.gc14.Controller;

import it.polimi.ingsw.gc14.Model.Game;
import it.polimi.ingsw.gc14.Network.Observer;
import it.polimi.ingsw.gc14.View.IView;

public class ClientController {

    private Game localModel;
    public GameController localController;
    public final IView view;

    public ClientController(IView view,Game localModel) {
        this.view = view;
        this.localModel = localModel;
        this.localController = new GameController(localModel);
    }

    public void setModel(Game model) {
        this.localModel = model;
        localController.setModel(model);
        localModel.addObserver((Observer) view);  // registra la view come observer
    }

    public void onError(String message) {
        view.showError(message);
    }

}
