Esempio n. 1
0
    /// <summary>
    /// Callback for when the exit game button is pressed.
    /// </summary>
    public void OnExitGameButtonPressed()
    {
        OpenPopup <PopupTwoButtons>("PopupTwoButtons", popup =>
        {
            popup.text.text        = "ゲームを終了しますか?";
            popup.buttonText.text  = "はい";
            popup.button2Text.text = "いいえ";


            popup.button.onClickEvent.AddListener(() =>
            {
                if (NetworkingUtils.GetLocalPlayer().isServer)
                {
                    GameNetworkManager.Instance.StopHost();
                }
                else
                {
                    GameNetworkManager.Instance.StopClient();
                }

                //追記

                SceneManager.LoadScene("Home");
            });


            popup.button2.onClickEvent.AddListener(() => { popup.Close(); });
        });
    }
    public override void OnEndGame(EndGameMessage msg)
    {
        base.OnEndGame(msg);

        var scene = GameObject.Find("GameScene").GetComponent <GameScene>();

        scene.OpenPopup <PopupOneButton>("PopupOneButton", popup =>
        {
            if (msg.winnerPlayerIndex == playerInfo.netId)
            {
                popup.gameObject.GetComponent <SortingGroup>().sortingLayerName = "HandCards";
                popup.gameObject.GetComponent <SortingGroup>().sortingOrder     = 2500;
                popup.text.text = "You win!";
            }
            else
            {
                popup.gameObject.GetComponent <SortingGroup>().sortingLayerName = "BoardCards";
                popup.gameObject.GetComponent <SortingGroup>().sortingOrder     = 2500;
                popup.text.text = "You lose!";
            }
            popup.buttonText.text = "Exit";
            popup.button.onClickEvent.AddListener(() =>
            {
                if (NetworkingUtils.GetLocalPlayer().isServer)
                {
                    NetworkManager.singleton.StopHost();
                }
                else
                {
                    NetworkManager.singleton.StopClient();
                }
            });
        });
    }
Esempio n. 3
0
    /// <summary>
    /// Callback for when the end turn button is pressed.
    /// </summary>
    public void OnEndTurnButtonPressed()
    {
        var localPlayer = NetworkingUtils.GetLocalPlayer() as DemoHumanPlayer;

        if (localPlayer != null)
        {
            //var maxHandSize = GameManager.Instance.Config.properties.maxHandSize;

            /*if (localPlayer.HandSize > maxHandSize)
             * {
             *  var diff = localPlayer.HandSize - maxHandSize;
             *  if (diff == 1)
             *      WindowUtils.OpenAlertDialog("You need to discard " + diff + " card from your hand.");
             *  else
             *      WindowUtils.OpenAlertDialog("You need to discard " + diff + " cards from your hand.");
             * }*/
            localPlayer.StopTurn();
        }
    }
Esempio n. 4
0
 /// <summary>
 /// Callback for when the exit game button is pressed.
 /// </summary>
 public void OnExitGameButtonPressed()
 {
     OpenPopup <PopupTwoButtons>("PopupTwoButtons", popup =>
     {
         popup.text.text        = "Do you want to leave this game?";
         popup.buttonText.text  = "Yes";
         popup.button2Text.text = "No";
         popup.button.onClickEvent.AddListener(() =>
         {
             if (NetworkingUtils.GetLocalPlayer().isServer)
             {
                 GameNetworkManager.Instance.StopHost();
             }
             else
             {
                 GameNetworkManager.Instance.StopClient();
             }
         });
         popup.button2.onClickEvent.AddListener(() => { popup.Close(); });
     });
 }
Esempio n. 5
0
    public override void OnEndGame(EndGameMessage msg)
    {
        base.OnEndGame(msg);

        var scene = GameObject.Find("GameScene").GetComponent <GameScene>();

        scene.OpenPopup <PopupOneButton>("PopupOneButton", popup =>
        {
            if (msg.winnerPlayerIndex == playerInfo.netId)
            {
                popup.text.text = "人生の勝利者";
            }
            else
            {
                popup.text.text = "負け犬";
            }
            popup.buttonText.text = "閉じる";
            popup.button.onClickEvent.AddListener(() =>
            {
                if (NetworkingUtils.GetLocalPlayer().isServer)
                {
                    NetworkManager.singleton.StopHost();
                }
                else
                {
                    NetworkManager.singleton.StopClient();
                }

                //追記
                SceneManager.LoadScene("Home");
            }



                                                  );
        });
    }