feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
117
SVSim.BattleEngine/Engine/Wizard/CardImageHelpder.cs
Normal file
117
SVSim.BattleEngine/Engine/Wizard/CardImageHelpder.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class CardImageHelpder : MonoBehaviour
|
||||
{
|
||||
private List<string> _loadList = new List<string>();
|
||||
|
||||
private List<UIBase_CardManager.CardObjData> _cardObjDataList;
|
||||
|
||||
private static readonly List<int> BOSS_RUSH_SPECIAL_CARD_ID = new List<int> { 117231010, 117231011, 117241010, 117241011, 117341010, 117341011 };
|
||||
|
||||
public UIBase_CardManager.CardObjData GetCardObjData(int index)
|
||||
{
|
||||
return _cardObjDataList[index];
|
||||
}
|
||||
|
||||
public void Load(List<int> cardIdList, float cardScale, int depth, Action<CardListTemplate> templateCustomize, Action onFinish)
|
||||
{
|
||||
StartCoroutine(LoadCoroutine(cardIdList, cardScale, depth, templateCustomize, onFinish));
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadList);
|
||||
_loadList.Clear();
|
||||
}
|
||||
|
||||
public static string GetBossRushTexturePath(int id, bool isFetch)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(id);
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(cardParameterFromId.BaseCardId.ToString(), ResourcesManager.AssetLoadPathType.BossRushSpecialCard, isFetch);
|
||||
}
|
||||
|
||||
public static bool IsSpecialCardId(int id)
|
||||
{
|
||||
return BOSS_RUSH_SPECIAL_CARD_ID.Contains(id);
|
||||
}
|
||||
|
||||
private IEnumerator LoadCoroutine(List<int> cardIdList, float cardScale, int depth, Action<CardListTemplate> templateCustomize, Action onFinish)
|
||||
{
|
||||
bool isLoaded = false;
|
||||
List<UIBase_CardManager.CardObjData> originalCardObjectList = null;
|
||||
UIManager.GetInstance().CardLoadSelect(null, cardIdList, base.gameObject.layer, is2D: true, delegate
|
||||
{
|
||||
isLoaded = true;
|
||||
originalCardObjectList = UIManager.GetInstance().getCardList2DObjs();
|
||||
foreach (UIBase_CardManager.CardObjData item in originalCardObjectList)
|
||||
{
|
||||
item.CardObj.SetActive(value: false);
|
||||
}
|
||||
});
|
||||
while (!isLoaded)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
List<string> specialCardLoadList = new List<string>();
|
||||
foreach (int cardId in cardIdList)
|
||||
{
|
||||
if (IsSpecialCardId(cardId))
|
||||
{
|
||||
specialCardLoadList.Add(GetBossRushTexturePath(cardId, isFetch: false));
|
||||
}
|
||||
}
|
||||
if (specialCardLoadList.Count > 0)
|
||||
{
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(specialCardLoadList, delegate
|
||||
{
|
||||
}));
|
||||
_loadList.AddRange(specialCardLoadList);
|
||||
}
|
||||
_cardObjDataList = new List<UIBase_CardManager.CardObjData>(originalCardObjectList);
|
||||
originalCardObjectList.Clear();
|
||||
List<string> cardListAssetPathList = Toolbox.ResourcesManager.CardListAssetPathList;
|
||||
_loadList.AddRange(new List<string>(cardListAssetPathList));
|
||||
cardListAssetPathList.Clear();
|
||||
int num = 0;
|
||||
List<GameObject> cloneCardList = new List<GameObject>();
|
||||
foreach (UIBase_CardManager.CardObjData cardObjData in _cardObjDataList)
|
||||
{
|
||||
int id = cardIdList[num];
|
||||
GameObject cardObj = cardObjData.CardObj;
|
||||
CardListTemplate component = cardObj.GetComponent<CardListTemplate>();
|
||||
GameObject gameObject = cardObj;
|
||||
if (IsSpecialCardId(id))
|
||||
{
|
||||
component.AttachCardTexture(Toolbox.ResourcesManager.LoadObject(GetBossRushTexturePath(id, isFetch: true)) as Texture);
|
||||
}
|
||||
cardObj = UnityEngine.Object.Instantiate(cardObjData.CardObj);
|
||||
component = cardObj.GetComponent<CardListTemplate>();
|
||||
_cardObjDataList[num].CardObj = cardObj;
|
||||
cloneCardList.Add(cardObj);
|
||||
cardObj.SetActive(value: true);
|
||||
component.SetId(id);
|
||||
component.SetScale(cardScale);
|
||||
component.AddDepth(depth);
|
||||
templateCustomize.Call(component);
|
||||
gameObject.transform.parent = base.transform;
|
||||
gameObject.SetActive(value: false);
|
||||
num++;
|
||||
}
|
||||
foreach (GameObject item2 in cloneCardList)
|
||||
{
|
||||
item2.SetActive(value: false);
|
||||
}
|
||||
yield return null;
|
||||
foreach (GameObject item3 in cloneCardList)
|
||||
{
|
||||
item3.SetActive(value: true);
|
||||
}
|
||||
onFinish();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user