public void ValidStep() { StopAllCoroutines(); playerFree = false; GetComponent <Image>().raycastTarget = true; Attach(); if (_uitargetContainer != null) { if (currentStep.UItarget != null) { currentStep.UItarget.transform.SetParent(_uitargetContainer); currentStep.UItarget.transform.SetSiblingIndex(_childIndex); } else if (currentStep.playerBtn != null) { currentStep.playerBtn.transform.SetParent(_uitargetContainer); currentStep.playerBtn.transform.SetSiblingIndex(_childIndex); } _uitargetContainer = null; } if (currentStep.targetTopic != -1) { NotePad.Instance.Topics[currentStep.targetTopic].gameObject.transform.SetParent(NotePad.Instance.gameObject.transform); NotePad.Instance.Topics[currentStep.targetTopic].SetColor(Color.white); } receiveTouch = false; activeInput = FtueInputs.NONE; currentStepIndex++; if (currentStepIndex >= steps.Count) { Clear(); } else { ftueText.gameObject.SetActive(false); ArrowDisplayer.Instances("FtueArrow").CleanArrows(); ArrowDisplayer.Instances("FtueTap").CleanArrows(); _clickableTransform = null; currentStep = steps[currentStepIndex]; Events.Instance.Raise(new OnFtueNextStep()); if (currentStep.targetTopic != -1 && !NotePad.Instance.Open) { Events.Instance.AddListener <OnFTUEOpenDialogue>(OpenDialogue); } else { RunCurrentStep(); } } }
public void Clear() { _finish = true; active = false; StopAllCoroutines(); _clickableTransform = null; gameObject.SetActive(false); receiveTouch = false; currentStep = null; currentStepIndex = 0; activeInput = FtueInputs.NONE; tapSprite.gameObject.SetActive(false); pinchSprite.gameObject.SetActive(false); ftueText.gameObject.SetActive(false); GameManager.Instance.EndOfFTUE(); }
public void ForceClear() { _finish = true; active = false; StopAllCoroutines(); _clickableTransform = null; gameObject.SetActive(false); receiveTouch = false; currentStep = null; currentStepIndex = 0; activeInput = FtueInputs.NONE; tapSprite.gameObject.SetActive(false); pinchSprite.gameObject.SetActive(false); ftueText.gameObject.SetActive(false); Display(false); ActiveHidden(); }
public void RunCurrentStep() { activeInput = currentStep.input; if (currentStep.text != null && currentStep.text != string.Empty) { ftueText.gameObject.SetActive(true); StartCoroutine(DisplayFtueStep(currentStep.text)); } else if (currentStep.input == FtueInputs.TOUCH) { StartCoroutine(DisplayFtueStep(string.Empty)); } if (currentStep.toDetach != null) { _detachContainer = currentStep.toDetach.parent; _childDetachIndex = GetChildIndex(currentStep.toDetach, _detachContainer); currentStep.toDetach.SetParent(transform); } if (currentStep.UItarget != null) { _uitargetContainer = currentStep.UItarget.transform.parent; _childIndex = GetChildIndex(currentStep.UItarget.transform, _uitargetContainer); currentStep.UItarget.transform.SetParent(transform); currentStep.UItarget.SetState(true); ArrowDisplayer.Instances("FtueTap").UseArrow <UIObjectPointer>(50f, currentStep.pointRotation, false, currentStep.UItarget.transform as RectTransform, "FtueTap"); } if (currentStep.toPointUI != null) { ArrowDisplayer.Instances("FtueArrow").UseArrow <UIObjectPointer>(50f, currentStep.pointRotation, false, currentStep.toPointUI, "FtueArrow"); } if (currentStep.specificPoint.pos != Vector3.zero) { if (currentStep.specificPoint.withArrow) { if (currentStep.specificPoint.icon != null) { NotePad.Instance.PointTarget(currentStep.specificPoint.pos, currentStep.specificPoint.icon); } else { NotePad.Instance.PointTarget(currentStep.specificPoint.pos); } } else { PlayerManager.Instance.player.SetPosCallBack(currentStep.specificPoint.pos, ValidStep); } } playerFree = currentStep.playerFree; if (playerFree) { GetComponent <Image>().raycastTarget = false; } if (currentStep.ftueSprite != null && currentStep.ftueSprite.Alpha < 1f) { SetFtueUIImageContainer(currentStep.ftueSprite, true, true); } if (currentStep.tapPosition != Vector2.zero) { clickTarget.gameObject.transform.localPosition = new Vector3(Screen.width * currentStep.tapPosition.x, Screen.height * currentStep.tapPosition.y, 0f); ArrowDisplayer.Instances("FtueTap").UseArrow <UIObjectPointer>(50f, 95f, false, clickTarget as RectTransform, "FtueTap", false); } if (currentStep.targetSmiley) { ArrowDisplayer.Instances("FtueArrow").UseArrow <UIObjectPointer>(75f, currentStep.pointRotation, false, UIManager.instance.PNJState.smileyRenderer.transform as RectTransform, "Ftue"); } if (currentStep.targetNPCIcon) { Transform nearestIconTrf = PlayerManager.Instance.GetNearestNPCIcon(); _clickableTransform = nearestIconTrf; ArrowDisplayer.Instances("FtueTap").UseArrow <UIObjectPointer>(50f, currentStep.pointRotation, false, nearestIconTrf.position, "FtueTap", false); } if (currentStep.pointNPCIcon) { Transform nearestIconTrf = PlayerManager.Instance.GetNearestNPCIcon(); ArrowDisplayer.Instances("FtueArrow").UseArrow <UIObjectPointer>(50f, currentStep.pointRotation, false, nearestIconTrf.position, "FtueArrow", false); } if (_clickableTransform != null) { clickTarget.gameObject.SetActive(true); clickTarget.position = Camera.main.WorldToScreenPoint(_clickableTransform.position); } if (currentStep.targetTopic != -1) { RectTransform topicTrf = NotePad.Instance.Topics[currentStep.targetTopic].GetComponent <RectTransform>(); NotePad.Instance.Topics[currentStep.targetTopic].gameObject.transform.SetParent(transform); NotePad.Instance.Topics[currentStep.targetTopic].SetColor(Color.green); ArrowDisplayer.Instances("FtueTap").UseArrow <UIObjectPointer>(50f, -90f, false, topicTrf, "FtueTap", false); Events.Instance.AddListener <OnActiveSelectTopic>(OnSelectTopic); } if (currentStep.playerBtn != null) { _uitargetContainer = currentStep.playerBtn.transform.parent; _childIndex = GetChildIndex(currentStep.playerBtn.transform, _uitargetContainer); currentStep.playerBtn.transform.SetParent(transform); ArrowDisplayer.Instances("FtueTap").UseArrow <UIObjectPointer>(25f, currentStep.pointRotation, false, currentStep.playerBtn.transform as RectTransform, "FtueTap"); Events.Instance.AddListener <SelectPlayer>(OnSelectPlayer); } if (currentStep.input == FtueInputs.PINCH) { pinchSprite.gameObject.SetActive(true); pinchSprite.GetComponent <Animator>().SetBool("pinch", true); Events.Instance.AddListener <OnPinchEnd>(ReceivePinch); Events.Instance.AddListener <OnEndFtuePinch>(ReceivePinch); Events.Instance.AddListener <OnInputFtuePinch>(DisablePinchSprite); } if (currentStep.drag.active) { StartCoroutine(DisplayDrag(currentStep.drag)); } if (currentStep.waitDezoom) { Events.Instance.AddListener <OnEndPanelZoom>(ReceiveZoomValidation); } }