指挥官技能选择界面
parent
a7d4deae08
commit
3c5e8052bc
|
|
@ -2807,7 +2807,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 1821, y: 981}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &8908203317343686215
|
||||
GameObject:
|
||||
|
|
|
|||
|
|
@ -11678,7 +11678,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &3997610456769359836
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ public partial class UIManager
|
|||
_WindowMeta(UINameConst.UI_DailyBonus, UIWindowLayer.Normal, UIOpenType.FullScreen, false, true);
|
||||
_WindowMeta(UINameConst.UI_CommandSkillCultivate, UIWindowLayer.Normal, UIOpenType.FullScreen, false, true);
|
||||
_WindowMeta(UINameConst.UI_TeamAndSkillSelect, UIWindowLayer.Normal, UIOpenType.FullScreen, false, true);
|
||||
_WindowMeta(UINameConst.UI_SelectSkillPanel, UIWindowLayer.Normal, UIOpenType.FullScreen);
|
||||
_WindowMeta(UINameConst.UICameraAndPosterChange, UIWindowLayer.Normal, UIOpenType.Pop, false, true);//FullScreen会导致调整看板娘操作时UI不显示
|
||||
_WindowMeta(UINameConst.UI_ItemCategory, UIWindowLayer.Normal, UIOpenType.FullScreen, false, true);
|
||||
_WindowMeta(UINameConst.UI_PlayerInfo, UIWindowLayer.Normal, UIOpenType.FullScreen, false, true);
|
||||
|
|
@ -339,6 +340,10 @@ public static class UINameConst
|
|||
/// 队伍选择和指挥官技能选择进入战斗界面
|
||||
/// </summary>
|
||||
public static readonly string UI_TeamAndSkillSelect = "CommandSkill/CommandAndTeamSelect/UI_TeamAndSkillSelect";
|
||||
/// <summary>
|
||||
/// 指挥官技能选择界面
|
||||
/// </summary>
|
||||
public static readonly string UI_SelectSkillPanel = "CommandSkill/CommandAndTeamSelect/SelectSkillPanel";
|
||||
|
||||
public static readonly string UI_DailyBonus = "Interface/UI_DailyBonus";
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// </summary>
|
||||
private Button buttonSelect;
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中的字体颜色
|
||||
/// </summary>
|
||||
|
|
@ -308,7 +308,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// 选中回调
|
||||
/// </summary>
|
||||
private readonly Action<PlayerSkillType> selectAction;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
|
|
@ -323,7 +323,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
text.color = NORMAL_FONT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 技能类型
|
||||
/// </summary>
|
||||
|
|
@ -331,19 +331,19 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
{
|
||||
get { return playerSkillType; }
|
||||
}
|
||||
|
||||
|
||||
public TabItem(GameObject root, PlayerSkillType playerSkillType, Action<PlayerSkillType> selectAction) : base(root, true)
|
||||
{
|
||||
this.playerSkillType = playerSkillType;
|
||||
this.selectAction = selectAction;
|
||||
|
||||
|
||||
goSelect = FindObj("ImageSelect");
|
||||
text = GetComponent<TMP_Text>("Text");
|
||||
buttonSelect = GoRoot.GetComponent<Button>();
|
||||
|
||||
|
||||
CommonUtils.BindButton(buttonSelect, OnClick);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
/// </summary>
|
||||
|
|
@ -352,7 +352,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
selectAction?.Invoke(playerSkillType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
|
|
@ -363,14 +363,14 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// </summary>
|
||||
private GameObject goSelect;
|
||||
private Button buttonSkill;
|
||||
|
||||
|
||||
private DataPlayerSkill skillData;
|
||||
private DataPlayerSkillUpgrade playerSkillData;
|
||||
/// <summary>
|
||||
/// 点击回调
|
||||
/// </summary>
|
||||
private readonly Action<int> clickAction;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
|
|
@ -378,41 +378,41 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
{
|
||||
set { goSelect.IsScaleShow(value); }
|
||||
}
|
||||
|
||||
|
||||
public DataPlayerSkill SkillData
|
||||
{
|
||||
get { return skillData; }
|
||||
}
|
||||
|
||||
|
||||
public DataPlayerSkillUpgrade PlayerSkillData
|
||||
{
|
||||
get { return playerSkillData; }
|
||||
}
|
||||
|
||||
|
||||
public SkillItem(GameObject root, Action<int> clickAction) : base(root)
|
||||
{
|
||||
this.clickAction = clickAction;
|
||||
|
||||
|
||||
goSelect = FindObj("ImageChooseRect");
|
||||
buttonSkill = GetComponent<Button>("ButtonSkillLogoS");
|
||||
|
||||
|
||||
CommonUtils.BindButton(buttonSkill, OnClick);
|
||||
}
|
||||
|
||||
|
||||
public void SetInfo(DataPlayerSkillUpgrade skillUpgradeData)
|
||||
{
|
||||
playerSkillData = skillUpgradeData;
|
||||
skillData = TableManager.Instance.Tables.PlayerSkillConfig.Get(playerSkillData.SkillID);
|
||||
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
|
||||
private void OnClick()
|
||||
{
|
||||
clickAction?.Invoke(playerSkillData.ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 关闭按钮
|
||||
|
|
@ -451,7 +451,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// </summary>
|
||||
private RawImage rawImageGaussianBlurMask;
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 页签列表
|
||||
/// </summary>
|
||||
|
|
@ -480,7 +480,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// 当前队伍技能索引
|
||||
/// </summary>
|
||||
private int curIndex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 以缩放判定是否显示
|
||||
/// </summary>
|
||||
|
|
@ -490,16 +490,16 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
{
|
||||
if (GoRoot.transform.localScale.x == 0f)
|
||||
return false;
|
||||
|
||||
|
||||
if (GoRoot.transform.localScale.y == 0f)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
GoRoot.IsScaleShow(value);
|
||||
|
||||
|
||||
// 缩放为0时,无限列表会计算错误,一直滑动
|
||||
if (value)
|
||||
scrollRect.enabled = true;
|
||||
|
|
@ -507,11 +507,11 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
scrollRect.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SelectSkillPanel(GameObject root, Action<int, int> selectSkill) : base(root)
|
||||
{
|
||||
selectSkillAction = selectSkill;
|
||||
|
||||
|
||||
buttonCancel = GetComponent<Button>("Button_Cancel");
|
||||
buttonConfirm = GetComponent<Button>("Button_Confirm");
|
||||
buttonClose = GetComponent<Button>("Image_BG/Button_Close");
|
||||
|
|
@ -521,11 +521,11 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
recycleView = GetComponent<RecycleView>("Image_BG/ScrollView");
|
||||
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
|
||||
scrollRect = recycleView.transform.GetComponent<ScrollRect>();
|
||||
|
||||
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_ConductTitle"), PlayerSkillType.Conduct, OnSelectTab));
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_AttackTitle"), PlayerSkillType.Attack, OnSelectTab));
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_SupportTitle"), PlayerSkillType.Support, OnSelectTab));
|
||||
|
||||
|
||||
#region 获取已经解锁的指挥官技能养成数据
|
||||
foreach (int skillId in Actor.Instance.PlayerSkill.GetSkillIds())
|
||||
{
|
||||
|
|
@ -533,16 +533,16 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
DataPlayerSkillUpgrade skillUpgradeData = TableManager.Instance.Tables.PlayerSkillUpgrade.Get(skillId, skillLevel);
|
||||
if (null == skillUpgradeData)
|
||||
continue;
|
||||
|
||||
|
||||
if (dicSkillUpgradeData.TryGetValue(skillUpgradeData.SkillType, out List<DataPlayerSkillUpgrade> listSkillData))
|
||||
listSkillData.Add(skillUpgradeData);
|
||||
else
|
||||
dicSkillUpgradeData[skillUpgradeData.SkillType] = new List<DataPlayerSkillUpgrade>() { skillUpgradeData };
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
recycleView.Init(RefreshItem);
|
||||
|
||||
|
||||
CommonUtils.BindButton(buttonCancel, OnClose);
|
||||
CommonUtils.BindButton(buttonClose, OnClose);
|
||||
CommonUtils.BindButton(buttonConfirm, OnConfirm);
|
||||
|
|
@ -551,11 +551,11 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
public void SetInfo(Team team, int skillIndex)
|
||||
{
|
||||
CommonUtils.CaptureScreenshot();
|
||||
|
||||
|
||||
curIndex = skillIndex;
|
||||
|
||||
|
||||
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
|
||||
|
||||
|
||||
uint[] skillIds = team.GetPlayerSkillIDs();
|
||||
curSelectSkillID = (int)skillIds[skillIndex];
|
||||
if (CommandSkillManager.IsIdValid(curSelectSkillID))
|
||||
|
|
@ -577,14 +577,14 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
DebugUtil.LogError("指挥官技能数据错误");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
curSelectSkillID = listCurSkillData[0].ID;
|
||||
OnSelectTab(PlayerSkillType.Conduct); // 默认选中指挥系
|
||||
}
|
||||
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 无限列表刷新单个项
|
||||
/// </summary>
|
||||
|
|
@ -597,24 +597,24 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
skillItem = new SkillItem(cell, OnSelectSkill);
|
||||
dicSkillItem[cell.GetInstanceID()] = skillItem;
|
||||
}
|
||||
|
||||
|
||||
List<DataPlayerSkillUpgrade> listPlayerSkillData = GetSkillDatasByTab(curSelectTab);
|
||||
if (listPlayerSkillData == null)
|
||||
return;
|
||||
|
||||
|
||||
if (listPlayerSkillData.Count < 0 || index >= listPlayerSkillData.Count)
|
||||
{
|
||||
DebugUtil.LogWarning("索引错误");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
skillItem.SetInfo(listPlayerSkillData[index]);
|
||||
if (skillItem.PlayerSkillData.ID == curSelectSkillID)
|
||||
OnSelectSkill(curSelectSkillID);
|
||||
else
|
||||
skillItem.IsSelect = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取页签对应所有技能数据
|
||||
/// </summary>
|
||||
|
|
@ -622,10 +622,10 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
private List<DataPlayerSkillUpgrade> GetSkillDatasByTab(PlayerSkillType playerSkillType)
|
||||
{
|
||||
dicSkillUpgradeData.TryGetValue(playerSkillType, out List<DataPlayerSkillUpgrade> listData);
|
||||
|
||||
|
||||
return listData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取动态列表需要显示的数量
|
||||
/// </summary>
|
||||
|
|
@ -633,13 +633,13 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
private int GetRecycleListShowCount()
|
||||
{
|
||||
List<DataPlayerSkillUpgrade> listSkillData = GetSkillDatasByTab(curSelectTab);
|
||||
|
||||
|
||||
if (listSkillData == null)
|
||||
return 0;
|
||||
else
|
||||
return listSkillData.Count;
|
||||
}
|
||||
|
||||
|
||||
#region 按钮回调方法
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
|
|
@ -647,15 +647,15 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
private void OnSelectTab(PlayerSkillType playerSkillType)
|
||||
{
|
||||
curSelectTab = playerSkillType;
|
||||
|
||||
|
||||
foreach (TabItem tabItem in listTab)
|
||||
{
|
||||
tabItem.IsSelect = tabItem.SkillType == curSelectTab;
|
||||
}
|
||||
|
||||
|
||||
recycleView.ShowList(GetRecycleListShowCount());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中技能
|
||||
/// </summary>
|
||||
|
|
@ -666,7 +666,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
if (skillItem.PlayerSkillData.ID == skillId)
|
||||
{
|
||||
skillItem.IsSelect = true;
|
||||
|
||||
|
||||
textSkillTitle.text = CommonUtils.GetLocalizeText(CommonUtils.GetLocalizeText(E_LocalizePrefix.PlayerSkill, skillItem.SkillData.ID));
|
||||
textDescribe.text = CommonUtils.GetLocalizeText(CommonUtils.GetLocalizeText(E_LocalizePrefix.PlayerSkillDesc, skillItem.SkillData.ID));
|
||||
textSkillCollingTime.text = string.Format(CommonUtils.GetLocalizeText("TeamAndSkill_SkillCD"),
|
||||
|
|
@ -677,7 +677,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
}
|
||||
AudioManager.Instance.PlayAudio(Framework.Constants.Sound.COMMON_CLICK);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关闭
|
||||
/// </summary>
|
||||
|
|
@ -686,7 +686,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
AudioManager.Instance.PlayAudio(Constants.Sound.COMMON_BACK);
|
||||
IsScaleShow = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 确定
|
||||
/// </summary>
|
||||
|
|
@ -697,7 +697,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
OnClose();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UI
|
||||
|
|
@ -753,10 +753,6 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// </summary>
|
||||
private readonly List<TeamItem> listTeam = new(TeamEditManager.MAX_TEAM_COUNT);
|
||||
/// <summary>
|
||||
/// 选择技能面板
|
||||
/// </summary>
|
||||
private SelectSkillPanel selectSkillPanel;
|
||||
/// <summary>
|
||||
/// 当前选中队伍UI
|
||||
/// </summary>
|
||||
private TeamItem curTeamItem;
|
||||
|
|
@ -817,7 +813,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
goBack = FindObj("ImageBG/Button_Back");
|
||||
imageTeamLogoBg = GetComponent<Image>("ImageBG/Image_TeamLogo");
|
||||
|
||||
selectSkillPanel = new SelectSkillPanel(FindObj("SelectSkillPanel"), OnChangeSkill);
|
||||
//selectSkillPanel = new SelectSkillPanel(FindObj("SelectSkillPanel"), OnChangeSkill);
|
||||
_currencyList = GetComponent<UI_CurrencyList>("ImageBG/UI_CurrencyList");
|
||||
|
||||
Transform tsTeamRoot = FindObj("UI_LiuHaiLeft/Teams").transform;
|
||||
|
|
@ -881,7 +877,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
}
|
||||
}
|
||||
|
||||
selectSkillPanel.IsScaleShow = false;
|
||||
//selectSkillPanel.IsScaleShow = false;
|
||||
|
||||
for (int i = 0; i < listTeam.Count; ++i)
|
||||
{
|
||||
|
|
@ -1142,8 +1138,9 @@ public class UI_TeamAndSkillSelectController : UIWindow
|
|||
/// </summary>
|
||||
private void OnOpenSkillSelect(int index)
|
||||
{
|
||||
selectSkillPanel.SetInfo(TeamEditManager.Instance.GetSelectTeam(), index);
|
||||
}
|
||||
//selectSkillPanel.SetInfo(TeamEditManager.Instance.GetSelectTeam(), index);
|
||||
SelectSkillPanelController.Open(TeamEditManager.Instance.GetSelectTeam(), index, OnChangeSkill).Forget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变队伍技能选择
|
||||
|
|
|
|||
|
|
@ -0,0 +1,473 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
using Constants = Framework.Constants;
|
||||
using Framework;
|
||||
using PhxhSDK;
|
||||
using Gameplay;
|
||||
using System;
|
||||
using Gameplay.Net;
|
||||
using cfg.ActorCfg;
|
||||
using cfg.SkillCfg;
|
||||
using cfg.PlayerSkillCfg;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
public class SelectSkillPanelController : UIWindow
|
||||
{
|
||||
//UI GameObj
|
||||
///Auto Gen Start///
|
||||
public Image Image_Cover;
|
||||
public Image Image_BG;
|
||||
public Image Image_LeftBG;
|
||||
public Image Image_RightBG;
|
||||
public TMP_Text Text_SkillTitle;
|
||||
public TMP_Text Text_SkillCollingTime;
|
||||
public TMP_Text Text_Describe;
|
||||
public Button Button_Close;
|
||||
public TMP_Text Text_CMDSkill;
|
||||
public Button Button_ConductTitle;
|
||||
public Button Button_AttackTitle;
|
||||
public Button Button_SupportTitle;
|
||||
public Button Button_Cancel;
|
||||
public TMP_Text Text_Cancel;
|
||||
public Button Button_Confirm;
|
||||
public TMP_Text Text_Confirm;
|
||||
|
||||
///Auto Gen End///
|
||||
|
||||
/// <summary>
|
||||
/// 动态列表
|
||||
/// </summary>
|
||||
private RecycleView recycleView;
|
||||
/// <summary>
|
||||
/// 滑动列表
|
||||
/// </summary>
|
||||
private ScrollRect scrollRect;
|
||||
/// <summary>
|
||||
/// 高斯模糊遮罩
|
||||
/// </summary>
|
||||
private RawImage rawImageGaussianBlurMask;
|
||||
private Team CurTeam;
|
||||
private int CurIndex;
|
||||
|
||||
// deal with input data
|
||||
public override void PreLoad(object data = null)
|
||||
{
|
||||
var initData = data as InitData;
|
||||
selectSkillAction = initData.SelectSkill;
|
||||
CurTeam = initData.Team;
|
||||
CurIndex = initData.Index;
|
||||
}
|
||||
|
||||
class InitData
|
||||
{
|
||||
public Team Team;
|
||||
public int Index;
|
||||
public Action<int, int> SelectSkill;
|
||||
|
||||
public InitData(Team team, int index, Action<int, int> selectSkill)
|
||||
{
|
||||
Team = team;
|
||||
Index = index;
|
||||
SelectSkill = selectSkill;
|
||||
}
|
||||
}
|
||||
|
||||
public static async UniTask<UIWindow> Open(Team team, int index, Action<int, int> selectSkill = null)
|
||||
{
|
||||
CommonUtils.CaptureScreenshot();
|
||||
var initData = new InitData(team, index, selectSkill);
|
||||
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_SelectSkillPanel, initData);
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
public override void OnInit()
|
||||
{
|
||||
//bind UI GameObj
|
||||
SelectSkillPanelBinder.GetComponents(this);
|
||||
recycleView = GetComponent<RecycleView>("Image_BG/ScrollView");
|
||||
scrollRect = recycleView.transform.GetComponent<ScrollRect>();
|
||||
|
||||
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
|
||||
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
|
||||
|
||||
BindButton(Button_Cancel, OnClose);
|
||||
BindButton(Button_Confirm, OnConfirm);
|
||||
BindButton(Button_Close, OnClose);
|
||||
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_ConductTitle"), PlayerSkillType.Conduct, OnSelectTab));
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_AttackTitle"), PlayerSkillType.Attack, OnSelectTab));
|
||||
listTab.Add(new TabItem(FindObj("Image_BG/Button_SupportTitle"), PlayerSkillType.Support, OnSelectTab));
|
||||
|
||||
#region 获取已经解锁的指挥官技能养成数据
|
||||
foreach (int skillId in Actor.Instance.PlayerSkill.GetSkillIds())
|
||||
{
|
||||
int skillLevel = Actor.Instance.PlayerSkill.GetLevel(skillId);
|
||||
DataPlayerSkillUpgrade skillUpgradeData = TableManager.Instance.Tables.PlayerSkillUpgrade.Get(skillId, skillLevel);
|
||||
if (null == skillUpgradeData)
|
||||
continue;
|
||||
|
||||
if (dicSkillUpgradeData.TryGetValue(skillUpgradeData.SkillType, out List<DataPlayerSkillUpgrade> listSkillData))
|
||||
listSkillData.Add(skillUpgradeData);
|
||||
else
|
||||
dicSkillUpgradeData[skillUpgradeData.SkillType] = new List<DataPlayerSkillUpgrade>() { skillUpgradeData };
|
||||
}
|
||||
#endregion
|
||||
|
||||
recycleView.Init(RefreshItem);
|
||||
|
||||
SetInfo(CurTeam, CurIndex);
|
||||
}
|
||||
|
||||
//invoke when open window
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//invoke when reload window
|
||||
protected override void OnReloadWindow(object data = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//invoke when close window
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//invoke when destroy
|
||||
public override void OnRelease()
|
||||
{
|
||||
base.OnRelease();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页签
|
||||
/// </summary>
|
||||
private class TabItem : UIGameObjectWrapper
|
||||
{
|
||||
#region UI
|
||||
/// <summary>
|
||||
/// 选中状态
|
||||
/// </summary>
|
||||
private GameObject goSelect;
|
||||
/// <summary>
|
||||
/// 页签文本
|
||||
/// </summary>
|
||||
private TMP_Text text;
|
||||
/// <summary>
|
||||
/// 页签按钮
|
||||
/// </summary>
|
||||
private Button buttonSelect;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 选中的字体颜色
|
||||
/// </summary>
|
||||
private readonly Color SELECT_FONT_COLOR = Color.black;
|
||||
/// <summary>
|
||||
/// 未选中的字体颜色
|
||||
/// </summary>
|
||||
private readonly Color NORMAL_FONT_COLOR = Color.white;
|
||||
/// <summary>
|
||||
/// 玩家技能类型
|
||||
/// </summary>
|
||||
private readonly PlayerSkillType playerSkillType;
|
||||
/// <summary>
|
||||
/// 选中回调
|
||||
/// </summary>
|
||||
private readonly Action<PlayerSkillType> selectAction;
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
public bool IsSelect
|
||||
{
|
||||
set
|
||||
{
|
||||
goSelect.IsScaleShow(value);
|
||||
if (value)
|
||||
text.color = SELECT_FONT_COLOR;
|
||||
else
|
||||
text.color = NORMAL_FONT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能类型
|
||||
/// </summary>
|
||||
public PlayerSkillType SkillType
|
||||
{
|
||||
get { return playerSkillType; }
|
||||
}
|
||||
|
||||
public TabItem(GameObject root, PlayerSkillType playerSkillType, Action<PlayerSkillType> selectAction) : base(root, true)
|
||||
{
|
||||
this.playerSkillType = playerSkillType;
|
||||
this.selectAction = selectAction;
|
||||
|
||||
goSelect = FindObj("ImageSelect");
|
||||
text = GetComponent<TMP_Text>("Text");
|
||||
buttonSelect = GoRoot.GetComponent<Button>();
|
||||
|
||||
CommonUtils.BindButton(buttonSelect, OnClick);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
/// </summary>
|
||||
private void OnClick()
|
||||
{
|
||||
selectAction?.Invoke(playerSkillType);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
private class SkillItem : UIGameObjectWrapper
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中状态
|
||||
/// </summary>
|
||||
private GameObject goSelect;
|
||||
private Button buttonSkill;
|
||||
|
||||
private DataPlayerSkill skillData;
|
||||
private DataPlayerSkillUpgrade playerSkillData;
|
||||
/// <summary>
|
||||
/// 点击回调
|
||||
/// </summary>
|
||||
private readonly Action<int> clickAction;
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
public bool IsSelect
|
||||
{
|
||||
set { goSelect.IsScaleShow(value); }
|
||||
}
|
||||
|
||||
public DataPlayerSkill SkillData
|
||||
{
|
||||
get { return skillData; }
|
||||
}
|
||||
|
||||
public DataPlayerSkillUpgrade PlayerSkillData
|
||||
{
|
||||
get { return playerSkillData; }
|
||||
}
|
||||
|
||||
public SkillItem(GameObject root, Action<int> clickAction) : base(root)
|
||||
{
|
||||
this.clickAction = clickAction;
|
||||
|
||||
goSelect = FindObj("ImageChooseRect");
|
||||
buttonSkill = GetComponent<Button>("ButtonSkillLogoS");
|
||||
|
||||
CommonUtils.BindButton(buttonSkill, OnClick);
|
||||
}
|
||||
|
||||
public void SetInfo(DataPlayerSkillUpgrade skillUpgradeData)
|
||||
{
|
||||
playerSkillData = skillUpgradeData;
|
||||
skillData = TableManager.Instance.Tables.PlayerSkillConfig.Get(playerSkillData.SkillID);
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
|
||||
private void OnClick()
|
||||
{
|
||||
clickAction?.Invoke(playerSkillData.ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 页签列表
|
||||
/// </summary>
|
||||
private readonly List<TabItem> listTab = new(4);
|
||||
/// <summary>
|
||||
/// 实例id对应玩家技能UI列表字典
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, SkillItem> dicSkillItem = new();
|
||||
/// <summary>
|
||||
/// 玩家技能类型对应玩家技能列表字典
|
||||
/// </summary>
|
||||
private readonly Dictionary<PlayerSkillType, List<DataPlayerSkillUpgrade>> dicSkillUpgradeData = new();
|
||||
/// <summary>
|
||||
/// 当前选中页签类型
|
||||
/// </summary>
|
||||
private PlayerSkillType curSelectTab;
|
||||
/// <summary>
|
||||
/// 当前选中技能id
|
||||
/// </summary>
|
||||
private int curSelectSkillID;
|
||||
/// <summary>
|
||||
/// 选择技能回调
|
||||
/// </summary>
|
||||
private Action<int, int> selectSkillAction;
|
||||
/// <summary>
|
||||
/// 当前队伍技能索引
|
||||
/// </summary>
|
||||
private int curIndex;
|
||||
|
||||
|
||||
public void SetInfo(Team team, int skillIndex)
|
||||
{
|
||||
curIndex = skillIndex;
|
||||
|
||||
uint[] skillIds = team.GetPlayerSkillIDs();
|
||||
curSelectSkillID = (int)skillIds[skillIndex];
|
||||
if (CommandSkillManager.IsIdValid(curSelectSkillID))
|
||||
{
|
||||
DataPlayerSkillUpgrade skillUpgradeData = TableManager.Instance.Tables.PlayerSkillUpgrade.Get(curSelectSkillID, 0);
|
||||
if (skillUpgradeData == null)
|
||||
{
|
||||
DebugUtil.LogError($"获取配置失败,id:{curSelectSkillID}");
|
||||
curSelectSkillID = 0;
|
||||
}
|
||||
else
|
||||
OnSelectTab(skillUpgradeData.SkillType);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<DataPlayerSkillUpgrade> listCurSkillData = GetSkillDatasByTab(PlayerSkillType.Conduct);
|
||||
if (listCurSkillData == null || listCurSkillData.Count < 1)
|
||||
{
|
||||
DebugUtil.LogError("指挥官技能数据错误");
|
||||
return;
|
||||
}
|
||||
|
||||
curSelectSkillID = listCurSkillData[0].ID;
|
||||
OnSelectTab(PlayerSkillType.Conduct); // 默认选中指挥系
|
||||
}
|
||||
|
||||
//IsScaleShow = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 无限列表刷新单个项
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="itemTransform"></param>
|
||||
private void RefreshItem(GameObject cell, int index)
|
||||
{
|
||||
if (!dicSkillItem.TryGetValue(cell.GetInstanceID(), out SkillItem skillItem))
|
||||
{
|
||||
skillItem = new SkillItem(cell, OnSelectSkill);
|
||||
dicSkillItem[cell.GetInstanceID()] = skillItem;
|
||||
}
|
||||
|
||||
List<DataPlayerSkillUpgrade> listPlayerSkillData = GetSkillDatasByTab(curSelectTab);
|
||||
if (listPlayerSkillData == null)
|
||||
return;
|
||||
|
||||
if (listPlayerSkillData.Count < 0 || index >= listPlayerSkillData.Count)
|
||||
{
|
||||
DebugUtil.LogWarning("索引错误");
|
||||
return;
|
||||
}
|
||||
|
||||
skillItem.SetInfo(listPlayerSkillData[index]);
|
||||
if (skillItem.PlayerSkillData.ID == curSelectSkillID)
|
||||
OnSelectSkill(curSelectSkillID);
|
||||
else
|
||||
skillItem.IsSelect = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取页签对应所有技能数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<DataPlayerSkillUpgrade> GetSkillDatasByTab(PlayerSkillType playerSkillType)
|
||||
{
|
||||
dicSkillUpgradeData.TryGetValue(playerSkillType, out List<DataPlayerSkillUpgrade> listData);
|
||||
|
||||
return listData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取动态列表需要显示的数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int GetRecycleListShowCount()
|
||||
{
|
||||
List<DataPlayerSkillUpgrade> listSkillData = GetSkillDatasByTab(curSelectTab);
|
||||
|
||||
if (listSkillData == null)
|
||||
return 0;
|
||||
else
|
||||
return listSkillData.Count;
|
||||
}
|
||||
|
||||
#region 按钮回调方法
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
/// </summary>
|
||||
private void OnSelectTab(PlayerSkillType playerSkillType)
|
||||
{
|
||||
curSelectTab = playerSkillType;
|
||||
|
||||
foreach (TabItem tabItem in listTab)
|
||||
{
|
||||
tabItem.IsSelect = tabItem.SkillType == curSelectTab;
|
||||
}
|
||||
|
||||
recycleView.ShowList(GetRecycleListShowCount());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中技能
|
||||
/// </summary>
|
||||
private void OnSelectSkill(int skillId)
|
||||
{
|
||||
foreach (SkillItem skillItem in dicSkillItem.Values)
|
||||
{
|
||||
if (skillItem.PlayerSkillData.ID == skillId)
|
||||
{
|
||||
skillItem.IsSelect = true;
|
||||
|
||||
Text_SkillTitle.text = CommonUtils.GetLocalizeText(CommonUtils.GetLocalizeText(E_LocalizePrefix.PlayerSkill, skillItem.SkillData.ID));
|
||||
Text_Describe.text = CommonUtils.GetLocalizeText(CommonUtils.GetLocalizeText(E_LocalizePrefix.PlayerSkillDesc, skillItem.SkillData.ID));
|
||||
Text_SkillCollingTime.text = string.Format(CommonUtils.GetLocalizeText("TeamAndSkill_SkillCD"),
|
||||
null == skillItem.SkillData ? 0f : skillItem.SkillData.CDTime); // 冷却时间:{0}s
|
||||
}
|
||||
else
|
||||
skillItem.IsSelect = false;
|
||||
}
|
||||
AudioManager.Instance.PlayAudio(Framework.Constants.Sound.COMMON_CLICK);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭
|
||||
/// </summary>
|
||||
private void OnClose()
|
||||
{
|
||||
//AudioManager.Instance.PlayAudio(Constants.Sound.COMMON_BACK);
|
||||
//IsScaleShow = false;
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确定
|
||||
/// </summary>
|
||||
private void OnConfirm()
|
||||
{
|
||||
AudioManager.Instance.PlayAudio(Constants.Sound.COMMON_CLAIM);
|
||||
selectSkillAction?.Invoke(curIndex, curSelectSkillID);
|
||||
OnClose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bee4cc53e03e2a7488517a93f4fcf144
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
|
||||
public class SelectSkillPanelBinder
|
||||
{
|
||||
|
||||
public static void GetComponents(SelectSkillPanelController window)
|
||||
{
|
||||
window.Image_Cover = window.GetComponent<Image>("Image_Cover");
|
||||
window.Image_BG = window.GetComponent<Image>("Image_BG");
|
||||
window.Image_LeftBG = window.GetComponent<Image>("Image_BG/Image_LeftBG");
|
||||
window.Image_RightBG = window.GetComponent<Image>("Image_BG/Image_RightBG");
|
||||
window.Text_SkillTitle = window.GetComponent<TMP_Text>("Image_BG/Image_RightBG/Text_SkillTitle");
|
||||
window.Text_SkillCollingTime = window.GetComponent<TMP_Text>("Image_BG/Image_RightBG/Text_SkillCollingTime");
|
||||
window.Text_Describe = window.GetComponent<TMP_Text>("Image_BG/Image_RightBG/Text_Describe");
|
||||
window.Button_Close = window.GetComponent<Button>("Image_BG/Button_Close");
|
||||
window.Text_CMDSkill = window.GetComponent<TMP_Text>("Image_BG/Text_CMDSkill");
|
||||
window.Button_ConductTitle = window.GetComponent<Button>("Image_BG/Button_ConductTitle");
|
||||
window.Button_AttackTitle = window.GetComponent<Button>("Image_BG/Button_AttackTitle");
|
||||
window.Button_SupportTitle = window.GetComponent<Button>("Image_BG/Button_SupportTitle");
|
||||
window.Button_Cancel = window.GetComponent<Button>("Button_Cancel");
|
||||
window.Text_Cancel = window.GetComponent<TMP_Text>("Button_Cancel/Text_Cancel");
|
||||
window.Button_Confirm = window.GetComponent<Button>("Button_Confirm");
|
||||
window.Text_Confirm = window.GetComponent<TMP_Text>("Button_Confirm/Text_Confirm");
|
||||
|
||||
}
|
||||
|
||||
/****** 定义变量语句 ******
|
||||
public Image Image_Cover;
|
||||
public Image Image_BG;
|
||||
public Image Image_LeftBG;
|
||||
public Image Image_RightBG;
|
||||
public TMP_Text Text_SkillTitle;
|
||||
public TMP_Text Text_SkillCollingTime;
|
||||
public TMP_Text Text_Describe;
|
||||
public Button Button_Close;
|
||||
public TMP_Text Text_CMDSkill;
|
||||
public Button Button_ConductTitle;
|
||||
public Button Button_AttackTitle;
|
||||
public Button Button_SupportTitle;
|
||||
public Button Button_Cancel;
|
||||
public TMP_Text Text_Cancel;
|
||||
public Button Button_Confirm;
|
||||
public TMP_Text Text_Confirm;
|
||||
|
||||
****** End ******/
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f886e7f3e01fdd040a6d698fe295c2ca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue