示例#1
0
    /**
     * Appeler sur server
     * */
    private void chooseFirstPlayer()
    {
        if (isServer)
        {
            indexPlayerPlaying = Random.Range(0, listJoueurs.Count);
            nbTurn             = 0;
            phase = DEBUT_TOUR;

            phase++;

            this.idJoueurTour = listJoueurs [indexPlayerPlaying].netIdJoueur;
            GameObject goBtn = NetworkServer.FindLocalObject(listJoueurs [indexPlayerPlaying].netIdBtnTour);

            if (null != goBtn && null != goBtn.GetComponent <BoutonTour> ())
            {
                BoutonTour boutonTour = goBtn.GetComponent <BoutonTour> ();
                boutonTour.setEtatBoutonServer(BoutonTour.enumEtatBouton.terminerTour);
            }
        }
    }
示例#2
0
    public void progressStepServer(int actionPlayer)
    {
        if (isServer)
        {
            if (actionPlayer == PHASE_ATTAQUE)
            {
                phase = PHASE_ATTAQUE;

                GameObject goBtnLastPlayer = NetworkServer.FindLocalObject(listJoueurs [indexPlayerPlaying].netIdBtnTour);
                if (null != goBtnLastPlayer && null != goBtnLastPlayer.GetComponent <BoutonTour> ())
                {
                    BoutonTour boutonTour = goBtnLastPlayer.GetComponent <BoutonTour> ();
                    boutonTour.setEtatBoutonServer(BoutonTour.enumEtatBouton.terminerTour);
                }

                List <CarteConstructionMetierAbstract> listAttaquant = CarteUtils.getListCarteCapableAttaque(listJoueurs [indexPlayerPlaying].netIdJoueur);
                foreach (CarteConstructionMetierAbstract attaquant in listAttaquant)
                {
                    attaquant.RpcSetEtatSelectionPlayer(listJoueurs [indexPlayerPlaying].netIdJoueur, SelectionnableUtils.ETAT_HIGH_LIGHT);
                }
            }
            else if (actionPlayer == FIN_TOUR)
            {
                Joueur joueurTour = JoueurUtils.getJoueur(listJoueurs [indexPlayerPlaying].netIdJoueur);

                int phasePrecedente = phase;

                phase = FIN_TOUR;

                if (phasePrecedente == PHASE_ATTAQUE)
                {
                    ActionEventManager.EventActionManager.CreateTask(NetworkInstanceId.Invalid, joueurTour.netId, -1, ConstanteIdObjet.ID_CONDITION_ACTION_FIN_ATTAQUE, NetworkInstanceId.Invalid, false);
                }
                else
                {
                    ActionEventManager.EventActionManager.CreateTask(NetworkInstanceId.Invalid, joueurTour.netId, -1, ConstanteIdObjet.ID_CONDITION_ACTION_FIN_TOUR, NetworkInstanceId.Invalid, false);
                }
            }
        }
    }
示例#3
0
    public void finTour(Joueur joueurTour)
    {
        GameObject goBtnLastPlayer = NetworkServer.FindLocalObject(listJoueurs [indexPlayerPlaying].netIdBtnTour);

        if (null != goBtnLastPlayer && null != goBtnLastPlayer.GetComponent <BoutonTour> ())
        {
            BoutonTour boutonTour = goBtnLastPlayer.GetComponent <BoutonTour> ();

            if (boutonTour.getEtatBouton() == BoutonTour.enumEtatBouton.terminerTour)
            {
                boutonTour.setEtatBoutonServer(BoutonTour.enumEtatBouton.enAttente);

                CapaciteUtils.endOfTurnOfCapacityPlayer(listJoueurs [indexPlayerPlaying].netIdJoueur);

                bool tourSupJoueur = 0 < CapaciteUtils.valeurAvecCapacite(0, joueurTour.CartePlaneteJoueur.containCapacityOfType(ConstanteIdObjet.ID_CAPACITE_PERTE_TOUR_JEU), ConstanteIdObjet.ID_CAPACITE_PERTE_TOUR_JEU);

                if (!tourSupJoueur)                   //Pas de tour supplementaire

                {
                    if (indexPlayerPlaying < listJoueurs.Count - 1)
                    {
                        indexPlayerPlaying++;
                    }
                    else
                    {
                        indexPlayerPlaying = 0;
                        nbTurn++;
                    }

                    this.idJoueurTour = listJoueurs [indexPlayerPlaying].netIdJoueur;
                    joueurTour        = JoueurUtils.getJoueur(listJoueurs [indexPlayerPlaying].netIdJoueur);
                }

                RpcAffichagePseudo(listJoueurs [indexPlayerPlaying].Pseudo);

                ActionEventManager.EventActionManager.CreateTask(NetworkInstanceId.Invalid, joueurTour.netId, -1, ConstanteIdObjet.ID_CONDITION_ACTION_DEBUT_TOUR, NetworkInstanceId.Invalid, false);
            }
        }
    }
示例#4
0
    public void debutTour(Joueur joueurTour)
    {
        bool perteTour = 0 > CapaciteUtils.valeurAvecCapacite(0, joueurTour.CartePlaneteJoueur.containCapacityOfType(ConstanteIdObjet.ID_CAPACITE_PERTE_TOUR_JEU), ConstanteIdObjet.ID_CAPACITE_PERTE_TOUR_JEU);

        initTour(joueurTour);

        if (perteTour)          //Perte de tour
        {
            progressStepServer(FIN_TOUR);
        }
        else
        {
            phase++;
            GameObject goBtnNewPlayer = NetworkServer.FindLocalObject(listJoueurs [indexPlayerPlaying].netIdBtnTour);

            if (null != goBtnNewPlayer && null != goBtnNewPlayer.GetComponent <BoutonTour> ())
            {
                BoutonTour boutonTour = goBtnNewPlayer.GetComponent <BoutonTour> ();
                boutonTour.setEtatBoutonServer(BoutonTour.enumEtatBouton.terminerTour);
            }
        }
    }