示例#1
0
    private void UpdatePlayerHp(Beast beast, IXUIListHeadInfoItem uiListHeadInfoItem)
    {
        if (beast != null && null != uiListHeadInfoItem)
        {
            float        rate         = beast.Hp / beast.HpMax;
            IXUIProgress iXUIProgress = uiListHeadInfoItem.GetUIObject("pb_hp") as IXUIProgress;
            iXUIProgress.value = rate;
            CampData ourCampData = Singleton <RoomManager> .singleton.GetOurCampData();

            CampData enemyCampData = Singleton <RoomManager> .singleton.GetEnemyCampData();

            if (beast.eCampType == ourCampData.CampType)
            {
                uiListHeadInfoItem.SetSprite("sp_bighp", "BlueHeadInfo");
                uiListHeadInfoItem.SetSprite("sp_hpred", "bluehp");
                //uiListHeadInfoItem.SetSprite("Sprite_Light_Green", "Light_Green");
            }
            else
            {
                uiListHeadInfoItem.SetSprite("sp_bighp", "RedHeadInfo");
                uiListHeadInfoItem.SetSprite("sp_hpred", "redhp");
                //uiListHeadInfoItem.SetSprite("Sprite_Light_Green", "Light_Red");
            }
        }
    }
示例#2
0
    private void Translate(Beast beast, IXUIListItem uiListItem, bool bSmooth)
    {
        if (beast != null && uiListItem != null)
        {
            if (null != beast.Object)
            {
                IXUIListHeadInfoItem iXUIListHeadInfoItem = uiListItem as IXUIListHeadInfoItem;
                if (iXUIListHeadInfoItem == null)
                {
                    XLog.Log.Error("null == uiListItemHeadInfo");
                }
                else
                {
                    Vector3 movingPos = beast.MovingPos;
                    movingPos.y += beast.Height + 2f;
                    Vector3 position = Camera.main.WorldToScreenPoint(movingPos);
                    Vector3 vector   = Singleton <UIManager> .singleton.UICamera.ScreenToWorldPoint(position);

                    Vector3 position2 = iXUIListHeadInfoItem.CachedGameObject.transform.position;
                    Vector3 position3 = bSmooth ? Vector3.Lerp(position2, vector, 0.6f) : vector;
                    iXUIListHeadInfoItem.CachedTransform.position = position3;
                    Vector3 localPosition = iXUIListHeadInfoItem.CachedTransform.localPosition;
                    localPosition.z = vector.z / 100f;
                    iXUIListHeadInfoItem.CachedTransform.localPosition = localPosition;
                }
            }
        }
    }
示例#3
0
        public HeadInfoEntity(long unBeastId, IXUIListHeadInfoItem uiHeadInfo)
        {
            this.m_unBeastId      = unBeastId;
            this.m_uiHeadInfoItem = uiHeadInfo;
            Beast heroById = Singleton <BeastManager> .singleton.GetBeastById(unBeastId);

            uiHeadInfo.Id = heroById.BeastTypeId;
        }
示例#4
0
 private void UpdatePlayerHpAction(Beast beast, IXUIListHeadInfoItem uiListHeadInfoItem, int hp)
 {
     if (beast != null && null != uiListHeadInfoItem)
     {
         float        rate         = (float)hp / (float)beast.HpMax;
         IXUIProgress iXUIProgress = uiListHeadInfoItem.GetUIObject("pb_hp") as IXUIProgress;
         if (iXUIProgress != null)
         {
             iXUIProgress.value = rate;
         }
     }
 }
示例#5
0
    protected override void OnRefresh()
    {
        base.OnRefresh();
        List <long> allBeastIds = Singleton <BeastManager> .singleton.GetAllBeastIds();

        List <long> exitsIds = this.m_dicBeastHeadInfo.Keys.ToList <long>();

        for (int i = 0; i < allBeastIds.Count; i++)
        {
            long id = allBeastIds[i];
            exitsIds.Remove(id);
            if (!this.m_dicBeastHeadInfo.ContainsKey(id))
            {
                IXUIListHeadInfoItem       iXUIListHeadInfoItem = base.uiBehaviour.m_List_HeadInfo.AddListItem() as IXUIListHeadInfoItem;
                DlgHeadInfo.HeadInfoEntity headInfoEntity       = new DlgHeadInfo.HeadInfoEntity(id, iXUIListHeadInfoItem);
                this.m_dicBeastHeadInfo.Add(id, headInfoEntity);
                this.Translate(headInfoEntity.TargetBeast, iXUIListHeadInfoItem, false);
                this.Refresh(headInfoEntity.TargetBeast);
            }
        }
    }