// Play In-Animations of m_Dialog IEnumerator ShowDialog() { yield return(new WaitForSeconds(1.0f)); // Play In-Animations of m_Dialog m_Dialog.PlayInAnims(); // Enable all scene switch buttons StartCoroutine(EnableAllDemoButtons()); }
// Play In-Animations of all primary buttons IEnumerator MoveInPrimaryButtons() { yield return(new WaitForSeconds(1.0f)); // Play In-Animations of all primary buttons m_TopLeft_A.PlayInAnims(eGUIMove.Self); m_BottomLeft_A.PlayInAnims(eGUIMove.Self); m_RightBar_A.PlayInAnims(eGUIMove.Self); // Enable all scene switch buttons StartCoroutine(EnableAllDemoButtons()); }
// Play In-Animations of dialogs IEnumerator MoveInPrimaryButtons() { yield return(new WaitForSeconds(1.0f)); // Play In-Animations of dialogs m_Dialog1.PlayInAnims(); m_Dialog2.PlayInAnims(); m_Dialog3.PlayInAnims(); m_Dialog4.PlayInAnims(); // Enable all scene switch buttons StartCoroutine(EnableAllDemoButtons()); }
// Play In-Animations of all primary buttons IEnumerator MoveInPrimaryButtons() { yield return(new WaitForSeconds(1.0f)); // Play In-Animations of all primary buttons m_CenterButtons.PlayInAnims(); // Enable all scene switch buttons StartCoroutine(EnableAllDemoButtons()); }
// ######################################## // MoveIn/MoveOut functions // ######################################## #region MoveIn/MoveOut // Play In-Animations of m_Title1 and m_Title2 IEnumerator MoveInTitleGameObjects() { yield return(new WaitForSeconds(1.0f)); // Play In-Animations of m_Title1 and m_Title2 m_Title1.PlayInAnims(eGUIMove.Self); m_Title2.PlayInAnims(eGUIMove.Self); // Play In-Animations of m_Dialog StartCoroutine(ShowDialog()); }
// ######################################## // MoveIn/MoveOut functions // ######################################## #region MoveIn/MoveOut // Move In m_Title1 and m_Title2 IEnumerator MoveInTitleGameObjects() { yield return(new WaitForSeconds(1.0f)); // Move In m_Title1 and m_Title2 m_Title1.PlayInAnims(eGUIMove.Self); m_Title2.PlayInAnims(eGUIMove.Self); // Play In-Animations of dialogs StartCoroutine(MoveInPrimaryButtons()); }
// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time. // http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html void Start() { // Play In-Animations of m_TopBar and m_BottomBar m_TopBar.PlayInAnims(); m_BottomBar.PlayInAnims(); // Play In-Animations of m_Title1 and m_Title2 StartCoroutine(MoveInTitleGameObjects()); // Disable all scene switch buttons // http://docs.unity3d.com/Manual/script-GraphicRaycaster.html GSui.Instance.EnableGraphicRaycaster(m_Canvas, false); }
// Toggle m_Bar4 void ToggleBar4() { m_Bar4_IsOn = !m_Bar4_IsOn; if (m_Bar4_IsOn == true) { // m_Bar4 moves in m_Bar4.PlayInAnims(); } else { // m_Bar4 moves out m_Bar4.PlayOutAnims(); } }
// Toggle m_Button5 void ToggleButton_5() { m_Button5_IsOn = !m_Button5_IsOn; if (m_Button5_IsOn == true) { // Play In-Animations of m_SecondaryButton5 m_SecondaryButton5.PlayInAnims(); } else { // Play Out-Animations of m_SecondaryButton5 m_SecondaryButton5.PlayOutAnims(); } }
// Toggle BottomLeft buttons void ToggleBottomLeft() { m_BottomLeft_IsOn = !m_BottomLeft_IsOn; if (m_BottomLeft_IsOn == true) { // m_BottomLeft_B moves in m_BottomLeft_B.PlayInAnims(); } else { // m_BottomLeft_B moves out m_BottomLeft_B.PlayOutAnims(); } }
// Play In-Animations of all primary buttons IEnumerator MoveInPrimaryButtons() { yield return(new WaitForSeconds(1.0f)); // Play In-Animations of all primary buttons m_PrimaryButton1.PlayInAnims(eGUIMove.Self); m_PrimaryButton2.PlayInAnims(eGUIMove.Self); m_PrimaryButton3.PlayInAnims(eGUIMove.Self); m_PrimaryButton4.PlayInAnims(eGUIMove.Self); m_PrimaryButton5.PlayInAnims(eGUIMove.Self); // Enable all scene switch buttons StartCoroutine(EnableAllDemoButtons()); }
// ######################################## // MoveIn/MoveOut functions // ######################################## #region MoveIn/MoveOut // Move In m_Title1 and m_Title2 IEnumerator MoveInTitleGameObjects() { yield return(new WaitForSeconds(1.0f)); // Move In m_Title1 and m_Title2 m_Title1.PlayInAnims(eGUIMove.Self); m_Title2.PlayInAnims(eGUIMove.Self); // Play In-Animations of dialogs StartCoroutine(MoveInPrimaryButtons()); // Enable all scene switch buttons // http://docs.unity3d.com/Manual/script-GraphicRaycaster.html GSui.Instance.EnableGraphicRaycaster(m_Canvas, true); }
// Toggle RightBar buttons void ToggleRightBar() { m_RightBar_IsOn = !m_RightBar_IsOn; if (m_RightBar_IsOn == true) { // m_RightBar_A moves out m_RightBar_A.PlayOutAnims(); // m_RightBar_B moves in m_RightBar_B.PlayInAnims(); } else { // m_RightBar_A moves in m_RightBar_A.PlayInAnims(); // m_RightBar_B moves out m_RightBar_B.PlayOutAnims(); } }
// Play Animations void Play() { // Random Time and Delay float Time = UnityEngine.Random.Range(m_MinRandomTime, m_MinRandomTime + 2); float Delay = UnityEngine.Random.Range(m_MinRandomDelay, m_MinRandomDelay + 0.5f); // Reset m_Title and m_Details strings m_Title = ""; m_Details = ""; // Random Ease type eEaseType EaseType = (eEaseType)UnityEngine.Random.Range(0, 22); // Translation checkbox is enable if (m_Translation == true) { // Get parent Canvas space float LeftEdge = 0, TopEdge = 0, RightEdge = 0, BottomEdge = 0; m_GAui.GetParentCanvasEdges(out LeftEdge, out TopEdge, out RightEdge, out BottomEdge); // Random Easing for Translation if m_UseSameEasing is disabled if (m_UseSameEasing == false) { EaseType = (eEaseType)UnityEngine.Random.Range(0, 22); } // Update Text UI m_Title += "Translation:\r\n"; m_Details += EaseType.ToString() + "\r\n"; // Setup begin and end position RectTransform RT = (RectTransform)m_GAui.transform; Vector3 Begin = new Vector3(RT.localPosition.x, RT.localPosition.y, 0); float NewEndX = 0; Bounds TotalBounds = m_GAui.GetTotalBounds(); if (RT.localPosition.x > 0) { NewEndX = LeftEdge + (TotalBounds.size.x * 2); } else { NewEndX = RightEdge - (TotalBounds.size.x * 2); } Vector3 End = new Vector3( NewEndX, UnityEngine.Random.Range(BottomEdge + TotalBounds.size.y * 2, TopEdge - TotalBounds.size.y * 2), 0); // Set MoveIn, we will call PlayInAnims() later m_GAui.SetInAnimsMove(true, ePosMove.RectTransformPosition, Begin, End, Time, Delay, EaseType); } else { // Update Text UI m_Title += "Translation:\r\n"; m_Details += "-\r\n"; // Disable MoveIn m_GAui.SetInAnimsMove(false); } // Rotation checkbox is enable if (m_Rotation == true) { // Random Easing for Translation if m_UseSameEasing is disabled if (m_UseSameEasing == false) { EaseType = (eEaseType)UnityEngine.Random.Range(0, 22); } // Update m_Title and m_Details strings m_Title += "Rotation:\r\n"; m_Details += EaseType.ToString() + "\r\n"; // Setup begin and end rotation Vector3 Begin = new Vector3(0, 0, 0); Vector3 End = new Vector3(0, 0, 360); // Set RotateIn, we will call PlayInAnims() later m_GAui.SetInAnimsRotate(true, Begin, End, Time, Delay, EaseType); } else { // Update m_Title and m_Details strings m_Title += "Rotation:\r\n"; m_Details += "-\r\n"; // Disable RotateIn m_GAui.SetInAnimsRotate(false); } // Scale checkbox is enable if (m_Scale == true) { // Random Easing for Translation if m_UseSameEasing is disabled if (m_UseSameEasing == false) { EaseType = (eEaseType)UnityEngine.Random.Range(0, 22); } // Update m_Title and m_Details strings m_Title += "Scale:\r\n"; m_Details += EaseType.ToString() + "\r\n"; // Setup begin and end scale Vector3 Begin = new Vector3(0, 0, 0); // Set RotateIn, we will call PlayInAnims() later m_GAui.SetInAnimsScale(true, Begin, Time, Delay, EaseType); } else { // Update m_Title and m_Details strings m_Title += "Scale:\r\n"; m_Details += "-\r\n"; // Disable ScaleIn m_GAui.SetInAnimsScale(false); } // Fade checkbox is enable if (m_Fade == true) { // Random Easing for Translation if m_UseSameEasing is disabled if (m_UseSameEasing == false) { EaseType = (eEaseType)UnityEngine.Random.Range(0, 22); } // Update m_Title and m_Details strings m_Title += "Fade:\r\n"; m_Details += EaseType.ToString() + "\r\n"; // Set RotateIn, we will call PlayInAnims() later m_GAui.SetInAnimsFade(true, Time, Delay, EaseType); } else { // Update m_Title and m_Details strings m_Title += "Fade:\r\n"; m_Details += "-\r\n"; // Disable RotateIn m_GAui.SetInAnimsFade(false); } // ShowTimeAndDelay checkbox is enable if (m_ShowTimeAndDelay == true) { // Update m_Title and m_Details strings m_Title += "Time:\r\nDelay:\r\n"; m_Details += string.Format("{0:0.0}", Time) + " secs" + "\r\n" + string.Format("{0:0.0}", Delay) + " secs" + "\r\n"; } if (m_TextTitle != null && m_TextDetails != null) { // Update Text UI m_TextTitle.text = m_Title; m_TextDetails.text = m_Details; } // Play In-animations m_GAui.PlayInAnims(eGUIMove.Self); }