Ejemplo n.º 1
0
    /// <summary>
    /// 获取NPC头顶标识数据
    /// </summary>
    /// <param name="entity"></param>
    /// <returns></returns>
    public static table.NpcHeadMaskDataBase GetNPCHeadMaskDB(Client.IEntity entity)
    {
        table.NpcHeadMaskDataBase db = null;
        if (null != entity
            //&& entity.GetEntityType() == EntityType.EntityType_NPC
            )
        {
            db = GetNPCHeadMaskDB((uint)entity.GetProp((int)Client.EntityProp.BaseID));
        }

        return(db);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 获取NPC头顶标识数据
    /// </summary>
    /// <param name="npcBaseId"></param>
    /// <returns></returns>
    public static table.NpcHeadMaskDataBase GetNPCHeadMaskDB(uint npcBaseId)
    {
        table.NpcHeadMaskDataBase db = null;
        if (npcBaseId != 0
            //&& entity.GetEntityType() == EntityType.EntityType_NPC
            )
        {
            table.NpcDataBase npcdb
                = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(npcBaseId);
            if (null != npcdb && npcdb.npcHeadMaskID != 0)
            {
                db = GameTableManager.Instance.GetTableItem <table.NpcHeadMaskDataBase>(npcdb.npcHeadMaskID);
            }
        }

        return(db);
    }
Ejemplo n.º 3
0
    public HeadTipData(IEntity entity, HeadTipType htype, bool vivible)
    {
        if (entity == null)
        {
            throw new ArgumentNullException("entity");
        }

        this.type       = htype;
        this.m_bVisible = vivible;

        switch (type)
        {
        case HeadTipType.Hp:
        {
            this.value        = entity.GetProp((int)CreatureProp.Hp) / (float)entity.GetProp((int)CreatureProp.MaxHp);
            this.color        = ColorType.Green;
            this.spriteParams = GetSpiteName(entity);
        }
        break;

        case HeadTipType.Name:
        {
            this.value = entity.GetName();
            this.color = GetNameColor(entity);
        }
        break;

        case HeadTipType.HeadMaskIcon:
        {
            table.NpcHeadMaskDataBase npcmaskDB = RoleStateBarManager.GetNPCHeadMaskDB(entity);
            this.value = (null != npcmaskDB) ? npcmaskDB.headMaskIcon : "";
        }
        break;

        case HeadTipType.Clan:
        {
            this.color = GetClanNameColor(entity);
//                    this.m_nFontSize = 18;
            //this.value = //异步请求
        }
        break;

        case HeadTipType.Title:
        {
            this.value = GetTitleText(entity);
            this.color = ColorType.Green;
        }
        break;

        case HeadTipType.Collect:
        {
            this.color      = ColorType.JSXT_CaiJiWu;
            this.m_bVisible = true;
        }
        break;

        case HeadTipType.Max:
            break;

        default:
            break;
        }
    }
Ejemplo n.º 4
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();
            }
        }
    }
Ejemplo n.º 5
0
    public void InitInfo(Client.NPCInfo info)
    {
        if (null == m_spMaskIcon)
        {
            m_spMaskIcon = transform.Find("MaskIcon").GetComponent <UISprite>();
        }
        m_type  = (MapScrollItemType)info.type;
        npcInfo = info;
        if (info != null)
        {
            Transform labelTrans = transform.Find("Label");
            bool      visible    = RoleStateBarManager.IsEntityHaveHeadIconMask((uint)info.npcID);
            if (null != m_spMaskIcon)
            {
                if (m_spMaskIcon.gameObject.activeSelf != visible)
                {
                    m_spMaskIcon.gameObject.SetActive(visible);
                }

                if (visible)
                {
                    table.NpcHeadMaskDataBase maskDb = RoleStateBarManager.GetNPCHeadMaskDB((uint)info.npcID);
                    if (null != maskDb)
                    {
                        UIManager.GetAtlasAsyn(maskDb.miniMapMaskIcon, ref m_curIconAsynSeed, () =>
                        {
                            if (null != m_spMaskIcon)
                            {
                                m_spMaskIcon.atlas = null;
                            }
                        }, m_spMaskIcon, false);
                    }
                }
            }
            if (labelTrans != null)
            {
                UILabel label = labelTrans.GetComponent <UILabel>();
                if (label != null)
                {
                    string showText = npcInfo.name;
                    if (npcInfo.pos.x != 0 || npcInfo.pos.y != 0)
                    {
                        string levelStr = string.Empty;

                        table.NpcDataBase ndb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcInfo.npcID);
                        if (ndb != null)
                        {
                            if (ndb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_NONE)
                            {
                                if (ndb.dwMonsterType != 0)
                                {
                                    levelStr = ndb.dwLevel + "级 ";
                                }
                            }
                        }

                        showText = levelStr + npcInfo.name + "(" + npcInfo.pos.x.ToString() + "," + npcInfo.pos.y.ToString() + ")";
                    }
                    label.text = showText;
                }
            }
        }
    }