2024-10-15 17:37:05 +08:00
|
|
|
|
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>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>̬<EFBFBD>б<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private RecycleView recycleView;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private ScrollRect scrollRect;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>˹ģ<CBB9><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </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));
|
|
|
|
|
|
|
2024-10-18 14:41:43 +08:00
|
|
|
|
#region <20><>ȡ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ӹټ<D3B9><D9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
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>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<><D1A1>״̬
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goSelect;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ҳǩ<D2B3>ı<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text text;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ҳǩ<D2B3><C7A9>ť
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Button buttonSelect;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Color SELECT_FONT_COLOR = Color.black;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// δѡ<CEB4>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Color NORMAL_FONT_COLOR = Color.white;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly PlayerSkillType playerSkillType;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<>лص<D0BB>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Action<PlayerSkillType> selectAction;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsSelect
|
|
|
|
|
|
{
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
goSelect.IsScaleShow(value);
|
|
|
|
|
|
if (value)
|
|
|
|
|
|
text.color = SELECT_FONT_COLOR;
|
|
|
|
|
|
else
|
|
|
|
|
|
text.color = NORMAL_FONT_COLOR;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </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>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<><D1A1>ҳǩ
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
selectAction?.Invoke(playerSkillType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private class SkillItem : UIGameObjectWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<><D1A1>״̬
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goSelect;
|
|
|
|
|
|
private Button buttonSkill;
|
|
|
|
|
|
|
|
|
|
|
|
private DataPlayerSkill skillData;
|
|
|
|
|
|
private DataPlayerSkillUpgrade playerSkillData;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD>ص<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Action<int> clickAction;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </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>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ҳǩ<D2B3>б<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<TabItem> listTab = new(4);
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ʵ<><CAB5>id<69><64>Ӧ<EFBFBD><D3A6>Ҽ<EFBFBD><D2BC><EFBFBD>UI<55>б<EFBFBD><D0B1>ֵ<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Dictionary<int, SkillItem> dicSkillItem = new();
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD>Ӧ<EFBFBD><D3A6>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD>б<EFBFBD><D0B1>ֵ<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Dictionary<PlayerSkillType, List<DataPlayerSkillUpgrade>> dicSkillUpgradeData = new();
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>ǰѡ<C7B0><D1A1>ҳǩ<D2B3><C7A9><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private PlayerSkillType curSelectTab;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>ǰѡ<C7B0>м<EFBFBD><D0BC><EFBFBD>id
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int curSelectSkillID;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<><D1A1><EFBFBD>ܻص<DCBB>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Action<int, int> selectSkillAction;
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>ǰ<EFBFBD><C7B0><EFBFBD>鼼<EFBFBD><E9BCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </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)
|
|
|
|
|
|
{
|
2024-10-18 14:41:43 +08:00
|
|
|
|
DebugUtil.LogError($"<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>id:{curSelectSkillID}");
|
2024-10-15 17:37:05 +08:00
|
|
|
|
curSelectSkillID = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
OnSelectTab(skillUpgradeData.SkillType);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
List<DataPlayerSkillUpgrade> listCurSkillData = GetSkillDatasByTab(PlayerSkillType.Conduct);
|
|
|
|
|
|
if (listCurSkillData == null || listCurSkillData.Count < 1)
|
|
|
|
|
|
{
|
2024-10-18 14:41:43 +08:00
|
|
|
|
DebugUtil.LogError("ָ<>ӹټ<D3B9><D9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>");
|
2024-10-15 17:37:05 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
curSelectSkillID = listCurSkillData[0].ID;
|
2024-10-18 14:41:43 +08:00
|
|
|
|
OnSelectTab(PlayerSkillType.Conduct); // Ĭ<><C4AC>ѡ<EFBFBD><D1A1>ָ<EFBFBD><D6B8>ϵ
|
2024-10-15 17:37:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//IsScaleShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ˢ<EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </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)
|
|
|
|
|
|
{
|
2024-10-18 14:41:43 +08:00
|
|
|
|
DebugUtil.LogWarning("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2024-10-15 17:37:05 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
skillItem.SetInfo(listPlayerSkillData[index]);
|
|
|
|
|
|
if (skillItem.PlayerSkillData.ID == curSelectSkillID)
|
|
|
|
|
|
OnSelectSkill(curSelectSkillID);
|
|
|
|
|
|
else
|
|
|
|
|
|
skillItem.IsSelect = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>ȡҳǩ<D2B3><C7A9>Ӧ<EFBFBD><D3A6><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private List<DataPlayerSkillUpgrade> GetSkillDatasByTab(PlayerSkillType playerSkillType)
|
|
|
|
|
|
{
|
|
|
|
|
|
dicSkillUpgradeData.TryGetValue(playerSkillType, out List<DataPlayerSkillUpgrade> listData);
|
|
|
|
|
|
|
|
|
|
|
|
return listData;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20><>ȡ<EFBFBD><C8A1>̬<EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ҫ<EFBFBD><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private int GetRecycleListShowCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<DataPlayerSkillUpgrade> listSkillData = GetSkillDatasByTab(curSelectTab);
|
|
|
|
|
|
|
|
|
|
|
|
if (listSkillData == null)
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
else
|
|
|
|
|
|
return listSkillData.Count;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-18 14:41:43 +08:00
|
|
|
|
#region <20><>ť<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<><D1A1>ҳǩ
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnSelectTab(PlayerSkillType playerSkillType)
|
|
|
|
|
|
{
|
|
|
|
|
|
curSelectTab = playerSkillType;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (TabItem tabItem in listTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
tabItem.IsSelect = tabItem.SkillType == curSelectTab;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
recycleView.ShowList(GetRecycleListShowCount());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ѡ<>м<EFBFBD><D0BC><EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </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"),
|
2024-10-18 14:41:43 +08:00
|
|
|
|
null == skillItem.SkillData ? 0f : skillItem.SkillData.CDTime); // <20><>ȴʱ<C8B4>䣺{0}s
|
2024-10-15 17:37:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
skillItem.IsSelect = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
AudioManager.Instance.PlayAudio(Framework.Constants.Sound.COMMON_CLICK);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// <20>ر<EFBFBD>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnClose()
|
|
|
|
|
|
{
|
2024-10-18 14:41:43 +08:00
|
|
|
|
AudioManager.Instance.PlayAudio(Constants.Sound.COMMON_BACK);
|
2024-10-15 17:37:05 +08:00
|
|
|
|
//IsScaleShow = false;
|
|
|
|
|
|
CloseWindow();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-18 14:41:43 +08:00
|
|
|
|
/// ȷ<><C8B7>
|
2024-10-15 17:37:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnConfirm()
|
|
|
|
|
|
{
|
|
|
|
|
|
AudioManager.Instance.PlayAudio(Constants.Sound.COMMON_CLAIM);
|
|
|
|
|
|
selectSkillAction?.Invoke(curIndex, curSelectSkillID);
|
2024-10-18 14:41:43 +08:00
|
|
|
|
CloseWindow();
|
2024-10-15 17:37:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|