/// <summary> /// 显示引导 /// </summary> /// <param name="data"></param> private void ShowGuide() { Transform ts = null; if (IsDataReady) { GuideDefine.LocalGuideData data = m_helpData.LocalData; if (null == m_helpData.LocalData.GuideTargetObj) { SilentComplete(); } if (!m_helpData.GuideRoot.gameObject.activeSelf) { m_helpData.GuideRoot.gameObject.SetActive(true); } GuideStyleData gstyleData = GuidePanel.GetGuideStyleData(m_helpData); Vector3 angle = Vector3.zero; angle.z = gstyleData.ArrowRotateAngle; UILabel desLab = null; if (null != m_trans_ArrowContent) { m_trans_ArrowContent.localEulerAngles = angle; } if (null != m_trans_PointBoxContent) { m_trans_PointBoxContent.parent = gstyleData.TargetRoot; m_trans_PointBoxContent.localPosition = Vector3.zero; } if (null != m_trans_PBLeftContent) { if (m_trans_PBLeftContent.gameObject.activeSelf == gstyleData.ArrowRight) { m_trans_PBLeftContent.gameObject.SetActive(!gstyleData.ArrowRight); } if (!gstyleData.ArrowRight) { desLab = m_label_GuideLeftContent; } } if (null != m_trans_PBRightContent) { if (m_trans_PBRightContent.gameObject.activeSelf != gstyleData.ArrowRight) { m_trans_PBRightContent.gameObject.SetActive(gstyleData.ArrowRight); } if (gstyleData.ArrowRight) { desLab = m_label_GuideRightContent; } } if (null != desLab) { desLab.text = data.Des; } if (null != data.GuideTargetObj && null != m_helpData.AttachRoot) { //备份目标对象 GameObject cloneTarget = GameObject.Instantiate(data.GuideTargetObj); cloneTarget.name = data.GuideTargetObj.name; cloneTarget.transform.parent = m_helpData.AttachRoot; cloneTarget.transform.localScale = data.GuideTargetObj.transform.localScale; cloneTarget.transform.localPosition = data.GuideTargetObj.transform.localPosition; cloneTarget.transform.localRotation = data.GuideTargetObj.transform.localRotation; cloneTarget.transform.position = data.GuideTargetObj.transform.position; m_helpData.CloneTarget = cloneTarget; //删除UIPlayerTween UIPlayTween[] tws = cloneTarget.GetComponents <UIPlayTween>(); int length = (null != tws) ? tws.Length:0; if (length > 0) { for (int i = 0; i < length; i++) { GameObject.Destroy(tws[i]); } } GuideTrigger trigger = cloneTarget.GetComponent <GuideTrigger>(); if (null == trigger) { trigger = cloneTarget.AddComponent <GuideTrigger>(); } trigger.InitTrigger(data.ID, GuideTriggerDlg); //如果没有事件触发,需要手动添加碰撞器触发引导事件 //if (data.TriggerEventType == GuideDefine.GuideTriggerEventType.None) { BoxCollider boxCollider = cloneTarget.GetComponent <BoxCollider>(); if (null == boxCollider) { boxCollider = cloneTarget.AddComponent <BoxCollider>(); boxCollider.size = data.GuideTargetObjLocalBounds.size; boxCollider.center = data.GuideTargetObjLocalBounds.center; } if (!boxCollider.enabled) { boxCollider.enabled = true; } } } if (null != m_helpData.PointBoxRoot) { if (!m_helpData.PointBoxRoot.gameObject.activeSelf) { m_helpData.PointBoxRoot.gameObject.SetActive(true); } m_helpData.PointBoxRoot.localPosition = gstyleData.TargetPos; } ShowGuideDynamicMask(m_helpData.LocalData.GuideTargetWorldPos, 1); if (null != m_trans_ConstraintAnimContent) { TweenScale tween = m_trans_ConstraintAnimContent.GetComponent <TweenScale>(); if (null != tween) { tween.ResetToBeginning(); tween.enabled = true; } } SetVisible(false); SetVisible(true); } }