private void UpdateData(fightrolehppanel_item itm, FightHeroMsg data) { if (data.hp < 0) { data.hp = 0; } if (data.shield < 0) { data.shield = 0; } itm.curHpLab.text = data.hp.ToString(); itm.dieLab.gameObject.SetActive(data.hp <= 0); itm.shieldLab.text = data.shield.ToString(); itm.maxHpLab.text = data.maxHp.ToString(); }
/// <summary>加载A队人物伍完成</summary> /// <param name="abName"></param> /// <param name="obj"></param> /// <param name="param"></param> private void OnLoader_FSideAvatarCompleteTest(string abName, GameObject obj, object param) { CreateSpineAni create = obj.GetComponent <CreateSpineAni>(); create.SpineScale = new Vector3(0.01f, 0.01f, 0.01f); int index; CardRole cdRole = obj.GetComponent <CardRole>(); if (FightProxy.Instance.RoomInfo != null) { FightHeroMsg msg = param as FightHeroMsg; cdRole.SerData = msg; index = msg.pos - 1; cdRole.SlotIndex = msg.pos; CardRoleDidDic[msg.heroId] = cdRole; } else { index = param.ToInt(); FightHeroMsg msg = new FightHeroMsg(); msg.heroId = index; cdRole.SerData = msg; cdRole.SerData.pos = index; cdRole.SlotIndex = index + 1; CardRoleDidDic[msg.heroId] = cdRole; } cdRole.SlotPostion = Instance.MyPosition[index].position; obj.transform.position = Instance.MyPosition[index].position; TransformCardRoleTeamA[obj.transform] = cdRole; obj.layer = LayerMask.NameToLayer("MapLayer"); Facade.Instance.SendNotification(NotificationID.FightRoleHp_AddMyHP, cdRole); }