2023-10-19 15:00:19 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
|
using Framework;
|
2024-01-04 19:31:16 +08:00
|
|
|
|
using Gameplay;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using Gameplay.Net;
|
|
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
using TGS;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.TextCore.Text;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 编队系统管理器
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class TeamEditManager : Singlenton<TeamEditManager>, IInitable
|
|
|
|
|
|
{
|
2024-03-06 16:59:44 +08:00
|
|
|
|
public const int MAX_TEAM_COUNT = 10;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private List<Team> _teamList;
|
|
|
|
|
|
private Team _selectTeam;
|
2023-11-01 14:58:52 +08:00
|
|
|
|
private int _selectTeamIdx;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private TeamPreviewNode _teamPreviewNode;
|
2023-10-30 13:59:27 +08:00
|
|
|
|
public static readonly List<string> PreviewNodeOpenList = new List<string>();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-01-09 17:08:19 +08:00
|
|
|
|
private bool _isOpeningUI;
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public List<Team> TeamList => _teamList;
|
|
|
|
|
|
public TeamPreviewNode TeamPreviewNode => _teamPreviewNode;
|
2023-11-07 15:12:31 +08:00
|
|
|
|
public int SelectTeamIdx
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var teamStoreData = StorageMgr.Instance.GetStorage<TeamEditStoreData>("DefaultTeamIndex");
|
|
|
|
|
|
if (_selectTeamIdx <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (teamStoreData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_selectTeamIdx = teamStoreData.teamSelectID;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return _selectTeamIdx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
public int ImageSceneWidth = 1200;
|
|
|
|
|
|
public int ImageSceneHeight = 600;
|
|
|
|
|
|
|
|
|
|
|
|
void IInitable.Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
_teamList = new List<Team>();
|
|
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.TeamEditCreateSucc, OnTeamUpdate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IInitable.Release()
|
|
|
|
|
|
{
|
|
|
|
|
|
_teamList.Clear();
|
|
|
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.TeamEditCreateSucc, OnTeamUpdate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void RefreshTeams()
|
|
|
|
|
|
{
|
|
|
|
|
|
RefreshOwnTeams();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Team GetSelectTeam()
|
|
|
|
|
|
{
|
2023-10-27 16:47:42 +08:00
|
|
|
|
if (_teamList.Count == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("当前没有任何编队");
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2023-11-01 14:58:52 +08:00
|
|
|
|
_selectTeam = _teamList[_selectTeamIdx];
|
2023-10-19 15:00:19 +08:00
|
|
|
|
return _selectTeam;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置编队界面场景RawImage长宽
|
|
|
|
|
|
public void SetRawImageRect(int width, int height)
|
|
|
|
|
|
{
|
|
|
|
|
|
ImageSceneWidth = width;
|
|
|
|
|
|
ImageSceneHeight = height;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//资源预加载
|
|
|
|
|
|
public async void LoadTeamEditAssets()
|
|
|
|
|
|
{
|
|
|
|
|
|
var headEmptyImgStr =
|
|
|
|
|
|
"Assets/Art/UI/Texture/UI_Pic_Main/UI_Pic_CultivateAll/UI_Pic_Cultivate/UI_Cultivate_RankPlus.png";
|
2024-03-12 15:34:23 +08:00
|
|
|
|
await AssetManager.Instance.PostPreload<Sprite>(headEmptyImgStr);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//在管理器内部创建一个成员Team
|
2024-03-08 20:00:56 +08:00
|
|
|
|
public void CreateTeam(int idx, string name, int icon, uint[] characterIDs, uint[] playerSkillIDs, uint vehicleID)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
//test
|
|
|
|
|
|
for (int i = 0; i < characterIDs.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var dataDic = CharacterDataInfoManager.Instance.DataDic;
|
|
|
|
|
|
bool isValid = characterIDs[i] == 0 || dataDic.ContainsKey(characterIDs[i]);
|
|
|
|
|
|
if (!isValid)
|
|
|
|
|
|
{
|
|
|
|
|
|
characterIDs[i] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-08 20:00:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_teamList.Add(new Team(idx, name, icon, characterIDs, playerSkillIDs, vehicleID));
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void CreateTeam(Team team)
|
|
|
|
|
|
{
|
2024-03-08 20:00:56 +08:00
|
|
|
|
CreateTeam(team.TeamIndex, team.Name, team.IconNumber, team.GetCharacterIDs(), team.GetPlayerSkillIDs(), team.GetVehicleID());
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Team GetTeamByIndex(uint idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < _teamList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_teamList[i].TeamIndex == idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _teamList[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置选中上阵的Team
|
|
|
|
|
|
public void SetSelectTeam(uint idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_teamList.Count <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("----- 当前编队列表为空,请检查!!!-----");
|
|
|
|
|
|
}
|
2023-11-01 14:58:52 +08:00
|
|
|
|
|
|
|
|
|
|
_selectTeamIdx = (int)idx;
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
for (int i = 0; i < _teamList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_teamList[i].TeamIndex == idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
_selectTeam = _teamList[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-01 14:58:52 +08:00
|
|
|
|
|
2023-11-07 15:12:31 +08:00
|
|
|
|
var teamStoreData = StorageMgr.Instance.GetStorage<TeamEditStoreData>("DefaultTeamIndex");
|
|
|
|
|
|
if (teamStoreData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
teamStoreData.teamSelectID = _selectTeamIdx;
|
|
|
|
|
|
}
|
2023-11-01 14:58:52 +08:00
|
|
|
|
StorageMgr.Instance.SyncForce = true;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SaveTeam(Team team)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (team == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-06 17:36:51 +08:00
|
|
|
|
uint[] charIds = team.GetCharacterIDs();
|
|
|
|
|
|
uint[] playerSkillIds = team.GetPlayerSkillIDs();
|
|
|
|
|
|
NetHelper.CreateTeam((uint)team.TeamIndex, team.Name, (uint)team.IconNumber, charIds, playerSkillIds, team.GetVehicleID());
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-30 13:59:27 +08:00
|
|
|
|
public async UniTask LoadTeamPreviewNode(int teamIdx, string openPanel = "")
|
2023-10-27 15:37:05 +08:00
|
|
|
|
{
|
2023-10-30 13:59:27 +08:00
|
|
|
|
if (string.IsNullOrEmpty(openPanel))
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("----- 请传入打开TeamPreviewNode的界面名!!!-----");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-30 18:23:17 +08:00
|
|
|
|
bool isRefresh = _teamPreviewNode && PreviewNodeOpenList.Count > 0;
|
|
|
|
|
|
|
2023-10-30 13:59:27 +08:00
|
|
|
|
if (!PreviewNodeOpenList.Contains(openPanel))
|
|
|
|
|
|
{
|
|
|
|
|
|
PreviewNodeOpenList.Add(openPanel);
|
2023-10-27 15:37:05 +08:00
|
|
|
|
}
|
2023-10-30 18:23:17 +08:00
|
|
|
|
if (isRefresh)
|
|
|
|
|
|
{
|
|
|
|
|
|
RefreshPreviewNode(teamIdx);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2023-10-27 15:37:05 +08:00
|
|
|
|
|
|
|
|
|
|
await LoadNewTeamPreviewNode(teamIdx);
|
2023-10-30 13:59:27 +08:00
|
|
|
|
|
2023-10-27 15:37:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
public async UniTask LoadNewTeamPreviewNode(int teamIdx)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2023-10-30 13:59:27 +08:00
|
|
|
|
DoReleaseTeamPreviewNode();
|
2023-10-27 15:37:05 +08:00
|
|
|
|
|
|
|
|
|
|
var team = _teamList[teamIdx];
|
|
|
|
|
|
var charIDs = team.GetCharacterIDs();
|
|
|
|
|
|
var vehicleID = team.GetVehicleID();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
var node = await TeamPreviewNode.LoadNode();
|
|
|
|
|
|
_teamPreviewNode = node;
|
2023-10-30 18:23:17 +08:00
|
|
|
|
node.SetData(teamIdx, charIDs, vehicleID);
|
2023-11-13 16:23:12 +08:00
|
|
|
|
node.CreateRt();
|
2023-10-30 18:23:17 +08:00
|
|
|
|
await node.Init();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-13 16:23:12 +08:00
|
|
|
|
public async void RefreshPreviewNode(int teamIdx)
|
2023-10-27 13:24:48 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (_teamPreviewNode)
|
|
|
|
|
|
{
|
|
|
|
|
|
var team = _teamList[teamIdx];
|
|
|
|
|
|
if (team != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var charIDs = team.GetCharacterIDs();
|
|
|
|
|
|
var vehicleID = team.GetVehicleID();
|
2023-10-30 18:23:17 +08:00
|
|
|
|
_teamPreviewNode.SetData(teamIdx, charIDs, vehicleID);
|
2023-11-13 16:23:12 +08:00
|
|
|
|
await _teamPreviewNode.Init();
|
2023-10-30 18:23:17 +08:00
|
|
|
|
//_teamPreviewNode.RefreshNode(teamIdx);
|
2023-10-27 13:24:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-30 13:59:27 +08:00
|
|
|
|
public void ReleaseTeamPreviewNode(string releasePanel = "")
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(releasePanel))
|
|
|
|
|
|
{
|
2023-11-22 12:57:02 +08:00
|
|
|
|
//DebugUtil.LogError("----- 请传入释放TeamPreviewNode的界面名!!!-----");
|
|
|
|
|
|
return;
|
2023-10-30 13:59:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PreviewNodeOpenList.Remove(releasePanel);
|
|
|
|
|
|
|
|
|
|
|
|
if (_teamPreviewNode && PreviewNodeOpenList.Count <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DoReleaseTeamPreviewNode();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-22 12:57:02 +08:00
|
|
|
|
public void CompulsoryReleasePreviewNode()
|
|
|
|
|
|
{
|
|
|
|
|
|
PreviewNodeOpenList.Clear();
|
|
|
|
|
|
DoReleaseTeamPreviewNode();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-04 19:31:16 +08:00
|
|
|
|
public async UniTask PreLoadAssets()
|
|
|
|
|
|
{
|
|
|
|
|
|
// for (int i = 0; i < _teamList.Count; i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var team = _teamList[i];
|
|
|
|
|
|
// if (team.IsCharEmpty())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// var charIDs = team.GetCharacterIDs();
|
|
|
|
|
|
// for (int j = 0; j < charIDs.Length; j++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var id = charIDs[j];
|
|
|
|
|
|
// if (id != Team.NONE_ID)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var headIconPath = CommonUtils.GetDefaultHeadPathByUid(id);
|
|
|
|
|
|
// AssetManager.Instance.PostPreload<Sprite>(headIconPath);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
var charList = CharacterDataInfoManager.Instance.DataList;
|
|
|
|
|
|
for (int i = 0; i < charList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var path = CommonUtils.GetDefaultHeadPathByUid(charList[i].Uid);
|
2024-03-12 15:34:23 +08:00
|
|
|
|
await AssetManager.Instance.PostPreload<Sprite>(path);
|
2024-01-04 19:31:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await AssetManager.Instance.WaitAllPreloads();
|
|
|
|
|
|
}
|
2024-01-09 17:08:19 +08:00
|
|
|
|
|
|
|
|
|
|
//外部打开编队信息界面
|
|
|
|
|
|
public async UniTask OpenTeamInfoUI(int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_isOpeningUI)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
_isOpeningUI = true;
|
|
|
|
|
|
Team team = TeamEditManager.Instance.TeamList[idx];
|
|
|
|
|
|
await TeamEditManager.Instance.LoadTeamPreviewNode(idx, UINameConst.UITeamInfo);
|
2024-05-16 12:40:15 +08:00
|
|
|
|
await UIManager.Instance.CreateAndOpenWindow(UINameConst.UITeamInfo, team);
|
2024-01-09 17:08:19 +08:00
|
|
|
|
_isOpeningUI = false;
|
|
|
|
|
|
}
|
2024-01-04 19:31:16 +08:00
|
|
|
|
|
2023-10-30 13:59:27 +08:00
|
|
|
|
private void DoReleaseTeamPreviewNode()
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (_teamPreviewNode)
|
|
|
|
|
|
{
|
|
|
|
|
|
TeamPreviewNode.ReleaseNode(_teamPreviewNode);
|
|
|
|
|
|
_teamPreviewNode = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RefreshOwnTeams()
|
|
|
|
|
|
{
|
|
|
|
|
|
_teamList.Clear();
|
|
|
|
|
|
var partTeam = Actor.Instance.Team;
|
|
|
|
|
|
var teamInfos = partTeam.Get();
|
|
|
|
|
|
if (teamInfos != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < teamInfos.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var info = teamInfos[i];
|
|
|
|
|
|
if (info != null)
|
|
|
|
|
|
{
|
2024-03-08 20:00:56 +08:00
|
|
|
|
CreateTeam(i, info.Name, (int)info.Icon, info.CharacterIDs, info.PlayerSkillIDs, info.VehicleID);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
//test
|
|
|
|
|
|
uint[] testIDs = {0, 0, 0, 0, 0, 0};
|
2024-03-08 20:00:56 +08:00
|
|
|
|
uint[] testSkillIDs = { 0, 0, 0 };
|
|
|
|
|
|
CreateTeam(i, CommonUtils.GetLocalizeText("team_edit_default" + i), 1, testIDs, testSkillIDs, 0);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-01 14:58:52 +08:00
|
|
|
|
|
2023-11-07 15:12:31 +08:00
|
|
|
|
var storeData = StorageMgr.Instance.GetStorage<TeamEditStoreData>("DefaultTeamIndex");
|
|
|
|
|
|
int storeIdx = 0;
|
|
|
|
|
|
if (storeData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
storeIdx = storeData.teamSelectID;
|
|
|
|
|
|
}
|
2023-11-01 14:58:52 +08:00
|
|
|
|
_selectTeamIdx = storeIdx;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnTeamUpdate()
|
|
|
|
|
|
{
|
|
|
|
|
|
RefreshOwnTeams();
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.TeamUpdate);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 队列类
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class Team
|
|
|
|
|
|
{
|
|
|
|
|
|
private string _name;
|
|
|
|
|
|
private int _icon;
|
|
|
|
|
|
private uint[] _characterIDs;
|
2024-03-06 17:36:51 +08:00
|
|
|
|
private uint[] _playerSkillIDs;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private uint _vehicleID;
|
|
|
|
|
|
private int _teamIdx;
|
|
|
|
|
|
|
|
|
|
|
|
public const int MAX_CHARACTER_COUNT = 7;
|
|
|
|
|
|
public const int MAX_VEHICLE_COUNT = 1;
|
|
|
|
|
|
public const uint NONE_ID = 0;
|
|
|
|
|
|
|
2024-03-08 20:00:56 +08:00
|
|
|
|
public Team(int teamIdx, string name, int icon, uint[] characterIDs, uint[] playerSkillIDs, uint vehicleID)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
_teamIdx = teamIdx;
|
|
|
|
|
|
_name = name;
|
|
|
|
|
|
_icon = icon;
|
|
|
|
|
|
|
|
|
|
|
|
uint[] tempIDs =
|
|
|
|
|
|
{
|
|
|
|
|
|
NONE_ID, NONE_ID, NONE_ID, NONE_ID, NONE_ID, NONE_ID, NONE_ID
|
|
|
|
|
|
};
|
|
|
|
|
|
//判断一下传入的队员列表是否达到固定长度,未达到后面添加0到满足固定长度
|
|
|
|
|
|
if (characterIDs.Length < MAX_CHARACTER_COUNT)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < tempIDs.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (i < characterIDs.Length)
|
|
|
|
|
|
{
|
|
|
|
|
|
tempIDs[i] = characterIDs[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
_characterIDs = tempIDs;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
_characterIDs = (uint[]) characterIDs.Clone();
|
|
|
|
|
|
}
|
2024-03-08 20:00:56 +08:00
|
|
|
|
|
|
|
|
|
|
uint[] tempSkillIDs = { NONE_ID, NONE_ID, NONE_ID };
|
|
|
|
|
|
// 判断一下传入的技能列表是否达到固定长度,未达到后面添加0到满足固定长度
|
|
|
|
|
|
if (playerSkillIDs.Length < CommandSkillManager.COMMAND_SKILL_COUNT)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < tempSkillIDs.Length; i++)
|
|
|
|
|
|
{
|
2024-03-11 14:53:49 +08:00
|
|
|
|
if (i < playerSkillIDs.Length)
|
|
|
|
|
|
tempSkillIDs[i] = playerSkillIDs[i];
|
2024-03-08 20:00:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
_playerSkillIDs = tempSkillIDs;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2024-03-11 14:53:49 +08:00
|
|
|
|
_playerSkillIDs = (uint[])playerSkillIDs.Clone();
|
2024-03-08 20:00:56 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
_vehicleID = vehicleID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _name;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int IconNumber
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _icon;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int TeamIndex
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _teamIdx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************** 静态方法 ***************/
|
|
|
|
|
|
public static bool IsTeamIdxCharacterEmpty(Team team, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!ValueValidator.IsIdValid(team._characterIDs[idx]))
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************** End ***************/
|
|
|
|
|
|
|
|
|
|
|
|
//获取队列成员
|
|
|
|
|
|
public uint[] GetCharacterIDs()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _characterIDs;
|
|
|
|
|
|
}
|
2024-03-06 17:36:51 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取指挥官技能id
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public uint[] GetPlayerSkillIDs()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _playerSkillIDs;
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
public uint GetVehicleID()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _vehicleID;
|
|
|
|
|
|
}
|
2023-12-14 14:42:27 +08:00
|
|
|
|
|
|
|
|
|
|
public uint[] GetVehicleIDs()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_vehicleID == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Array.Empty<uint>();
|
|
|
|
|
|
}
|
|
|
|
|
|
return new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleID
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
//上阵角色
|
|
|
|
|
|
public void DoCharacterUp(int idx, uint id = 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (idx > MAX_CHARACTER_COUNT)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
_characterIDs[idx] = id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//下阵角色
|
|
|
|
|
|
public void DoCharacterDown(int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (idx > MAX_CHARACTER_COUNT)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
_characterIDs[idx] = NONE_ID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DoCharacterDown(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!_characterIDs.Contains(id))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var idx = Array.IndexOf(_characterIDs, id);
|
|
|
|
|
|
if (idx > -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
_characterIDs[idx] = NONE_ID;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-11 16:08:15 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更换技能
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
|
/// <param name="skillId"></param>
|
|
|
|
|
|
public void ChangeSkill(int index, uint skillId)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_playerSkillIDs == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("空");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (index >= _playerSkillIDs.Length)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("越界");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_playerSkillIDs[index] = skillId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public void DoVehicleDown()
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleID = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DoVehicleUp(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleID = id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断某个队列位置是否有角色
|
|
|
|
|
|
public bool IsIndexCharacterEmpty(int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!ValueValidator.IsIdValid(_characterIDs[idx]))
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsVehicleEmpty()
|
|
|
|
|
|
{
|
2023-11-07 15:12:31 +08:00
|
|
|
|
if (_vehicleID != NONE_ID)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2023-11-07 15:12:31 +08:00
|
|
|
|
return false;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2023-11-07 15:12:31 +08:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsCharEmpty()
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < _characterIDs.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_characterIDs[i] != NONE_ID)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsMemberEmpty()
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsVehicleEmpty() && IsCharEmpty();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//修改属性
|
|
|
|
|
|
public void ChangeName(string newName)
|
|
|
|
|
|
{
|
|
|
|
|
|
_name = newName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ChangeIcon(int icon)
|
|
|
|
|
|
{
|
|
|
|
|
|
_icon = icon;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ChangeCharacterID(int idx, uint newID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (idx > MAX_CHARACTER_COUNT)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
_characterIDs[idx] = newID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ChangeVehicleID(uint newID)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleID = newID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//清理掉所有队伍成员
|
|
|
|
|
|
public void ClearAllMembers()
|
|
|
|
|
|
{
|
|
|
|
|
|
uint[] tempIDs =
|
|
|
|
|
|
{
|
|
|
|
|
|
NONE_ID, NONE_ID, NONE_ID, NONE_ID, NONE_ID, NONE_ID
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
_characterIDs = tempIDs;
|
|
|
|
|
|
_vehicleID = NONE_ID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-11 16:36:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 判断是否包含某个角色
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public bool IsCharacterInTeam(uint id)
|
|
|
|
|
|
{
|
2024-03-11 16:36:47 +08:00
|
|
|
|
return _characterIDs.Contains(id);
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-03-11 16:36:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 判断是否包含某个技能
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public bool IsSkillInTeam(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _playerSkillIDs.Contains(id);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsVehicleInTeam(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _vehicleID == id;
|
|
|
|
|
|
}
|
2024-07-04 13:48:56 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取队伍角色数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public int GetCharacterCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
foreach (uint id in _characterIDs)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (NONE_ID == id)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
++count;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
|
}
|
2024-08-06 13:40:53 +08:00
|
|
|
|
|
|
|
|
|
|
//获取角色索引
|
|
|
|
|
|
public int GetCharacterIdx(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Array.IndexOf(_characterIDs, id) + 1;
|
|
|
|
|
|
}
|
2023-11-07 15:12:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class TeamEditStoreData
|
|
|
|
|
|
{
|
2024-04-23 14:43:56 +08:00
|
|
|
|
public int teamSelectID = 0;
|
2023-11-07 15:12:31 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|