예제 #1
0
    public static table.TitleDataBase GetTitleText(IEntity entity)
    {
        int    titleId   = entity.GetProp((int)PlayerProp.TitleId);
        string titleText = "";

        if (titleId != 0)
        {
            table.TitleDataBase tdb = GameTableManager.Instance.GetTableItem <table.TitleDataBase>((uint)titleId);
            return(tdb);
        }

        return(null);
    }
예제 #2
0
    string GetTitleText(IEntity entity)
    {
        int    titleId   = entity.GetProp((int)PlayerProp.TitleId);
        string titleText = "";

        if (titleId != 0)
        {
            table.TitleDataBase tdb = GameTableManager.Instance.GetTableItem <table.TitleDataBase>((uint)titleId);
            if (tdb != null && tdb.UIState == 0)   //0 仅仅文本显示
            {
                titleText = tdb.SceneTextUI;
            }
        }

        return(titleText);
    }
예제 #3
0
    /// <summary>
    /// 更新顶部栏状态
    /// </summary>
    public void UpdateHeadStatus(HeadStatusType type, bool adjustPos = true)
    {
        RoleStateBarManager mgr    = DataManager.Manager <RoleStateBarManager>();
        IEntity             entity = RoleStateBarManager.GetEntity(UID);

        if (null == entity)
        {
            return;
        }
        Transform widget = GetWidget(type);

        if (null != widget)
        {
            QuestTraceInfo traceInfo = null;
            bool           visible   = false;
            if (type != HeadStatusType.TaskStatus)
            {
                visible = RoleStateBarManager.IsEntityHeadStatusTypeEnable(entity, type);
            }
            else
            {
                if (RoleStateBarManager.TryGetNPCTraceInfo(entity, out traceInfo))
                {
                    visible = true;
                }
            }
            if (widget.gameObject.activeSelf != visible)
            {
                widget.gameObject.SetActive(visible);
            }
            if (type == HeadStatusType.Title &&
                null != m_particleWidget)
            {
                m_particleWidget.ReleaseParticle();
            }
            if (visible)
            {
                switch (type)
                {
                case HeadStatusType.Hp:
                    if (null != m_hpSlider && null != m_spHpbg && null != m_spHpForg)
                    {
                        float          hpPer = entity.GetProp((int)CreatureProp.Hp) / (float)entity.GetProp((int)CreatureProp.MaxHp);
                        EntityHpSprite hpSp  = RoleStateBarManager.GetEntityHpSpData(entity);
                        if (hpSp != null)
                        {
                            m_spHpbg.spriteName = hpSp.bgSpriteName;
                            m_spHpbg.MakePixelPerfect();
                            m_spHpForg.spriteName = hpSp.spriteName;
                            m_spHpForg.MakePixelPerfect();
                            m_hpSlider.gameObject.SetActive(hpSp.bShow);
                            m_hpSlider.value = hpPer;
                        }
                    }
                    break;

                case HeadStatusType.Name:
                    if (null != m_labName)
                    {
                        m_labName.text = ColorManager.GetColorString(mgr.GetNameColor(entity), entity.GetName());
                    }
                    break;

                case HeadStatusType.Clan:
                    if (null != m_labClanName)
                    {
                        Action <string, int> clanNameDlg = (clanName, getNameSeed) =>
                        {
                            if (getNameSeed >= m_iGetNameSeed)
                            {
                                //保证先后
                                //string name = DataManager.Manager<TextManager>().GetLocalFormatText(LocalTextType.Clan_Commond_shizumingzi, clanName);
                                //labelClan.fontSize = data.m_nFontSize;
                                m_labClanName.text = ColorManager.GetColorString(RoleStateBarManager.GetClanNameColor(entity), clanName);
                            }
                        };
                        RoleStateBarManager.GetRoleBarClanName(entity, clanNameDlg, ++m_iGetNameSeed);
                    }
                    break;

                case HeadStatusType.Title:
                    if (null != m_labTitle)
                    {
                        table.TitleDataBase titleDb = RoleStateBarManager.GetTitleText(entity);
                        if (null != titleDb)
                        {
                            bool visibleTxt = (titleDb.UIState == 0);
                            if (null != m_labTitle)
                            {
                                if (m_labTitle.gameObject.activeSelf != visibleTxt)
                                {
                                    m_labTitle.gameObject.SetActive(visibleTxt);
                                }
                                m_labTitle.text = titleDb.SceneTextUI;
                            }

                            if (null != m_particleWidget)
                            {
                                if (m_particleWidget.gameObject.activeSelf == visibleTxt)
                                {
                                    m_particleWidget.gameObject.SetActive(!visibleTxt);
                                }

                                m_particleWidget.AddParticle(titleDb.FxUI, m_particleRelativeWidget);
                            }
                        }
                    }
                    break;

                case HeadStatusType.Collect:
                    if (null != m_labCollectTips)
                    {
                        m_labCollectTips.color = ColorManager.GetColor32OfType(ColorType.JSXT_CaiJiWu);
                    }
                    break;

                case HeadStatusType.HeadMaskIcon:
                    if (null != m_spHeadMask)
                    {
                        table.NpcHeadMaskDataBase npcmaskDB = RoleStateBarManager.GetNPCHeadMaskDB(entity);
                        string iconName = (null != npcmaskDB) ? npcmaskDB.headMaskIcon : "";
                        UIManager.GetAtlasAsyn(iconName, ref m_headCASD, () =>
                        {
                            if (null != m_spHeadMask)
                            {
                                m_spHeadMask.atlas = null;
                            }
                        }, m_spHeadMask);
                    }
                    break;

                case HeadStatusType.TaskStatus:
                    if (null != m_spTaskStatus && null != traceInfo)
                    {
                        long   uid  = 0;
                        string icon = "";
                        if (RoleStateBarManager.TryGetQuestStatusIcon(traceInfo, out uid, out icon) &&
                            uid == UID)
                        {
                            UIManager.GetAtlasAsyn(icon, ref m_taskCASD, () =>
                            {
                                if (null != m_spTaskStatus)
                                {
                                    m_spTaskStatus.atlas = null;
                                }
                            }, m_spTaskStatus);
                        }
                        else
                        {
                            widget.gameObject.SetActive(false);
                        }
                    }
                    break;

                case HeadStatusType.CampMask:
                {
                    bool isGod = true;
                    int  camp  = entity.GetProp((int)Client.CreatureProp.Camp);
                    if (camp == (int)GameCmd.eCamp.CF_Red)
                    {
                        isGod = false;
                    }
                    if (null != m_tsDemonMask && m_tsDemonMask.gameObject.activeSelf == isGod)
                    {
                        m_tsDemonMask.gameObject.SetActive(!isGod);
                    }

                    if (null != m_tsGodMask && m_tsGodMask.gameObject.activeSelf != isGod)
                    {
                        m_tsGodMask.gameObject.SetActive(isGod);
                    }
                }
                break;

                case HeadStatusType.BossSay:
                {
                    uint npcID = DataManager.Manager <RoleStateBarManager>().GetTalkingBossID();

                    table.BossTalkDataBase db = GameTableManager.Instance.GetTableItem <table.BossTalkDataBase>(npcID);
                    if (db != null)
                    {
                        uint textID = db.textID;
                        table.LangTextDataBase ldb = GameTableManager.Instance.GetTableItem <table.LangTextDataBase>(textID);
                        if (ldb != null)
                        {
                            m_bossText.text = ldb.strText;
                        }
                        m_bossTalk.gameObject.SetActive(visible);
                    }
                    else
                    {
                        m_bossTalk.gameObject.SetActive(false);
                    }
                }
                break;
                }
            }

            if (adjustPos)
            {
                AdjustStatusPos();
            }
        }
    }