2023-10-19 15:00:19 +08:00
|
|
|
|
using cfg.CharacterCfg;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
using NLDPB;
|
|
|
|
|
|
using System;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using System.Collections.Generic;
|
2023-12-05 12:49:29 +08:00
|
|
|
|
using Gameplay;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
using TMPro;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using Image = UnityEngine.UI.Image;
|
2023-12-15 16:18:03 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
2024-07-04 14:40:00 +08:00
|
|
|
|
using Gameplay.Guide;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
public class UISelectCharacterController : UIWindow
|
|
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开角色界面(队伍编辑)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="team"></param>
|
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static async UniTask<UIWindow> Open(Team team, int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
InputData inputData = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenType = E_OpenType.EditTeam,
|
|
|
|
|
|
Data = team,
|
|
|
|
|
|
Idx = index
|
|
|
|
|
|
};
|
2023-12-06 16:36:42 +08:00
|
|
|
|
|
2024-05-16 12:40:15 +08:00
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UISelectCharacter, inputData);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
2023-12-15 16:18:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开角色界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="team"></param>
|
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static async UniTask<UIWindow> Open()
|
|
|
|
|
|
{
|
|
|
|
|
|
InputData inputData = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenType = E_OpenType.Default
|
|
|
|
|
|
};
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-05-16 12:40:15 +08:00
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UISelectCharacter, inputData);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 结构
|
|
|
|
|
|
private struct InputData
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
public E_OpenType OpenType;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public Team Data;
|
|
|
|
|
|
public int Idx;
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private enum E_OpenType
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 默认
|
|
|
|
|
|
/// </summary>
|
2023-10-19 15:00:19 +08:00
|
|
|
|
Default,
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 队伍编辑
|
|
|
|
|
|
/// </summary>
|
2023-10-19 15:00:19 +08:00
|
|
|
|
EditTeam
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色排序类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private enum E_CharacterSortType
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按星级(稀有度)排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
EStar,
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按等级排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
ELevel,
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按进修等级排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
EAwake,
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按考核等级排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
EBreak,
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按好感度排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
ELikely,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private enum E_SortState
|
2024-01-24 15:42:01 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 不排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
None = 0,
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 升序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Up,
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 降序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Down,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class CultivateStruct
|
|
|
|
|
|
{
|
|
|
|
|
|
public List<CharacterDataInfo> showList;
|
|
|
|
|
|
public CharacterDataInfo info;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private class CharacterItem : UIGameObjectWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
#region UI
|
|
|
|
|
|
private Image imageBg;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 等级进度条
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageLevel;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业图标
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageProfessionLogo;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色立绘
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imagePoster;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 等级
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textLevel;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色名
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textCharacterName;
|
2024-07-25 17:06:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色稀有度颜色遮罩
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image RarityCover;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private TMP_Text textDebugId;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 遮罩
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goMask;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 卸下
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goClear;
|
|
|
|
|
|
private Button button;
|
2024-06-27 18:55:53 +08:00
|
|
|
|
private RedPointUIController RedPointUI;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
private CharacterDataInfo info;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 星星列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<GameObject> listStar;
|
|
|
|
|
|
private readonly Action<CharacterDataInfo> 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<CharacterDataInfo> callbackAction) : base(root)
|
|
|
|
|
|
{
|
|
|
|
|
|
callback = callbackAction;
|
|
|
|
|
|
|
2024-07-03 12:24:28 +08:00
|
|
|
|
imageBg = GetComponent<Image>("Bg");//GoRoot.
|
|
|
|
|
|
imageLevel = GetComponent<Image>("Bg/Image_Poster/Image_Rect/Image_LevelBar");
|
|
|
|
|
|
imageProfessionLogo = GetComponent<Image>("Bg/Image_Poster/Image_Rect/Image_ProfessionLogo");
|
|
|
|
|
|
imagePoster = GetComponent<Image>("Bg/Image_Poster");
|
|
|
|
|
|
textLevel = GetComponent<TMP_Text>("Bg/Image_Poster/Image_Rect/Image_LevelBar/Text_Level");
|
|
|
|
|
|
textCharacterName = GetComponent<TMP_Text>("Bg/Image_Poster/Image_ColorCover/Image_CharacterName/Text_CharacterName");
|
2024-07-25 17:06:02 +08:00
|
|
|
|
RarityCover = GetComponent<Image>("Bg/Image_Poster/Image_ColorCover");
|
2024-07-03 12:24:28 +08:00
|
|
|
|
textDebugId = GetComponent<TMP_Text>("Bg/DebugID");
|
|
|
|
|
|
goMask = FindObj("Bg/Image_Mask");
|
|
|
|
|
|
goClear = FindObj("Bg/Image_Clear");
|
2024-07-08 15:56:34 +08:00
|
|
|
|
button = GoRoot.GetComponent<Button>();
|
2024-07-03 12:24:28 +08:00
|
|
|
|
RedPointUI = GetComponent<RedPointUIController>("Bg/UI_RedPoint");
|
|
|
|
|
|
|
|
|
|
|
|
Transform tsStarRoot = FindObj("Bg/Image_Poster/Image_ColorCover/Image_CharacterName/Stars").transform;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listStar = new(tsStarRoot.childCount);
|
|
|
|
|
|
for (int i = 0; i < tsStarRoot.childCount; ++i)
|
2024-01-24 15:42:01 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listStar.Add(tsStarRoot.GetChild(i).gameObject);
|
2024-01-24 15:42:01 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
BindButton(button, OnClick);
|
2024-01-24 15:42:01 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
public async void SetInfo(CharacterDataInfo characterDataInfo, E_OpenType openType, Team team)
|
|
|
|
|
|
{
|
|
|
|
|
|
info = characterDataInfo;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-06-27 18:55:53 +08:00
|
|
|
|
RedPointUI.NodeID = info.RedPointNode.ID;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
DataCharacterBreak breakCfg = TableManager.Instance.Tables.CharacterBreak.Get(info.Cfg.RoleID, (int)info.BreakLevel);
|
|
|
|
|
|
int levelLimit = breakCfg?.LevelLimit ?? 1000;
|
2024-07-25 19:44:20 +08:00
|
|
|
|
|
|
|
|
|
|
if (info.Level >= levelLimit)
|
|
|
|
|
|
{
|
|
|
|
|
|
imageLevel.fillAmount = 1f;
|
|
|
|
|
|
//imageLevel.fillAmount = (float)info.Level / levelLimit;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var LevelExpCfg = TableManager.Instance.Tables.CharacterLevelExp;
|
|
|
|
|
|
imageLevel.fillAmount = info.Exp * 1.0f / (LevelExpCfg.Get((int)info.Level + 1).EXP == 0 ? 1 : LevelExpCfg.Get((int)info.Level + 1).EXP);
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
textLevel.text = info.Level.ToString();
|
2024-08-12 18:48:32 +08:00
|
|
|
|
imageProfessionLogo.sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(TableManager.Instance.Tables.JobAttri.GetOrDefault((int)info.Cfg.Job).IconPath);
|
|
|
|
|
|
//await LoadAssetAsync<Sprite>(TableManager.Instance.Tables.JobAttri.GetOrDefault((int)info.Cfg.Job).IconPath);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
textCharacterName.text = CommonUtils.GetLocalizeText(info.Cfg.Name);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
IsShowMask = openType == E_OpenType.EditTeam && team.IsCharacterInTeam(info.Uid);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-05-08 17:04:37 +08:00
|
|
|
|
var imgPath =
|
|
|
|
|
|
CommonUtils.GetCharacterPicPath(info.Cfg.RoleID, CommonUtils.ECharacterPicPathType.SelectCharacter);
|
2024-08-12 17:34:04 +08:00
|
|
|
|
var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(imgPath);//获取预加载好的角色立绘
|
2024-05-08 17:04:37 +08:00
|
|
|
|
CommonUtils.RefreshCharacter2DPic(imagePoster, sprite);
|
|
|
|
|
|
|
2024-05-08 16:16:50 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
for (int i = 0; i < listStar.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject goStar = listStar[i];
|
|
|
|
|
|
goStar.IsScaleShow((i + 1) < info.Cfg.StartStar);
|
|
|
|
|
|
}
|
2024-07-25 17:06:02 +08:00
|
|
|
|
var coverPath = "Assets/Art/UI/Texture/UI_Pic_Main/UI_Pic_ShowAllCharacter/SAC_AllPart/";
|
|
|
|
|
|
if (info.Cfg.StartStar == 3)
|
|
|
|
|
|
{
|
2024-08-12 17:34:04 +08:00
|
|
|
|
RarityCover.sprite = await LoadAssetAsync<Sprite>(coverPath + "UI_RarityWhite.png");//白色:三星
|
2024-07-25 17:06:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (info.Cfg.StartStar == 4)
|
|
|
|
|
|
{
|
2024-08-12 17:34:04 +08:00
|
|
|
|
RarityCover.sprite = await LoadAssetAsync<Sprite>(coverPath + "UI_RarityBlue.png");//蓝色:四星
|
2024-07-25 17:06:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-08-12 17:34:04 +08:00
|
|
|
|
RarityCover.sprite = await LoadAssetAsync<Sprite>(coverPath + "UI_RarityRed.png");//红色:五星
|
2024-07-25 17:06:02 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
textDebugId.gameObject.IsScaleShow(DisplayIDForCeHua.IsDisplayID);
|
|
|
|
|
|
textDebugId.text = $"ID:{info.Cfg.RoleID}";
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
IsShowPoster = true;
|
|
|
|
|
|
IsShowClear = false;
|
|
|
|
|
|
imageBg.color = new Color(imageBg.color.r, imageBg.color.g, imageBg.color.b, 1f);
|
|
|
|
|
|
|
|
|
|
|
|
IsScaleShow = true;
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 队伍编辑特殊下阵入口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void SetInfoByTeamEditorEmpty()
|
2024-01-09 16:01:37 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
info = null;
|
|
|
|
|
|
|
|
|
|
|
|
IsShowPoster = false;
|
|
|
|
|
|
IsShowMask = false;
|
|
|
|
|
|
IsShowClear = true;
|
|
|
|
|
|
imageBg.color = new Color(imageBg.color.r, imageBg.color.g, imageBg.color.b, 0f);
|
|
|
|
|
|
|
|
|
|
|
|
IsScaleShow = true;
|
2024-01-09 16:01:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private void OnClick()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
callback?.Invoke(info);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private class SortItem : UIGameObjectWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly Color SELECT_COLOR = Color.white;
|
|
|
|
|
|
private readonly Color NORMAL_COLOR = new(1f, 1f, 1f, 0.3f);
|
|
|
|
|
|
|
|
|
|
|
|
private Button button;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 升序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goUp;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 降序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goDown;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序名
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text text;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Action<SortItem> sortAction;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private E_CharacterSortType sortType;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private E_SortState sortState;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public E_SortState SortState
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return sortState; }
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
sortState = value;
|
|
|
|
|
|
switch (sortState)
|
|
|
|
|
|
{
|
|
|
|
|
|
case E_SortState.Up:
|
|
|
|
|
|
{
|
|
|
|
|
|
goUp.IsScaleShow(true);
|
|
|
|
|
|
goDown.IsScaleShow(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case E_SortState.Down:
|
|
|
|
|
|
{
|
|
|
|
|
|
goUp.IsScaleShow(false);
|
|
|
|
|
|
goDown.IsScaleShow(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
{
|
|
|
|
|
|
goUp.IsScaleShow(false);
|
|
|
|
|
|
goDown.IsScaleShow(false);
|
2024-06-26 18:53:14 +08:00
|
|
|
|
IsSelect = false;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-21 13:24:42 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
public E_CharacterSortType SortType
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
set { sortType = value; }
|
|
|
|
|
|
get { return sortType; }
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
public bool IsSelect
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
set { text.color = value ? SELECT_COLOR : NORMAL_COLOR; }
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
public SortItem(GameObject root, E_CharacterSortType sortType, Action<SortItem> sort) : base(root)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
this.sortType = sortType;
|
|
|
|
|
|
sortAction = sort;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
button = GoRoot.GetComponent<Button>();
|
|
|
|
|
|
goUp = FindObj("Image_Default/Image_UP");
|
|
|
|
|
|
goDown = FindObj("Image_Default/Image_Down");
|
|
|
|
|
|
text = GetComponent<TMP_Text>("Text_Default");
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
SortState = E_SortState.None;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
BindButton(button, OnClick);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
IsScaleShow = true;
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
private void OnClick()
|
2023-12-15 16:18:03 +08:00
|
|
|
|
{
|
2024-08-02 16:54:16 +08:00
|
|
|
|
//if (SortState == E_SortState.None)
|
|
|
|
|
|
// SortState = E_SortState.Down;
|
|
|
|
|
|
//else if (SortState == E_SortState.Down)
|
|
|
|
|
|
// SortState = E_SortState.Up;
|
|
|
|
|
|
//else
|
|
|
|
|
|
// SortState = E_SortState.None;
|
|
|
|
|
|
|
|
|
|
|
|
if (SortState == E_SortState.Down)
|
|
|
|
|
|
SortState = E_SortState.Up;
|
|
|
|
|
|
else
|
|
|
|
|
|
SortState = E_SortState.Down;
|
|
|
|
|
|
//改为两种状态切换
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
sortAction?.Invoke(this);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 没有角色状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goEmpty;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 循环列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private RecycleView recycleView;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 下拉框全选值
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private const int DROPDOWN_ALL_VALUE = -1;
|
|
|
|
|
|
/// <summary>
|
2024-04-22 13:32:36 +08:00
|
|
|
|
/// 职业下拉框全选图标路径
|
|
|
|
|
|
/// </summary>
|
2024-05-31 18:53:00 +08:00
|
|
|
|
private const string DROPDOWN_JOBALL_ICON_PATH = "Assets/Art/UI/Texture/Icon/Job/UI_Profession_All.png";
|
2024-04-22 13:32:36 +08:00
|
|
|
|
|
|
|
|
|
|
#region 私有变量
|
|
|
|
|
|
/// <summary>
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// 势力下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private UITextDropdown<int> factionDropDown;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 其他下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private UITextDropdown<int> otherDropDown;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private UIImageDropDown<int> jobDropDown;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业配置
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private JobAttri jobAttriCfg;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 势力排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private FactionAttri factionAttriCfg;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开界面类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private E_OpenType openType = E_OpenType.Default;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开时传入队伍信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Team curTeam;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开时传入的队伍索引
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int teamIndex;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色字典
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Dictionary<int, CharacterItem> dicCharacter = new();
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前筛选的势力
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int selectFractionIndex = DROPDOWN_ALL_VALUE;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前筛选的职业
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int selectJobIndex = DROPDOWN_ALL_VALUE;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 所有角色列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private List<CharacterDataInfo> listAllCharacter = new();
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 要显示的角色列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<CharacterDataInfo> listShowCharacter = new();
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序选项列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<SortItem> listSortItem = new();
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前选择排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private SortItem curSortItem;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
public override async void PreLoad(object data = null)
|
2023-12-06 16:36:42 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (data == null)
|
2023-12-06 16:36:42 +08:00
|
|
|
|
return;
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
InputData input = (InputData)data;
|
|
|
|
|
|
openType = input.OpenType;
|
|
|
|
|
|
if (openType == E_OpenType.EditTeam)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
curTeam = input.Data;
|
|
|
|
|
|
teamIndex = input.Idx;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 获取配置
|
|
|
|
|
|
jobAttriCfg = TableManager.Instance.Tables.JobAttri;
|
|
|
|
|
|
factionAttriCfg = TableManager.Instance.Tables.FactionAttri;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取角色数据
|
|
|
|
|
|
listAllCharacter = CharacterDataInfoManager.Instance.DataList;
|
|
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
2023-12-15 16:18:03 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
string path = CommonUtils.GetCharacterPicPath(listAllCharacter[i].Cfg.RoleID, CommonUtils.ECharacterPicPathType.SelectCharacter);
|
2024-08-12 17:34:04 +08:00
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(path).Forget();
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2024-08-12 18:48:32 +08:00
|
|
|
|
|
|
|
|
|
|
#region 获取职业图标
|
2024-08-12 17:34:04 +08:00
|
|
|
|
foreach (Ejob factionItem in Enum.GetValues(typeof(Ejob)))
|
|
|
|
|
|
{
|
|
|
|
|
|
DataJobAttri dataJobAttri = jobAttriCfg.Get((int)factionItem);
|
|
|
|
|
|
if (null == dataJobAttri)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"配置获取失败,id: {(int)factionItem}");
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(dataJobAttri.IconPath).Forget();
|
|
|
|
|
|
}
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(DROPDOWN_JOBALL_ICON_PATH).Forget();
|
2024-08-12 18:48:32 +08:00
|
|
|
|
#endregion
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-08-12 17:34:04 +08:00
|
|
|
|
public override void OnInit()
|
2023-12-15 16:18:03 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
recycleView = GetComponent<RecycleView>("ScrollView_SelectCharacter");
|
2024-07-03 12:24:28 +08:00
|
|
|
|
//recycleView.cell = FindObj("ScrollView_SelectCharacter/Viewport/Content/Cell");
|
2024-04-08 17:09:33 +08:00
|
|
|
|
goEmpty = FindObj("Nothing");
|
|
|
|
|
|
|
|
|
|
|
|
factionDropDown = new UITextDropdown<int>(FindObj("Image_BG/Button_Group"), FindObj("Image_BG/Button_Group/Text_Group"), FactionDropdownValueChanged, FactionDropdownData2Text);
|
|
|
|
|
|
otherDropDown = new UITextDropdown<int>(FindObj("Image_BG/Image_Menu/Button_ChangeLevel"), FindObj("Image_BG/Image_Menu/Button_AdvanceLevel/Text_Default"), OtherDropdownValueChanged, OtherDropdownData2Text);
|
|
|
|
|
|
jobDropDown = new UIImageDropDown<int>(FindObj("Image_BG/Button_Profession"), FindObj("Image_BG/Button_Profession/Text_Profession"), JobDropdownValueChanged, JobDropdownData2Text, JobDropdownData2Image);
|
|
|
|
|
|
listSortItem.Add(new SortItem(FindObj("Image_BG/Image_Menu/Button_Rarity"), E_CharacterSortType.EStar, OnSort));
|
|
|
|
|
|
listSortItem.Add(new SortItem(FindObj("Image_BG/Image_Menu/Button_Level"), E_CharacterSortType.ELevel, OnSort));
|
|
|
|
|
|
listSortItem.Add(new SortItem(FindObj("Image_BG/Image_Menu/Button_AdvanceLevel"), E_CharacterSortType.EAwake, OnSort));
|
2024-08-12 18:57:34 +08:00
|
|
|
|
|
|
|
|
|
|
//进入时默认选择一种排序
|
2024-08-12 18:48:32 +08:00
|
|
|
|
curSortItem = listSortItem[1];
|
|
|
|
|
|
listSortItem[1].SortState = E_SortState.Down;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
recycleView.Init(OnRefreshItem);
|
2024-04-17 13:11:05 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
AddDropDownOption();
|
2023-12-15 16:18:03 +08:00
|
|
|
|
|
2024-04-12 16:46:48 +08:00
|
|
|
|
BindButton("Image_BG/Button_Back/Button_back", OnBack);
|
|
|
|
|
|
BindButton("Image_BG/Button_Back/Button_Home", OnHome);
|
2024-08-07 19:11:21 +08:00
|
|
|
|
|
2024-08-12 18:57:34 +08:00
|
|
|
|
//OnSort(listSortItem[1]);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
protected override void OnShowWindow(object data = null)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-06-03 15:57:43 +08:00
|
|
|
|
base.OnShowWindow(data);
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
|
|
|
|
|
|
|
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.EN_ShowAllCharacterSortType, OnReceiveShowAllCharacterSortEvent);
|
|
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.EN_CharacterLevelUp, (Action<UpgradeType>)OnCharacterLevelup);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
protected override void OnHideWindow()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.EN_CharacterLevelUp, (Action<UpgradeType>)OnCharacterLevelup);
|
|
|
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.EN_ShowAllCharacterSortType, OnReceiveShowAllCharacterSortEvent);
|
2024-06-03 15:57:43 +08:00
|
|
|
|
|
|
|
|
|
|
base.OnHideWindow();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-12-15 16:18:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
public override void OnRelease()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 卸载职业图标
|
|
|
|
|
|
foreach (Ejob factionItem in Enum.GetValues(typeof(Ejob)))
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
AssetManager.Instance.Unload(jobAttriCfg.Get((int)factionItem).IconPath);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-22 13:32:36 +08:00
|
|
|
|
AssetManager.Instance.Unload(DROPDOWN_JOBALL_ICON_PATH);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 卸载角色立绘
|
|
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
string path = CommonUtils.GetCharacterPicPath(listAllCharacter[i].Cfg.RoleID, CommonUtils.ECharacterPicPathType.SelectCharacter);
|
|
|
|
|
|
AssetManager.Instance.Unload(path);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-05-08 13:59:40 +08:00
|
|
|
|
foreach (CharacterItem characterItem in dicCharacter.Values)
|
|
|
|
|
|
{
|
|
|
|
|
|
characterItem.Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
dicCharacter.Clear();
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
base.OnRelease();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 队伍编辑返回
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BackInTeam()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam)
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamModified, curTeam.TeamIndex);
|
|
|
|
|
|
|
|
|
|
|
|
CloseWindow();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序角色
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sortType"></param>
|
|
|
|
|
|
private void SortCharacter()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (curSortItem == null || curSortItem.SortState == E_SortState.None)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
switch (curSortItem.SortType)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
case E_CharacterSortType.EStar:
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, a.Cfg.StartStar.CompareTo(b.Cfg.StartStar)); });
|
2024-08-02 14:23:00 +08:00
|
|
|
|
else
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, b.Cfg.StartStar.CompareTo(a.Cfg.StartStar)); });
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
case E_CharacterSortType.ELevel:
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, a.Level.CompareTo(b.Level)); });
|
2024-08-02 14:23:00 +08:00
|
|
|
|
else
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, b.Level.CompareTo(a.Level)); });
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
case E_CharacterSortType.EAwake:
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, a.AwakeLevel.CompareTo(b.AwakeLevel)); });
|
2024-08-02 14:23:00 +08:00
|
|
|
|
else
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, b.AwakeLevel.CompareTo(a.AwakeLevel)); });
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
case E_CharacterSortType.EBreak:
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, a.BreakLevel.CompareTo(b.BreakLevel)); });
|
2024-08-02 14:23:00 +08:00
|
|
|
|
else
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, b.BreakLevel.CompareTo(a.BreakLevel)); });
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
case E_CharacterSortType.ELikely:
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, a.LikelyLevel.CompareTo(b.LikelyLevel)); });
|
2024-08-02 14:23:00 +08:00
|
|
|
|
else
|
2024-08-02 15:57:31 +08:00
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, b.LikelyLevel.CompareTo(a.LikelyLevel)); });
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
default:
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("未处理类型");
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-08-02 15:57:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色排序多层逻辑
|
|
|
|
|
|
/// 按等级>稀有度>突破等级>觉醒等级>好感度>ID这样的优先级依次来排
|
|
|
|
|
|
/// 遇到同级别情况就往后一个优先级取
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="a"></param>
|
|
|
|
|
|
/// <param name="b"></param>
|
|
|
|
|
|
/// <param name="FirstCompare"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
int CharacterSort(CharacterDataInfo a, CharacterDataInfo b, int FirstCompare)
|
|
|
|
|
|
{
|
|
|
|
|
|
int ret = FirstCompare;
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
|
return FirstCompare;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ret = b.Level.CompareTo(a.Level);//等级
|
|
|
|
|
|
if (ret != 0) return ret;
|
|
|
|
|
|
ret = b.Cfg.StartStar.CompareTo(a.Cfg.StartStar);//稀有度
|
|
|
|
|
|
if (ret != 0) return ret;
|
|
|
|
|
|
ret = b.BreakLevel.CompareTo(a.BreakLevel);//突破等级
|
|
|
|
|
|
if (ret != 0) return ret;
|
|
|
|
|
|
ret = b.AwakeLevel.CompareTo(a.AwakeLevel);//觉醒等级
|
|
|
|
|
|
if (ret != 0) return ret;
|
|
|
|
|
|
ret = b.LikelyLevel.CompareTo(a.LikelyLevel);//好感度
|
|
|
|
|
|
if (ret != 0) return ret;
|
|
|
|
|
|
ret = a.Cfg.RoleID.CompareTo(b.Cfg.RoleID);//ID
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 刷新方法
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 刷新动态列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="cell"></param>
|
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
|
private void OnRefreshItem(GameObject cell, int index)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (!dicCharacter.TryGetValue(cell.GetInstanceID(), out CharacterItem item))
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
item = new CharacterItem(cell, OnCharacter);
|
|
|
|
|
|
dicCharacter.Add(cell.GetInstanceID(), item);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
2024-04-15 13:08:54 +08:00
|
|
|
|
if (openType == E_OpenType.Default && (index < 0 || index >= listShowCharacter.Count))
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
DebugUtil.LogError($"索引错误 {index}");
|
|
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-15 13:08:54 +08:00
|
|
|
|
var realIndex = openType == E_OpenType.EditTeam && index != 0 ? index - 1 : index;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam && index <= 0)
|
|
|
|
|
|
item.SetInfoByTeamEditorEmpty();
|
|
|
|
|
|
else
|
2024-04-15 13:08:54 +08:00
|
|
|
|
item.SetInfo(listShowCharacter[realIndex], openType, curTeam);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 刷新全部
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void RefreshUI()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
SelectListByJobAndFraction(); // 先筛选
|
|
|
|
|
|
SortCharacter(); // 再排序
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (listShowCharacter.Count == 0)
|
|
|
|
|
|
goEmpty.IsScaleShow(true);
|
|
|
|
|
|
else
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
goEmpty.IsScaleShow(false);
|
2024-04-15 13:08:54 +08:00
|
|
|
|
var count = listShowCharacter.Count;
|
|
|
|
|
|
if (openType == E_OpenType.EditTeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
++count;
|
|
|
|
|
|
}
|
|
|
|
|
|
recycleView.ShowList(count);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 回调方法
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 返回
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnBack()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
BackInTeam();
|
|
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
CloseWindow();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-03 15:37:12 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 主页
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnHome()
|
2024-04-03 15:37:12 +08:00
|
|
|
|
{
|
2024-07-04 14:40:00 +08:00
|
|
|
|
if (GuideManager.Instance.IsGuiding && GuideManager.Instance.IsEditTeamGuide) // 编队引导不能退出
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
UIManager.Instance.CloseAllNormalExcept(UINameConst.UI_MainPanel);
|
2024-04-03 15:37:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OnSort(SortItem item)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
curSortItem = item;
|
|
|
|
|
|
foreach (SortItem sortItem in listSortItem)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-06-26 18:53:14 +08:00
|
|
|
|
if (sortItem != curSortItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
sortItem.SortState = E_SortState.None;
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
sortItem.IsSelect = sortItem == curSortItem;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 点击角色
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="go"></param>
|
|
|
|
|
|
private async void OnCharacter(CharacterDataInfo info)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (openType != E_OpenType.EditTeam)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
CultivateStruct cultivateStruct = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
showList = listShowCharacter,
|
|
|
|
|
|
info = info
|
|
|
|
|
|
};
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-05-16 12:40:15 +08:00
|
|
|
|
await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_Cultivate, cultivateStruct);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (info == null)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
curTeam.DoCharacterDown(teamIndex);
|
|
|
|
|
|
RefreshUI();
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamEditModelClear, teamIndex);
|
|
|
|
|
|
BackInTeam();
|
|
|
|
|
|
return;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
uint id = info.Uid;
|
|
|
|
|
|
if (curTeam.IsCharacterInTeam(id))
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
uint[] ids = curTeam.GetCharacterIDs();
|
|
|
|
|
|
int idx = Array.IndexOf(ids, id);
|
|
|
|
|
|
if (idx >= 0)
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamEditModelClear, idx);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
curTeam.DoCharacterDown(id);
|
|
|
|
|
|
}
|
2024-04-24 12:59:23 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
curTeam.DoCharacterUp(teamIndex, id);
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamEditModelCreate, new TeamPreviewNode.CharAddData { ID = id, Idx = teamIndex });
|
2024-07-31 13:39:07 +08:00
|
|
|
|
DialogueManager.Instance.PlayDiaogue((int)id, cfg.DialogueCfg.E_DialogueType.JoinTeam);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
|
|
|
|
|
BackInTeam();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色升级
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="type"></param>
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private void OnCharacterLevelup(UpgradeType type)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (type != UpgradeType.UtLevel)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private void OnReceiveShowAllCharacterSortEvent()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("事件接收成功");
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region DropDown
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 势力下拉框获取文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string FactionDropdownData2Text(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (value == DROPDOWN_ALL_VALUE)
|
|
|
|
|
|
return CommonUtils.GetLocalizeText("cultivate_AllFraction");
|
|
|
|
|
|
else
|
2024-07-11 15:06:37 +08:00
|
|
|
|
return CommonUtils.GetLocalizeText(E_LocalizePrefix.faction, factionAttriCfg.Get(value).Faction);// factionAttriCfg.Get(value).DisplayName
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业下拉框获取文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string JobDropdownData2Text(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (value == DROPDOWN_ALL_VALUE)
|
|
|
|
|
|
return CommonUtils.GetLocalizeText("cultivate_AllJob");
|
2023-08-22 19:08:45 +08:00
|
|
|
|
else
|
2024-04-08 17:09:33 +08:00
|
|
|
|
return CommonUtils.GetLocalizeText(jobAttriCfg.Get(value).DisplayName);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业下拉框获取图片
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private Sprite JobDropdownData2Image(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (value == DROPDOWN_ALL_VALUE)
|
2024-04-22 13:32:36 +08:00
|
|
|
|
return AssetManager.Instance.GetPreLoadResult<Sprite>(DROPDOWN_JOBALL_ICON_PATH);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
else
|
|
|
|
|
|
return AssetManager.Instance.GetPreLoadResult<Sprite>(jobAttriCfg.Get(value).IconPath);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 其他下拉框获取文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string OtherDropdownData2Text(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
return GetCharactererSortTypeLocalize((E_CharacterSortType)value);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 势力下拉框选中回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
private void FactionDropdownValueChanged(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (selectFractionIndex == value)
|
|
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
selectFractionIndex = value;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (value != DROPDOWN_ALL_VALUE && !IsExistEligible())
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
CommonUtils.ShowMessageTips(CommonUtils.GetLocalizeText("cultivate_notHaveFractionJob"));
|
|
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业下拉框选中回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
private void JobDropdownValueChanged(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (selectJobIndex == value)
|
|
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
selectJobIndex = value;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (value != DROPDOWN_ALL_VALUE && !IsExistEligible())
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
CommonUtils.ShowMessageTips(CommonUtils.GetLocalizeText("cultivate_notHaveFractionJob"));
|
|
|
|
|
|
return;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 其他下拉框选中回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
|
private void OtherDropdownValueChanged(int value)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listSortItem[^1].SortType = (E_CharacterSortType)value;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
/// <summary>
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// 添加下拉框选项
|
2023-10-19 15:00:19 +08:00
|
|
|
|
/// </summary>
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private void AddDropDownOption()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
List<int> listDropDownData;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 添加势力下拉框选项
|
|
|
|
|
|
listDropDownData = new() { DROPDOWN_ALL_VALUE };
|
|
|
|
|
|
foreach (Efaction faction in Enum.GetValues(typeof(Efaction)))
|
|
|
|
|
|
{
|
|
|
|
|
|
listDropDownData.Add((int)faction);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
factionDropDown.SetData(listDropDownData);
|
|
|
|
|
|
#endregion
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 职业下拉框选项
|
|
|
|
|
|
listDropDownData = new() { DROPDOWN_ALL_VALUE };
|
|
|
|
|
|
foreach (Ejob factionItem in Enum.GetValues(typeof(Ejob)))
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listDropDownData.Add(((int)factionItem));
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
jobDropDown.SetData(listDropDownData);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 其他下拉框选项
|
|
|
|
|
|
listDropDownData = new();
|
|
|
|
|
|
foreach (E_CharacterSortType sortType in Enum.GetValues(typeof(E_CharacterSortType)))
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (sortType == E_CharacterSortType.EStar)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (sortType == E_CharacterSortType.ELevel)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
listDropDownData.Add((int)sortType);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
otherDropDown.SetData(listDropDownData);
|
|
|
|
|
|
#endregion
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private string GetCharactererSortTypeLocalize(E_CharacterSortType sortType)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
return sortType switch
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
E_CharacterSortType.EAwake => CommonUtils.GetLocalizeText("culitivate_AwakeLevel"),
|
|
|
|
|
|
E_CharacterSortType.EBreak => CommonUtils.GetLocalizeText("culitivate_BreakLevel"),
|
|
|
|
|
|
E_CharacterSortType.ELikely => CommonUtils.GetLocalizeText("culitivate_likely"),
|
|
|
|
|
|
_ => "",
|
|
|
|
|
|
};
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否存在符合条件的
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="fraction"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private bool IsExistEligible()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
foreach (CharacterDataInfo info in listAllCharacter)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (!IsConditionValid(selectFractionIndex, (int)info.Cfg.Fraction))
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (!IsConditionValid(selectJobIndex, (int)info.Cfg.Job))
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
|
|
|
|
|
return false;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 筛选势力和职业
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void SelectListByJobAndFraction()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listShowCharacter.Clear();
|
|
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (!IsConditionValid(selectFractionIndex, (int)listAllCharacter[i].Cfg.Fraction))
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (!IsConditionValid(selectJobIndex, (int)listAllCharacter[i].Cfg.Job))
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
listShowCharacter.Add(listAllCharacter[i]);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 筛选条件是否有效
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private bool IsConditionValid(int selectId, int comparisonsId)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
if (selectId == DROPDOWN_ALL_VALUE)
|
|
|
|
|
|
return true;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
return selectId == comparisonsId;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|