Exemplo n.º 1
0
    IEnumerator ShowPage0()
    {
        // Creates a yield instruction to wait for a given number of seconds
        // http://docs.unity3d.com/400/Documentation/ScriptReference/WaitForSeconds.WaitForSeconds.html
        yield return(new WaitForSeconds(0.5f));

        foreach (Transform child in m_Page0.transform)
        {
            GAui pGAui = child.gameObject.GetComponent <GAui>();
            if (pGAui != null)
            {
                pGAui.m_ScaleIn.Delay = Random.Range(0.0f, 1.0f);
                pGAui.m_ScaleIn.Time  = Random.Range(0.5f, 1.5f);

                // Play MoveIn animation
                pGAui.MoveIn();
            }
        }

        // Play MoveIn animation
        m_Page1.MoveIn(GUIAnimSystem.eGUIMove.Children);

        // Play particles in the hierarchy of given transfrom
        GSui.Instance.PlayParticle(m_Page0.transform);

        // Update Loading progress bar.
        StartCoroutine(ShowBottomScreenButtons());
    }
Exemplo n.º 2
0
    IEnumerator HideMSG(GAui pGUIANimFREE)
    {
        // Creates a yield instruction to wait for a given number of seconds
        // http://docs.unity3d.com/400/Documentation/ScriptReference/WaitForSeconds.WaitForSeconds.html
        yield return(new WaitForSeconds(2.5f));

        if (pGUIANimFREE.gameObject.activeSelf == false)
        {
            pGUIANimFREE.gameObject.SetActive(true);
        }

        // Play Move Out animation
        pGUIANimFREE.MoveOut();

        // Stop particles in the hierarchy of given transfrom
        GSui.Instance.StopParticle(pGUIANimFREE.transform);

        // Enable GraphicRaycasters of Canvas in m_Gameplay
        // http://docs.unity3d.com/Manual/script-GraphicRaycaster.html
        GSui.Instance.SetGraphicRaycasterEnable(m_Gameplay, true);

        // Creates a yield instruction to wait for a given number of seconds
        // http://docs.unity3d.com/400/Documentation/ScriptReference/WaitForSeconds.WaitForSeconds.html
        yield return(new WaitForSeconds(1.5f));

        // Play MoveIn animation
        GSui.Instance.MoveIn(m_PanelForButtons.transform, true);
    }
Exemplo n.º 3
0
    IEnumerator ShowMSG(GAui pGUIANimFREE)
    {
        // Disable GraphicRaycasters of Canvas in m_Gameplay
        // http://docs.unity3d.com/Manual/script-GraphicRaycaster.html
        GSui.Instance.SetGraphicRaycasterEnable(m_Gameplay, false);

        // Creates a yield instruction to wait for a given number of seconds
        // http://docs.unity3d.com/400/Documentation/ScriptReference/WaitForSeconds.WaitForSeconds.html
        yield return(new WaitForSeconds(0.5f));

        if (pGUIANimFREE.gameObject.activeSelf == false)
        {
            pGUIANimFREE.gameObject.SetActive(true);
        }

        // Reset all animations' information of before replay
        pGUIANimFREE.Reset();

        // Play MoveIn animation
        pGUIANimFREE.MoveIn();

        // Play particles in the hierarchy of given transfrom
        GSui.Instance.PlayParticle(pGUIANimFREE.transform);

        // Creates a yield instruction to wait for a given number of seconds
        // http://docs.unity3d.com/400/Documentation/ScriptReference/WaitForSeconds.WaitForSeconds.html
        yield return(new WaitForSeconds(0.5f));

        StartCoroutine(HideMSG(pGUIANimFREE));
    }
        // ########################################
        // MonoBehaviour Functions
        // http://docs.unity3d.com/ScriptReference/MonoBehaviour.html
        // ########################################

        #region MonoBehaviour

        // Awake is called when the script instance is being loaded.
        // http://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html
        void Awake()
        {
            if (enabled)
            {
                // Disable auto-animation and let this script controls all GAui elements in the scene.
                GSui.Instance.m_AutoAnimation = false;

                // Get GAui component
                m_GAui = this.gameObject.GetComponent <GAui>();
                if (m_GAui == null)
                {
                    // Set up new GAui component
                    m_GAui = this.gameObject.AddComponent <GAui>();

                    // Add PlayInAnimsStarted Eventhandler
                    m_GAui.PlayInAnimsStarted.AddListener(PlayInAnimsStarted);

                    // Add PlayInAnimsFinished Eventhandler
                    m_GAui.PlayInAnimsFinished.AddListener(PlayInAnimsFinished);
                }
            }
        }
    // Use this for initialization
    void Start()
    {
#if UNITY_IPHONE
        if (UnityEngine.iOS.Device.generation == UnityEngine.iOS.DeviceGeneration.iPhoneX)
        {
            iphoneXCanvas.SetActive(true);
            iphoneCanvas.SetActive(false);
            // GameObject ratiFitter = iphoneXCanvas.transform.Find("RatioFitter").gameObject;

            ansButtons      = ansButtonsX;
            stars           = starX;
            starParticles   = starParticleX;
            bannImage       = bannImgeX;
            continueWindow  = continueWindowX;
            black           = blackX;
            readyImg        = readyImgX;
            trophiImage     = trophyImgX;
            trophyCountText = trophyCountX;
        }
        else
        {
            iphoneCanvas.SetActive(true);
            iphoneXCanvas.SetActive(false);
            // GameObject ratiFitter = iphoneCanvas.transform.Find("RatioFitter").gameObject;
        }
#else
        iphoneCanvas.SetActive(true);
        iphoneXCanvas.SetActive(false);

        // GameObject ratiFitter = iphoneXCanvas.transform.Find("RatioFitter").gameObject;
#endif


        trophyCountText.text = PlayerPrefs.GetInt("LPL_TrophyCount", 0).ToString();
        trophyCount          = PlayerPrefs.GetInt("LPL_TrophyCount", 0);

        black.SetActive(false);

        qIndex = 0;

        // Set value
        for (int i = 0; i < arr.Length; i++)
        {
            arr[i] = i;
        }

        int temp;

        // Shuffle the arrays
        for (int i = 0; i < arr.Length; i++)
        {
            int ran = Random.Range(0, arr.Length);

            temp     = arr[ran];
            arr[ran] = arr[i];
            arr[i]   = temp;
        }

        // Parse the sentence
        string str = sentenceFile.text;
        rawSentences = str.Split('\n');

        // Referesh the sentences list.
        RefershScentencesList();

        // Stop music
        GameObject o = GameObject.Find("MusicPlayer");
        if (o != null)
        {
            if (!o.GetComponent <AudioSource>().isPlaying)
            {
                // o.GetComponent<AudioSource>().Play();
                bannImage.SetActive(true);
            }
            else
            {
                bannImage.SetActive(false);
            }
        }

        // If all done, Start asking questions
        StartCoroutine(ShowQuestions());
    }