コード例 #1
0
 IEnumerator _WaitForCameraLock(uint focusedPlanetInex)
 {
     while (!mainCamera.IsCurrentPhase(CameraScript.Phase.PlanetLock))// IsCurrentPhasePlanetLock())
     {
         yield return(new WaitForSeconds(0.01f));
     }
     foreach (GameObject infoPanel in planetInfoPanels)
     {
         if (infoPanel.transform.GetComponent <PlanetInfoScript>().GetIndex() == focusedPlanetInex)
         {
             infoPanel.SetActive(true);
         }
         else
         {
             infoPanel.SetActive(false);
         }
     }
     currentPhase = UI_Phase.PlanetInfo;
     if (saveManager.IsPlanetDone((int)focusedPlanetInex, (int)DificultySwitcherScript.GetChosenDifficulty()))
     {
         planetIsDoneText.SetActive(true);
     }
     btmButton.SetActive(true);
     solveButton.SetActive(true);
     yield break;
 }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
    IEnumerator _WaitForCameraLock(uint focusedPlanetInex)
    {
        while (!mainCamera.IsCurrentPhase(CameraScript.Phase.PlanetLock))// IsCurrentPhasePlanetLock())
        {
            yield return(new WaitForSeconds(0.01f));
        }

        planetInfoScreen.style.display = DisplayStyle.Flex;
        var planetInfoText = planetInfoScreen.Q <Label>("info-label");
        var planetInfoName = planetInfoScreen.Q <Label>("name-label");
        var planetInfo     = TextTable.GetLines(IndexToName(focusedPlanetInex), "PlanetInfo");

        planetInfoName.text = planetInfo[0];
        planetInfoText.text = planetInfo[1];
        currentPlanetName   = planetInfo[0];
        if (saveManager.IsPlanetDone((int)focusedPlanetInex, (int)UIManager.GetDifficulty()))
        {
            planetIsDoneText.SetActive(true);
        }
        //foreach (GameObject infoPanel in planetInfoPanels)
        //{
        //    if (infoPanel.transform.GetComponent<PlanetInfoScript>().GetIndex() == focusedPlanetInex)
        //    {
        //        infoPanel.SetActive(true);
        //    }
        //    else
        //    {
        //        infoPanel.SetActive(false);
        //    }
        //}
        currentPhase = UI_Phase.PlanetInfo;
        //btmButton.SetActive(true);
        //solveButton.SetActive(true);
        yield break;
    }
コード例 #3
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
 IEnumerator _WaitForCameraSettingsPhase()
 {
     while (!mainCamera.IsCurrentPhase(CameraScript.Phase.Settings))// IsCurrentPhaseMenu())
     {
         yield return(new WaitForSeconds(0.01f));
     }
     currentPhase = UI_Phase.Settings;
     //settingsMenu.SetActive(true);
     yield break;
 }
