2023-10-19 15:00:19 +08:00
|
|
|
|
using cfg.CharacterCfg;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using Framework;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
using Gameplay;
|
|
|
|
|
|
using Gameplay.Guide;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using NLDPB;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
using PhxhSDK;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using System;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using System.Collections.Generic;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using TMPro;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using Image = UnityEngine.UI.Image;
|
|
|
|
|
|
|
|
|
|
|
|
public class UISelectCharacterController : UIWindow
|
|
|
|
|
|
{
|
2024-10-21 19:55:05 +08:00
|
|
|
|
public static async UniTask<UIWindow> OpenLoadedUI(Team team, int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
InputData inputData = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenType = E_OpenType.EditTeam,
|
|
|
|
|
|
Data = team,
|
|
|
|
|
|
Idx = index,
|
|
|
|
|
|
job = -1
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIManager.WindowInfo wInfo;
|
|
|
|
|
|
wInfo = UIManager.Instance.WindowInfos[UINameConst.UISelectCharacter];
|
|
|
|
|
|
var window = UIManager.Instance.GetOpenedWindowByPath(UINameConst.UISelectCharacter);
|
|
|
|
|
|
// if (mMemoryWindows.ContainsKey(UINameConst.UISelectCharacter))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// mMemoryWindows[UINameConst.UISelectCharacter].CreateWindow(data, wInfo.NotSetMainCamera);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (window != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
window.CreateWindow(inputData, wInfo.NotSetMainCamera);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static async UniTask<UIWindow> OpenLoadedUI(Team team, int index, Ejob ejob)
|
|
|
|
|
|
{
|
|
|
|
|
|
InputData inputData = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenType = E_OpenType.EditTeam,
|
|
|
|
|
|
Data = team,
|
|
|
|
|
|
Idx = index,
|
|
|
|
|
|
job = (int)ejob
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIManager.WindowInfo wInfo;
|
|
|
|
|
|
wInfo = UIManager.Instance.WindowInfos[UINameConst.UISelectCharacter];
|
|
|
|
|
|
var window = UIManager.Instance.GetOpenedWindowByPath(UINameConst.UISelectCharacter);
|
|
|
|
|
|
// if (mMemoryWindows.ContainsKey(UINameConst.UISelectCharacter))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// mMemoryWindows[UINameConst.UISelectCharacter].CreateWindow(data, wInfo.NotSetMainCamera);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (window != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
window.CreateWindow(inputData, wInfo.NotSetMainCamera);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开角色界面(队伍编辑)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="team"></param>
|
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-10-15 16:30:20 +08:00
|
|
|
|
public static async UniTask<UIWindow> Open(Team team, int index)
|
2024-04-08 17:09:33 +08:00
|
|
|
|
{
|
|
|
|
|
|
InputData inputData = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenType = E_OpenType.EditTeam,
|
|
|
|
|
|
Data = team,
|
2024-09-30 13:45:06 +08:00
|
|
|
|
Idx = index,
|
|
|
|
|
|
job = -1
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UISelectCharacter, inputData);
|
|
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-10-15 16:30:20 +08:00
|
|
|
|
public static async UniTask<UIWindow> Open(Team team, int index, Ejob ejob)
|
2024-09-30 13:45:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
InputData inputData = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenType = E_OpenType.EditTeam,
|
|
|
|
|
|
Data = team,
|
|
|
|
|
|
Idx = index,
|
|
|
|
|
|
job = (int)ejob
|
2024-04-08 17:09:33 +08:00
|
|
|
|
};
|
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 结构
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private struct InputData
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
public E_OpenType OpenType;
|
2024-10-15 16:30:20 +08:00
|
|
|
|
public Team Data;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public int Idx;
|
2024-09-30 13:45:06 +08:00
|
|
|
|
public int job;
|
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 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-10-11 15:22:03 +08:00
|
|
|
|
|
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-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按等级排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
ELevel,
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按进修等级排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
EAwake,
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按考核等级排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
EBreak,
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按好感度排序
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
ELikely,
|
2024-10-14 14:46:54 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 按领导力消耗排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Cost,
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
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,
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 升序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Up,
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 降序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Down,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class CultivateStruct
|
|
|
|
|
|
{
|
|
|
|
|
|
public List<CharacterDataInfo> showList;
|
|
|
|
|
|
public CharacterDataInfo info;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private class CharacterItem : UIGameObjectWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
#region UI
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private Image imageBg;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 等级进度条
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageLevel;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业图标
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageProfessionLogo;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色立绘
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imagePoster;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 等级
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textLevel;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色名
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textCharacterName;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-07-25 17:06:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色稀有度颜色遮罩
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image RarityCover;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private TMP_Text textDebugId;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 遮罩
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goMask;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 卸下
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goClear;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private Button button;
|
2024-06-27 18:55:53 +08:00
|
|
|
|
private RedPointUIController RedPointUI;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
private CharacterDataInfo info;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 星星列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<GameObject> listStar;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
private readonly Action<CharacterDataInfo> callback;
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsShowMask
|
|
|
|
|
|
{
|
|
|
|
|
|
set { goMask.IsScaleShow(value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsShowClear
|
|
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
set { goClear.IsScaleShow(value); }
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsShowPoster
|
|
|
|
|
|
{
|
|
|
|
|
|
set { imagePoster.gameObject.IsScaleShow(value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public CharacterItem(GameObject root, Action<CharacterDataInfo> callbackAction) : base(root)
|
|
|
|
|
|
{
|
|
|
|
|
|
callback = callbackAction;
|
|
|
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
|
imageBg = GetComponent<Image>("Bg"); //GoRoot.
|
2024-07-03 12:24:28 +08:00
|
|
|
|
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");
|
2024-10-11 15:22:03 +08:00
|
|
|
|
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
|
|
|
|
|
2024-09-24 17:33:07 +08:00
|
|
|
|
CommonUtils.BindButton(button, OnClick);
|
2024-01-24 15:42:01 +08:00
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-10-22 17:43:08 +08:00
|
|
|
|
public void SetInfo(CharacterDataInfo characterDataInfo, E_OpenType openType, Team team)
|
2024-04-08 17:09:33 +08:00
|
|
|
|
{
|
|
|
|
|
|
info = characterDataInfo;
|
2024-08-15 18:59:14 +08:00
|
|
|
|
//RedPointUI.gameObject.SetActive(true);
|
2024-06-27 18:55:53 +08:00
|
|
|
|
RedPointUI.NodeID = info.RedPointNode.ID;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
DataCharacterBreak breakCfg =
|
|
|
|
|
|
TableManager.Instance.Tables.CharacterBreak.Get(info.Cfg.RoleID, (int)info.BreakLevel);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
imageLevel.fillAmount = info.Exp * 1.0f / (LevelExpCfg.Get((int)info.Level + 1).EXP == 0
|
|
|
|
|
|
? 1
|
|
|
|
|
|
: LevelExpCfg.Get((int)info.Level + 1).EXP);
|
2024-07-25 19:44:20 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
textLevel.text = info.Level.ToString();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
imageProfessionLogo.sprite =
|
|
|
|
|
|
AssetManager.Instance.GetPreLoadResult<Sprite>(TableManager.Instance.Tables.JobAttri
|
|
|
|
|
|
.GetOrDefault((int)info.Cfg.Job).IconPath);
|
2024-10-22 17:43:08 +08:00
|
|
|
|
|
2024-11-12 16:47:23 +08:00
|
|
|
|
textCharacterName.text = CommonUtils.GetCharacterName(info.Cfg.RoleID);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
|
2024-10-29 15:47:29 +08:00
|
|
|
|
IsShowMask = openType == E_OpenType.EditTeam && TeamEditManager.Instance.IsUnitInAllTeam(info.Uid);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-05-08 17:04:37 +08:00
|
|
|
|
var imgPath =
|
2024-10-16 16:48:48 +08:00
|
|
|
|
CommonUtils.GetCharacterPicPath(info.Cfg.RoleID, CommonUtils.ECharacterPicPathType.SelectCharacter, (int)info.SkinID);
|
2024-10-11 15:22:03 +08:00
|
|
|
|
var sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(imgPath); //获取预加载好的角色立绘
|
2024-05-08 17:04:37 +08:00
|
|
|
|
CommonUtils.RefreshCharacter2DPic(imagePoster, sprite);
|
2024-10-11 15:22:03 +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-10-11 15:22:03 +08:00
|
|
|
|
|
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-10-22 17:43:08 +08:00
|
|
|
|
RarityCover.sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(coverPath + "UI_RarityWhite.png"); //白色:三星
|
2024-07-25 17:06:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (info.Cfg.StartStar == 4)
|
|
|
|
|
|
{
|
2024-10-22 17:43:08 +08:00
|
|
|
|
RarityCover.sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(coverPath + "UI_RarityBlue.png"); //蓝色:四星
|
2024-07-25 17:06:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-10-22 17:43:08 +08:00
|
|
|
|
RarityCover.sprite = AssetManager.Instance.GetPreLoadResult<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>
|
|
|
|
|
|
/// 队伍编辑特殊下阵入口
|
2024-08-15 18:59:14 +08:00
|
|
|
|
///
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void SetInfoByTeamEditorEmpty()
|
2024-01-09 16:01:37 +08:00
|
|
|
|
{
|
2024-04-08 17:09:33 +08:00
|
|
|
|
info = null;
|
2024-08-15 18:59:14 +08:00
|
|
|
|
//RedPointUI.gameObject.SetActive(false);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 升序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goUp;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 降序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goDown;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序名
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text text;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Action<SortItem> sortAction;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private E_CharacterSortType sortType;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private E_SortState sortState;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public E_SortState SortState
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return sortState; }
|
2024-10-11 15:22:03 +08:00
|
|
|
|
set
|
2024-04-08 17:09:33 +08:00
|
|
|
|
{
|
|
|
|
|
|
sortState = value;
|
|
|
|
|
|
switch (sortState)
|
|
|
|
|
|
{
|
|
|
|
|
|
case E_SortState.Up:
|
2024-10-11 15:22:03 +08:00
|
|
|
|
{
|
|
|
|
|
|
goUp.IsScaleShow(true);
|
|
|
|
|
|
goDown.IsScaleShow(false);
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case E_SortState.Down:
|
2024-10-11 15:22:03 +08:00
|
|
|
|
{
|
|
|
|
|
|
goUp.IsScaleShow(false);
|
|
|
|
|
|
goDown.IsScaleShow(true);
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2024-10-11 15:22:03 +08:00
|
|
|
|
{
|
|
|
|
|
|
goUp.IsScaleShow(false);
|
|
|
|
|
|
goDown.IsScaleShow(false);
|
|
|
|
|
|
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-09-24 17:33:07 +08:00
|
|
|
|
CommonUtils.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;
|
|
|
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
|
if (SortState == E_SortState.Down)
|
|
|
|
|
|
SortState = E_SortState.Up;
|
|
|
|
|
|
else
|
|
|
|
|
|
SortState = E_SortState.Down;
|
2024-08-02 16:54:16 +08:00
|
|
|
|
//改为两种状态切换
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
sortAction?.Invoke(this);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-11 15:22: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;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 循环列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private RecycleView recycleView;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 下拉框全选值
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private const int DROPDOWN_ALL_VALUE = -1;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-10-28 13:17:01 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 展示职业种类数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int JOB_MAX;
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <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
|
|
|
|
|
2024-10-16 16:48:48 +08:00
|
|
|
|
private Dictionary<int, int> CharacterSkinDic = new Dictionary<int, int>();
|
|
|
|
|
|
|
2024-04-22 13:32:36 +08:00
|
|
|
|
#region 私有变量
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-22 13:32:36 +08:00
|
|
|
|
/// <summary>
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// 势力下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private UITextDropdown<int> factionDropDown;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
2024-08-29 17:49:47 +08:00
|
|
|
|
/// 下拉框展示的势力枚举值 (包括全选枚举值)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private List<int> shownFactions = new List<int>();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-08-29 17:49:47 +08:00
|
|
|
|
/// <summary>
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// 其他下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private UITextDropdown<int> otherDropDown;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private UIImageDropDown<int> jobDropDown;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 职业配置
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private JobAttri jobAttriCfg;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 势力排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private FactionAttri factionAttriCfg;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开界面类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private E_OpenType openType = E_OpenType.Default;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开时传入队伍信息
|
|
|
|
|
|
/// </summary>
|
2024-10-15 16:30:20 +08:00
|
|
|
|
private Team curTeam;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
2024-10-08 11:01:38 +08:00
|
|
|
|
/// 打开时传入的队伍人员索引
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int teamIndex;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
2024-09-30 13:45:06 +08:00
|
|
|
|
/// 打开的职业索引界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int jobIndex;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-09-30 13:45:06 +08:00
|
|
|
|
/// <summary>
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// 角色字典
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Dictionary<int, CharacterItem> dicCharacter = new();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前筛选的势力
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int selectFractionIndex = DROPDOWN_ALL_VALUE;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前筛选的职业
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int selectJobIndex = DROPDOWN_ALL_VALUE;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 所有角色列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private List<CharacterDataInfo> listAllCharacter = new();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 要显示的角色列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<CharacterDataInfo> listShowCharacter = new();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序选项列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly List<SortItem> listSortItem = new();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前选择排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private SortItem curSortItem;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#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-10-11 15:22:03 +08:00
|
|
|
|
|
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;
|
2024-10-08 11:01:38 +08:00
|
|
|
|
jobIndex = input.job + 1;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-28 13:17:01 +08:00
|
|
|
|
JOB_MAX = TableManager.Instance.Tables.GlobalConfig.CharacterJobCount;
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 获取配置
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
jobAttriCfg = TableManager.Instance.Tables.JobAttri;
|
|
|
|
|
|
factionAttriCfg = TableManager.Instance.Tables.FactionAttri;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取角色数据
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listAllCharacter = CharacterDataInfoManager.Instance.DataList;
|
|
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
2023-12-15 16:18:03 +08:00
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
string path = CommonUtils.GetCharacterPicPath(listAllCharacter[i].Cfg.RoleID,
|
2024-10-16 16:48:48 +08:00
|
|
|
|
CommonUtils.ECharacterPicPathType.SelectCharacter, (int)listAllCharacter[i].SkinID);
|
|
|
|
|
|
CharacterSkinDic.Add(listAllCharacter[i].Cfg.RoleID, (int)listAllCharacter[i].SkinID);
|
2024-08-12 17:34:04 +08:00
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(path).Forget();
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2024-08-12 18:48:32 +08:00
|
|
|
|
|
|
|
|
|
|
#region 获取职业图标
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-08-12 17:34:04 +08:00
|
|
|
|
foreach (Ejob factionItem in Enum.GetValues(typeof(Ejob)))
|
|
|
|
|
|
{
|
2024-10-28 13:17:01 +08:00
|
|
|
|
if ((int)factionItem >= JOB_MAX)
|
2024-10-25 13:50:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-08-12 17:34:04 +08:00
|
|
|
|
DataJobAttri dataJobAttri = jobAttriCfg.Get((int)factionItem);
|
|
|
|
|
|
if (null == dataJobAttri)
|
|
|
|
|
|
{
|
2024-10-25 13:50:42 +08:00
|
|
|
|
DebugUtil.Log($"配置获取失败,职业ID: {(int)factionItem}");
|
2024-08-12 17:34:04 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(dataJobAttri.IconPath).Forget();
|
|
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-08-12 17:34:04 +08:00
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(DROPDOWN_JOBALL_ICON_PATH).Forget();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-08-12 18:48:32 +08:00
|
|
|
|
#endregion
|
2024-10-22 17:43:08 +08:00
|
|
|
|
|
|
|
|
|
|
#region 稀有度颜色遮罩
|
|
|
|
|
|
var coverPath = "Assets/Art/UI/Texture/UI_Pic_Main/UI_Pic_ShowAllCharacter/SAC_AllPart/";
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(coverPath + "UI_RarityWhite.png").Forget();
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(coverPath + "UI_RarityBlue.png").Forget();
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(coverPath + "UI_RarityRed.png").Forget();
|
|
|
|
|
|
#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");
|
|
|
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
|
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);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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));
|
2024-10-11 15:22:03 +08:00
|
|
|
|
listSortItem.Add(new SortItem(FindObj("Image_BG/Image_Menu/Button_AdvanceLevel"), E_CharacterSortType.EAwake,
|
|
|
|
|
|
OnSort));
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
recycleView.Init(OnRefreshItem);
|
|
|
|
|
|
AddDropDownOption();
|
2024-09-30 13:45:06 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (jobIndex != -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
jobDropDown.SetValue(jobIndex);
|
2024-10-17 17:11:05 +08:00
|
|
|
|
if (jobIndex != 0)
|
|
|
|
|
|
FindObj("Image_BG/Button_Profession").GetComponent<TMP_Dropdown>().interactable = false;
|
2024-09-30 13:45:06 +08:00
|
|
|
|
}
|
2024-10-14 14:46:54 +08:00
|
|
|
|
otherDropDown.SetValue((int)E_CharacterSortType.Cost);
|
|
|
|
|
|
curSortItem = listSortItem[^1];
|
|
|
|
|
|
curSortItem.SortState = E_SortState.Down;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
//进入时默认选择一种排序
|
|
|
|
|
|
curSortItem = listSortItem[1];
|
|
|
|
|
|
listSortItem[1].SortState = E_SortState.Down;
|
2024-09-30 13:45:06 +08:00
|
|
|
|
}
|
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]);
|
2024-10-16 16:48:48 +08:00
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.ItemUse,RefreshSprite);
|
2023-12-15 16:18:03 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
|
2024-10-16 16:48:48 +08:00
|
|
|
|
void RefreshSprite()
|
|
|
|
|
|
{
|
|
|
|
|
|
listAllCharacter = CharacterDataInfoManager.Instance.DataList;
|
|
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var roleID = listAllCharacter[i].Cfg.RoleID;
|
|
|
|
|
|
if (CharacterSkinDic.ContainsKey(roleID) && CharacterSkinDic[roleID] != listAllCharacter[i].SkinID)
|
|
|
|
|
|
{
|
|
|
|
|
|
string path = CommonUtils.GetCharacterPicPath(roleID, CommonUtils.ECharacterPicPathType.SelectCharacter, CharacterSkinDic[roleID]);
|
|
|
|
|
|
AssetManager.Instance.Unload(path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newPath = CommonUtils.GetCharacterPicPath(roleID, CommonUtils.ECharacterPicPathType.SelectCharacter, (int)listAllCharacter[i].SkinID);
|
|
|
|
|
|
CharacterSkinDic[roleID] = (int)listAllCharacter[i].SkinID;
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(newPath).Forget();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RefreshUI();
|
|
|
|
|
|
}
|
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();
|
|
|
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
|
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-10-11 15:22:03 +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 卸载职业图标
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
foreach (Ejob factionItem in Enum.GetValues(typeof(Ejob)))
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-10-28 13:17:01 +08:00
|
|
|
|
if ((int)factionItem >= JOB_MAX)
|
2024-10-25 13:50:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
DataJobAttri dataJobAttri = jobAttriCfg.Get((int)factionItem);
|
|
|
|
|
|
if (null == dataJobAttri)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log($"配置获取失败,职业ID: {(int)factionItem}");
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
AssetManager.Instance.Unload(dataJobAttri.IconPath);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-22 13:32:36 +08:00
|
|
|
|
AssetManager.Instance.Unload(DROPDOWN_JOBALL_ICON_PATH);
|
2024-10-11 15:22: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
|
|
|
|
#region 卸载角色立绘
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-10-16 16:48:48 +08:00
|
|
|
|
foreach(var kvPair in CharacterSkinDic)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-10-16 16:48:48 +08:00
|
|
|
|
string path = CommonUtils.GetCharacterPicPath(kvPair.Key, CommonUtils.ECharacterPicPathType.SelectCharacter, kvPair.Value);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
AssetManager.Instance.Unload(path);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-10-16 16:48:48 +08:00
|
|
|
|
CharacterSkinDic.Clear();
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-10-22 17:43:08 +08:00
|
|
|
|
#region 稀有度颜色遮罩
|
|
|
|
|
|
var coverPath = "Assets/Art/UI/Texture/UI_Pic_Main/UI_Pic_ShowAllCharacter/SAC_AllPart/";
|
|
|
|
|
|
AssetManager.Instance.Unload(coverPath + "UI_RarityWhite.png");
|
|
|
|
|
|
AssetManager.Instance.Unload(coverPath + "UI_RarityBlue.png");
|
|
|
|
|
|
AssetManager.Instance.Unload(coverPath + "UI_RarityRed.png");
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-05-08 13:59:40 +08:00
|
|
|
|
foreach (CharacterItem characterItem in dicCharacter.Values)
|
|
|
|
|
|
{
|
|
|
|
|
|
characterItem.Dispose();
|
|
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-05-08 13:59:40 +08:00
|
|
|
|
dicCharacter.Clear();
|
|
|
|
|
|
|
2024-10-16 16:48:48 +08:00
|
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.ItemUse, RefreshSprite);
|
|
|
|
|
|
|
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:
|
2024-10-14 14:46:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, a.Cfg.StartStar.CompareTo(b.Cfg.StartStar));
|
|
|
|
|
|
});
|
|
|
|
|
|
else
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, b.Cfg.StartStar.CompareTo(a.Cfg.StartStar));
|
|
|
|
|
|
});
|
2024-10-12 14:34:24 +08:00
|
|
|
|
break;
|
2024-10-14 14:46:54 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
case E_CharacterSortType.ELevel:
|
2024-10-14 14:46:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
|
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, a.Level.CompareTo(b.Level)); });
|
|
|
|
|
|
else
|
|
|
|
|
|
listShowCharacter.Sort((a, b) => { return CharacterSort(a, b, b.Level.CompareTo(a.Level)); });
|
2024-10-12 14:34:24 +08:00
|
|
|
|
break;
|
2024-10-14 14:46:54 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
case E_CharacterSortType.EAwake:
|
2024-10-14 14:46:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, a.AwakeLevel.CompareTo(b.AwakeLevel));
|
|
|
|
|
|
});
|
|
|
|
|
|
else
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, b.AwakeLevel.CompareTo(a.AwakeLevel));
|
|
|
|
|
|
});
|
2024-10-12 14:34:24 +08:00
|
|
|
|
break;
|
2024-10-14 14:46:54 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
case E_CharacterSortType.EBreak:
|
2024-10-14 14:46:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, a.BreakLevel.CompareTo(b.BreakLevel));
|
|
|
|
|
|
});
|
|
|
|
|
|
else
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, b.BreakLevel.CompareTo(a.BreakLevel));
|
|
|
|
|
|
});
|
2024-10-12 14:34:24 +08:00
|
|
|
|
break;
|
2024-10-14 14:46:54 +08:00
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
case E_CharacterSortType.ELikely:
|
2024-10-14 14:46:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, a.LikelyLevel.CompareTo(b.LikelyLevel));
|
|
|
|
|
|
});
|
|
|
|
|
|
else
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, b.LikelyLevel.CompareTo(a.LikelyLevel));
|
|
|
|
|
|
});
|
2024-10-12 14:34:24 +08:00
|
|
|
|
break;
|
2024-10-14 14:46:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
case E_CharacterSortType.Cost:
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curSortItem.SortState == E_SortState.Up)
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, a.Cfg.SpendLeadership.CompareTo(b.Cfg.SpendLeadership));
|
|
|
|
|
|
});
|
|
|
|
|
|
else
|
|
|
|
|
|
listShowCharacter.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return CharacterSort(a, b, b.Cfg.SpendLeadership.CompareTo(a.Cfg.SpendLeadership));
|
|
|
|
|
|
});
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
default:
|
2024-10-14 14:46:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("未处理的排序类型:" + curSortItem.SortType);
|
2024-10-12 14:34:24 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-24 15:10:30 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam)//将已上阵的角色排在最后面
|
2024-10-12 14:34:24 +08:00
|
|
|
|
{
|
2024-10-28 19:01:27 +08:00
|
|
|
|
int index = 0;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
for (int i = 0; i < listShowCharacter.Count; i++)
|
|
|
|
|
|
{
|
2024-10-29 15:47:29 +08:00
|
|
|
|
if (TeamEditManager.Instance.IsUnitInAllTeam(listShowCharacter[index].Uid))
|
2024-10-12 14:34:24 +08:00
|
|
|
|
{
|
2024-10-28 19:01:27 +08:00
|
|
|
|
listShowCharacter.Insert(listShowCharacter.Count, listShowCharacter[index]);
|
|
|
|
|
|
listShowCharacter.RemoveAt(index);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
index++;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
}
|
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
|
|
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
ret = b.Level.CompareTo(a.Level); //等级
|
2024-08-02 15:57:31 +08:00
|
|
|
|
if (ret != 0) return ret;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
ret = b.Cfg.StartStar.CompareTo(a.Cfg.StartStar); //稀有度
|
2024-08-02 15:57:31 +08:00
|
|
|
|
if (ret != 0) return ret;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
ret = b.BreakLevel.CompareTo(a.BreakLevel); //突破等级
|
2024-08-02 15:57:31 +08:00
|
|
|
|
if (ret != 0) return ret;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
ret = b.AwakeLevel.CompareTo(a.AwakeLevel); //觉醒等级
|
2024-08-02 15:57:31 +08:00
|
|
|
|
if (ret != 0) return ret;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
ret = b.LikelyLevel.CompareTo(a.LikelyLevel); //好感度
|
2024-08-02 15:57:31 +08:00
|
|
|
|
if (ret != 0) return ret;
|
2024-10-11 15:22:03 +08:00
|
|
|
|
ret = a.Cfg.RoleID.CompareTo(b.Cfg.RoleID); //ID
|
2024-08-02 15:57:31 +08:00
|
|
|
|
return ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 刷新方法
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <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-10-12 14:34:24 +08:00
|
|
|
|
//editTeam && isEmptyCharacter时,无empty的item显示
|
|
|
|
|
|
//realIndex = index
|
|
|
|
|
|
//
|
|
|
|
|
|
//不是EmptyCharacter时,有empty的item显示,多一个index=0的空item
|
|
|
|
|
|
//realIndex = index - 1
|
|
|
|
|
|
|
2024-04-15 13:08:54 +08:00
|
|
|
|
var realIndex = openType == E_OpenType.EditTeam && index != 0 ? index - 1 : index;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam && curTeam.IsEmptyCharacter(teamIndex))
|
|
|
|
|
|
{
|
|
|
|
|
|
realIndex = index;
|
|
|
|
|
|
item.SetInfo(listShowCharacter[realIndex], openType, curTeam);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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;
|
2024-10-12 14:34:24 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam && !curTeam.IsEmptyCharacter(teamIndex))//非空角色的点击进入编队会多一个下阵的按钮item
|
2024-04-15 13:08:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
++count;
|
|
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-15 13:08:54 +08:00
|
|
|
|
recycleView.ShowList(count);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-11 15:22: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
|
|
|
|
#region 回调方法
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <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-10-11 15:22:03 +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-10-17 18:21:20 +08:00
|
|
|
|
if (openType == E_OpenType.EditTeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
EventManager.Instance.Send<Action>(EventManager.EventName.ExitEditTeamOnOtherPanel, SureHome);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SureHome();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-01 12:59:22 +08:00
|
|
|
|
private async void SureHome()
|
2024-10-17 18:21:20 +08:00
|
|
|
|
{
|
2024-09-11 18:31:35 +08:00
|
|
|
|
CommonUtils.ChangeUIScene(Framework.Constants.MAIN_SCENE_PATH);
|
2024-11-01 12:59:22 +08:00
|
|
|
|
if (!UIManager.Instance.CheckWindowCreated(UINameConst.UI_MainPanel))
|
|
|
|
|
|
{
|
|
|
|
|
|
await UIManager.Instance.LoadWindow(UINameConst.UI_MainPanel);
|
|
|
|
|
|
UIManager.Instance.CloseAllNormalExcept(UINameConst.UI_MainPanel);
|
|
|
|
|
|
await UI_MainPanelController.Open();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
//await UI_MainPanelController.Open();
|
|
|
|
|
|
UIManager.Instance.CloseAllNormalExcept(UINameConst.UI_MainPanel);
|
2024-04-03 15:37:12 +08:00
|
|
|
|
}
|
2024-10-17 18:21:20 +08:00
|
|
|
|
|
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-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
sortItem.IsSelect = sortItem == curSortItem;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-09-09 15:38:27 +08:00
|
|
|
|
StopScroll();
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-09-09 15:38:27 +08:00
|
|
|
|
void StopScroll()
|
|
|
|
|
|
{
|
|
|
|
|
|
recycleView.ScrollRect.velocity = Vector2.zero;
|
|
|
|
|
|
recycleView.ScrollRect.content.anchoredPosition = Vector2.zero;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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-10-29 17:50:56 +08:00
|
|
|
|
curTeam.RemoveCharacter(teamIndex);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
RefreshUI();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamEditCharacterModelClear, teamIndex + 1);
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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;
|
2024-10-29 15:47:29 +08:00
|
|
|
|
if (TeamEditManager.Instance.IsUnitInAllTeam(id))
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-10-29 13:10:21 +08:00
|
|
|
|
CommonUtils.ShowMessageTips(CommonUtils.GetLocalizeText("Selected_click"));
|
2024-10-12 16:46:49 +08:00
|
|
|
|
//var idx = curTeam.GetAllCharacterIdx(id);
|
|
|
|
|
|
//if (idx >= 0 || teamIndex == TeamNew.ConductorIndex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// EventManager.Instance.Send(EventManager.EventName.TeamEditCharacterModelClear, idx);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//curTeam.DoCharacterDown(id);
|
|
|
|
|
|
//队内角色不可再点击
|
|
|
|
|
|
return;
|
2024-04-08 17:09:33 +08:00
|
|
|
|
}
|
2024-10-15 16:30:20 +08:00
|
|
|
|
else if (teamIndex == Team.ConductorIndex)
|
2024-10-11 15:22:03 +08:00
|
|
|
|
{
|
|
|
|
|
|
var idx = curTeam.GetAllCharacterIdx(id);
|
|
|
|
|
|
if (idx >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamEditCharacterModelClear, idx);
|
|
|
|
|
|
}
|
2024-10-29 17:50:56 +08:00
|
|
|
|
curTeam.RemoveCharacter(teamIndex);
|
2024-10-11 15:22:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 传入的指挥官角色为-1 展示界面的索引需要+1
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamEditCharacterModelCreate,
|
|
|
|
|
|
new TeamPreviewNode.CharAddData { ID = id, Idx = teamIndex + 1 });
|
2024-04-24 12:59:23 +08:00
|
|
|
|
|
2024-10-29 17:50:56 +08:00
|
|
|
|
curTeam.AddCharacter(teamIndex, id);
|
|
|
|
|
|
PlayCharacterAudio(id);
|
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-10-29 17:50:56 +08:00
|
|
|
|
private async void PlayCharacterAudio(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
AudioManager.Instance.PlayAudio(Framework.Constants.Sound.TEAM_INFO_CLICK);
|
|
|
|
|
|
await UniTask.WaitForSeconds(0.3f);
|
|
|
|
|
|
AudioManager.Instance.StopAllSpeaks();
|
|
|
|
|
|
DialogueManager.Instance.PlayDiaogue((int)id, cfg.DialogueCfg.E_DialogueType.FightChoose);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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-10-11 15:22: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
|
|
|
|
#region DropDown
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
/// <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-10-11 15:22:03 +08:00
|
|
|
|
return CommonUtils.GetLocalizeText(E_LocalizePrefix.faction,
|
2024-10-29 13:24:00 +08:00
|
|
|
|
value); // factionAttriCfg.Get(value).Faction
|
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-10-11 15:22:03 +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;
|
2024-08-29 17:49:47 +08:00
|
|
|
|
var oldIndex = selectFractionIndex;
|
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"));
|
2024-08-29 17:49:47 +08:00
|
|
|
|
for (int index = 0; index < shownFactions.Count; index++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((int)shownFactions[index] == oldIndex)
|
|
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
factionDropDown.SetValue(index); //设置回原来的值
|
2024-08-29 17:49:47 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +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
|
|
|
|
/// <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;
|
2024-08-29 17:49:47 +08:00
|
|
|
|
var oldIndex = selectJobIndex;
|
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"));
|
2024-10-12 13:24:18 +08:00
|
|
|
|
if (openType != E_OpenType.EditTeam || jobIndex <= 0)//选定职业的编队时如果没有符合条件的角色,不允许切换职业,显示空
|
|
|
|
|
|
{
|
|
|
|
|
|
jobDropDown.SetValue(oldIndex + 1); //设置回原来的值 (index -1 对应dropdown内value 0 选项
|
|
|
|
|
|
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 添加势力下拉框选项
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listDropDownData = new() { DROPDOWN_ALL_VALUE };
|
2024-08-29 17:49:47 +08:00
|
|
|
|
|
|
|
|
|
|
//只显示拥有角色的势力
|
|
|
|
|
|
var containsFactions = new List<Efaction>();
|
|
|
|
|
|
foreach (var character in listAllCharacter)
|
|
|
|
|
|
{
|
2024-11-14 15:44:17 +08:00
|
|
|
|
if (containsFactions.Contains(CommonUtils.GetEfactionByCfg(character.Cfg)))
|
2024-08-29 17:49:47 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
else
|
2024-11-14 15:44:17 +08:00
|
|
|
|
containsFactions.Add(CommonUtils.GetEfactionByCfg(character.Cfg));
|
2024-08-29 17:49:47 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
foreach (Efaction faction in Enum.GetValues(typeof(Efaction)))
|
|
|
|
|
|
{
|
2024-08-29 17:49:47 +08:00
|
|
|
|
if (containsFactions.Contains(faction))
|
2024-10-11 15:22:03 +08:00
|
|
|
|
listDropDownData.Add((int)faction);
|
2024-08-29 17:49:47 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-08-29 17:49:47 +08:00
|
|
|
|
shownFactions.Clear();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
foreach (var item in listDropDownData)
|
2024-08-29 17:49:47 +08:00
|
|
|
|
{
|
|
|
|
|
|
shownFactions.Add(item);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
factionDropDown.SetData(listDropDownData);
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#region 职业下拉框选项
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listDropDownData = new() { DROPDOWN_ALL_VALUE };
|
|
|
|
|
|
foreach (Ejob factionItem in Enum.GetValues(typeof(Ejob)))
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-10-28 13:17:01 +08:00
|
|
|
|
if ((int)factionItem >= JOB_MAX)
|
2024-10-25 13:50:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
DataJobAttri dataJobAttri = jobAttriCfg.Get((int)factionItem);
|
|
|
|
|
|
if (null == dataJobAttri)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log($"配置获取失败,职业ID: {(int)factionItem}");
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-04-08 17:09:33 +08:00
|
|
|
|
listDropDownData.Add(((int)factionItem));
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
jobDropDown.SetData(listDropDownData);
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 其他下拉框选项
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
otherDropDown.SetData(listDropDownData);
|
2024-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-11 15:22:03 +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"),
|
2024-10-14 14:46:54 +08:00
|
|
|
|
E_CharacterSortType.Cost => CommonUtils.GetLocalizeText("culitivate_Cost"),
|
2024-04-08 17:09:33 +08:00
|
|
|
|
_ => "",
|
|
|
|
|
|
};
|
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-11-14 15:44:17 +08:00
|
|
|
|
if (!IsConditionValid(selectFractionIndex, (int)CommonUtils.GetEfactionByCfg(info.Cfg)))
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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();
|
2024-10-25 12:30:56 +08:00
|
|
|
|
|
|
|
|
|
|
#region 引导特殊处理
|
|
|
|
|
|
if (GuideManager.Instance.IsGuiding && GuideManager.Instance.CurGuideStepId < 200)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (100011 != listAllCharacter[i].Cfg.RoleID)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
listShowCharacter.Add(listAllCharacter[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
for (int i = 0; i < listAllCharacter.Count; i++)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-11-14 15:44:17 +08:00
|
|
|
|
if (!IsConditionValid(selectFractionIndex, (int)CommonUtils.GetEfactionByCfg(listAllCharacter[i].Cfg)))
|
2024-04-08 17:09:33 +08:00
|
|
|
|
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-10-11 15:22:03 +08:00
|
|
|
|
|
2024-04-08 17:09:33 +08:00
|
|
|
|
#endregion
|
2024-10-11 15:22:03 +08:00
|
|
|
|
}
|