Package controler

Source Code of controler.Othello

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package controler;

//import model.TimerStartTop;
//import model.Ranking;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import model.OthelloGrid;
import view.ChoiceGameView;
import view.GridView;
import view.ListWaitingPlayerView;
import view.LoginView;
/*import view.ClientServerView;
import view.DifficultyView;
import view.LogView;
import view.TypeGameView;
import view.WaitView;*/

/**
*
* @author jul
*/
public class Othello extends MIDlet{

    /* penser à faire un type Enuméré!!!! public enum TYPE_JOUER_SEUL;*/
    public static final int TYPE_JOUER_SEUL = 0;
    public static final int TYPE_JOUER_PLUSIEURS = 1;

    private int _modeJeu;

    private ChoiceGameView _choiceGameView;
    private LoginView _loginView;
    private ListWaitingPlayerView _listWaitingPlayerView;
    private GridView _gridView;

    private OthelloGrid _othelloGrid;

    private Display _display;
   
    public Othello(){
         super();
        _display = Display.getDisplay(this);
        _othelloGrid = new OthelloGrid();
       
        _choiceGameView = new ChoiceGameView(_display, this);
        _loginView = new LoginView(_display, this);
        _listWaitingPlayerView = new ListWaitingPlayerView(_display, this);
        _gridView = new GridView(_display,_othelloGrid, this);
    }

    protected void startApp() throws MIDletStateChangeException {
        _choiceGameView.display();
    }

    protected void pauseApp() {
        // No action
    }

    protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
    }

     /**
     * Affecte le mode de fonctionnement de l'application et défini l'enchainement des vues
     * @param mode : mode de fonctionnement
     */
    public void setModeJeu(int mode) {
        _modeJeu = mode;
        if (_modeJeu == TYPE_JOUER_SEUL) { // Mode Client
            _choiceGameView.setParentAndChild(_choiceGameView, _gridView);
            _gridView.setParentAndChild(_choiceGameView, _gridView);
            /*_listWaitingPlayerView.setParentAndChild(_clientServerView, _DifficultyView);
            _DifficultyView.setParentAndChild(_typeGameView, _sudokuView);
            _sudokuView.setParentAndChild(_DifficultyView, _sudokuView);
            // Vue inutilisées en mode client
            _waitView.setParentAndChild(_waitView, _waitView);
            _logView.setParentAndChild(_logView, _logView);*/

        } else if (_modeJeu == TYPE_JOUER_PLUSIEURS) { // Mode Serveur
            _choiceGameView.setParentAndChild(_choiceGameView, _loginView);
            _loginView.setParentAndChild(_choiceGameView, _listWaitingPlayerView);
            _listWaitingPlayerView.setParentAndChild(_loginView, _gridView);
            _gridView.setParentAndChild(_listWaitingPlayerView, _gridView);
            // Vue inutilisées en mode serveur
           /* _typeGameView.setParentAndChild(_typeGameView, _typeGameView);
            _sudokuView.setParentAndChild(_sudokuView, _sudokuView);
            _logView.setParentAndChild(_logView, _logView);*/
        }
    }

     public void setGrid(int diff) {
        //_grid.setGrid(diff);
        System.out.println("Othello : il faut afficher la liste des joueurs");
    }
}
TOP

Related Classes of controler.Othello

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.