コード例 #4
0
    // Start is called before the first frame update
    void Start()
    {
        tutorial                = GameObject.Find("Tutorial").GetComponent <TutorialScript>();
        loadGameScene           = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <LoadGameScene>();
        titleText               = GameObject.Find("3dPuzzleText");
        playButton              = GameObject.Find("PlayButton");
        settingsButton          = GameObject.Find("SettingsButton");
        settingsMenu            = GameObject.Find("SettingsMenu");
        htpButton               = GameObject.Find("HowToPlayButton");
        exitButton              = GameObject.Find("ExitButton");
        btmButton               = GameObject.Find("BackToMenuButton");
        solveButton             = GameObject.Find("SolveButton");
        planetNameInGame        = GameObject.Find("PlanetNameInGame");
        planetIsDoneText        = GameObject.Find("PlanetIsDoneText");
        pauseMenuBG             = GameObject.Find("PauseMenuBG");
        pauseMenuCanvas         = GameObject.Find("PauseMenuCanvas");
        pauseSettingsButton     = GameObject.Find("PauseSettingsButton");
        pauseMainMenuButton     = GameObject.Find("PauseMainMenuButton");
        dificultySwitcherScript = GameObject.Find("DificultySwitch").GetComponent <DificultySwitcherScript>();
        saveManager             = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <SaveManager>();
        tutorialCompleteText    = GameObject.Find("TutorialCompleteText");
        //difButtons[0] = GameObject.Find("NextDifButton");
        //difButtons[1] = GameObject.Find("PrevDifButton");
        settingsSwitcher = settingsMenu.GetComponent <ConfirmSettingsScript>();
        //playButton.GetComponent<Button>().onClick.AddListener(PlayTask);
        settingsButton.GetComponent <Button>().onClick.AddListener(SettingsTask);
        //btmButton.GetComponent<Button>().onClick.AddListener(BackTask);
        //exitButton.GetComponent<Button>().onClick.AddListener(ExitTask);
        //htpButton.GetComponent<Button>().onClick.AddListener(HowToPlayTask);
        //solveButton.GetComponent<Button>().onClick.AddListener(SolveTask);
        //pauseSettingsButton.GetComponent<Button>().onClick.AddListener(SettingFromPauseTask);
        //pauseMainMenuButton.GetComponent<Button>().onClick.AddListener(MainMenuButtonTask);
        tapController = GameObject.Find("Controller").GetComponent <TapController>();

        btmButton.SetActive(false);
        solveButton.SetActive(false);
        settingsMenu.SetActive(false);
        planetNameInGame.SetActive(false);
        pauseMenuBG.SetActive(false);
        pauseMenuCanvas.SetActive(false);
        planetIsDoneText.SetActive(false);
        solarSystem = GameObject.FindGameObjectWithTag("Sun").GetComponent <SolarSystem>();
        mainCamera  = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>();

        planetInfoPanels = GameObject.FindGameObjectsWithTag("InfoPanel");
        foreach (GameObject infoPanel in planetInfoPanels)
        {
            infoPanel.SetActive(false);
        }

        currentPhase = UI_Phase.MainMenu;
    }
コード例 #5
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
 IEnumerator _WaitForCameraMenuPhase()
 {
     while (!mainCamera.IsCurrentPhase(CameraScript.Phase.Menu))// IsCurrentPhaseMenu())
     {
         yield return(new WaitForSeconds(0.01f));
     }
     //titleText.SetActive(true);
     //playButton.SetActive(true);
     //settingsButton.SetActive(true);
     //htpButton.SetActive(true);
     //exitButton.SetActive(true);
     currentPhase = UI_Phase.MainMenu;
     yield break;
 }
コード例 #6
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
 void _CheckoutToSolarSystemPhase()
 {
     mainCamera.GoFree();
     planetClickSubscription = tapController.SubscribeToTap(TapController.Tap.Tap,
                                                            (GameObject target) =>
     {
         if (currentPhase == UI_Phase.SolarSystem && target != null && target.tag == "Planet")
         {
             lastActiveInfoPanel = target.GetComponent <PlanetScript>().GetIndex();
             StartCoroutine(_WaitForCameraLock(lastActiveInfoPanel));
             loadGameScene.StopWaitingForPlanetClick();
         }
     });
     currentPhase = UI_Phase.SolarSystem;
 }
コード例 #7
0
 void SolveTask()
 {
     currentPhase = UI_Phase.Puzzle;
     mainCamera.EnablePuzzleLock(true);
     planetNameInGame.SetActive(true);
     planetNameInGame.GetComponent <TextMeshProUGUI>().text = IndexToName(loadGameScene.planetType);
     foreach (GameObject infoPanel in planetInfoPanels)
     {
         infoPanel.SetActive(false);
     }
     solveButton.SetActive(false);
     planetIsDoneText.SetActive(false);
     loadGameScene.LoadScene();
     loadGameScene.StopWaitingForPlanetClick();
 }
コード例 #8
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
    void PlayTask()
    {
        if (saveManager.IsTutorialDone() == false)
        {
            tutorial.EnableTutorial();
        }
        currentPhase = UI_Phase.SolarSystem;
        mainMenuScreen.style.display   = DisplayStyle.None;
        backButtonScreen.style.display = DisplayStyle.Flex;
        loadGameScene.StartWaitingForPlanetClick();
        solarSystem.EnableSolarSystemPhase(true);

        //GesturesController.RecogniseDoubleTouchGesturesAs_PinchSpread();

        _CheckoutToSolarSystemPhase();
    }
