Example #1
0
 public void RestartGame()
 {
     hasWon    = false;
     isPlaying = true;
     dataController.Initialize();
     curWord = dataController.GetRandomWord();
     displayController.Initialize(curWord);
     curSelections = new string[2];
 }
    private void OnDisplayListReady()
    {
        Preloader.instance.onOperationCompleteCallback = null;
        Preloader.instance.UpdateDisplayList();
        if (Preloader.instance.GetDisplayListLength() > 0)
        {
            loadingScreen.SetActive(false);

            Toggle     toggle = toggleGroup.ActiveToggles().FirstOrDefault();
            GameObject displayContainer;

            if (toggle.name == "ThreeScreensToggle")
            {
                displayContainer = threeScreensDisplayContainer;
                threeScreensDotBackground.SetActive(true);
                oneScreenDotBackground.SetActive(false);
            }
            else
            {
                displayContainer = oneScreenDisplayContainer;
                threeScreensDotBackground.SetActive(false);
                oneScreenDotBackground.SetActive(true);
            }

            PlayerPrefs.SetString(DISPLAY_TYPE_KEY, toggle.name);

            displayContainer.SetActive(true);

            displayController.gameObject.SetActive(true);
            displayController.Initialize(displayContainer);
            gameObject.SetActive(false);
            Cursor.visible = false;
        }
        else
        {
            errorPanel.SetActive(false);
            errorPanel.SetActive(true);
            errorPanel.GetComponentInChildren <Text>().text = "The selected " +
                                                              "screen has no displays.";

            errorPanel.GetComponent <Animator>().SetTrigger("ShowError");

            InvokeRepeating("UpdateScreenList", updateListTimer, updateListTimer);
        }
    }