using cfg.CharacterCfg;
using Framework;
using NLDPB;
using System;
using System.Collections.Generic;
using Gameplay;
using PhxhSDK;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Image = UnityEngine.UI.Image;
using Cysharp.Threading.Tasks;
using Gameplay.Guide;
public class UISelectCharacterController : UIWindow
{
///
/// 打开角色界面(队伍编辑)
///
///
///
///
public static async UniTask Open(Team team, int index)
{
InputData inputData = new()
{
OpenType = E_OpenType.EditTeam,
Data = team,
Idx = index
};
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UISelectCharacter, inputData);
}
///
/// 打开角色界面
///
///
///
///
public static async UniTask Open()
{
InputData inputData = new()
{
OpenType = E_OpenType.Default
};
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UISelectCharacter, inputData);
}
#region 结构
private struct InputData
{
public E_OpenType OpenType;
public Team Data;
public int Idx;
}
///
/// 打开类型
///
private enum E_OpenType
{
///
/// 默认
///
Default,
///
/// 队伍编辑
///
EditTeam
}
///
/// 角色排序类型
///
private enum E_CharacterSortType
{
///
/// 按星级(稀有度)排序
///
EStar,
///
/// 按等级排序
///
ELevel,
///
/// 按进修等级排序
///
EAwake,
///
/// 按考核等级排序
///
EBreak,
///
/// 按好感度排序
///
ELikely,
}
///
/// 排序状态
///
private enum E_SortState
{
///
/// 不排序
///
None = 0,
///
/// 升序
///
Up,
///
/// 降序
///
Down,
}
public class CultivateStruct
{
public List showList;
public CharacterDataInfo info;
}
///
/// 角色
///
private class CharacterItem : UIGameObjectWrapper
{
#region UI
private Image imageBg;
///
/// 等级进度条
///
private Image imageLevel;
///
/// 职业图标
///
private Image imageProfessionLogo;
///
/// 角色立绘
///
private Image imagePoster;
///
/// 等级
///
private TMP_Text textLevel;
///
/// 角色名
///
private TMP_Text textCharacterName;
///
/// 角色稀有度颜色遮罩
///
private Image RarityCover;
private TMP_Text textDebugId;
///
/// 遮罩
///
private GameObject goMask;
///
/// 卸下
///
private GameObject goClear;
private Button button;
private RedPointUIController RedPointUI;
#endregion
private CharacterDataInfo info;
///
/// 星星列表
///
private readonly List listStar;
private readonly Action callback;
public bool IsShowMask
{
set { goMask.IsScaleShow(value); }
}
public bool IsShowClear
{
set{ goClear.IsScaleShow(value); }
}
public bool IsShowPoster
{
set { imagePoster.gameObject.IsScaleShow(value); }
}
public CharacterItem(GameObject root, Action callbackAction) : base(root)
{
callback = callbackAction;
imageBg = GetComponent("Bg");//GoRoot.
imageLevel = GetComponent("Bg/Image_Poster/Image_Rect/Image_LevelBar");
imageProfessionLogo = GetComponent("Bg/Image_Poster/Image_Rect/Image_ProfessionLogo");
imagePoster = GetComponent("Bg/Image_Poster");
textLevel = GetComponent("Bg/Image_Poster/Image_Rect/Image_LevelBar/Text_Level");
textCharacterName = GetComponent("Bg/Image_Poster/Image_ColorCover/Image_CharacterName/Text_CharacterName");
RarityCover = GetComponent("Bg/Image_Poster/Image_ColorCover");
textDebugId = GetComponent("Bg/DebugID");
goMask = FindObj("Bg/Image_Mask");
goClear = FindObj("Bg/Image_Clear");
button = GoRoot.GetComponent