public void CheckTriggerData(uint guideId, UIEventDelegate dlg) { GuideDefine.LocalGuideData localGuideData = null; if (DataManager.Manager <GuideManager>().TryGetGuideLocalData(ID, out localGuideData)) { if (null != localGuideData.GuideTargetObj) { GuideTrigger trigger = localGuideData.GuideTargetObj.GetComponent <GuideTrigger>(); if (null == trigger) { trigger = localGuideData.GuideTargetObj.AddComponent <GuideTrigger>(); trigger.InitTrigger(localGuideData.ID, dlg); } else { trigger.AddTriggerId(localGuideData.ID); } //如果没有事件触发,需要手动添加碰撞器触发引导事件 if (localGuideData.TriggerEventType == GuideDefine.GuideTriggerEventType.None) { BoxCollider boxCollider = localGuideData.GuideTargetObj.GetComponent <BoxCollider>(); if (null == boxCollider) { boxCollider = localGuideData.GuideTargetObj.AddComponent <BoxCollider>(); boxCollider.size = localGuideData.GuideTargetObjLocalBounds.size; boxCollider.center = localGuideData.GuideTargetObjLocalBounds.center; } } } } }
/// <summary> /// 设置非强制引导数据 /// </summary> /// <param name="panelDepath"></param> /// <param name="id"></param> public void SetData(int panelDepth, uint id, UIEventDelegate dlg) { Init(); if (!Visible) { SetVisible(true); } this.m_uint_id = id; GuideDefine.LocalGuideData localGuideData = null; SetDepth(panelDepth); if (DataManager.Manager <GuideManager>().TryGetGuideLocalData(ID, out localGuideData)) { //设置位置 SetPos(out m_v3ContentOffset); //显示内容 UILabel tempLab = null; RefreshHumanImage(ref tempLab); if (null != tempLab) { tempLab.text = localGuideData.Des; } if (null != localGuideData.GuideTargetObj) { m_sourcePos = localGuideData.GuideTargetObj.transform.position; GuideTrigger trigger = localGuideData.GuideTargetObj.GetComponent <GuideTrigger>(); if (null == trigger) { trigger = localGuideData.GuideTargetObj.AddComponent <GuideTrigger>(); trigger.InitTrigger(localGuideData.ID, dlg); } else { trigger.AddTriggerId(localGuideData.ID); } //如果没有事件触发,需要手动添加碰撞器触发引导事件 if (localGuideData.TriggerEventType == GuideDefine.GuideTriggerEventType.None) { BoxCollider boxCollider = localGuideData.GuideTargetObj.GetComponent <BoxCollider>(); if (null == boxCollider) { boxCollider = localGuideData.GuideTargetObj.AddComponent <BoxCollider>(); boxCollider.size = localGuideData.GuideTargetObjLocalBounds.size; boxCollider.center = localGuideData.GuideTargetObjLocalBounds.center; } } } if (null != m_particle) { m_effectRoot.transform.localPosition = Vector3.zero; m_particle.ReleaseParticle(); m_particle.AddParticle(50042, endCallback: OnParticleDispalyEffectComplete); } //if (null != m_particle && !m_bAddEffect) //{ // m_particle.AddParticle(50041); // m_bAddEffect = true; //} SetVisible(false); SetVisible(true); } }
/// <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); } }