Ejemplo n.º 1
0
    private void OnGameStateChanged(GameState previousState, GameState newState)
    {
        if (newState == GameState.ended)
        {
            LanguageController language = SettingsController.instance.languageController;

            Player winner = GetWinner();
            string message;
            if (winner != null)
            {
                if (winner.NetworkPlayer.IsLocal)
                {
                    message = language.GetWord("YOU_WON_GAME");
                }
                else
                {
                    message = language.GetWord("GAME_ENDED") + " " + language.GetWord("WINNER_IS") + winner.GetName();
                }
            }
            else
            {
                message = language.GetWord("GAME_ENDED");
            }

            QuestionPopup endGame = QuestionPopup.CreateOkDialog(message, delegate { menu.QuitGame(); });
            PopupSystem.instance.AddPopup(endGame);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Wyświetla stosowne komunikaty przy wowołaniu eventu przegranej gracza
    /// </summary>
    /// <param name="playerName">Gracz, który przegrał grę</param>
    private void OnPlayerLostGame(string playerName)
    {
        Player             player   = session.FindPlayer(playerName);
        LanguageController language = SettingsController.instance.languageController;

        if (player == null)
        {
            return;
        }

        //Gracz, który przegrał, jest graczem lokalnym
        if (player.NetworkPlayer.IsLocal)
        {
            string        message        = language.GetWord("YOU_LOST_THE_GAME");
            QuestionPopup playerLostGame = QuestionPopup.CreateOkDialog(message);

            PopupSystem.instance.AddPopup(playerLostGame);
        }
        else
        {
            string    message        = language.GetWord("PLAYER") + playerName + language.GetWord("LOST_THE_GAME");
            IconPopup playerLostGame = new IconPopup(IconPopupType.PlayerLost, message);

            PopupSystem.instance.AddPopup(playerLostGame);
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Inicjowanie popup-u typu Icon
    /// </summary>
    /// <param name="iconType">Typ ikony do wyświetlania</param>
    /// <param name="closeMode">Tryb automatycznego zamknięcia popupu</param>
    /// <param name="message">Wiadomość do wyświetlenia w QuestionPopupie po kliknięciu IconPopup-u</param>
    public IconPopup(IconPopupType iconType, string message, AutoCloseMode closeMode = AutoCloseMode.NewAppears)
        : base(closeMode)
    {
        this.iconType = iconType;
        onClick       = Functionality.Destroy();

        QuestionPopup toShow = QuestionPopup.CreateOkDialog(message);

        onClose += Functionality.Show(toShow);
    }
Ejemplo n.º 4
0
    protected void ShowPayPopup(Player player, PlaceVisualiser visualiser, float cost)
    {
        LanguageController language = SettingsController.instance.languageController;
        Player             owner    = GameplayController.instance.board.GetOwner(visualiser.placeIndex);
        //Wiadomość o konieczności zapłaty
        string message = language.GetWord("YOU_MUST_PAY") + owner.GetName() + language.GetWord("FOR_STAY_ON_PLACE") + "\n" + language.GetWord("COST") + cost;

        Popup.PopupAction onOk = delegate(Popup source)
        {
            GameplayController.instance.banking.Pay(player, owner, cost);
        };

        QuestionPopup payPopup = QuestionPopup.CreateOkDialog(message, onOk);

        PopupSystem.instance.AddPopup(payPopup);
    }
Ejemplo n.º 5
0
    public override void OnAwake(Player player, PlaceVisualiser visualiser)
    {
        if (player.NetworkPlayer.IsLocal && player.Imprisoned)
        {
            Board board = GameplayController.instance.board;
            LanguageController language = SettingsController.instance.languageController;
            FlowController     flow     = GameplayController.instance.flow;
            flow.Pause();

            QuestionPopup startTurn = QuestionPopup.CreateOkDialog(language.GetWord("YOU_ARE_IN_PRISON"));
            flow.CloseOnDiceClose(startTurn);

            Popup.PopupAction diceRoll = delegate(Popup source)
            {
                if (freeingThrows.Contains(board.dice.rollResult))
                {
                    QuestionPopup free = QuestionPopup.CreateOkDialog(language.GetWord("YOU_ARE_FREE"));
                    GameplayController.instance.flow.RollResult().Invoke(source);
                    player.Imprisoned = false;
                    PopupSystem.instance.AddPopup(free);
                }
                else
                {
                    QuestionPopup noFree = QuestionPopup.CreateOkDialog(language.GetWord("NOT_THIS_TIME"));
                    GameplayController.instance.diceController.Roll(board.dice.rollResult.Roll1, board.dice.rollResult.Roll2);
                    PopupSystem.instance.AddPopup(noFree);
                    flow.RewindToSkiping();
                }
            };

            startTurn.onClose += delegate { PopupSystem.instance.ShowDice(diceRoll); };

            PopupSystem.instance.AddPopup(startTurn);
        }
        else
        {
            base.OnAwake(player, visualiser);
        }
    }