private void DrawRepeatLineOnCookieButton() { TutorialUI.Clear(false); if (!m_bIsDragAnimPlaying) //stop { return; } Vector3[] _av3Path = new Vector3[3]; RectTransform _oRectCookieBDrag = m_oCookieButton.gameObject.GetComponent <RectTransform>(); _av3Path[0] = m_oCookieButton.transform.position; _av3Path[1] = _av3Path[0] + Vector3.up * 4 + Vector3.left * 2; _av3Path[2] = m_oCameraUI.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2)); _av3Path[2].z = _av3Path[1].z; TutorialUIAnimation _oDLAnim = TutorialUI.DrawLine(_av3Path, TutorialUI.DrawLineMode.Finger, false, true); _oDLAnim.MainTween.timeScale = 0.3f; _oDLAnim.OnComplete(delegate() { if (m_eTutoState != eAnturaSpaceTutoState.CUSTOMIZE) { DrawRepeatLineOnCookieButton(); } }); }
/// <summary> /// Advance the tutorial in his sequential flow. /// </summary> public void AdvanceTutorial() { if (!gameObject.activeSelf) //block any attempt to advance if tutorial isn't active { return; } switch (m_eTutoState) { case eAnturaSpaceTutoState.ANTURA_ANIM: m_eTutoState = eAnturaSpaceTutoState.COOKIE_BUTTON; TutorialUI.Clear(false); m_oAnturaBehaviour.onAnimationByClick -= AdvanceTutorial; AudioManager.I.StopDialogue(false); AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Intro_Touch, delegate() //dialog Antura { AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Intro_Cookie, delegate() //dialog cookies { AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Tuto_Cookie_1, delegate() //dialog tap for cookies { m_oCookieButton.gameObject.SetActive(true); //after the dialog make appear the cookie button m_oCookieButton.onClick.AddListener(AdvanceTutorial); //the button can call AdvanceTutorial on click //RectTransform _oRectCookieB = m_oCookieButton.gameObject.GetComponent<RectTransform>(); TutorialUI.ClickRepeat(m_oCookieButton.transform.position /*m_oCameraUI.ScreenToWorldPoint(new Vector3(_oRectCookieB.position.x,_oRectCookieB.position.y, m_oCameraUI.nearClipPlane))*/, float.MaxValue, 1); }); }); }); break; case eAnturaSpaceTutoState.COOKIE_BUTTON: m_eTutoState = eAnturaSpaceTutoState.USE_ALL_COOKIES; TutorialUI.Clear(false); m_oCookieButton.onClick.RemoveListener(AdvanceTutorial); AudioManager.I.StopDialogue(false); AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Tuto_Cookie_2); //dialog drag cookies m_bIsDragAnimPlaying = true; DrawRepeatLineOnCookieButton(); //Register delegate to disable draw line after done UnityEngine.EventSystems.EventTrigger.Entry _oEntry = new UnityEngine.EventSystems.EventTrigger.Entry(); _oEntry.eventID = UnityEngine.EventSystems.EventTriggerType.EndDrag; _oEntry.callback.AddListener((data) => { m_bIsDragAnimPlaying = false; }); m_oCookieButton.GetComponent <UnityEngine.EventSystems.EventTrigger>().triggers.Add(_oEntry); break; case eAnturaSpaceTutoState.USE_ALL_COOKIES: m_eTutoState = eAnturaSpaceTutoState.CUSTOMIZE; TutorialUI.Clear(false); AudioManager.I.StopDialogue(false); AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Tuto_Cookie_3, delegate() //dialog get more cookies { AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Custom_1, delegate() //dialog customize { m_oCustomizationButton.gameObject.SetActive(true); //after the dialog make appear the customization button m_oCustomizationButton.onClick.AddListener(AdvanceTutorial); /*AudioManager.I.PlayDialog(Db.LocalizationDataId.AnturaSpace_Custom_2, delegate() //dialog click customize * { * //Not knowing how many object there are, register to all buttons * //foreach (var it in m_oItemsParentUI.GetComponentsInChildren<UnityEngine.UI.Button>()) * //{ * // it.onClick.AddListener(AdvanceTutorial); * //} * m_oCustomizationButton.onClick.AddListener(AdvanceTutorial); * }); */ /*RectTransform _oRectCustomB = m_oCustomizationButton.gameObject.GetComponent<RectTransform>(); * TutorialUI.ClickRepeat(m_oCameraUI.ScreenToWorldPoint(new Vector3(_oRectCustomB.position.x, _oRectCustomB.position.y, m_oCameraUI.nearClipPlane)), float.MaxValue, 1); */ TutorialUI.ClickRepeat(m_oCustomizationButton.transform.position, float.MaxValue, 1); }); }); break; case eAnturaSpaceTutoState.CUSTOMIZE: m_eTutoState = eAnturaSpaceTutoState.FINISH; TutorialUI.Clear(false); /*//Unregister from object buttons * foreach (var it in m_oItemsParentUI.GetComponentsInChildren<UnityEngine.UI.Button>()) * { * it.onClick.RemoveListener(AdvanceTutorial); * }*/ m_oCustomizationButton.onClick.RemoveListener(AdvanceTutorial); GlobalUI.ShowBackButton(true, delegate() { NavigationManager.I.GoToScene(AppScene.Map); }); AudioManager.I.StopDialogue(false); AudioManager.I.PlayDialog(Db.LocalizationDataId.Map_Intro_AnturaSpace, delegate() //dialog go to map { //TutorialUI.ClickRepeat(m_oCameraUI.ScreenToWorldPoint(new Vector3(GlobalUI.I.BackButton.RectT.position.x, GlobalUI.I.BackButton.RectT.position.y, m_oCameraUI.nearClipPlane)), float.MaxValue, 1); }); break; default: break; } }