コード例 #9
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
    void SolveTask()
    {
        currentPhase = UI_Phase.Puzzle;
        mainCamera.EnablePuzzleLock(true);
        planetInfoScreen.style.display = DisplayStyle.None;
        var planetName = backButtonScreen.Q <Label>("name-label");

        planetName.style.display = DisplayStyle.Flex;
        planetName.text          = currentPlanetName;
        planetIsDoneText.SetActive(false);
        //planetNameInGame.SetActive(true);
        // planetNameInGame.GetComponent<TextMeshProUGUI>().text = IndexToName(loadGameScene.planetType);

        //GesturesController.RecogniseDoubleTouchGesturesAs_Shuffle();

        loadGameScene.LoadScene();
        loadGameScene.StopWaitingForPlanetClick();
    }
コード例 #10
0
 public void GoToMainMenu()
 {
     Destroy(GameObject.Find("AreYouSurePanel(Clone)"));
     planetNameInGame.SetActive(false);
     Time.timeScale = 1;
     isOnPause      = false;
     mainCamera.EnablePuzzleLock(false);
     currentPhase = UI_Phase.PlanetInfo;
     StartCoroutine(_WaitForCameraLock(lastActiveInfoPanel));
     solveButton.SetActive(true);
     dificultySwitcherScript.nextButton.GetComponent <Button>().interactable = true;
     dificultySwitcherScript.prevButton.GetComponent <Button>().interactable = true;
     pauseMenuBG.SetActive(false);
     settingsMenu.SetActive(false);
     pauseMenuCanvas.SetActive(false);
     loadGameScene.UnloadScene();
     BackTask();
     BackTask();
 }
コード例 #11
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
    void AgreeTask()
    {
        //planetNameInGame.SetActive(false);
        Time.timeScale = 1;
        isOnPause      = false;
        mainCamera.EnablePuzzleLock(false);
        currentPhase = UI_Phase.PlanetInfo;
        StartCoroutine(_WaitForCameraLock(lastActiveInfoPanel));
        areYouSureScreen.style.display = DisplayStyle.None;
        pauseScreen.style.display      = DisplayStyle.None;
        var planetName = backButtonScreen.Q <Label>("name-label");

        planetName.style.display = DisplayStyle.None;
        //solveButton.SetActive(true);
        //dificultySwitcherScript.nextButton.GetComponent<Button>().interactable = true;
        //dificultySwitcherScript.prevButton.GetComponent<Button>().interactable = true;
        //pauseMenuBG.SetActive(false);
        //settingsMenu.SetActive(false);
        //pauseMenuCanvas.SetActive(false);
        loadGameScene.UnloadScene();
        BackTask();
        BackTask();
    }
コード例 #12
0
ファイル: UIManager.cs プロジェクト: LittleMoon215/3DPuzzle
    void BackTask()
    {
        Debug.Log("Back clicked");
        if (TutorialScript.IsTutorialEnabled())
        {
            currentPhase = UI_Phase.SolarSystem;
            planetInfoScreen.style.display = DisplayStyle.None;
            var planetName = backButtonScreen.Q <Label>("name-label");
            planetName.style.display = DisplayStyle.None;
            loadGameScene.UnloadScene();
            planetIsDoneText.SetActive(false);
            //foreach (GameObject infoPanel in planetInfoPanels)
            //{
            //    infoPanel.SetActive(false);
            //}
            //solveButton.SetActive(false);
        }
        switch (currentPhase)
        {
        case UI_Phase.SolarSystem:
            backButtonScreen.style.display = DisplayStyle.None;
            mainMenuScreen.style.display   = DisplayStyle.Flex;
            currentPhase = UI_Phase.MainMenu;
            StartCoroutine(_WaitForCameraMenuPhase());
            ////btmButton.SetActive(false);
            //solarSystem.EnableSolarSystemPhase(false);
            mainCamera.GoMenu();
            tutorial.DisableTutorial();
            loadGameScene.StopWaitingForPlanetClick();

            break;

        case UI_Phase.PlanetInfo:
            mainCamera.GoFree();
            loadGameScene.StartWaitingForPlanetClick();
            currentPhase = UI_Phase.SolarSystem;
            planetInfoScreen.style.display = DisplayStyle.None;
            planetIsDoneText.SetActive(false);
            //foreach (GameObject infoPanel in planetInfoPanels)
            //{
            //    infoPanel.SetActive(false);
            //}
            //solveButton.SetActive(false);
            break;

        case UI_Phase.Puzzle:
            //pauseMenuCanvas.SetActive(true);
            //dificultySwitcherScript.nextButton.GetComponent<Button>().interactable = false;
            //dificultySwitcherScript.prevButton.GetComponent<Button>().interactable = false;
            pauseScreen.style.display      = DisplayStyle.Flex;
            backButtonScreen.style.display = DisplayStyle.None;
            currentPhase   = UI_Phase.Pause;
            Time.timeScale = 0;
            isOnPause      = true;
            //pauseMenuBG.SetActive(true);
            break;

        case UI_Phase.Settings:
            StartCoroutine(_WaitForCameraMenuPhase());
            //settingsSwitcher.ResetSwitchers();
            //btmButton.SetActive(false);
            //settingsMenu.SetActive(false);
            mainCamera.GoMenu();
            break;

        case UI_Phase.Pause:
            Time.timeScale                 = 1;
            currentPhase                   = UI_Phase.Puzzle;
            pauseScreen.style.display      = DisplayStyle.None;
            backButtonScreen.style.display = DisplayStyle.Flex;
            //dificultySwitcherScript.nextButton.GetComponent<Button>().interactable = true;
            //dificultySwitcherScript.prevButton.GetComponent<Button>().interactable = true;
            //pauseMenuBG.SetActive(false);
            //pauseMenuCanvas.SetActive(false);
            isOnPause = false;
            break;

        case UI_Phase.PauseSettings:
            currentPhase = UI_Phase.Pause;

            //settingsMenu.SetActive(false);
            //pauseMenuCanvas.SetActive(true);
            break;
        }
    }
