【拆分Mono】提交UINode部分子类修改
parent
5606320219
commit
074ab30011
|
|
@ -9,6 +9,8 @@ using Object = UnityEngine.Object;
|
|||
public class UINode: MonoBehaviour
|
||||
{
|
||||
protected List<string> LoadedAssets = new List<string>();
|
||||
protected bool isAutoCraete = true;
|
||||
//private UINodeLogic _nodeLogic;
|
||||
public static UINode LoadNode()
|
||||
{
|
||||
return null;
|
||||
|
|
@ -16,11 +18,16 @@ public class UINode: MonoBehaviour
|
|||
|
||||
protected void ClearBind(Button button)
|
||||
{
|
||||
button.onClick.RemoveAllListeners();
|
||||
if (button)
|
||||
{
|
||||
button.onClick.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
protected void BindButton(Button button, Action func)
|
||||
{
|
||||
if (!button)
|
||||
return;
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
func?.Invoke();
|
||||
|
|
@ -29,6 +36,8 @@ public class UINode: MonoBehaviour
|
|||
|
||||
protected void BindButton<T>(Button button, Action<T> func, T param)
|
||||
{
|
||||
if (!button)
|
||||
return;
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
func?.Invoke(param);
|
||||
|
|
@ -37,6 +46,8 @@ public class UINode: MonoBehaviour
|
|||
|
||||
protected void BindButton<T,TK>(Button button, Action<T,TK> func, T param1, TK param2)
|
||||
{
|
||||
if (!button)
|
||||
return;
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
func?.Invoke(param1, param2);
|
||||
|
|
@ -45,6 +56,12 @@ public class UINode: MonoBehaviour
|
|||
|
||||
protected T _GetComponent<T>(string path) where T: Behaviour
|
||||
{
|
||||
if (!transform)
|
||||
return null;
|
||||
if (!transform.Find(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var compGo = transform.Find(path).gameObject;
|
||||
if (compGo)
|
||||
{
|
||||
|
|
@ -57,6 +74,10 @@ public class UINode: MonoBehaviour
|
|||
|
||||
protected GameObject _FindObj(string path)
|
||||
{
|
||||
if (!transform.Find(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var compGo = transform.Find(path).gameObject;
|
||||
if (compGo)
|
||||
{
|
||||
|
|
@ -77,11 +98,19 @@ public class UINode: MonoBehaviour
|
|||
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
OnAwake();
|
||||
}
|
||||
|
||||
|
||||
public virtual void OnAwake()
|
||||
{
|
||||
|
||||
if (isAutoCraete)
|
||||
{
|
||||
//_nodeLogic = UIManager.Instance.CreateNewNode(this);
|
||||
}
|
||||
}
|
||||
public virtual void OnStart()
|
||||
{
|
||||
|
|
@ -90,7 +119,7 @@ public class UINode: MonoBehaviour
|
|||
|
||||
public virtual void OnUpdate()
|
||||
{
|
||||
|
||||
//_nodeLogic.OnUpdate();
|
||||
}
|
||||
|
||||
public virtual void SetData(object data)
|
||||
|
|
@ -108,6 +137,11 @@ public class UINode: MonoBehaviour
|
|||
|
||||
}
|
||||
|
||||
public virtual void Destroy()
|
||||
{
|
||||
//UIManager.Instance.DestroyNode(_nodeLogic);
|
||||
}
|
||||
|
||||
public virtual void OnRelease()
|
||||
{
|
||||
for (int i = 0; i < LoadedAssets.Count; i++)
|
||||
|
|
@ -882,6 +882,24 @@ public abstract class UIWindow
|
|||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
public T AddComponent<T>(string path = "") where T : Behaviour
|
||||
{
|
||||
var trans = transform.Find(path);
|
||||
if (trans)
|
||||
{
|
||||
var component = trans.GetComponent<T>();
|
||||
if (component == null)
|
||||
{
|
||||
component = trans.gameObject.AddComponent<T>();
|
||||
//DebugUtil.LogError("{0}未找到组件{1}: {2}", mWindowName, typeof(T).Name, path);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
DebugUtil.LogError("{0}未找到路径: {1}", mWindowName, path);
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
public void HideWindow(bool isOnlyHide = false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: addf2cbf139c33949a0780c876dc8ba1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,673 @@
|
|||
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);
|
||||
//base.OnRelease();
|
||||
}
|
||||
|
||||
// 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; //是否显示背景
|
||||
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,
|
||||
bool isShowLeadership = false, bool isShowNewLevel = false, bool isCommander = false)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
//角色显示设置类
|
||||
public class UIHerosHeadItemNode : UIHeadItemNodeBase
|
||||
{
|
||||
public Image Image_BattleReady;
|
||||
//public Image Image_BattleReadyArrow;
|
||||
public Image Image_HP_BG;
|
||||
public Image Image_BattleHp;
|
||||
public Image Image_BattleArmor;
|
||||
//public Image Image_CharacteStatusBar;
|
||||
//public Image Image_CharacterShadow;
|
||||
public Image Image_SkillCDFull;
|
||||
public Image Image_HeadPic;
|
||||
public Image Image_professionSapper;
|
||||
public Image Image_StateRetreat;
|
||||
public Image Image_MoraleStatusBar;
|
||||
//public Image Image_StatusBarBlue;
|
||||
public Image Image_BattleMorale;
|
||||
public Button Button_CharacterPicRect;
|
||||
//public Image Image_Dead;
|
||||
public Image Image_Selected;
|
||||
public GameObject GameObject_HP;
|
||||
public GameObject Content;
|
||||
public TMP_Text Text_Number;
|
||||
public Image Image_Number;
|
||||
|
||||
public ButtonUpDrag ButtonEx_CharacterPicRect;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIVehicleHeadItemNode: UIHeadItemNodeBase
|
||||
{
|
||||
public Image Image_VehicleStatusBar;
|
||||
public Image Image_V_BattleHp;
|
||||
public Image Image_V_BattleArmor;
|
||||
//public Image Image_VehicleShadow;
|
||||
public Image Image_V_HeadPic;
|
||||
//public Image Image_V_profession;
|
||||
public Image Image_V_StateParalysis;
|
||||
public Image Image_V_MoraleStatusBar;
|
||||
//public Image Image_V_StatusBarBlue;
|
||||
//public Image Image_V_BattleMorale;
|
||||
public UIButtonEx Button_VehiclePicRect;
|
||||
public ButtonUpDrag ButtonUpDrag_VehiclePicRect;
|
||||
public Image Image_V_SkillCDFull;
|
||||
public Image Image_Selected;
|
||||
public Image Image_Order;
|
||||
public Image Image_BattleReady;
|
||||
public GameObject Content;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using cfg.CharacterCfg;
|
||||
using System;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
|
|
@ -7,10 +6,7 @@ using TMPro;
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// 角色及载具头像UI设置基类
|
||||
/// </summary>
|
||||
public class UIHeadItemNode : UINode
|
||||
public class UIHeadItemNodeLogic : UINode
|
||||
{
|
||||
protected uint uid;
|
||||
protected UIHeadInfo uiheadInfo;
|
||||
|
|
@ -64,7 +60,7 @@ public class UIHeadItemNode : UINode
|
|||
|
||||
public override void OnAwake()
|
||||
{
|
||||
base.OnAwake();
|
||||
//base.OnAwake();
|
||||
_GetComponents();
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +84,7 @@ public class UIHeadItemNode : UINode
|
|||
private void _GetComponents()
|
||||
{
|
||||
root = gameObject;
|
||||
var uiHeadNode = root.GetComponent<UIHeadItemNode>();
|
||||
imgBg = _GetComponent<Image>("Content/ImageBg");
|
||||
imgTeamProBg = _GetComponent<Image>("Content/ImageJob");
|
||||
imgTeamProName = _GetComponent<Image>("Content/ImageJob/ImageName");
|
||||
|
|
@ -102,17 +99,29 @@ public class UIHeadItemNode : UINode
|
|||
imgSelect = _GetComponent<Image>("Content/ImageSelected");
|
||||
GoPro = _FindObj("Content/ImageProfession");
|
||||
txtLeadership = _GetComponent<TMP_Text>("Content/Image_CostBg/Text_CommandCost");
|
||||
|
||||
if (uiHeadNode)
|
||||
{
|
||||
buttonHead = uiHeadNode.buttonHead;
|
||||
}
|
||||
|
||||
if (!buttonHead)
|
||||
{
|
||||
buttonHead = _GetComponent<Button>("Content/ButtonHead");
|
||||
}
|
||||
|
||||
CostLeadershipGo = _FindObj("Content/Image_CostBg");
|
||||
contentFight = transform.Find("Content/FightContent").gameObject;
|
||||
buttonUpDrag = buttonHead.GetComponent<ButtonUpDrag>();
|
||||
|
||||
contentFight = transform.Find("Content/FightContent")?.gameObject;
|
||||
if (buttonHead)
|
||||
{
|
||||
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;
|
||||
_debugContent = transform.Find("Debug")?.gameObject;
|
||||
_debugRoleID = _GetComponent<TMP_Text>("Debug/RoleID");
|
||||
}
|
||||
|
||||
|
|
@ -607,67 +616,4 @@ public class UIHeadItemNode : UINode
|
|||
{
|
||||
|
||||
}
|
||||
/***************** 外部拓展接口 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; //是否显示背景
|
||||
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,
|
||||
bool isShowLeadership = false, bool isShowNewLevel = false, bool isCommander = false)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 90184c6ffe4541adae27416d57a8d89c
|
||||
timeCreated: 1745837833
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
public class UIHeadItemNodeLogicBase: UIHeadItemNodeLogic
|
||||
{
|
||||
public override void OnAwake()
|
||||
{
|
||||
//base.OnAwake();
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
//base.OnAwake();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fa12b9de2f8d4e4aa800647bef29937f
|
||||
timeCreated: 1745906441
|
||||
|
|
@ -14,8 +14,7 @@ using TMPro;
|
|||
using Unity.Mathematics;
|
||||
using Constants = Framework.Constants;
|
||||
|
||||
//角色显示设置类
|
||||
public class UIHerosHeadItemNode : UIHeadItemNodeBase
|
||||
public class UIHerosHeadItemNodeLogic: UIHeadItemNodeLogicBase
|
||||
{
|
||||
public Image Image_BattleReady;
|
||||
//public Image Image_BattleReadyArrow;
|
||||
|
|
@ -40,7 +39,7 @@ public class UIHerosHeadItemNode : UIHeadItemNodeBase
|
|||
public Image Image_Number;
|
||||
|
||||
public ButtonUpDrag ButtonEx_CharacterPicRect;
|
||||
|
||||
|
||||
private bool isOnFight; //是否是战斗上阵Item
|
||||
private bool isSkillReady; //技能是否已准备
|
||||
|
||||
|
|
@ -63,6 +62,7 @@ public class UIHerosHeadItemNode : UIHeadItemNodeBase
|
|||
private bool m_isDanger = false;
|
||||
private void Awake()
|
||||
{
|
||||
_GetComponents();
|
||||
EventManager.Instance.Register(EventManager.EventName.LevelFightUIHPInit, (Action<Character>)OnFightDataInit);
|
||||
EventManager.Instance.Register(EventManager.EventName.INFIGHT_MORALE_STATE_CHANGED, (Action<EDMoraleStateChange>)OnActionStatusChange);
|
||||
EventManager.Instance.Register(EventManager.EventName.INFIGHT_MORALE_STATE_CHANGED, (Action<EDMoraleStateChange>)OnActionStatusChange);
|
||||
|
|
@ -73,10 +73,35 @@ public class UIHerosHeadItemNode : UIHeadItemNodeBase
|
|||
EventManager.Instance.Register(EventManager.EventName.INFIGHT_UNIT_DEAD, (Action<GameUnit>)OnCharacterDead);
|
||||
EventManager.Instance.Register(EventManager.EventName.DebugHeadRoleID, _OnDebugRoleID);
|
||||
|
||||
_debugContent = transform.Find("Button_CharacterPicRect/Debug").gameObject;
|
||||
_debugContent = transform.Find("Button_CharacterPicRect/Debug")?.gameObject;
|
||||
_debugRoleID = _GetComponent<TMP_Text>("Button_CharacterPicRect/Debug/RoleID");
|
||||
}
|
||||
|
||||
private void _GetComponents()
|
||||
{
|
||||
var uiHeadNode = gameObject.GetComponent<UIHerosHeadItemNode>();
|
||||
if (!uiHeadNode)
|
||||
return;
|
||||
Image_BattleReady = uiHeadNode.Image_BattleReady;
|
||||
Image_HP_BG = uiHeadNode.Image_HP_BG;
|
||||
Image_BattleHp = uiHeadNode.Image_BattleHp;
|
||||
Image_BattleArmor = uiHeadNode.Image_BattleArmor;
|
||||
Image_SkillCDFull = uiHeadNode.Image_SkillCDFull;
|
||||
Image_HeadPic = uiHeadNode.Image_HeadPic;
|
||||
Image_professionSapper = uiHeadNode.Image_professionSapper;
|
||||
Image_StateRetreat = uiHeadNode.Image_StateRetreat;
|
||||
Image_MoraleStatusBar = uiHeadNode.Image_MoraleStatusBar;
|
||||
Image_BattleMorale = uiHeadNode.Image_BattleMorale;
|
||||
Button_CharacterPicRect = uiHeadNode.Button_CharacterPicRect;
|
||||
Image_Selected = uiHeadNode.Image_Selected;
|
||||
GameObject_HP = uiHeadNode.GameObject_HP;
|
||||
Content = uiHeadNode.Content;
|
||||
Text_Number = uiHeadNode.Text_Number;
|
||||
Image_Number = uiHeadNode.Image_Number;
|
||||
|
||||
ButtonEx_CharacterPicRect = uiHeadNode.ButtonEx_CharacterPicRect;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
EventManager.Instance.Unregister(EventManager.EventName.LevelFightUIHPInit, (Action<Character>)OnFightDataInit);
|
||||
|
|
@ -798,5 +823,4 @@ public class UIHerosHeadItemNode : UIHeadItemNodeBase
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2e6e8ac7a254a1f99a1eda47cef664a
|
||||
timeCreated: 1745906243
|
||||
|
|
@ -275,11 +275,25 @@ public class UITeamFightController : UIWindow
|
|||
go.name = i.ToString();
|
||||
go.SetActiveEx(true);
|
||||
|
||||
var nodeComp = go.GetComponent<UIHeadItemNodeBase>();
|
||||
nodeComp.RefreshHeadItem(waitIDList[i]);
|
||||
nodeComp.BindItemClick(OnClickSelectWaitItem, waitIDList[i]);
|
||||
var uiHeadNode = go.GetComponent<UIHeadItemNodeBase>();
|
||||
if (uiHeadNode)
|
||||
{
|
||||
if (charac?.Type == TeamUnitInfo.CharacType.Hero)
|
||||
{
|
||||
if(!go.GetComponent<UIHerosHeadItemNodeLogic>())
|
||||
go.AddComponent<UIHerosHeadItemNodeLogic>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!go.GetComponent<UIVehicleHeadItemNodeLogic>())
|
||||
go.AddComponent<UIVehicleHeadItemNodeLogic>();
|
||||
}
|
||||
var nodeComp = go.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
nodeComp.RefreshHeadItem(waitIDList[i]);
|
||||
nodeComp.BindItemClick(OnClickSelectWaitItem, waitIDList[i]);
|
||||
|
||||
nodeComp.BindItemUpDrag(OnItemStartDrag, waitIDList[i]);
|
||||
nodeComp.BindItemUpDrag(OnItemStartDrag, waitIDList[i]);
|
||||
}
|
||||
//nodeComp.BindItemOnDrag(OnItemDrag, waitIDList[i]);
|
||||
//nodeComp.BindItemEndDrag(OnItemEndDrag, waitIDList[i]);
|
||||
|
||||
|
|
@ -338,8 +352,23 @@ public class UITeamFightController : UIWindow
|
|||
go.name = i.ToString();
|
||||
go.SetActiveEx(true);
|
||||
|
||||
var nodeComp = go.GetComponent<UIHeadItemNodeBase>();
|
||||
nodeComp.RefreshHeadItem(onFightList[i], true);
|
||||
var uiHeadNode = go.GetComponent<UIHeadItemNodeBase>();
|
||||
if (uiHeadNode)
|
||||
{
|
||||
if (charac?.Type == TeamUnitInfo.CharacType.Hero)
|
||||
{
|
||||
if(!go.GetComponent<UIHerosHeadItemNodeLogic>())
|
||||
go.AddComponent<UIHerosHeadItemNodeLogic>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!go.GetComponent<UIVehicleHeadItemNodeLogic>())
|
||||
go.AddComponent<UIVehicleHeadItemNodeLogic>();
|
||||
}
|
||||
var nodeComp = go.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
nodeComp.RefreshHeadItem(onFightList[i], true);
|
||||
}
|
||||
|
||||
bool isFightStory = false;
|
||||
var level = LevelManager.Instance.CurrentLevel;
|
||||
if (level != null)
|
||||
|
|
@ -349,7 +378,11 @@ public class UITeamFightController : UIWindow
|
|||
|
||||
if (!isFightStory)
|
||||
{
|
||||
nodeComp.BindItemClick(OnClickSelectFightItem, onFightList[i]);
|
||||
if (uiHeadNode)
|
||||
{
|
||||
var nodeComp = go.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
nodeComp.BindItemClick(OnClickSelectFightItem, onFightList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var rectTransform = go.GetComponent<RectTransform>();
|
||||
|
|
@ -411,12 +444,28 @@ public class UITeamFightController : UIWindow
|
|||
GameObject go = Instantiate(goItem);
|
||||
go.name = i.ToString();
|
||||
go.SetActiveEx(true);
|
||||
var nodeComp = go.GetComponent<UIHeadItemNodeBase>();
|
||||
nodeComp.RefreshHeadItem(onFightList[i], true);
|
||||
nodeComp.RemoveClickListener();
|
||||
nodeComp.BindItemUpDrag(OnMoveUpFightSkill, onFightList[i]);
|
||||
nodeComp.BindItemPointerUp(OnPointerUpFightSkill);
|
||||
nodeComp.BindItemClick(OnClickFightItemInBattle, onFightList[i]);
|
||||
var uiHeadNode = go.GetComponent<UIHeadItemNodeBase>();
|
||||
if (uiHeadNode)
|
||||
{
|
||||
UIHeadItemNodeLogicBase nodeComp;
|
||||
if (charac?.Type == TeamUnitInfo.CharacType.Hero)
|
||||
{
|
||||
if(!go.GetComponent<UIHerosHeadItemNodeLogic>())
|
||||
go.AddComponent<UIHerosHeadItemNodeLogic>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!go.GetComponent<UIVehicleHeadItemNodeLogic>())
|
||||
go.AddComponent<UIVehicleHeadItemNodeLogic>();
|
||||
}
|
||||
|
||||
nodeComp = go.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
nodeComp.RefreshHeadItem(onFightList[i], true);
|
||||
nodeComp.RemoveClickListener();
|
||||
nodeComp.BindItemUpDrag(OnMoveUpFightSkill, onFightList[i]);
|
||||
nodeComp.BindItemPointerUp(OnPointerUpFightSkill);
|
||||
nodeComp.BindItemClick(OnClickFightItemInBattle, onFightList[i]);
|
||||
}
|
||||
|
||||
var rectTransform = go.GetComponent<RectTransform>();
|
||||
rectTransform.SetParent(contentTrans);
|
||||
|
|
@ -676,9 +725,7 @@ public class UITeamFightController : UIWindow
|
|||
//监听战斗阶段改变
|
||||
private void OnListenToFightStateChange()
|
||||
{
|
||||
Refresh();
|
||||
//ClearSelectFight();
|
||||
//BackReserve();
|
||||
//Refresh();
|
||||
TeamManager.Instance.SetSelectID();
|
||||
LevelManager.Instance.CurrentLevel.UnSelectUnit();
|
||||
}
|
||||
|
|
@ -1349,8 +1396,8 @@ public class UITeamFightController : UIWindow
|
|||
{
|
||||
return selectFightUid == id;
|
||||
});
|
||||
var comp = m_fightItemList[oriIdx].GetComponent<UIHeadItemNodeBase>();
|
||||
comp.RefreshSelect();
|
||||
var comp = m_fightItemList[oriIdx].GetComponent<UIHeadItemNodeLogicBase>();
|
||||
comp?.RefreshSelect();
|
||||
}
|
||||
|
||||
int idx = fightIDList.FindIndex((uint id)=>
|
||||
|
|
@ -1363,9 +1410,9 @@ public class UITeamFightController : UIWindow
|
|||
{
|
||||
SetSelectFightUid(uid);
|
||||
|
||||
var comp = m_fightItemList[idx].GetComponent<UIHeadItemNodeBase>();
|
||||
var comp = m_fightItemList[idx].GetComponent<UIHeadItemNodeLogicBase>();
|
||||
LevelManager.Instance.CurrentLevel.SelectUnit(uid);
|
||||
comp.RefreshSelect(true);
|
||||
comp?.RefreshSelect(true);
|
||||
|
||||
//GameObj_SkillInfo.SetActiveEx(true);
|
||||
}
|
||||
|
|
@ -1373,9 +1420,9 @@ public class UITeamFightController : UIWindow
|
|||
{
|
||||
SetSelectFightUid(uid);
|
||||
TeamManager.Instance.SelectToWait(selectFightUid);
|
||||
var comp = m_fightItemList[idx].GetComponent<UIHeadItemNodeBase>();
|
||||
var comp = m_fightItemList[idx].GetComponent<UIHeadItemNodeLogicBase>();
|
||||
LevelManager.Instance.CurrentLevel.SelectUnit(uid);
|
||||
comp.RefreshSelect(true);
|
||||
comp?.RefreshSelect(true);
|
||||
}
|
||||
else if (selectFightUid == uid)
|
||||
{
|
||||
|
|
@ -1553,8 +1600,8 @@ public class UITeamFightController : UIWindow
|
|||
{
|
||||
TeamManager.Instance.SetSelectID(uid);
|
||||
selectFightUid = uid;
|
||||
var comp = m_fightItemList[idx].GetComponent<UIHeadItemNodeBase>();
|
||||
comp.RefreshSelect(true);
|
||||
var comp = m_fightItemList[idx].GetComponent<UIHeadItemNodeLogicBase>();
|
||||
comp?.RefreshSelect(true);
|
||||
|
||||
//载具上有人时选中后弹出下面的角色栏
|
||||
var vehicle = GameUnitManager.instance.infightUnits.Search(uid);
|
||||
|
|
@ -1880,8 +1927,8 @@ public class UITeamFightController : UIWindow
|
|||
//GameObj_SkillInfo.SetActiveEx(false);
|
||||
foreach (var go in m_fightItemList)
|
||||
{
|
||||
var comp = go.GetComponent<UIHeadItemNodeBase>();
|
||||
comp.RefreshSelect();
|
||||
var comp = go.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
comp?.RefreshSelect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1890,14 +1937,14 @@ public class UITeamFightController : UIWindow
|
|||
foreach (var go in m_waitItemList)
|
||||
{
|
||||
int index = m_waitItemList.IndexOf(go);
|
||||
var comp = go.GetComponent<UIHeadItemNodeBase>();
|
||||
var comp = go.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
if (idx >= 0 && index == idx)
|
||||
{
|
||||
comp.RefreshSelect(true);
|
||||
comp?.RefreshSelect(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
comp.RefreshSelect();
|
||||
comp?.RefreshSelect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1914,14 +1961,14 @@ public class UITeamFightController : UIWindow
|
|||
{
|
||||
for (int i = 0; i < m_fightItemList.Count; i++)
|
||||
{
|
||||
var comp = m_fightItemList[i].GetComponent<UIHeadItemNodeBase>();
|
||||
var comp = m_fightItemList[i].GetComponent<UIHeadItemNodeLogicBase>();
|
||||
if (idx == i)
|
||||
{
|
||||
comp.RefreshSelect(true);
|
||||
comp?.RefreshSelect(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
comp.RefreshSelect();
|
||||
comp?.RefreshSelect();
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -1929,8 +1976,8 @@ public class UITeamFightController : UIWindow
|
|||
|
||||
foreach (var item in m_fightItemList)
|
||||
{
|
||||
var comp = item.GetComponent<UIHeadItemNodeBase>();
|
||||
comp.RefreshSelect();
|
||||
var comp = item.GetComponent<UIHeadItemNodeLogicBase>();
|
||||
comp?.RefreshSelect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using Unity.Mathematics;
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIVehicleHeadItemNode: UIHeadItemNodeBase
|
||||
public class UIVehicleHeadItemNodeLogic: UIHeadItemNodeLogicBase
|
||||
{
|
||||
public Image Image_VehicleStatusBar;
|
||||
public Image Image_V_BattleHp;
|
||||
|
|
@ -92,7 +92,26 @@ public class UIVehicleHeadItemNode: UIHeadItemNodeBase
|
|||
action?.Invoke(param);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var uiHeadNode = gameObject.GetComponent<UIVehicleHeadItemNode>();
|
||||
if (!uiHeadNode)
|
||||
return;
|
||||
Image_VehicleStatusBar = uiHeadNode.Image_VehicleStatusBar;
|
||||
Image_V_BattleHp = uiHeadNode.Image_V_BattleHp;
|
||||
Image_V_BattleArmor = uiHeadNode.Image_V_BattleArmor;
|
||||
Image_V_HeadPic = uiHeadNode.Image_V_HeadPic;
|
||||
Image_V_StateParalysis = uiHeadNode.Image_V_StateParalysis;
|
||||
Image_V_MoraleStatusBar = uiHeadNode.Image_V_MoraleStatusBar;
|
||||
Button_VehiclePicRect = uiHeadNode.Button_VehiclePicRect;
|
||||
ButtonUpDrag_VehiclePicRect = uiHeadNode.ButtonUpDrag_VehiclePicRect;
|
||||
Image_V_SkillCDFull = uiHeadNode.Image_V_SkillCDFull;
|
||||
Image_Selected = uiHeadNode.Image_Selected;
|
||||
Image_Order = uiHeadNode.Image_Order;
|
||||
Image_BattleReady = uiHeadNode.Image_BattleReady;
|
||||
Content = uiHeadNode.Content;
|
||||
}
|
||||
//帧推刷新
|
||||
private void Update()
|
||||
{
|
||||
|
|
@ -117,6 +136,10 @@ public class UIVehicleHeadItemNode: UIHeadItemNodeBase
|
|||
//刷新整个头像Item
|
||||
public override void RefreshHeadItem(uint id, bool bOnFight = false)
|
||||
{
|
||||
if (LevelManager.Instance.CurrentLevel != null && !LevelManager.Instance.CurrentLevel.IsPreparing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
uid = id;
|
||||
isOnFight = bOnFight;
|
||||
TeamUnitInfo unitData = TeamManager.Instance.GetCharacterDataInfo(uid);
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 04dbb2b472c74334a47441f59372111f
|
||||
timeCreated: 1745906791
|
||||
|
|
@ -642,9 +642,10 @@ public class UIPassGameController : UIWindow
|
|||
var headNode = CommonUtils.GetComponent<UIHeadItemNode>(item, "HeadNode");
|
||||
if (headNode)
|
||||
{
|
||||
var headNodeLogic = headNode.gameObject.AddComponent<UIHeadItemNodeLogic>();
|
||||
var headInfo = new UIHeadInfo(uid);
|
||||
headNode.SetData(headInfo);
|
||||
headNode.Refresh(false);
|
||||
headNodeLogic.SetData(headInfo);
|
||||
headNodeLogic.Refresh(false);
|
||||
}
|
||||
|
||||
var imgPro = CommonUtils.GetComponent<Image>(item, "ImageProfessionRect/ImageProfession");
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class UI_PassGame_SweepController : UIWindow
|
|||
/// <summary>
|
||||
/// 角色头像节点
|
||||
/// </summary>
|
||||
private UIHeadItemNode headNode;
|
||||
private UIHeadItemNodeLogic headNode;
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
|
|
@ -82,7 +82,11 @@ public class UI_PassGame_SweepController : UIWindow
|
|||
|
||||
public HeroHead(GameObject root) : base(root)
|
||||
{
|
||||
headNode = GetComponent<UIHeadItemNode>("HeadNode");
|
||||
if (GetComponent<UIHeadItemNode>("HeadNode"))
|
||||
{
|
||||
headNode = AddComponent<UIHeadItemNodeLogic>("HeadNode");
|
||||
}
|
||||
|
||||
imageProfession = GetComponent<Image>("ImageProfessionRect/ImageProfession");
|
||||
imageExpProcess = GetComponent<Image>("ImageHeroEXpEmpty/ImageHeroEXpFull");
|
||||
imageLikely = GetComponent<Image>("ImageFavorate");
|
||||
|
|
|
|||
|
|
@ -750,14 +750,19 @@ public class UI_DefendSettingController : UIWindow
|
|||
IsShowPro = true,
|
||||
ClickCb = (Action<int>)_OnClickItem
|
||||
};
|
||||
uiHeadNode.SetData(headInfo);
|
||||
uiHeadNode.Refresh();
|
||||
uiHeadNode.SetClickCbParam(index);
|
||||
if (uiHeadNode.buttonHead)
|
||||
if (uiHeadNode)
|
||||
{
|
||||
uiHeadNode.buttonUpDrag.RemoveAll();
|
||||
uiHeadNode.buttonUpDrag.AddUpDrag(_OnDragStart, index);
|
||||
var uiHeadNodeLogic = uiHeadNode.gameObject.AddComponent<UIHeadItemNodeLogic>();
|
||||
uiHeadNodeLogic.SetData(headInfo);
|
||||
uiHeadNodeLogic.Refresh();
|
||||
uiHeadNodeLogic.SetClickCbParam(index);
|
||||
if (uiHeadNodeLogic.buttonHead)
|
||||
{
|
||||
uiHeadNodeLogic.buttonUpDrag.RemoveAll();
|
||||
uiHeadNodeLogic.buttonUpDrag.AddUpDrag(_OnDragStart, index);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void _RefreshVehicleItem(GameObject cell, int index)
|
||||
|
|
|
|||
|
|
@ -189,10 +189,10 @@ public class UI_TeamInfoController : UIWindow
|
|||
private Team _team;
|
||||
private Team _teamOld; //传进来的队伍 用于对比
|
||||
|
||||
private UIHeadItemNode _commanderHeadNode;
|
||||
private UIHeadItemNodeLogic _commanderHeadNode;
|
||||
private TriggerBoundsInfo _triggerBoundsInfo;
|
||||
private Dictionary<int, UIVehicleNode> _vehicleIds;
|
||||
private Dictionary<int, UIHeadItemNode> _headNodes;
|
||||
private Dictionary<int, UIHeadItemNodeLogic> _headNodes;
|
||||
private Dictionary<int, GameObject> _lockHeadNodes;
|
||||
private VehicleSound vehicleSound;
|
||||
|
||||
|
|
@ -208,9 +208,10 @@ public class UI_TeamInfoController : UIWindow
|
|||
|
||||
vehicleSound = new VehicleSound();
|
||||
_vehicleIds = new Dictionary<int, UIVehicleNode>();
|
||||
_headNodes = new Dictionary<int, UIHeadItemNode>();
|
||||
_headNodes = new Dictionary<int, UIHeadItemNodeLogic>();
|
||||
_lockHeadNodes = new Dictionary<int, GameObject>();
|
||||
_commanderHeadNode = GetComponent<UIHeadItemNode>("UI_AllChoose/Image_Leader");
|
||||
var commanderHeadNode = GetComponent<UIHeadItemNode>("UI_AllChoose/Image_Leader");
|
||||
_commanderHeadNode = commanderHeadNode.gameObject.AddComponent<UIHeadItemNodeLogic>();
|
||||
|
||||
BindButton(Button_Back, OnBackClick);
|
||||
BindButton(Button_Home, OnClickHome);
|
||||
|
|
@ -337,7 +338,7 @@ public class UI_TeamInfoController : UIWindow
|
|||
index = _vehicleIds.Count * 1;
|
||||
foreach (var unit in _team.GetAllCharactersButCommander())
|
||||
{
|
||||
var headNode = GetComponent<UIHeadItemNode>("UI_AllChoose/Image_Member" + index);
|
||||
var headNode = AddComponent<UIHeadItemNodeLogic>("UI_AllChoose/Image_Member" + index);
|
||||
headNode.GetComponents();
|
||||
_headNodes.Add(index, headNode);
|
||||
var lockHead = FindObj("UI_AllChoose/Image_MemberLock" + index);
|
||||
|
|
@ -349,7 +350,7 @@ public class UI_TeamInfoController : UIWindow
|
|||
{
|
||||
for (var i = 0; i < MaxCharacterCount; i++)
|
||||
{
|
||||
var headNode = GetComponent<UIHeadItemNode>("UI_AllChoose/Image_Member" + i);
|
||||
var headNode = AddComponent<UIHeadItemNodeLogic>("UI_AllChoose/Image_Member" + i);
|
||||
_headNodes.Add(i, headNode);
|
||||
var lockHead = FindObj("UI_AllChoose/Image_MemberLock" + i);
|
||||
_lockHeadNodes.Add(i, lockHead);
|
||||
|
|
@ -1487,7 +1488,7 @@ public class UI_TeamInfoController : UIWindow
|
|||
|
||||
#region 内部方法
|
||||
|
||||
private void CreateHeadInfo(UIHeadItemNode headItemNode, UIHeadInfo uiHeadInfo, int index, Ejob job,
|
||||
private void CreateHeadInfo(UIHeadItemNodeLogic headItemNode, UIHeadInfo uiHeadInfo, int index, Ejob job,
|
||||
string bgPath = "", string proNamePath = "")
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -263,8 +263,8 @@ public class UI_PVPSettlementController : UIWindow
|
|||
IsShowPro = true,
|
||||
IsShowRarity = true
|
||||
};
|
||||
headNode.SetData(headInfo);
|
||||
headNode.Refresh();
|
||||
//headNode.SetData(headInfo);
|
||||
//headNode.Refresh();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -93,11 +93,17 @@ public class UI_PatioController : UIWindow
|
|||
IsShowBg = false
|
||||
};
|
||||
UIHeadItemNode headItemNode = CommonUtils.GetComponent<UIHeadItemNode>(gameObject, "Head/UIHeadItemNode");
|
||||
headItemNode.GetComponents();
|
||||
headItemNode.SetData(uiHeadInfo);
|
||||
//headItemNode.SetClickCbParam(index);
|
||||
headItemNode.Refresh(false);
|
||||
|
||||
UIHeadItemNodeLogic uiHeadItemNodeLogic;
|
||||
if (headItemNode)
|
||||
{
|
||||
var go = headItemNode.gameObject;
|
||||
uiHeadItemNodeLogic = go.AddComponent<UIHeadItemNodeLogic>();
|
||||
uiHeadItemNodeLogic.GetComponents();
|
||||
uiHeadItemNodeLogic.SetData(uiHeadInfo);
|
||||
//headItemNode.SetClickCbParam(index);
|
||||
uiHeadItemNodeLogic.Refresh(false);
|
||||
}
|
||||
|
||||
CommonUtils.GetComponent<TMP_Text>(gameObject, "Price").text = normalShopData.price.ToString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d258cae8c21a6039f10c1e96bbb99fb34f07bb06
|
||||
Subproject commit dc8cb2a60826a50f5d754fb5381706f2139c5924
|
||||
Loading…
Reference in New Issue