コード例 #1
0
 public void BtnYes()
 {
     if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 1)
     {
         if (NetworkManager.IsConnected())
         {
             NetworkManager.DebugLog("Cannot restart!\n");
         }
         else
         {
             SceneManager.LoadScene("GameScene");
         }
     }
     else if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 2)
     {
         if (NetworkManager.IsConnected())
         {
             NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic();
             networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.QUIT);
         }
         else
         {
             SceneManager.LoadScene("MainMenu");
         }
     }
 }
コード例 #2
0
ファイル: BtnScript.cs プロジェクト: shikang/tictactoe4D
    public void BtnYes()
    {
        if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 1)
        {
            if (NetworkManager.IsConnected())
            {
                NetworkManager.DebugLog("Cannot restart!\n");
            }
            else
            {
                GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().UpdateAnalyticsGameEnd();
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.CLICK);
                }
                BGManager.Instance.partsParent.SetActive(false);
                BackToMainMenu(2, false);
                Adverts.Instance.RandomShowAd();
            }
        }
        else if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 2)
        {
            GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().UpdateAnalyticsGameEnd();
            BGManager.Instance.partsParent.SetActive(false);

            GameObject [] allGUI = GameObject.FindGameObjectsWithTag("GUIManager");
            foreach (GameObject curr in allGUI)
            {
                Destroy(curr);
            }

            if (NetworkManager.IsConnected())
            {
                Defines.TURN turn = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn;
                Debug.Log("ttt: : " + turn);
                if (turn == Defines.TURN.P1 || turn == Defines.TURN.P2 || turn == Defines.TURN.NOTSTARTED)
                {
                    NetworkManager.Disconnect();
                }
                else
                {
                    NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic();
                    networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.QUIT);
                    GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn = Defines.TURN.DISCONNECTED;
                    NetworkManager.Disconnect();
                }
            }

            if (AudioManager.Instance)
            {
                AudioManager.Instance.PlaySoundEvent(SOUNDID.CLICK);
            }
            BGManager.Instance.partsParent.SetActive(false);
            BackToMainMenu(1, false);
            Adverts.Instance.RandomShowAd();
        }
    }
コード例 #3
0
 public void BtnNewGame()
 {
     // New Game
     if (NetworkManager.IsConnected())
     {
         NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic();
         networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.RESTART);
         GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().WaitingForOtherPlayer();
     }
     else
     {
         SceneManager.LoadScene("GameScene");
     }
 }
コード例 #4
0
ファイル: BtnScript.cs プロジェクト: shikang/tictactoe4D
    public void BtnNewGame()
    {
        BGManager.Instance.partsParent.SetActive(false);
        if (AudioManager.Instance)
        {
            AudioManager.Instance.PlaySoundEvent(SOUNDID.BGM);
        }

        // New Game
        if (NetworkManager.IsConnected())
        {
            NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic();
            networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.RESTART);
            GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().WaitingForOtherPlayer();
        }
        else
        {
            SceneManager.LoadScene("GameScene");
        }
        //Adverts.Instance.RandomShowAd();
    }