コード例 #13
0
 void SettingFromPauseTask()
 {
     settingsMenu.SetActive(true);
     pauseMenuCanvas.SetActive(false);
     currentPhase = UI_Phase.PauseSettings;
 }
コード例 #14
0
    void BackTask()
    {
        Debug.Log("Back clicked");
        if (TutorialScript.IsTutorialEnabled())
        {
            currentPhase = UI_Phase.SolarSystem;
            foreach (GameObject infoPanel in planetInfoPanels)
            {
                infoPanel.SetActive(false);
            }
            solveButton.SetActive(false);
        }
        switch (currentPhase)
        {
        case UI_Phase.SolarSystem:
            StartCoroutine(_WaitForCameraMenuPhase());
            btmButton.SetActive(false);
            solarSystem.EnableSolarSystemPhase(false);
            mainCamera.GoMenu();
            tutorial.DisableTutorial();
            loadGameScene.StopWaitingForPlanetClick();
            break;

        case UI_Phase.PlanetInfo:
            mainCamera.GoFree();
            loadGameScene.StartWaitingForPlanetClick();
            currentPhase = UI_Phase.SolarSystem;
            foreach (GameObject infoPanel in planetInfoPanels)
            {
                infoPanel.SetActive(false);
            }
            solveButton.SetActive(false);
            planetIsDoneText.SetActive(false);
            break;

        case UI_Phase.Puzzle:
            //settingsMenu.SetActive(true);
            pauseMenuCanvas.SetActive(true);
            dificultySwitcherScript.nextButton.GetComponent <Button>().interactable = false;
            dificultySwitcherScript.prevButton.GetComponent <Button>().interactable = false;
            currentPhase   = UI_Phase.Pause;
            Time.timeScale = 0;
            isOnPause      = true;
            tutorialCompleteText.SetActive(false);
            pauseMenuBG.SetActive(true);
            break;

        case UI_Phase.Settings:
            StartCoroutine(_WaitForCameraMenuPhase());
            settingsSwitcher.ResetSwitchers();
            btmButton.SetActive(false);
            settingsMenu.SetActive(false);
            mainCamera.GoMenu();
            break;

        case UI_Phase.Pause:
            Time.timeScale = 1;
            //mainCamera.EnablePuzzleLock(false);
            currentPhase = UI_Phase.Puzzle;
            //StartCoroutine(_WaitForCameraLock(lastActiveInfoPanel));
            //solveButton.SetActive(true);
            dificultySwitcherScript.nextButton.GetComponent <Button>().interactable = true;
            dificultySwitcherScript.prevButton.GetComponent <Button>().interactable = true;
            pauseMenuBG.SetActive(false);
            //settingsMenu.SetActive(false);
            pauseMenuCanvas.SetActive(false);
            isOnPause = false;


            break;

        case UI_Phase.PauseSettings:
            currentPhase = UI_Phase.Pause;
            settingsMenu.SetActive(false);
            pauseMenuCanvas.SetActive(true);
            break;
        }
    }