2025-04-29 15:10:33 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using cfg.CharacterCfg;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
using Gameplay;
|
|
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色及载具头像UI设置基类
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class UIHeadItemNode : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
protected uint uid;
|
|
|
|
|
|
protected UIHeadInfo uiheadInfo;
|
|
|
|
|
|
|
|
|
|
|
|
public GameObject root;
|
|
|
|
|
|
public Image imgBg;
|
|
|
|
|
|
public Image imgTeamProBg;
|
|
|
|
|
|
public Image imgTeamProName;
|
|
|
|
|
|
public Image imgHead;
|
|
|
|
|
|
public Image imgPro;
|
|
|
|
|
|
public Image imgMorale;
|
|
|
|
|
|
public Image imgMoraleFill;
|
|
|
|
|
|
public Image imgStateInBattle;
|
|
|
|
|
|
public TMP_Text txtLevel;
|
|
|
|
|
|
public Image imgRarity;
|
|
|
|
|
|
public TMP_Text txtName;
|
|
|
|
|
|
public Image imgSelect;
|
|
|
|
|
|
public Button buttonHead;
|
|
|
|
|
|
public TMP_Text txtLeadership;
|
|
|
|
|
|
public UIButtonLongPress buttonLongPress;
|
|
|
|
|
|
|
|
|
|
|
|
public GameObject contentFight;
|
|
|
|
|
|
public GameObject GoPro;
|
|
|
|
|
|
public GameObject CostLeadershipGo;
|
|
|
|
|
|
|
|
|
|
|
|
public TMP_Text txtLevelForEditTeam;
|
|
|
|
|
|
public GameObject LevelGoForEditTeam;
|
|
|
|
|
|
|
|
|
|
|
|
public ButtonUpDrag buttonUpDrag;
|
|
|
|
|
|
|
|
|
|
|
|
protected GameObject _debugContent;
|
|
|
|
|
|
protected TMP_Text _debugRoleID;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
// OnAwake();
|
|
|
|
|
|
// EventManager.Instance.Register(EventManager.EventName.DebugHeadRoleID, _OnDebugRoleID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
//EventManager.Instance.Unregister(EventManager.EventName.DebugHeadRoleID, _OnDebugRoleID);
|
2025-09-12 15:18:50 +08:00
|
|
|
|
//
|
2025-04-29 15:10:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// public override void OnAwake()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// base.OnAwake();
|
|
|
|
|
|
// _GetComponents();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public override void OnStart()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// base.OnStart();
|
|
|
|
|
|
// _GetComponents();
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// public override void SetData(object data)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// uiheadInfo = data as UIHeadInfo;
|
|
|
|
|
|
// if (uiheadInfo == null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// DebugUtil.LogError($"{name} SetData data is null!!! ");
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// uid = uiheadInfo.Uid;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _GetComponents()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// root = gameObject;
|
|
|
|
|
|
// imgBg = _GetComponent<Image>("Content/ImageBg");
|
|
|
|
|
|
// imgTeamProBg = _GetComponent<Image>("Content/ImageJob");
|
|
|
|
|
|
// imgTeamProName = _GetComponent<Image>("Content/ImageJob/ImageName");
|
|
|
|
|
|
// imgHead = _GetComponent<Image>("Content/ImageHead");
|
|
|
|
|
|
// imgPro = _GetComponent<Image>("Content/ImageProfession/Image_Job");
|
|
|
|
|
|
// imgMorale = _GetComponent<Image>("Content/FightContent/ImageMoraleStatusBar");
|
|
|
|
|
|
// imgStateInBattle = _GetComponent<Image>("Content/FightContent/ImageState");
|
|
|
|
|
|
// imgMoraleFill = _GetComponent<Image>("Content/FightContent/ImageMoraleStatusBar/ImageBattleMorale");
|
|
|
|
|
|
// imgRarity = _GetComponent<Image>("Content/ImageRarity");
|
|
|
|
|
|
// txtLevel = _GetComponent<TMP_Text>("Content/TextLevel");
|
|
|
|
|
|
// txtName = _GetComponent<TMP_Text>("Content/TextName");
|
|
|
|
|
|
// imgSelect = _GetComponent<Image>("Content/ImageSelected");
|
|
|
|
|
|
// GoPro = _FindObj("Content/ImageProfession");
|
|
|
|
|
|
// txtLeadership = _GetComponent<TMP_Text>("Content/Image_CostBg/Text_CommandCost");
|
|
|
|
|
|
//
|
|
|
|
|
|
// CostLeadershipGo = _FindObj("Content/Image_CostBg");
|
|
|
|
|
|
// contentFight = transform.Find("Content/FightContent").gameObject;
|
|
|
|
|
|
// buttonUpDrag = buttonHead.GetComponent<ButtonUpDrag>();
|
|
|
|
|
|
//
|
|
|
|
|
|
// // For Team Edit
|
|
|
|
|
|
// LevelGoForEditTeam = _FindObj("Content/Image_LevelBg");
|
|
|
|
|
|
// txtLevelForEditTeam = _GetComponent<TMP_Text>("Content/Image_LevelBg/TextLevel");
|
|
|
|
|
|
//
|
|
|
|
|
|
// //Debug
|
|
|
|
|
|
// _debugContent = transform.Find("Debug").gameObject;
|
|
|
|
|
|
// _debugRoleID = _GetComponent<TMP_Text>("Debug/RoleID");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public void GetComponents()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _GetComponents();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// #region Refresh
|
|
|
|
|
|
//
|
|
|
|
|
|
// public void Refresh(bool isAsync = true)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (isAsync)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _RefreshAsync();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _Refresh();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// _RefreshCostLeadership();
|
|
|
|
|
|
//
|
|
|
|
|
|
// _RefreshCommon();
|
|
|
|
|
|
// _BindClickCb();
|
|
|
|
|
|
//
|
|
|
|
|
|
// _RefreshDebug();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _Refresh()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.IsFight)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// contentFight.SetActive(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// _RefreshHead();
|
|
|
|
|
|
// _RefreshProfession();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private async void _RefreshAsync()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.IsFight)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!contentFight)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// contentFight = transform.Find("Content/FightContent").gameObject;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// contentFight.SetActive(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// _RefreshHeadAsync();
|
|
|
|
|
|
// _RefreshProfessionAsync();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 异步方法
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// private async void _RefreshHeadAsync()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!uiheadInfo.IsShowHead)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgHead.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// imgHead.gameObject.SetActive(true);
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (!uiheadInfo.IsAutoSetHead) return;
|
|
|
|
|
|
// if (!ValueValidator.IsIdValid(uid)) return;
|
|
|
|
|
|
// var characterInfo = CharacterDataInfoManager.Instance.GetCharacterInfo(uid);
|
|
|
|
|
|
// var spritePath = CommonUtils.GetCharacterPicPath((int)uid, CommonUtils.ECharacterPicPathType.HeadPic,
|
|
|
|
|
|
// (int)characterInfo.SkinID, uiheadInfo.IsCommander);//CommonUtils.GetDefaultHeadPathByUid(uid);
|
|
|
|
|
|
// var sprite = await LoadAssetAsync<Sprite>(spritePath);
|
|
|
|
|
|
// if (sprite)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgHead.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private async void _RefreshProfessionAsync()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.IsShowPro)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GoPro.SetActive(true);
|
|
|
|
|
|
// var job = CommonUtils.GetProfessionByUid(uid);
|
|
|
|
|
|
// var jobData = TableManager.Instance.Tables.JobAttri.GetOrDefault((int)job);
|
|
|
|
|
|
// var spritePath = jobData.IconPath;
|
|
|
|
|
|
// var sprite = await LoadAssetAsync<Sprite>(spritePath);
|
|
|
|
|
|
// if (sprite)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgPro.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GoPro.SetActive(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 同步方法
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// private void _RefreshHead()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!uiheadInfo.IsShowHead)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgHead.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// imgHead.gameObject.SetActive(true);
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (!uiheadInfo.IsAutoSetHead) return;
|
|
|
|
|
|
// if (!ValueValidator.IsIdValid(uid)) return;
|
|
|
|
|
|
//
|
|
|
|
|
|
// var config = CharacterDataInfoManager.Instance.GetCharacterInfo(uid);
|
|
|
|
|
|
// var spritePath = CommonUtils.GetCharacterPicPath((int)uid, CommonUtils.ECharacterPicPathType.HeadPic, (int)config.SkinID);//CommonUtils.GetDefaultHeadPathByUid(uid);
|
|
|
|
|
|
// var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(spritePath);
|
|
|
|
|
|
// if (sprite)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgHead.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _RefreshCostLeadership()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.IsShowLeadership)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// CostLeadershipGo.SetActive(true);
|
|
|
|
|
|
// var leadership = CharacterDataInfoManager.Instance.GetSpendLeadership(uid);
|
|
|
|
|
|
// txtLeadership.text = leadership.ToString();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// CostLeadershipGo.SetActive(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _RefreshProfession()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.IsShowPro)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GoPro.gameObject.SetActive(true);
|
|
|
|
|
|
// var job = CommonUtils.GetProfessionByUid(uid);
|
|
|
|
|
|
// var jobData = TableManager.Instance.Tables.JobAttri.GetOrDefault((int)job);
|
|
|
|
|
|
// var spritePath = jobData.IconPath;
|
|
|
|
|
|
// var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(spritePath);
|
|
|
|
|
|
// if (sprite)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgPro.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GoPro.SetActive(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 共有的显示刷新逻辑
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// private void _RefreshCommon()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _RefreshRarity();
|
|
|
|
|
|
// _RefreshLevel();
|
|
|
|
|
|
// _RefreshName();
|
|
|
|
|
|
// _RefreshBg();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _RefreshBg()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgBg.gameObject.SetActive(uiheadInfo.IsShowBg);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// private void _RefreshRarity()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgRarity.gameObject.SetActive(uiheadInfo.IsShowRarity);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _RefreshName()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!uiheadInfo.IsShowName)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// txtName.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// txtName.gameObject.SetActive(true);
|
|
|
|
|
|
// if (!ValueValidator.IsIdValid(uid)) return;
|
|
|
|
|
|
//
|
|
|
|
|
|
// var data = TableManager.Instance.Tables.CharacterAttri.GetOrDefault((int)uid);
|
|
|
|
|
|
// if (data != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// txtName.text = CommonUtils.GetCharacterName(data.RoleID); //CommonUtils.GetLocalizeText(data.Name);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //绑定点击回调
|
|
|
|
|
|
// private void _BindClickCb()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (buttonLongPress != null && uiheadInfo.LongPress != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// buttonLongPress.onLongPress = uiheadInfo.LongPress;
|
|
|
|
|
|
// if (uiheadInfo.ClickCb is Action action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// buttonLongPress.onClick = action;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if(uiheadInfo.ClickCb is Action action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ClearBind(buttonHead);
|
|
|
|
|
|
// BindButton(buttonHead, action);
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _RefreshLevel()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!uiheadInfo.IsShowLevel && !uiheadInfo.IsShowNewLevel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// LevelGoForEditTeam.SetActive(false);
|
|
|
|
|
|
// txtLevel.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (uiheadInfo.IsShowLevel && !uiheadInfo.IsShowNewLevel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// txtLevel.gameObject.SetActive(true);
|
|
|
|
|
|
// LevelGoForEditTeam.gameObject.SetActive(false);
|
|
|
|
|
|
// if (CharacterDataInfoManager.Instance.DataDic.TryGetValue(uid, out var charInfo))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// txtLevel.text = "LV " + charInfo.Level;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (uiheadInfo.IsShowLevel && uiheadInfo.IsShowNewLevel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// txtLevel.gameObject.SetActive(false);
|
|
|
|
|
|
// LevelGoForEditTeam.gameObject.SetActive(true);
|
|
|
|
|
|
// if (CharacterDataInfoManager.Instance.DataDic.TryGetValue(uid, out var charInfo))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// txtLevelForEditTeam.text = charInfo.Level.ToString();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置点击回调的参数
|
|
|
|
|
|
// public void SetClickCbParam<T>(T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.ClickCb != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ClearBind(buttonHead);
|
|
|
|
|
|
// var clickCb = uiheadInfo.ClickCb;
|
|
|
|
|
|
// if (clickCb is Action<T> action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// BindButton(buttonHead, action, param);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置点击回调的参数
|
|
|
|
|
|
// public void SetClickCbParam<T,TK>(T param1,TK param2)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (uiheadInfo.ClickCb != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ClearBind(buttonHead);
|
|
|
|
|
|
// var clickCb = uiheadInfo.ClickCb;
|
|
|
|
|
|
// if (clickCb is Action<T,TK> action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// BindButton(buttonHead, action, param1, param2);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 提供手动设置头像接口
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// /// <param name="isAsync"></param>
|
|
|
|
|
|
// public void SetHeadImage(bool isAsync = true)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!uiheadInfo.IsShowHead)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgHead.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (!ValueValidator.IsIdValid(uid)) return;
|
|
|
|
|
|
//
|
|
|
|
|
|
// imgHead.gameObject.SetActive(true);
|
|
|
|
|
|
// if (isAsync)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _RefreshHeadAsync();
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// _RefreshHead();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public async void SetHeadImageAsync(string spritePath)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// var sprite = await LoadAssetAsync<Sprite>(spritePath);
|
|
|
|
|
|
// imgHead.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public void SetHeadImage(string spritePath)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(spritePath);
|
|
|
|
|
|
// imgHead.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public void SetActive(bool active = true)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// root.SetActive(active);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置背景
|
|
|
|
|
|
// public void SetBgImage(string spritePath, bool isAsync = true)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (!uiheadInfo.IsShowBg)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgBg.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if(string.IsNullOrEmpty(spritePath))
|
|
|
|
|
|
// return;
|
|
|
|
|
|
//
|
|
|
|
|
|
// imgBg.gameObject.SetActive(true);
|
|
|
|
|
|
// if (isAsync)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _SetBgImageAsync(spritePath);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// _SetBgImage(spritePath);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public void HideTeamProBg()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgTeamProBg.gameObject.SetActive(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public void SetTeamBgImage(string spritePath, string proPath, bool isAsync = true)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (string.IsNullOrEmpty(spritePath) || string.IsNullOrEmpty(proPath))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// imgTeamProBg.gameObject.SetActive(false);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// imgTeamProBg.gameObject.SetActive(true);
|
|
|
|
|
|
// if (isAsync)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _SetTeamBgImageAsync(spritePath, proPath);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// _SetTeamBgImage(spritePath, proPath);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private async void _SetBgImageAsync(string spritePath)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var sprite = await LoadAssetAsync<Sprite>(spritePath);
|
|
|
|
|
|
// imgBg.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _SetBgImage(string spritePath)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(spritePath);
|
|
|
|
|
|
// imgBg.sprite = sprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private async void _SetTeamBgImageAsync(string spritePath, string proPath)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var sprite = await LoadAssetAsync<Sprite>(spritePath);
|
|
|
|
|
|
// var proSprite = await LoadAssetAsync<Sprite>(proPath);
|
|
|
|
|
|
// imgTeamProBg.sprite = sprite;
|
|
|
|
|
|
// imgTeamProName.sprite = proSprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void _SetTeamBgImage(string spritePath, string proPath)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(spritePath);
|
|
|
|
|
|
// var proSprite = AssetManager.Instance.GetPreLoadResult<Sprite>(proPath);
|
|
|
|
|
|
// imgTeamProBg.sprite = sprite;
|
|
|
|
|
|
// imgTeamProName.sprite = proSprite;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 刷新debug部分
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// protected virtual void _RefreshDebug()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _debugRoleID.text = "ID:" + uid;
|
|
|
|
|
|
// _debugContent.gameObject.SetActive(DisplayIDForCeHua.IsDisplayID);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
//
|
|
|
|
|
|
// #region Events
|
|
|
|
|
|
//
|
|
|
|
|
|
// protected virtual void _OnDebugRoleID()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _RefreshDebug();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
//
|
|
|
|
|
|
// /***************** 外部拓展接口,可继承重写 ******************/
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 刷新整个Item
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// /// <param name="id"></param> 角色uid
|
|
|
|
|
|
// /// <param name="isOnfight"></param> 是否是上阵列表Item
|
|
|
|
|
|
// public virtual void RefreshHeadItem(uint id, bool isOnfight = false)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //选中时上移
|
|
|
|
|
|
// public virtual void RefreshSelect(bool isSelect = false)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemClick(Action action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemClick<T>(Action<T> action, T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //action?.Invoke(param);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemClick<T, D>(Action<T, D> action, T param0, D param1)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //action?.Invoke(param);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemLongPress(Action action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemLongPress<T>(Action<T> action, T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemPointerUp(Action action)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemUpDrag<T>(Action<T> action, T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemStartDrag<T>(Action<T> action, T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemEndDrag<T>(Action<T> action, T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void BindItemOnDrag<T>(Action<T> action, T param)
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void RemoveAllClickListener(ButtonUpDrag button)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //button.RemoveAllListener();
|
|
|
|
|
|
// button.RemoveAll();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// public virtual void RemoveClickListener()
|
|
|
|
|
|
// {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
/***************** 外部拓展接口 End ******************/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class UIHeadInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
private uint _uid; //角色ID
|
|
|
|
|
|
private bool _isFight; //是否战斗中使用
|
|
|
|
|
|
private bool _isSelect; //是否选中
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsShowPro; //是否显示职业
|
|
|
|
|
|
public bool IsShowName; //是否显示名字
|
|
|
|
|
|
public bool IsShowRarity; //是否显示品质
|
|
|
|
|
|
public bool IsShowLevel; //是否显示等级
|
|
|
|
|
|
public bool IsShowHead = true; //是否显示头像
|
|
|
|
|
|
public bool IsShowBg = true; //是否显示背景
|
2025-05-28 15:24:42 +08:00
|
|
|
|
public bool IsShowFaction = false; //是否显示地区
|
2025-04-29 15:10:33 +08:00
|
|
|
|
public Delegate ClickCb; //点击回调,如果有参数,调用node的SetClickCbParam传参
|
|
|
|
|
|
public Action LongPress; //长按点击
|
|
|
|
|
|
|
|
|
|
|
|
// 针对编队中的头像
|
|
|
|
|
|
public bool IsShowLeadership; //是否是编队中的
|
|
|
|
|
|
public bool IsShowNewLevel; //是否展示新等级
|
|
|
|
|
|
public bool IsCommander; //是否是为指挥官头像
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsAutoSetHead = true; //是否自动设置头像图片
|
|
|
|
|
|
|
|
|
|
|
|
public uint Uid => _uid;
|
|
|
|
|
|
public bool IsFight => _isFight;
|
|
|
|
|
|
public bool IsSelect => _isSelect;
|
|
|
|
|
|
public UIHeadInfo(uint uid, bool isFight, Delegate clickCb, Action longPress = null, bool isSelect = false, bool isShowHead = true,
|
|
|
|
|
|
bool isShowPro = true, bool isShowName = true, bool isShowRarity = true, bool isShowLevel = true,
|
2025-05-28 15:24:42 +08:00
|
|
|
|
bool isShowLeadership = false, bool isShowNewLevel = false, bool isCommander = false, bool isShowFaction = false)
|
2025-04-29 15:10:33 +08:00
|
|
|
|
{
|
|
|
|
|
|
_uid = uid;
|
|
|
|
|
|
_isFight = isFight;
|
|
|
|
|
|
ClickCb = clickCb;
|
|
|
|
|
|
LongPress = longPress;
|
|
|
|
|
|
_isSelect = isSelect;
|
|
|
|
|
|
IsShowPro = isShowPro;
|
|
|
|
|
|
IsShowName = isShowName;
|
|
|
|
|
|
IsShowRarity = isShowRarity;
|
|
|
|
|
|
IsShowHead = isShowHead;
|
|
|
|
|
|
IsShowLevel = isShowLevel;
|
|
|
|
|
|
IsShowLeadership = isShowLeadership;
|
|
|
|
|
|
IsShowNewLevel = isShowNewLevel;
|
|
|
|
|
|
IsCommander = isCommander;
|
2025-05-28 15:24:42 +08:00
|
|
|
|
IsShowFaction = isShowFaction;
|
2025-04-29 15:10:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public UIHeadInfo(uint uid, bool isFight)
|
|
|
|
|
|
{
|
|
|
|
|
|
_uid = uid;
|
|
|
|
|
|
_isFight = isFight;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public UIHeadInfo(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
_uid = uid;
|
|
|
|
|
|
_isFight = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetIsSelect(bool isSelect)
|
|
|
|
|
|
{
|
|
|
|
|
|
_isSelect = isSelect;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|