feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
90
SVSim.BattleEngine/Engine/Wizard/ChatReplayListDialog.cs
Normal file
90
SVSim.BattleEngine/Engine/Wizard/ChatReplayListDialog.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class ChatReplayListDialog : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private SimpleScrollViewUI _replayListScrollView;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelNoReplay;
|
||||
|
||||
private List<ReplayInfoItem> _listReplayInfoItem;
|
||||
|
||||
private Action<ReplayInfoItem> _onClickReplaySendBtn;
|
||||
|
||||
private List<string> _loadedResourceList = new List<string>();
|
||||
|
||||
public void Init(List<ReplayInfoItem> listReplayInfoItem, Action<ReplayInfoItem> onClickReplaySendBtn)
|
||||
{
|
||||
_listReplayInfoItem = listReplayInfoItem;
|
||||
_onClickReplaySendBtn = onClickReplaySendBtn;
|
||||
CreateReplayList();
|
||||
}
|
||||
|
||||
private void CreateReplayList()
|
||||
{
|
||||
bool flag = _listReplayInfoItem.Count <= 0;
|
||||
_replayListScrollView.SetVisiable(!flag);
|
||||
_labelNoReplay.gameObject.SetActive(flag);
|
||||
if (!flag)
|
||||
{
|
||||
LoadResources(delegate
|
||||
{
|
||||
_replayListScrollView.CreateScrollView(_listReplayInfoItem.Count, OnInitializeContent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void OnInitializeContent(int index, GameObject plate)
|
||||
{
|
||||
ReplayInfoItem replayInfo = _listReplayInfoItem[index];
|
||||
plate.GetComponent<ChatReplayListDialogContent>().SetData(replayInfo, delegate
|
||||
{
|
||||
_onClickReplaySendBtn.Call(replayInfo);
|
||||
});
|
||||
}
|
||||
|
||||
private void LoadResources(Action callBack = null)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
List<string> list = new List<string>();
|
||||
foreach (ReplayInfoItem item in _listReplayInfoItem)
|
||||
{
|
||||
list.Add(Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentEmblemId, ResourcesManager.AssetLoadPathType.Emblem_S));
|
||||
if (!string.IsNullOrEmpty(item.OpponentCountryCode))
|
||||
{
|
||||
list.Add(Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentCountryCode, ResourcesManager.AssetLoadPathType.Country_S));
|
||||
}
|
||||
}
|
||||
List<string> loadPathList = list.Distinct().Except(_loadedResourceList).ToList();
|
||||
if (loadPathList.Count > 0)
|
||||
{
|
||||
StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadPathList, delegate
|
||||
{
|
||||
_loadedResourceList.AddRange(loadPathList);
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
callBack.Call();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private void UnloadResources()
|
||||
{
|
||||
if (_loadedResourceList.Count > 0)
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList);
|
||||
_loadedResourceList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
UnloadResources();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user