示例#1
0
    private void GetWidget(HeadTipType type, Transform child)
    {
        switch (type)
        {
        case HeadTipType.Name:
            lableName = child.GetComponent <UILabel>();
            break;

        case HeadTipType.HeadMaskIcon:
            m_spHeadMask = child.GetComponent <UISprite>();
            break;

        case HeadTipType.Hp:
            hpslider     = child.GetComponent <UISlider>();
            bgSprite     = child.Find("bg").GetComponent <UISprite>();
            sliderSprite = child.GetComponent <UISprite>();
            break;

        case HeadTipType.Title:
            lableTitle = child.GetComponent <UILabel>();
            break;

        case HeadTipType.Clan:
            labelClan = child.GetComponent <UILabel>();
            break;

        case HeadTipType.Collect:
            m_labelCollectTips = child.GetComponent <UILabel>();
            break;

        default:
            break;
        }
    }
示例#2
0
    public void SetWidgetState(HeadTipType type, bool active)
    {
        switch (type)
        {
        case HeadTipType.Name:
        {
            if (lableName != null)
            {
                lableName.enabled = active;
            }
        }
        break;

        case HeadTipType.HeadMaskIcon:
        {
            if (null != m_spHeadMask && m_spHeadMask.enabled != active)
            {
                m_spHeadMask.enabled = active;
            }
        }
        break;

        case HeadTipType.Title:
            if (lableTitle != null)
            {
                lableTitle.enabled = active;
            }
            break;

        case HeadTipType.Clan:
        {
            if (labelClan != null)
            {
                labelClan.enabled = active;
            }
        }
        break;

        case HeadTipType.Hp:
        {
            if (hpslider != null)        //血条有子节点
            {
                hpslider.gameObject.SetActive(active);
            }
        }
        break;

        case HeadTipType.Collect:
            if (m_labelCollectTips != null)
            {
                m_labelCollectTips.enabled = active;
            }
            break;

        case HeadTipType.Max:
            break;

        default:
            break;
        }
    }
示例#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;
        }
    }