Example #1
0
    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;
                    }
                }
            }
        }
    }
Example #2
0
    /// <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);
        }
    }